From dd56e5aae6314f296280ed9bbffd84e872951ca7 Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Tue, 27 Sep 2022 12:24:48 +0200 Subject: [PATCH 1/7] add installScripts step in boostrap command - Scripts have to be updated before running bootstrap core/install --- scripts/bootstrap.js | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/scripts/bootstrap.js b/scripts/bootstrap.js index 70e9dfc499f8..e9b9b0f576ff 100755 --- a/scripts/bootstrap.js +++ b/scripts/bootstrap.js @@ -3,6 +3,7 @@ /* eslint-disable global-require */ const { spawnSync } = require('child_process'); +const path = require('path'); const { join } = require('path'); const { maxConcurrentTasks } = require('./utils/concurrency'); @@ -113,6 +114,7 @@ function run() { const command = process.env.CI ? `yarn install --immutable` : `yarn install`; return spawn(command); }, + pre: ['installScripts'], order: 1, }), build: createTask({ @@ -147,6 +149,15 @@ function run() { }, order: 9, }), + installScripts: createTask({ + name: `Install dependencies on scripts directory ${chalk.gray('(dev)')}`, + defaultValue: false, + option: '--installScripts', + command: () => { + return spawn('yarn install', { cwd: path.join('..', 'scripts') }); + }, + order: 10, + }), }; const groups = { @@ -184,16 +195,21 @@ function run() { .map((key) => tasks[key].value) .filter(Boolean).length ) { - selection = prompts([ + selection = prompts( + [ + { + type: 'multiselect', + message: 'Select the bootstrap activities', + name: 'todo', + warn: ' ', + pageSize: Object.keys(tasks).length + Object.keys(groups).length, + choices, + }, + ], { - type: 'multiselect', - message: 'Select the bootstrap activities', - name: 'todo', - warn: ' ', - pageSize: Object.keys(tasks).length + Object.keys(groups).length, - choices, - }, - ]) + onCancel: () => process.exit(0), + } + ) .then(({ todo }) => todo.map((name) => tasks[Object.keys(tasks).find((i) => tasks[i].name === name)]) ) From 1b37d5f295acb3dc0353bb9d4fd4a0ae50d33789 Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Tue, 27 Sep 2022 12:56:56 +0200 Subject: [PATCH 2/7] update netlify build-storybooks script --- netlify.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netlify.toml b/netlify.toml index 9d21e769f0a9..b0d5b8615aa5 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,6 +1,6 @@ [build] publish = "code/built-storybooks" - command = "cd scripts && yarn && cd ../code && yarn && yarn bootstrap --core && yarn build-storybooks --all" + command = "./bootstrap --core && cd ../code && yarn build-storybooks --all" [build.environment] NODE_VERSION = "14" YARN_VERSION = "1.22.10" From b165e6e7ca65d6211b7c4ec5b6d3c08cbcabfef9 Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Tue, 27 Sep 2022 12:57:53 +0200 Subject: [PATCH 3/7] update initial setup section to use ./bootstrap --- docs/contribute/code.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/docs/contribute/code.md b/docs/contribute/code.md index 3d8a6691f2e1..5ba180d5a4b2 100644 --- a/docs/contribute/code.md +++ b/docs/contribute/code.md @@ -17,17 +17,13 @@ Start by [forking](https://docs.github.com/en/github/getting-started-with-github git clone https://github.com/your-username/storybook.git ``` -Navigate to the `storybook/scripts` directory and install the required dependencies with the following commands: +In the root directory, run the following command: ```shell -yarn install +./bootstrap --core ``` -Navigate to the `storybook/code` directory and run the following commands: - -```shell -yarn install && yarn bootstrap --core -``` +This will install dependencies in both `scripts` and `code` directories, as well as build all the necessary packages for Storybook to run. ## Run tests & examples From dec3c8684ba061db8108cb4257005af9df61362a Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Tue, 27 Sep 2022 13:12:19 +0200 Subject: [PATCH 4/7] update gitpod config --- .gitpod.yml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index c76052a6390f..662fcd77df50 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -3,15 +3,6 @@ # and commit this file to your remote git repository to share the goodness with others. tasks: - - name: Scripts - init: | - cd scripts - yarn install - gp sync-done scripts - - - name: Code - init: | - gp sync-await scripts # wait for the above 'init' to finish - cd code - yarn install - yarn bootstrap --core + + - name: Bootstrap + init: ./bootstrap --core From 7ebef8eccb2e4385d027ded34c3d254225738463 Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Tue, 27 Sep 2022 13:12:40 +0200 Subject: [PATCH 5/7] update installScripts command --- scripts/bootstrap.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/bootstrap.js b/scripts/bootstrap.js index e9b9b0f576ff..c8150c32e072 100755 --- a/scripts/bootstrap.js +++ b/scripts/bootstrap.js @@ -154,7 +154,8 @@ function run() { defaultValue: false, option: '--installScripts', command: () => { - return spawn('yarn install', { cwd: path.join('..', 'scripts') }); + const command = process.env.CI ? `yarn install --immutable` : `yarn install`; + return spawn(command, { cwd: path.join('..', 'scripts') }); }, order: 10, }), From 6315e4ad903fd16d7dacc01c9fad7bcba81014f7 Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Tue, 27 Sep 2022 14:29:56 +0200 Subject: [PATCH 6/7] add missing extension on bootstrap command usage --- .gitpod.yml | 2 +- docs/contribute/code.md | 2 +- netlify.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 662fcd77df50..46120fd36e10 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -5,4 +5,4 @@ tasks: - name: Bootstrap - init: ./bootstrap --core + init: ./bootstrap.sh --core diff --git a/docs/contribute/code.md b/docs/contribute/code.md index 5ba180d5a4b2..116d396952fc 100644 --- a/docs/contribute/code.md +++ b/docs/contribute/code.md @@ -20,7 +20,7 @@ git clone https://github.com/your-username/storybook.git In the root directory, run the following command: ```shell -./bootstrap --core +./bootstrap.sh --core ``` This will install dependencies in both `scripts` and `code` directories, as well as build all the necessary packages for Storybook to run. diff --git a/netlify.toml b/netlify.toml index b0d5b8615aa5..6807596ae4e7 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,6 +1,6 @@ [build] publish = "code/built-storybooks" - command = "./bootstrap --core && cd ../code && yarn build-storybooks --all" + command = "./bootstrap.sh --core && cd ../code && yarn build-storybooks --all" [build.environment] NODE_VERSION = "14" YARN_VERSION = "1.22.10" From 39d582aac5c4b38538ecbce7a8a3b3b0048fd7a2 Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Tue, 27 Sep 2022 15:56:32 +0200 Subject: [PATCH 7/7] fix path in netlify script --- netlify.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netlify.toml b/netlify.toml index 6807596ae4e7..7664fe8ca3ff 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,6 +1,6 @@ [build] publish = "code/built-storybooks" - command = "./bootstrap.sh --core && cd ../code && yarn build-storybooks --all" + command = "./bootstrap.sh --core && cd code && yarn build-storybooks --all" [build.environment] NODE_VERSION = "14" YARN_VERSION = "1.22.10"