From 212dedff127971bd047a5efd005766428110dba3 Mon Sep 17 00:00:00 2001 From: Ian Dilling Date: Mon, 7 Nov 2022 12:32:59 -0500 Subject: [PATCH] Added a single dev script for running all dev watchers concurrently --- README.md | 9 +++---- package.json | 7 ++++- yarn.lock | 72 +++++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 79 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 79024080..123b1cad 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,9 @@ ### Development Workflow -This library is composed of several packages, most of which need to be built before your development and build tooling will work. The quickest way to build the package is to run the command: `yarn build`. +This library is composed of several packages, most of which need to be built before your development and build tooling will work. The quickest way to build the package is to run the command: `yarn build`. To only build the components and theme packages, run `yarn build-lib`. + +To quickly start a dev process that watches `@ui-kit-2022/components`, `@ui-kit-2022/theme`, and starts the Storybook preview, run `yarn dev`. You can then make changes in each package and have those changes reflected in Storybook for fast development feedback. While not always neccessary, you can remove all builds with `yarn clean`. @@ -22,10 +24,7 @@ To run a local command on a sub package, for instance if you only want to build - `yarn workspace @ui-kit-2022/components run build` to build the component package only. - `yarn workspace @ui-kit-2022/docs run preview` to run the storybook locally for development. -- `yarn workspace @ui-kit-2022/theme run dev` to run a dev build of the theme package that auto rebuilds on change. The `@ui-kit-2022/components` package also supports a `dev` command. - -When developing in multiple packages at the same time, currently you'll need to run separate dev/preview commands for each package in order for each to auto rebuild so dependent packages to recongize changes in the package they depend upon. -For instance, Storybook will no longer auto update when a file changes in the components package. You'll need to make sure the components package is autorebuilding along side the Storybook process to get a similar experience. +- `yarn workspace @ui-kit-2022/theme run dev` to run a dev build of the theme package that auto rebuilds on change. The `@ui-kit-2022/components` package also supports a `dev` command. You can also use the shorthand `yarn dev:components` or `yarn dev:theme`. ## Releasing diff --git a/package.json b/package.json index 207b1ccc..a12cc71e 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,10 @@ "docs" ], "scripts": { + "dev": "yarn build-lib && yarn conc \"yarn dev:components\" \"yarn dev:theme\" \"yarn dev:storybook\"", + "dev:components": "yarn workspace @ui-kit-2022/components run dev", + "dev:theme": "yarn workspace @ui-kit-2022/theme run dev", + "dev:storybook": "yarn workspace @ui-kit-2022/docs run preview", "build": "yarn workspaces foreach --topological-dev run build", "build-lib": "yarn workspaces foreach --topological-dev --from '{@ui-kit-2022/components,@ui-kit-2022/theme}' run build", "build-storybook": "yarn workspace @ui-kit-2022/docs run build", @@ -44,7 +48,8 @@ "react-dom": "^18.2.0", "typescript": "^4.6.4", "vite": "^3.1.0", - "vite-plugin-svgr": "^2.2.1" + "vite-plugin-svgr": "^2.2.1", + "concurrently": "^7.5.0" }, "lint-staged": { "*.{jsx,js,ts,tsx}": "eslint --fix", diff --git a/yarn.lock b/yarn.lock index ea8b7254..3eaff123 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4722,6 +4722,7 @@ __metadata: "@typescript-eslint/parser": ^5.38.0 "@vitejs/plugin-react": ^2.1.0 chromatic: ^6.10.2 + concurrently: ^7.5.0 eslint: ^8.24.0 eslint-config-prettier: ^8.5.0 eslint-plugin-import: ^2.26.0 @@ -6944,6 +6945,26 @@ __metadata: languageName: node linkType: hard +"concurrently@npm:^7.5.0": + version: 7.5.0 + resolution: "concurrently@npm:7.5.0" + dependencies: + chalk: ^4.1.0 + date-fns: ^2.29.1 + lodash: ^4.17.21 + rxjs: ^7.0.0 + shell-quote: ^1.7.3 + spawn-command: ^0.0.2-1 + supports-color: ^8.1.0 + tree-kill: ^1.2.2 + yargs: ^17.3.1 + bin: + conc: dist/bin/concurrently.js + concurrently: dist/bin/concurrently.js + checksum: 7886e1c8559d2699ae1b62be8aca5d56c226966e252a2b9dd6077b3c1fd5397e98ef537c040fffa1de50418bd2616746eb9dd589a31ffb9056d4758b850a865b + languageName: node + linkType: hard + "console-browserify@npm:^1.1.0": version: 1.2.0 resolution: "console-browserify@npm:1.2.0" @@ -7314,6 +7335,13 @@ __metadata: languageName: node linkType: hard +"date-fns@npm:^2.29.1": + version: 2.29.3 + resolution: "date-fns@npm:2.29.3" + checksum: e01cf5b62af04e05dfff921bb9c9933310ed0e1ae9a81eb8653452e64dc841acf7f6e01e1a5ae5644d0337e9a7f936175fd2cb6819dc122fdd9c5e86c56be484 + languageName: node + linkType: hard + "debug@npm:2.6.9, debug@npm:^2.2.0, debug@npm:^2.3.3, debug@npm:^2.6.9": version: 2.6.9 resolution: "debug@npm:2.6.9" @@ -14466,7 +14494,7 @@ __metadata: languageName: node linkType: hard -"rxjs@npm:^7.5.5": +"rxjs@npm:^7.0.0, rxjs@npm:^7.5.5": version: 7.5.7 resolution: "rxjs@npm:7.5.7" dependencies: @@ -14790,6 +14818,13 @@ __metadata: languageName: node linkType: hard +"shell-quote@npm:^1.7.3": + version: 1.7.4 + resolution: "shell-quote@npm:1.7.4" + checksum: 2874ea9c1a7c3ebfc9ec5734a897e16533d0d06f2e4cddc22ba3d1cab5cdc07d0f825364c1b1e39abe61236f44d8e60e933c7ad7349ce44de4f5dddc7b4354e9 + languageName: node + linkType: hard + "side-channel@npm:^1.0.3, side-channel@npm:^1.0.4": version: 1.0.4 resolution: "side-channel@npm:1.0.4" @@ -15020,6 +15055,13 @@ __metadata: languageName: node linkType: hard +"spawn-command@npm:^0.0.2-1": + version: 0.0.2 + resolution: "spawn-command@npm:0.0.2" + checksum: e35c5d28177b4d461d33c88cc11f6f3a5079e2b132c11e1746453bbb7a0c0b8a634f07541a2a234fa4758239d88203b758def509161b651e81958894c0b4b64b + languageName: node + linkType: hard + "spawndamnit@npm:^2.0.0": version: 2.0.0 resolution: "spawndamnit@npm:2.0.0" @@ -15489,7 +15531,7 @@ __metadata: languageName: node linkType: hard -"supports-color@npm:^8.0.0": +"supports-color@npm:^8.0.0, supports-color@npm:^8.1.0": version: 8.1.1 resolution: "supports-color@npm:8.1.1" dependencies: @@ -15815,6 +15857,15 @@ __metadata: languageName: node linkType: hard +"tree-kill@npm:^1.2.2": + version: 1.2.2 + resolution: "tree-kill@npm:1.2.2" + bin: + tree-kill: cli.js + checksum: 49117f5f410d19c84b0464d29afb9642c863bc5ba40fcb9a245d474c6d5cc64d1b177a6e6713129eb346b40aebb9d4631d967517f9fbe8251c35b21b13cd96c7 + languageName: node + linkType: hard + "trim-newlines@npm:^1.0.0": version: 1.0.0 resolution: "trim-newlines@npm:1.0.0" @@ -17023,7 +17074,7 @@ __metadata: languageName: node linkType: hard -"yargs-parser@npm:^21.0.0": +"yargs-parser@npm:^21.0.0, yargs-parser@npm:^21.1.1": version: 21.1.1 resolution: "yargs-parser@npm:21.1.1" checksum: ed2d96a616a9e3e1cc7d204c62ecc61f7aaab633dcbfab2c6df50f7f87b393993fe6640d017759fe112d0cb1e0119f2b4150a87305cc873fd90831c6a58ccf1c @@ -17079,6 +17130,21 @@ __metadata: languageName: node linkType: hard +"yargs@npm:^17.3.1": + version: 17.6.2 + resolution: "yargs@npm:17.6.2" + dependencies: + cliui: ^8.0.1 + escalade: ^3.1.1 + get-caller-file: ^2.0.5 + require-directory: ^2.1.1 + string-width: ^4.2.3 + y18n: ^5.0.5 + yargs-parser: ^21.1.1 + checksum: 47da1b0d854fa16d45a3ded57b716b013b2179022352a5f7467409da5a04a1eef5b3b3d97a2dfc13e8bbe5f2ffc0afe3bc6a4a72f8254e60f5a4bd7947138643 + languageName: node + linkType: hard + "yocto-queue@npm:^0.1.0": version: 0.1.0 resolution: "yocto-queue@npm:0.1.0"