Skip to content

Commit 2d767a4

Browse files
authored
Merge pull request #123 from deriv-com/shayan/feq-1615/improve-project-folder-structure
chore: revise project folder structure
2 parents 56cfce1 + 3dae568 commit 2d767a4

File tree

106 files changed

+31
-51
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+31
-51
lines changed

.storybook/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { StorybookConfig } from "@storybook/react-vite";
22
import { withoutVitePlugins } from "@storybook/builder-vite";
33

44
const config: StorybookConfig = {
5-
stories: ["../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
5+
stories: ["../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
66
addons: [
77
"@storybook/addon-links",
88
"@storybook/addon-essentials",
File renamed without changes.
File renamed without changes.

lib/components/Button/__test__/Button.spec.tsx src/components/Button/__test__/Button.spec.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { render, screen } from '@testing-library/react';
3-
import { Button } from '../';
3+
import { Button } from '..';
44

55
describe('Button component', () => {
66
it('renders without crashing', () => {
File renamed without changes.
File renamed without changes.

lib/components/Checkbox/__test__/Checkbox.spec.tsx src/components/Checkbox/__test__/Checkbox.spec.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { render } from '@testing-library/react';
3-
import { Checkbox } from '../';
3+
import { Checkbox } from '..';
44
import userEvent from '@testing-library/user-event';
55

66
describe('Checkbox', () => {
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

lib/main.ts src/main.ts

File renamed without changes.

src/main.tsx

-9
This file was deleted.

src/style.scss

-11
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

lib/types.ts src/types.ts

File renamed without changes.
File renamed without changes.

src/stories/ActionScreen.stories.tsx stories/ActionScreen.stories.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22
import type { Meta, StoryObj } from "@storybook/react";
3-
import { ActionScreen } from "../../lib/components/ActionScreen";
4-
import { Button } from "../../lib/main";
3+
import { ActionScreen } from "../src/components/ActionScreen";
4+
import { Button } from "../src/main";
55

66
const meta = {
77
title: "Components/ActionScreen",

src/stories/Button.stories.ts stories/Button.stories.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Meta, StoryObj } from "@storybook/react";
2-
import { Button } from "../../lib/components/Button";
2+
import { Button } from "../src/components/Button";
33

44
const meta = {
55
title: "Components/Button",

src/stories/Checkbox.stories.tsx stories/Checkbox.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { StoryObj, Meta } from "@storybook/react";
2-
import { Checkbox } from "../../lib/main";
2+
import { Checkbox } from "../src/main";
33
import { useEffect, useState } from "react";
44

55
const meta = {

src/stories/Divider.stories.tsx stories/Divider.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Meta, StoryObj } from "@storybook/react";
22

3-
import { Divider } from "../../lib/components/Divider";
3+
import { Divider } from "../src/components/Divider";
44

55
const meta: Meta<typeof Divider> = {
66
title: "Components/Divider",

src/stories/Dropdown.stories.ts stories/Dropdown.stories.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Meta, StoryObj } from "@storybook/react";
2-
import { Dropdown } from "../../lib/components/Dropdown";
2+
import { Dropdown } from "../src/components/Dropdown";
33

44
const meta = {
55
title: "Components/Dropdown",

src/stories/InlineMessage.stories.ts stories/InlineMessage.stories.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { StoryObj, Meta } from "@storybook/react";
2-
import { InlineMessage } from "../../lib/main";
2+
import { InlineMessage } from "../src/main";
33

44
const meta = {
55
title: "Components/InlineMessage",

src/stories/Input.stories.tsx stories/Input.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { StoryObj, Meta } from "@storybook/react";
2-
import { Input } from "../../lib/main";
2+
import { Input } from "../src/main";
33
import { useState } from "react";
44

55
const meta = {

src/stories/LinearProgressBar.stories.tsx stories/LinearProgressBar.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { Meta,StoryObj } from '@storybook/react';
3-
import { LinearProgressBar } from '../../lib/components/LinearProgressBar';
3+
import { LinearProgressBar } from '../src/components/LinearProgressBar';
44

55
const meta={
66
title: 'Components/LinearProgressBar',

src/stories/Loader.stories.ts stories/Loader.stories.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Meta, StoryObj } from "@storybook/react";
22

3-
import { Loader } from "../../lib/components/Loader";
3+
import { Loader } from "../src/components/Loader";
44

55
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
66
const meta = {

src/stories/Modal.stories.tsx stories/Modal.stories.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Meta, StoryObj } from "@storybook/react";
22

3-
import { Modal } from "../../lib/main";
4-
import { Button } from "../../lib/components/Button";
3+
import { Modal } from "../src/main";
4+
import { Button } from "../src/components/Button";
55
import { useEffect, useState } from "react";
66

77

src/stories/PageLayout.stories.tsx stories/PageLayout.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22
import type { Meta, StoryObj } from "@storybook/react";
33

4-
import { PageLayout } from "../../lib/components/PageLayout";
4+
import { PageLayout } from "../src/components/PageLayout";
55

66
const Pane: React.FC<React.PropsWithChildren<{ name: string }>> = ({
77
children,

src/stories/PasswordInput.stories.tsx stories/PasswordInput.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { StoryObj, Meta } from "@storybook/react";
2-
import { PasswordInput } from "../../lib/main";
2+
import { PasswordInput } from "../src/main";
33
import { useState } from "react";
44

55
const meta = {

src/stories/SideNote.stories.tsx stories/SideNote.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Meta, StoryObj } from "@storybook/react";
2-
import { SideNote } from "../../lib/main";
2+
import { SideNote } from "../src/main";
33

44
const meta = {
55
title: "Components/SideNote",

src/stories/Table.stories.tsx stories/Table.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Meta, StoryObj } from "@storybook/react";
22

3-
import { Table } from "../../lib/components/Table";
3+
import { Table } from "../src/components/Table";
44

55
const data = [
66
{ id: 1, name: "person489", team: "civil engineer", country: "Brazil" },

src/stories/Text.stories.ts stories/Text.stories.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Meta, StoryObj } from "@storybook/react";
22

3-
import { Text } from "../../lib/components/Text";
3+
import { Text } from "../src/components/Text";
44

55
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
66
const meta = {

src/stories/TextArea.stories.tsx stories/TextArea.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Meta, StoryObj } from "@storybook/react";
2-
import { TextArea } from "../../lib/main";
2+
import { TextArea } from "../src/main";
33
import { useState } from "react";
44

55
const meta = {

src/stories/ToggleSwitch.stories.ts stories/ToggleSwitch.stories.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { StoryObj, Meta } from "@storybook/react";
22
import { action } from "@storybook/addon-actions";
3-
import { ToggleSwitch } from "../../lib/components/ToggleSwitch";
3+
import { ToggleSwitch } from "../src/components/ToggleSwitch";
44

55
const meta = {
66
title: "Components/ToggleSwitch",

tsconfig-build.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"extends": "./tsconfig.json",
3-
"include": ["lib"]
3+
"include": ["src"]
44
}

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
"noFallthroughCasesInSwitch": true,
2222
"types": ["@testing-library/jest-dom"]
2323
},
24-
"include": ["src", "lib"],
24+
"include": ["src", "stories"],
2525
"references": [{ "path": "./tsconfig.node.json" }]
2626
}

vite.config.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@ export default defineConfig({
1212
plugins: [
1313
react(),
1414
libInjectCss(),
15-
dts({ include: ["lib"], exclude: ["lib/**/*.spec.tsx"] }),
15+
dts({ include: ["src"], exclude: ["src/**/*.spec.tsx"] }),
1616
],
1717
css: {
1818
preprocessorOptions: {
1919
scss: {
2020
implementation: sass,
21-
additionalData: ['@use "./lib/styles/index.scss" as *;'],
21+
additionalData: ['@use "./src/styles/index.scss" as *;'],
2222
},
2323
},
2424
},
2525
build: {
2626
lib: {
27-
entry: resolve(__dirname, "lib/main.ts"),
27+
entry: resolve(__dirname, "src/main.ts"),
2828
formats: ["es"],
2929
},
3030
copyPublicDir: false,
3131
rollupOptions: {
3232
external: ["react", "react/jsx-runtime", 'react-dom'],
3333
input: Object.fromEntries(
3434
glob
35-
.sync("lib/**/*.{ts,tsx}", {
35+
.sync("src/**/*.{ts,tsx}", {
3636
ignore: [
3737
"**/*.test.ts",
3838
"**/*.test.tsx",
@@ -44,16 +44,16 @@ export default defineConfig({
4444
.map((file) => {
4545
return [
4646
// The name of the entry point
47-
// lib/nested/foo.ts becomes nested/foo
47+
// src/nested/foo.ts becomes nested/foo
4848
relative(
49-
"lib",
49+
"src",
5050
file.slice(
5151
0,
5252
file.length - extname(file).length,
5353
),
5454
),
5555
// The absolute path to the entry file
56-
// lib/nested/foo.ts becomes /project/lib/nested/foo.ts
56+
// src/nested/foo.ts becomes /project/src/nested/foo.ts
5757
fileURLToPath(new URL(file, import.meta.url)),
5858
];
5959
}),

0 commit comments

Comments
 (0)