diff --git a/pnpm/react-vite/package.json b/pnpm/react-vite/package.json index ba6aa55..6b6e38e 100644 --- a/pnpm/react-vite/package.json +++ b/pnpm/react-vite/package.json @@ -1,5 +1,5 @@ { - "name": "before-storybook", + "name": "pnpm-react-vite", "private": true, "version": "0.0.0", "type": "module", diff --git a/yarn-pnp/react-vite/package.json b/yarn-pnp/react-vite/package.json index f3f2b8c..8a836cb 100644 --- a/yarn-pnp/react-vite/package.json +++ b/yarn-pnp/react-vite/package.json @@ -1,5 +1,5 @@ { - "name": "before-storybook", + "name": "yarn-pnp-react-vite", "private": true, "version": "0.0.0", "type": "module", diff --git a/yarn-workspaces-monorepo/packages/react-vite/.eslintrc.cjs b/yarn-workspaces-monorepo/packages/react-vite-app/.eslintrc.cjs similarity index 100% rename from yarn-workspaces-monorepo/packages/react-vite/.eslintrc.cjs rename to yarn-workspaces-monorepo/packages/react-vite-app/.eslintrc.cjs diff --git a/yarn-workspaces-monorepo/packages/react-vite/.gitignore b/yarn-workspaces-monorepo/packages/react-vite-app/.gitignore similarity index 100% rename from yarn-workspaces-monorepo/packages/react-vite/.gitignore rename to yarn-workspaces-monorepo/packages/react-vite-app/.gitignore diff --git a/yarn-workspaces-monorepo/packages/react-vite/index.html b/yarn-workspaces-monorepo/packages/react-vite-app/index.html similarity index 100% rename from yarn-workspaces-monorepo/packages/react-vite/index.html rename to yarn-workspaces-monorepo/packages/react-vite-app/index.html diff --git a/yarn-workspaces-monorepo/packages/react-vite/package.json b/yarn-workspaces-monorepo/packages/react-vite-app/package.json similarity index 96% rename from yarn-workspaces-monorepo/packages/react-vite/package.json rename to yarn-workspaces-monorepo/packages/react-vite-app/package.json index 43787f9..655ea58 100644 --- a/yarn-workspaces-monorepo/packages/react-vite/package.json +++ b/yarn-workspaces-monorepo/packages/react-vite-app/package.json @@ -1,5 +1,5 @@ { - "name": "react-vite", + "name": "react-vite-app", "private": true, "version": "0.0.0", "type": "module", diff --git a/yarn-workspaces-monorepo/packages/react-vite/public/vite.svg b/yarn-workspaces-monorepo/packages/react-vite-app/public/vite.svg similarity index 100% rename from yarn-workspaces-monorepo/packages/react-vite/public/vite.svg rename to yarn-workspaces-monorepo/packages/react-vite-app/public/vite.svg diff --git a/yarn-workspaces-monorepo/packages/react-vite/src/App.css b/yarn-workspaces-monorepo/packages/react-vite-app/src/App.css similarity index 100% rename from yarn-workspaces-monorepo/packages/react-vite/src/App.css rename to yarn-workspaces-monorepo/packages/react-vite-app/src/App.css diff --git a/yarn-workspaces-monorepo/packages/react-vite/src/App.tsx b/yarn-workspaces-monorepo/packages/react-vite-app/src/App.tsx similarity index 100% rename from yarn-workspaces-monorepo/packages/react-vite/src/App.tsx rename to yarn-workspaces-monorepo/packages/react-vite-app/src/App.tsx diff --git a/yarn-workspaces-monorepo/packages/react-vite/src/assets/react.svg b/yarn-workspaces-monorepo/packages/react-vite-app/src/assets/react.svg similarity index 100% rename from yarn-workspaces-monorepo/packages/react-vite/src/assets/react.svg rename to yarn-workspaces-monorepo/packages/react-vite-app/src/assets/react.svg diff --git a/yarn-workspaces-monorepo/packages/react-vite/src/index.css b/yarn-workspaces-monorepo/packages/react-vite-app/src/index.css similarity index 100% rename from yarn-workspaces-monorepo/packages/react-vite/src/index.css rename to yarn-workspaces-monorepo/packages/react-vite-app/src/index.css diff --git a/yarn-workspaces-monorepo/packages/react-vite/src/main.tsx b/yarn-workspaces-monorepo/packages/react-vite-app/src/main.tsx similarity index 100% rename from yarn-workspaces-monorepo/packages/react-vite/src/main.tsx rename to yarn-workspaces-monorepo/packages/react-vite-app/src/main.tsx diff --git a/yarn-workspaces-monorepo/packages/react-vite/src/stories/Button.stories.ts b/yarn-workspaces-monorepo/packages/react-vite-app/src/stories/Button.stories.ts similarity index 90% rename from yarn-workspaces-monorepo/packages/react-vite/src/stories/Button.stories.ts rename to yarn-workspaces-monorepo/packages/react-vite-app/src/stories/Button.stories.ts index c2a874a..26d89ae 100644 --- a/yarn-workspaces-monorepo/packages/react-vite/src/stories/Button.stories.ts +++ b/yarn-workspaces-monorepo/packages/react-vite-app/src/stories/Button.stories.ts @@ -1,6 +1,7 @@ import type { Meta, StoryObj } from '@storybook/react'; -import { Button } from './Button'; +// a component which comes from a separate package +import { Button } from '../../../react-vite-components/src/components/Button'; // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export const meta = { diff --git a/yarn-workspaces-monorepo/packages/react-vite/src/stories/Button.tsx b/yarn-workspaces-monorepo/packages/react-vite-app/src/stories/Button.tsx similarity index 80% rename from yarn-workspaces-monorepo/packages/react-vite/src/stories/Button.tsx rename to yarn-workspaces-monorepo/packages/react-vite-app/src/stories/Button.tsx index c33be6e..d4bc3fd 100644 --- a/yarn-workspaces-monorepo/packages/react-vite/src/stories/Button.tsx +++ b/yarn-workspaces-monorepo/packages/react-vite-app/src/stories/Button.tsx @@ -34,11 +34,11 @@ export const Button = ({ label, ...props }: ButtonProps) => { - const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary'; + const mode = primary ? 'app-storybook-button--primary' : 'app-storybook-button--secondary'; return ( + ); +}; diff --git a/yarn-workspaces-monorepo/packages/react-vite-components/src/components/button.css b/yarn-workspaces-monorepo/packages/react-vite-components/src/components/button.css new file mode 100644 index 0000000..15cbc08 --- /dev/null +++ b/yarn-workspaces-monorepo/packages/react-vite-components/src/components/button.css @@ -0,0 +1,30 @@ +.component-storybook-button { + font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; + font-weight: 700; + border: 0; + border-radius: 3em; + cursor: pointer; + display: inline-block; + line-height: 1; +} +.component-storybook-button--primary { + color: white; + background-color: red; +} +.component-storybook-button--secondary { + color: #333; + background-color: transparent; + box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset; +} +.component-storybook-button--small { + font-size: 12px; + padding: 10px 16px; +} +.component-storybook-button--medium { + font-size: 14px; + padding: 11px 20px; +} +.component-storybook-button--large { + font-size: 16px; + padding: 12px 24px; +} diff --git a/yarn-workspaces-monorepo/packages/react-vite-components/tsconfig.json b/yarn-workspaces-monorepo/packages/react-vite-components/tsconfig.json new file mode 100644 index 0000000..a7fc6fb --- /dev/null +++ b/yarn-workspaces-monorepo/packages/react-vite-components/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react-jsx", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src"], + "references": [{ "path": "./tsconfig.node.json" }] +} diff --git a/yarn-workspaces-monorepo/packages/react-vite-components/tsconfig.node.json b/yarn-workspaces-monorepo/packages/react-vite-components/tsconfig.node.json new file mode 100644 index 0000000..42872c5 --- /dev/null +++ b/yarn-workspaces-monorepo/packages/react-vite-components/tsconfig.node.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "composite": true, + "skipLibCheck": true, + "module": "ESNext", + "moduleResolution": "bundler", + "allowSyntheticDefaultImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/yarn-workspaces-monorepo/packages/react-vite-components/vite.config.ts b/yarn-workspaces-monorepo/packages/react-vite-components/vite.config.ts new file mode 100644 index 0000000..5a33944 --- /dev/null +++ b/yarn-workspaces-monorepo/packages/react-vite-components/vite.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [react()], +}) diff --git a/yarn-workspaces-monorepo/packages/react-vite/README.md b/yarn-workspaces-monorepo/packages/react-vite/README.md deleted file mode 100644 index 298465d..0000000 --- a/yarn-workspaces-monorepo/packages/react-vite/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# React Vite (TS) - -This project was bootstrapped with [Storybook](https://storybook.js.org/). - -## Available Scripts - -In the project directory, you can run: - -### npm run storybook - -Runs the Storybook UI locally. - -Open [http://localhost:6006](http://localhost:6006) to view it in the browser. - -The page will reload if you make edits. - -### npm run build-storybook - -Builds the Storybook UI for production. - -## Learn More - -You can learn more in the [Storybook documentation](https://storybook.js.org/docs). diff --git a/yarn-workspaces-monorepo/packages/storybook-app/.storybook/main.ts b/yarn-workspaces-monorepo/packages/storybook-app/.storybook/main.ts index 71eeeb0..9721387 100644 --- a/yarn-workspaces-monorepo/packages/storybook-app/.storybook/main.ts +++ b/yarn-workspaces-monorepo/packages/storybook-app/.storybook/main.ts @@ -2,8 +2,8 @@ import type { StorybookConfig } from "@storybook/react-vite"; const config: StorybookConfig = { stories: [ - "../../react-vite/src/**/*.mdx", - "../../react-vite/src/**/*.stories.@(js|jsx|mjs|ts|tsx)", + "../../react-vite-app/src/**/*.mdx", + "../../react-vite-app/src/**/*.stories.@(js|jsx|mjs|ts|tsx)", { directory: "../src/stories", }, diff --git a/yarn-workspaces-monorepo/packages/storybook-app/README.md b/yarn-workspaces-monorepo/packages/storybook-app/README.md deleted file mode 100644 index 298465d..0000000 --- a/yarn-workspaces-monorepo/packages/storybook-app/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# React Vite (TS) - -This project was bootstrapped with [Storybook](https://storybook.js.org/). - -## Available Scripts - -In the project directory, you can run: - -### npm run storybook - -Runs the Storybook UI locally. - -Open [http://localhost:6006](http://localhost:6006) to view it in the browser. - -The page will reload if you make edits. - -### npm run build-storybook - -Builds the Storybook UI for production. - -## Learn More - -You can learn more in the [Storybook documentation](https://storybook.js.org/docs). diff --git a/yarn-workspaces-monorepo/packages/storybook-app/package.json b/yarn-workspaces-monorepo/packages/storybook-app/package.json index 171a6db..a8cb8de 100644 --- a/yarn-workspaces-monorepo/packages/storybook-app/package.json +++ b/yarn-workspaces-monorepo/packages/storybook-app/package.json @@ -24,7 +24,7 @@ "@storybook/blocks": "^7.2.0", "@storybook/react": "^7.2.0", "@storybook/react-vite": "^7.2.0", - "@storybook/test-runner": "0.12.1--canary.339.848d743.0", + "@storybook/test-runner": "0.12.1--canary.339.90fb7b2.0", "@storybook/testing-library": "^0.2.0", "@types/react": "^18.2.15", "@types/react-dom": "^18.2.7", diff --git a/yarn-workspaces-monorepo/yarn.lock b/yarn-workspaces-monorepo/yarn.lock index cb63f31..c695bab 100644 --- a/yarn-workspaces-monorepo/yarn.lock +++ b/yarn-workspaces-monorepo/yarn.lock @@ -3728,9 +3728,9 @@ __metadata: languageName: node linkType: hard -"@storybook/test-runner@npm:0.12.1--canary.339.848d743.0": - version: 0.12.1--canary.339.848d743.0 - resolution: "@storybook/test-runner@npm:0.12.1--canary.339.848d743.0" +"@storybook/test-runner@npm:0.12.1--canary.339.90fb7b2.0": + version: 0.12.1--canary.339.90fb7b2.0 + resolution: "@storybook/test-runner@npm:0.12.1--canary.339.90fb7b2.0" dependencies: "@babel/core": ^7.22.5 "@babel/generator": ^7.22.5 @@ -3761,7 +3761,7 @@ __metadata: ts-dedent: ^2.0.0 bin: test-storybook: dist/test-storybook.js - checksum: e78385afec609aa5117627d6e43b1487f696c7490f6492ec50be3dc1413b181b9a0efa6a1d9005bfe5caf323d08c309137fcdac3219b68b55ca32370d91b0f25 + checksum: 1494203350cd99892baadfeb324bee3761e8a2a6d76f42100d7e76553726445a308a6f0b9280cf7fc9cbea31ce97c754261026bbd4a4225001f9b99cbb5d5030 languageName: node linkType: hard @@ -10501,9 +10501,28 @@ __metadata: languageName: node linkType: hard -"react-vite@workspace:packages/react-vite": +"react-vite-app@workspace:packages/react-vite-app": version: 0.0.0-use.local - resolution: "react-vite@workspace:packages/react-vite" + resolution: "react-vite-app@workspace:packages/react-vite-app" + dependencies: + "@types/react": ^18.2.15 + "@types/react-dom": ^18.2.7 + "@typescript-eslint/eslint-plugin": ^6.0.0 + "@typescript-eslint/parser": ^6.0.0 + "@vitejs/plugin-react": ^4.0.3 + eslint: ^8.45.0 + eslint-plugin-react-hooks: ^4.6.0 + eslint-plugin-react-refresh: ^0.4.3 + react: ^18.2.0 + react-dom: ^18.2.0 + typescript: ^5.0.2 + vite: ^4.4.5 + languageName: unknown + linkType: soft + +"react-vite-components@workspace:packages/react-vite-components": + version: 0.0.0-use.local + resolution: "react-vite-components@workspace:packages/react-vite-components" dependencies: "@types/react": ^18.2.15 "@types/react-dom": ^18.2.7 @@ -11276,7 +11295,7 @@ __metadata: "@storybook/blocks": ^7.2.0 "@storybook/react": ^7.2.0 "@storybook/react-vite": ^7.2.0 - "@storybook/test-runner": 0.12.1--canary.339.848d743.0 + "@storybook/test-runner": 0.12.1--canary.339.90fb7b2.0 "@storybook/testing-library": ^0.2.0 "@types/react": ^18.2.15 "@types/react-dom": ^18.2.7