diff --git a/.gitpod.yml b/.gitpod.yml index c76052a6390f..46120fd36e10 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.sh --core diff --git a/code/frameworks/angular/src/server/framework-preset-angular-ivy.ts b/code/frameworks/angular/src/server/framework-preset-angular-ivy.ts index 3ff8d02415c3..16c5d3391558 100644 --- a/code/frameworks/angular/src/server/framework-preset-angular-ivy.ts +++ b/code/frameworks/angular/src/server/framework-preset-angular-ivy.ts @@ -58,7 +58,7 @@ export const webpack = async (webpackConfig: Configuration, options: PresetOptio return webpackConfig; } - if(angularOptions.enableNgcc !== false) { + if (angularOptions.enableNgcc !== false) { runNgcc(); } diff --git a/code/lib/telemetry/src/storybook-metadata.test.ts b/code/lib/telemetry/src/storybook-metadata.test.ts index a45f970dbf3a..f4875adc99c6 100644 --- a/code/lib/telemetry/src/storybook-metadata.test.ts +++ b/code/lib/telemetry/src/storybook-metadata.test.ts @@ -128,7 +128,10 @@ describe('await computeStorybookMetadata', () => { }, }); - expect(angularResult.framework).toEqual({ name: 'angular', options: { enableIvy: true, enableNgcc: true } }); + expect(angularResult.framework).toEqual({ + name: 'angular', + options: { enableIvy: true, enableNgcc: true }, + }); }); test('should separate storybook packages and addons', async () => { diff --git a/docs/contribute/code.md b/docs/contribute/code.md index 3d8a6691f2e1..116d396952fc 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.sh --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 diff --git a/netlify.toml b/netlify.toml index 9d21e769f0a9..7664fe8ca3ff 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.sh --core && cd code && yarn build-storybooks --all" [build.environment] NODE_VERSION = "14" YARN_VERSION = "1.22.10" diff --git a/scripts/bootstrap.js b/scripts/bootstrap.js index 70e9dfc499f8..c8150c32e072 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,16 @@ function run() { }, order: 9, }), + installScripts: createTask({ + name: `Install dependencies on scripts directory ${chalk.gray('(dev)')}`, + defaultValue: false, + option: '--installScripts', + command: () => { + const command = process.env.CI ? `yarn install --immutable` : `yarn install`; + return spawn(command, { cwd: path.join('..', 'scripts') }); + }, + order: 10, + }), }; const groups = { @@ -184,16 +196,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)]) )