Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build: Add NX bootstrap optimization #14535

Merged
merged 5 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"@angular/forms": "^11.2.0",
"@angular/platform-browser": "^11.2.0",
"@angular/platform-browser-dynamic": "^11.2.0",
"@nrwl/workspace": "^11.1.5",
"@nrwl/workspace": "^11.6.3",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an update to the devDependency.

This new version has some allowances that allow Nx to be tested within an Nx repo.

"@types/autoprefixer": "^9.7.2",
"@types/jest": "^26.0.16",
"@webcomponents/custom-elements": "^1.4.3",
Expand Down
1 change: 1 addition & 0 deletions app/angular/src/server/angular-read-workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const readAngularWorkspaceConfig = async (

const nxWorkspace = require('@nrwl/workspace').readWorkspaceConfig({
format: 'angularCli',
path: dirToSearch,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that this method is used within a Nx workspace, it began to resolve the workspace.json at the root of this repo in unit tests.

This should not affect end users of Storybook. This is a fix for some tests that use this method.

});

// Use the workspace version of nx when angular looks for the angular.json file
Expand Down
4 changes: 4 additions & 0 deletions lib/core-server/src/core-presets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ import { executor as managerExecutor } from './manager/builder';
import { buildDevStandalone } from './build-dev';
import { buildStaticStandalone } from './build-static';

// nx-ignore-next-line
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were some imports that created circular dependencies. These comments ignore the dependencies generated by these lines.

import reactOptions from '../../../app/react/src/server/options';
// nx-ignore-next-line
import vue3Options from '../../../app/vue3/src/server/options';
// nx-ignore-next-line
import htmlOptions from '../../../app/html/src/server/options';
// nx-ignore-next-line
Comment on lines 13 to +18
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shilman If we wanted to remove these circular dependencies we could extract this into it's own util, or duplicate the code (wouldn't recommend that)

import webComponentsOptions from '../../../app/web-components/src/server/options';
import { outputStats } from './utils/output-stats';

