Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: revise project folder structure #123

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { StorybookConfig } from "@storybook/react-vite";
import { withoutVitePlugins } from "@storybook/builder-vite";

const config: StorybookConfig = {
stories: ["../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
stories: ["../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import { Button } from '../';
import { Button } from '..';

describe('Button component', () => {
it('renders without crashing', () => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { render } from '@testing-library/react';
import { Checkbox } from '../';
import { Checkbox } from '..';
import userEvent from '@testing-library/user-event';

describe('Checkbox', () => {
Expand Down
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.
9 changes: 0 additions & 9 deletions src/main.tsx

This file was deleted.

11 changes: 0 additions & 11 deletions src/style.scss

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import type { Meta, StoryObj } from "@storybook/react";
import { ActionScreen } from "../../lib/components/ActionScreen";
import { Button } from "../../lib/main";
import { ActionScreen } from "../src/components/ActionScreen";
import { Button } from "../src/main";

const meta = {
title: "Components/ActionScreen",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from "@storybook/react";
import { Button } from "../../lib/components/Button";
import { Button } from "../src/components/Button";

const meta = {
title: "Components/Button",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StoryObj, Meta } from "@storybook/react";
import { Checkbox } from "../../lib/main";
import { Checkbox } from "../src/main";
import { useEffect, useState } from "react";

const meta = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Meta, StoryObj } from "@storybook/react";

import { Divider } from "../../lib/components/Divider";
import { Divider } from "../src/components/Divider";

const meta: Meta<typeof Divider> = {
title: "Components/Divider",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Meta, StoryObj } from "@storybook/react";
import { Dropdown } from "../../lib/components/Dropdown";
import { Dropdown } from "../src/components/Dropdown";

const meta = {
title: "Components/Dropdown",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StoryObj, Meta } from "@storybook/react";
import { InlineMessage } from "../../lib/main";
import { InlineMessage } from "../src/main";

const meta = {
title: "Components/InlineMessage",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StoryObj, Meta } from "@storybook/react";
import { Input } from "../../lib/main";
import { Input } from "../src/main";
import { useState } from "react";

const meta = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Meta,StoryObj } from '@storybook/react';
import { LinearProgressBar } from '../../lib/components/LinearProgressBar';
import { LinearProgressBar } from '../src/components/LinearProgressBar';

const meta={
title: 'Components/LinearProgressBar',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Meta, StoryObj } from "@storybook/react";

import { Loader } from "../../lib/components/Loader";
import { Loader } from "../src/components/Loader";

// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
const meta = {
Expand Down
4 changes: 2 additions & 2 deletions src/stories/Modal.stories.tsx → stories/Modal.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Meta, StoryObj } from "@storybook/react";

import { Modal } from "../../lib/main";
import { Button } from "../../lib/components/Button";
import { Modal } from "../src/main";
import { Button } from "../src/components/Button";
import { useEffect, useState } from "react";


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import type { Meta, StoryObj } from "@storybook/react";

import { PageLayout } from "../../lib/components/PageLayout";
import { PageLayout } from "../src/components/PageLayout";

const Pane: React.FC<React.PropsWithChildren<{ name: string }>> = ({
children,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StoryObj, Meta } from "@storybook/react";
import { PasswordInput } from "../../lib/main";
import { PasswordInput } from "../src/main";
import { useState } from "react";

const meta = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from "@storybook/react";
import { SideNote } from "../../lib/main";
import { SideNote } from "../src/main";

const meta = {
title: "Components/SideNote",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Meta, StoryObj } from "@storybook/react";

import { Table } from "../../lib/components/Table";
import { Table } from "../src/components/Table";

const data = [
{ id: 1, name: "person489", team: "civil engineer", country: "Brazil" },
Expand Down
2 changes: 1 addition & 1 deletion src/stories/Text.stories.ts → stories/Text.stories.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Meta, StoryObj } from "@storybook/react";

import { Text } from "../../lib/components/Text";
import { Text } from "../src/components/Text";

// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
const meta = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from "@storybook/react";
import { TextArea } from "../../lib/main";
import { TextArea } from "../src/main";
import { useState } from "react";

const meta = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { StoryObj, Meta } from "@storybook/react";
import { action } from "@storybook/addon-actions";
import { ToggleSwitch } from "../../lib/components/ToggleSwitch";
import { ToggleSwitch } from "../src/components/ToggleSwitch";

const meta = {
title: "Components/ToggleSwitch",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig-build.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "./tsconfig.json",
"include": ["lib"]
"include": ["src"]
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"noFallthroughCasesInSwitch": true,
"types": ["@testing-library/jest-dom"]
},
"include": ["src", "lib"],
"include": ["src", "stories"],
"references": [{ "path": "./tsconfig.node.json" }]
}
14 changes: 7 additions & 7 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@ export default defineConfig({
plugins: [
react(),
libInjectCss(),
dts({ include: ["lib"], exclude: ["lib/**/*.spec.tsx"] }),
dts({ include: ["src"], exclude: ["src/**/*.spec.tsx"] }),
],
css: {
preprocessorOptions: {
scss: {
implementation: sass,
additionalData: ['@use "./lib/styles/index.scss" as *;'],
additionalData: ['@use "./src/styles/index.scss" as *;'],
},
},
},
build: {
lib: {
entry: resolve(__dirname, "lib/main.ts"),
entry: resolve(__dirname, "src/main.ts"),
formats: ["es"],
},
copyPublicDir: false,
rollupOptions: {
external: ["react", "react/jsx-runtime", 'react-dom'],
input: Object.fromEntries(
glob
.sync("lib/**/*.{ts,tsx}", {
.sync("src/**/*.{ts,tsx}", {
ignore: [
"**/*.test.ts",
"**/*.test.tsx",
Expand All @@ -44,16 +44,16 @@ export default defineConfig({
.map((file) => {
return [
// The name of the entry point
// lib/nested/foo.ts becomes nested/foo
// src/nested/foo.ts becomes nested/foo
relative(
"lib",
"src",
file.slice(
0,
file.length - extname(file).length,
),
),
// The absolute path to the entry file
// lib/nested/foo.ts becomes /project/lib/nested/foo.ts
// src/nested/foo.ts becomes /project/src/nested/foo.ts
fileURLToPath(new URL(file, import.meta.url)),
];
}),
Expand Down