Skip to content

Commit

Permalink
Merge pull request #19270 from storybookjs/install-scripts-bootstrap
Browse files Browse the repository at this point in the history
Build: Add installScripts step in bootstrap command
  • Loading branch information
ndelangen authored Oct 5, 2022
2 parents 40116ce + 9d2abf7 commit 01064b7
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 31 deletions.
15 changes: 3 additions & 12 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const webpack = async (webpackConfig: Configuration, options: PresetOptio
return webpackConfig;
}

if(angularOptions.enableNgcc !== false) {
if (angularOptions.enableNgcc !== false) {
runNgcc();
}

Expand Down
5 changes: 4 additions & 1 deletion code/lib/telemetry/src/storybook-metadata.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
10 changes: 3 additions & 7 deletions docs/contribute/code.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
35 changes: 26 additions & 9 deletions scripts/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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)])
)
Expand Down

0 comments on commit 01064b7

Please sign in to comment.