Expand Down
303 changes: 303 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,303 @@
{
"npmScope": "storybook",
"implicitDependencies": {
"package.json": {
"dependencies": "*",
"devDependencies": "*"
}
},
"tasksRunnerOptions": {
"default": {
"runner": "@nrwl/nx-cloud",
"options": {
"cacheableOperations": [
"build",
"test",
"lint",
"package",
"prepare"
],
"strictlyOrderedTargets": [
"build",
"package",
"prepare"
],
"accessToken": "NzM2ODA4OTYtZGYyMi00MmVlLTgxNmEtODU1NGMwNjk0M2EzfHJlYWQtd3JpdGU=",
"canTrackAnalytics": false,
"showUsageWarnings": true
}
}
},
"projects": {
"@storybook/addon-a11y": {
"implicitDependencies": []
},
"@storybook/addon-actions": {
"implicitDependencies": []
},
"@storybook/addon-backgrounds": {
"implicitDependencies": []
},
"@storybook/addon-controls": {
"implicitDependencies": []
},
"@storybook/addon-cssresources": {
"implicitDependencies": []
},
"@storybook/addon-design-assets": {
"implicitDependencies": []
},
"@storybook/addon-docs": {
"implicitDependencies": []
},
"@storybook/addon-essentials": {
"implicitDependencies": []
},
"@storybook/addon-events": {
"implicitDependencies": []
},
"@storybook/addon-google-analytics": {
"implicitDependencies": []
},
"@storybook/addon-graphql": {
"implicitDependencies": []
},
"@storybook/addon-jest": {
"implicitDependencies": []
},
"@storybook/addon-knobs": {
"implicitDependencies": []
},
"@storybook/addon-links": {
"implicitDependencies": []
},
"@storybook/addon-queryparams": {
"implicitDependencies": []
},
"@storybook/addon-storyshots": {
"implicitDependencies": []
},
"@storybook/addon-storyshots-puppeteer": {
"implicitDependencies": []
},
"@storybook/addon-storysource": {
"implicitDependencies": []
},
"@storybook/addon-toolbars": {
"implicitDependencies": []
},
"@storybook/addon-viewport": {
"implicitDependencies": []
},
"@storybook/angular": {
"implicitDependencies": []
},
"@storybook/aurelia": {
"implicitDependencies": []
},
"@storybook/ember": {
"implicitDependencies": []
},
"@storybook/html": {
"implicitDependencies": []
},
"@storybook/marionette": {
"implicitDependencies": []
},
"@storybook/marko": {
"implicitDependencies": []
},
"@storybook/mithril": {
"implicitDependencies": []
},
"@storybook/preact": {
"implicitDependencies": []
},
"@storybook/rax": {
"implicitDependencies": []
},
"@storybook/react": {
"implicitDependencies": []
},
"@storybook/riot": {
"implicitDependencies": []
},
"@storybook/server": {
"implicitDependencies": []
},
"@storybook/svelte": {
"implicitDependencies": []
},
"@storybook/vue": {
"implicitDependencies": []
},
"@storybook/vue3": {
"implicitDependencies": []
},
"@storybook/web-components": {
"implicitDependencies": []
},
"@storybook/addon-decorator": {
"implicitDependencies": []
},
"@storybook/addon-parameter": {
"implicitDependencies": []
},
"@storybook/addon-preview-wrapper": {
"implicitDependencies": []
},
"@storybook/addon-roundtrip": {
"implicitDependencies": []
},
"angular-cli": {
"implicitDependencies": []
},
"aurelia-kitchen-sink": {
"implicitDependencies": []
},
"cra-kitchen-sink": {
"implicitDependencies": []
},
"cra-react15": {
"implicitDependencies": []
},
"cra-ts-essentials": {
"implicitDependencies": []
},
"cra-ts-kitchen-sink": {
"implicitDependencies": []
},
"@storybook/example-devkits": {
"implicitDependencies": []
},
"ember-example": {
"implicitDependencies": []
},
"html-kitchen-sink": {
"implicitDependencies": []
},
"marko-cli": {
"implicitDependencies": []
},
"mithril-example": {
"implicitDependencies": []
},
"official-storybook": {
"implicitDependencies": []
},
"preact-example": {
"implicitDependencies": []
},
"rax-kitchen-sink": {
"implicitDependencies": []
},
"@storybook/example-react-ts": {
"implicitDependencies": []
},
"@storybook/example-react-ts-webpack4": {
"implicitDependencies": []
},
"riot-example": {
"implicitDependencies": []
},
"server-kitchen-sink": {
"implicitDependencies": []
},
"standalone-preview": {
"implicitDependencies": []
},
"svelte-example": {
"implicitDependencies": []
},
"vue-3-cli-example": {
"implicitDependencies": []
},
"vue-cli-example": {
"implicitDependencies": []
},
"vue-example": {
"implicitDependencies": []
},
"web-components-kitchen-sink": {
"implicitDependencies": []
},
"@storybook/addons": {
"implicitDependencies": []
},
"@storybook/api": {
"implicitDependencies": []
},
"@storybook/builder-webpack4": {
"implicitDependencies": []
},
"@storybook/builder-webpack5": {
"implicitDependencies": []
},
"@storybook/channel-postmessage": {
"implicitDependencies": []
},
"@storybook/channel-websocket": {
"implicitDependencies": []
},
"@storybook/channels": {
"implicitDependencies": []
},
"@storybook/cli": {
"implicitDependencies": []
},
"sb": {
"implicitDependencies": []
},
"storybook": {
"implicitDependencies": []
},
"@storybook/client-api": {
"implicitDependencies": []
},
"@storybook/client-logger": {
"implicitDependencies": []
},
"@storybook/codemod": {
"implicitDependencies": []
},
"@storybook/components": {
"implicitDependencies": []
},
"@storybook/core": {
"implicitDependencies": []
},
"@storybook/core-client": {
"implicitDependencies": []
},
"@storybook/core-common": {
"implicitDependencies": []
},
"@storybook/core-events": {
"implicitDependencies": []
},
"@storybook/core-server": {
"implicitDependencies": []
},
"@storybook/node-logger": {
"implicitDependencies": []
},
"@storybook/postinstall": {
"implicitDependencies": []
},
"@storybook/router": {
"implicitDependencies": []
},
"@storybook/source-loader": {
"implicitDependencies": []
},
"@storybook/theming": {
"implicitDependencies": []
},
"@storybook/ui": {
"implicitDependencies": []
}
},
"affected": {
"defaultBase": "next"
}
}
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@
"@compodoc/compodoc": "^1.1.11",
"@emotion/snapshot-serializer": "^0.8.2",
"@nicolo-ribaudo/chokidar-2": "^2.1.8",
"@nrwl/cli": "12.0.7",
"@nrwl/nx-cloud": "11.2.0",
"@nrwl/tao": "12.0.7",
"@nrwl/workspace": "12.0.7",
"@storybook/addon-a11y": "workspace:*",
"@storybook/addon-actions": "workspace:*",
"@storybook/addon-backgrounds": "workspace:*",
Expand Down
4 changes: 2 additions & 2 deletions scripts/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ function run() {
command: () => {
log.info(prefix, 'prepare');
spawn(
`lerna run prepare ${
process.env.CI ? `--concurrency ${maxConcurrentTasks} --stream` : ''
`nx run-many --target=prepare --all --parallel ${
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the command to use Nx instead of lerna which has remote caching!

process.env.CI ? `--max-parallel=${maxConcurrentTasks}` : ''
}`
);
},
Expand Down
Loading