fix(nx): add storybook to deploy pipeline
This commit is contained in:
parent
f095647013
commit
26ead7bfe3
@ -0,0 +1,5 @@
|
||||
describe('storybook builer', () => {
|
||||
it('should have a test', () => {
|
||||
expect(true).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -1,5 +1,9 @@
|
||||
import { Tree } from '@angular-devkit/schematics';
|
||||
import { readJsonInTree } from '@nrwl/workspace';
|
||||
import {
|
||||
readJsonInTree,
|
||||
readWorkspaceJson,
|
||||
getProjectConfig
|
||||
} from '@nrwl/workspace';
|
||||
import { createTestUILib, runSchematic } from '../../utils/testing';
|
||||
import { StorybookConfigureSchema } from './schema';
|
||||
|
||||
@ -24,17 +28,21 @@ describe('schematic:configuration', () => {
|
||||
).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should update `angular.json` file', async () => {
|
||||
it('should update workspace file', async () => {
|
||||
const tree = await runSchematic(
|
||||
'configuration',
|
||||
{ name: 'test-ui-lib' },
|
||||
appTree
|
||||
);
|
||||
const angularJson = readJsonInTree(tree, 'angular.json');
|
||||
const project = angularJson.projects['test-ui-lib'];
|
||||
const project = getProjectConfig(tree, 'test-ui-lib');
|
||||
|
||||
expect(project.architect.storybook).toEqual({
|
||||
builder: '@nrwl/storybook:storybook',
|
||||
configurations: {
|
||||
ci: {
|
||||
quiet: true
|
||||
}
|
||||
},
|
||||
options: {
|
||||
port: 4400,
|
||||
config: {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Tree } from '@angular-devkit/schematics';
|
||||
import { readJsonInTree } from '@nrwl/workspace';
|
||||
import { readJsonInTree, getProjectConfig } from '@nrwl/workspace';
|
||||
import { createTestUILib, runSchematic } from '../../utils/testing';
|
||||
|
||||
describe('schematic:cypress-project', () => {
|
||||
@ -30,8 +30,7 @@ describe('schematic:cypress-project', () => {
|
||||
{ name: 'test-ui-lib' },
|
||||
appTree
|
||||
);
|
||||
const angularJson = readJsonInTree(tree, 'angular.json');
|
||||
const project = angularJson.projects['test-ui-lib-e2e'];
|
||||
const project = getProjectConfig(tree, 'test-ui-lib-e2e');
|
||||
|
||||
expect(project.architect.e2e.options.devServerTarget).toEqual(
|
||||
'test-ui-lib:storybook'
|
||||
|
||||
@ -18,9 +18,6 @@ describe('ng-add', () => {
|
||||
const packageJson = readJsonInTree(tree, 'package.json');
|
||||
expect(packageJson.devDependencies['@storybook/angular']).toBeDefined();
|
||||
expect(packageJson.devDependencies['@storybook/addon-knobs']).toBeDefined();
|
||||
expect(
|
||||
packageJson.devDependencies['@types/storybook__addon-knobs']
|
||||
).toBeDefined();
|
||||
expect(packageJson.devDependencies['babel-loader']).toBeDefined();
|
||||
expect(packageJson.devDependencies['@babel/core']).toBeDefined();
|
||||
});
|
||||
|
||||
@ -307,6 +307,10 @@ describe('Migration', () => {
|
||||
'@nrwl/next': { version: '2.0.0', alwaysAddToPackageJson: false },
|
||||
'@nrwl/node': { version: '2.0.0', alwaysAddToPackageJson: false },
|
||||
'@nrwl/react': { version: '2.0.0', alwaysAddToPackageJson: false },
|
||||
'@nrwl/storybook': {
|
||||
version: '2.0.0',
|
||||
alwaysAddToPackageJson: false
|
||||
},
|
||||
'@nrwl/tao': { version: '2.0.0', alwaysAddToPackageJson: false },
|
||||
'@nrwl/web': { version: '2.0.0', alwaysAddToPackageJson: false }
|
||||
}
|
||||
|
||||
@ -183,6 +183,7 @@ export class Migrator {
|
||||
'@nrwl/next',
|
||||
'@nrwl/node',
|
||||
'@nrwl/react',
|
||||
'@nrwl/storybook',
|
||||
'@nrwl/tao',
|
||||
'@nrwl/web'
|
||||
].reduce(
|
||||
|
||||
@ -49,6 +49,7 @@ cp README.md build/packages/next
|
||||
cp README.md build/packages/angular
|
||||
cp README.md build/packages/jest
|
||||
cp README.md build/packages/cypress
|
||||
cp README.md build/packages/storybook
|
||||
cp README.md build/packages/cli
|
||||
cp README.md build/packages/tao
|
||||
cp README.md build/packages/eslint-plugin-nx
|
||||
@ -68,6 +69,7 @@ cp LICENSE build/packages/next
|
||||
cp LICENSE build/packages/angular
|
||||
cp LICENSE build/packages/jest
|
||||
cp LICENSE build/packages/cypress
|
||||
cp LICENSE build/packages/storybook
|
||||
cp LICENSE build/packages/cli
|
||||
cp LICENSE build/packages/tao
|
||||
cp LICENSE build/packages/eslint-plugin-nx
|
||||
|
||||
@ -150,6 +150,7 @@ const options = {
|
||||
'build/npm/create-nx-workspace/package.json',
|
||||
'build/npm/jest/package.json',
|
||||
'build/npm/cypress/package.json',
|
||||
'build/npm/storybook/package.json',
|
||||
'build/npm/angular/package.json',
|
||||
'build/npm/react/package.json',
|
||||
'build/npm/next/package.json',
|
||||
|
||||
@ -16,14 +16,14 @@ fi
|
||||
cd build/packages
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
sed -i "" "s|exports.nxVersion = '\*';|exports.nxVersion = '$NX_VERSION';|g" {react,next,web,jest,node,express,nest,cypress,angular,workspace}/src/utils/versions.js
|
||||
sed -i "" "s|\*|$NX_VERSION|g" {schematics,react,next,web,jest,node,express,nest,cypress,angular,workspace,cli,linter,tao,eslint-plugin-nx,create-nx-workspace}/package.json
|
||||
sed -i "" "s|exports.nxVersion = '\*';|exports.nxVersion = '$NX_VERSION';|g" {react,next,web,jest,node,express,nest,cypress,storybook,angular,workspace}/src/utils/versions.js
|
||||
sed -i "" "s|\*|$NX_VERSION|g" {schematics,react,next,web,jest,node,express,nest,cypress,storybook,angular,workspace,cli,linter,tao,eslint-plugin-nx,create-nx-workspace}/package.json
|
||||
sed -i "" "s|NX_VERSION|$NX_VERSION|g" create-nx-workspace/bin/create-nx-workspace.js
|
||||
sed -i "" "s|ANGULAR_CLI_VERSION|$ANGULAR_CLI_VERSION|g" create-nx-workspace/bin/create-nx-workspace.js
|
||||
sed -i "" "s|TYPESCRIPT_VERSION|$TYPESCRIPT_VERSION|g" create-nx-workspace/bin/create-nx-workspace.js
|
||||
else
|
||||
sed -i "s|exports.nxVersion = '\*';|exports.nxVersion = '$NX_VERSION';|g" {react,next,web,jest,node,express,nest,cypress,angular,workspace}/src/utils/versions.js
|
||||
sed -i "s|\*|$NX_VERSION|g" {schematics,react,next,web,jest,node,express,nest,cypress,angular,workspace,cli,linter,tao,eslint-plugin-nx,create-nx-workspace}/package.json
|
||||
sed -i "s|exports.nxVersion = '\*';|exports.nxVersion = '$NX_VERSION';|g" {react,next,web,jest,node,express,nest,cypress,storybook,angular,workspace}/src/utils/versions.js
|
||||
sed -i "s|\*|$NX_VERSION|g" {schematics,react,next,web,jest,node,express,nest,cypress,storybook,angular,workspace,cli,linter,tao,eslint-plugin-nx,create-nx-workspace}/package.json
|
||||
sed -i "s|NX_VERSION|$NX_VERSION|g" create-nx-workspace/bin/create-nx-workspace.js
|
||||
sed -i "s|ANGULAR_CLI_VERSION|$ANGULAR_CLI_VERSION|g" create-nx-workspace/bin/create-nx-workspace.js
|
||||
sed -i "s|TYPESCRIPT_VERSION|$TYPESCRIPT_VERSION|g" create-nx-workspace/bin/create-nx-workspace.js
|
||||
@ -31,9 +31,9 @@ fi
|
||||
|
||||
if [[ $NX_VERSION == "*" ]]; then
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
sed -E -i "" "s|\"@nrwl\/([^\"]+)\": \"\\*\"|\"@nrwl\/\1\": \"file:$PWD\/\1\"|" {schematics,jest,web,react,next,node,express,nest,cypress,angular,workspace,linter,cli,tao,eslint-plugin-nx,create-nx-workspace}/package.json
|
||||
sed -E -i "" "s|\"@nrwl\/([^\"]+)\": \"\\*\"|\"@nrwl\/\1\": \"file:$PWD\/\1\"|" {schematics,jest,web,react,next,node,express,nest,cypress,storybook,angular,workspace,linter,cli,tao,eslint-plugin-nx,create-nx-workspace}/package.json
|
||||
else
|
||||
echo $PWD
|
||||
sed -E -i "s|\"@nrwl\/([^\"]+)\": \"\\*\"|\"@nrwl\/\1\": \"file:$PWD\/\1\"|" {schematics,jest,web,react,next,node,express,nest,cypress,angular,workspace,linter,cli,tao,eslint-plugin-nx,create-nx-workspace}/package.json
|
||||
sed -E -i "s|\"@nrwl\/([^\"]+)\": \"\\*\"|\"@nrwl\/\1\": \"file:$PWD\/\1\"|" {schematics,jest,web,react,next,node,express,nest,cypress,storybook,angular,workspace,linter,cli,tao,eslint-plugin-nx,create-nx-workspace}/package.json
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -3,5 +3,5 @@
|
||||
if [ -n "$1" ]; then
|
||||
jest --maxWorkers=1 ./build/packages/$1.spec.js
|
||||
else
|
||||
jest --maxWorkers=1 ./build/packages/{schematics,bazel,builders,react,jest,web,node,express,nest,cypress,angular,workspace,tao,eslint-plugin-nx,next} --passWithNoTests
|
||||
jest --maxWorkers=1 ./build/packages/{schematics,bazel,builders,react,jest,web,node,express,nest,cypress,storybook,angular,workspace,tao,eslint-plugin-nx,next} --passWithNoTests
|
||||
fi
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user