Skip to content

Commit

Permalink
Merge branch 'master' into fix-web-builder
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarini committed Sep 4, 2020
2 parents 2dde17f + 326bff6 commit 694aa0c
Show file tree
Hide file tree
Showing 33 changed files with 360 additions and 119 deletions.
36 changes: 1 addition & 35 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,12 @@
"env": {
"node": true
},
"ignorePatterns": ["**/*"],
"ignorePatterns": ["**/*.ts"],
"plugins": ["@typescript-eslint", "@nrwl/nx"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint"
],
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_"
}
],
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-parameter-properties": "off",
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
},
"overrides": [
{
"files": ["*.tsx"],
"rules": {
"@typescript-eslint/no-unused-vars": "off"
}
}
]
}
2 changes: 1 addition & 1 deletion docs/angular/api-jest/builders/jest.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ The directory where Jest should output its coverage files.

### coverageReporters

Type: `string`
Type: `array`

A list of reporter names that Jest uses when writing coverage reports. Any istanbul reporter

Expand Down
42 changes: 39 additions & 3 deletions docs/angular/api-workspace/builders/run-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,44 @@ or simply with:
nx run frontend:create-script --name=example
```

##### Arguments forwarding

When interpolation is not present in the command, all arguments are forwarded to the command by default.

This is useful when you need to pass raw argument strings to your command.

For example, when you run:

nx run frontend:webpack --args="--config=example.config.js"

```json
"webpack": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"command": "webpack"
}
}
```

The above command will execute: `webpack --config=example.config.js`

This functionality can be disabled by using `commands` and expanding each `command` into an object
that sets the `forwardAllArgs` option to `false` as shown below:

```json
"webpack": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"commands": [
{
"command": "webpack",
"forwardAllArgs": false
}
]
}
}
```

##### Custom **done** conditions

Normally, `run-commands` considers the commands done when all of them have finished running. If you don't need to wait until they're all done, you can set a special string, that considers the command finished the moment the string appears in `stdout` or `stderr`:
Expand All @@ -74,9 +112,7 @@ Normally, `run-commands` considers the commands done when all of them have finis
"finish-when-ready": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"command": [
"echo 'READY' && sleep 5 && echo 'FINISHED'"
],
"command": "echo 'READY' && sleep 5 && echo 'FINISHED'",
"readyWhen": "READY"
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/node/api-jest/builders/jest.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ The directory where Jest should output its coverage files.

### coverageReporters

Type: `string`
Type: `array`

A list of reporter names that Jest uses when writing coverage reports. Any istanbul reporter

Expand Down
42 changes: 39 additions & 3 deletions docs/node/api-workspace/builders/run-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,44 @@ or simply with:
nx run frontend:create-script --name=example
```

##### Arguments forwarding

When interpolation is not present in the command, all arguments are forwarded to the command by default.

This is useful when you need to pass raw argument strings to your command.

For example, when you run:

nx run frontend:webpack --args="--config=example.config.js"

```json
"webpack": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"command": "webpack"
}
}
```

The above command will execute: `webpack --config=example.config.js`

This functionality can be disabled by using `commands` and expanding each `command` into an object
that sets the `forwardAllArgs` option to `false` as shown below:

```json
"webpack": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"commands": [
{
"command": "webpack",
"forwardAllArgs": false
}
]
}
}
```

##### Custom **done** conditions

Normally, `run-commands` considers the commands done when all of them have finished running. If you don't need to wait until they're all done, you can set a special string, that considers the command finished the moment the string appears in `stdout` or `stderr`:
Expand All @@ -75,9 +113,7 @@ Normally, `run-commands` considers the commands done when all of them have finis
"finish-when-ready": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"command": [
"echo 'READY' && sleep 5 && echo 'FINISHED'"
],
"command": "echo 'READY' && sleep 5 && echo 'FINISHED'",
"readyWhen": "READY"
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/react/api-jest/builders/jest.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ The directory where Jest should output its coverage files.

### coverageReporters

Type: `string`
Type: `array`

A list of reporter names that Jest uses when writing coverage reports. Any istanbul reporter

Expand Down
42 changes: 39 additions & 3 deletions docs/react/api-workspace/builders/run-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,44 @@ or simply with:
nx run frontend:create-script --name=example
```

##### Arguments forwarding

When interpolation is not present in the command, all arguments are forwarded to the command by default.

This is useful when you need to pass raw argument strings to your command.

For example, when you run:

nx run frontend:webpack --args="--config=example.config.js"

```json
"webpack": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"command": "webpack"
}
}
```

The above command will execute: `webpack --config=example.config.js`

This functionality can be disabled by using `commands` and expanding each `command` into an object
that sets the `forwardAllArgs` option to `false` as shown below:

```json
"webpack": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"commands": [
{
"command": "webpack",
"forwardAllArgs": false
}
]
}
}
```

##### Custom **done** conditions

Normally, `run-commands` considers the commands done when all of them have finished running. If you don't need to wait until they're all done, you can set a special string, that considers the command finished the moment the string appears in `stdout` or `stderr`:
Expand All @@ -75,9 +113,7 @@ Normally, `run-commands` considers the commands done when all of them have finis
"finish-when-ready": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"command": [
"echo 'READY' && sleep 5 && echo 'FINISHED'"
],
"command": "echo 'READY' && sleep 5 && echo 'FINISHED'",
"readyWhen": "READY"
}
}
Expand Down
24 changes: 24 additions & 0 deletions e2e/jest/src/jest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,29 @@ forEachCli(() => {
);
done();
}, 45000);

it('should support multiple `coverageReporters` through CLI', async (done) => {
ensureProject();
const mylib = uniq('mylib');
runCLI(`generate @nrwl/workspace:lib ${mylib} --unit-test-runner jest`);

updateFile(
`libs/${mylib}/src/lib/${mylib}.spec.ts`,
`
test('can access jest global', () => {
expect(true).toBe(true);
});
`
);

const result = await runCLIAsync(
`test ${mylib} --no-watch --code-coverage --coverageReporters=text --coverageReporters=text-summary`
);
expect(result.stdout).toContain(
'File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s'
); // text
expect(result.stdout).toContain('Coverage summary'); // text-summary
done();
}, 45000);
});
});
30 changes: 30 additions & 0 deletions e2e/react/src/react.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,36 @@ forEachCli('nx', () => {
);
}, 120000);

it('should generate app with legacy-ie support', async () => {
ensureProject();
const appName = uniq('app');

runCLI(
`generate @nrwl/react:app ${appName} --style=css --no-interactive`
);

// changing browser suporrt of this application
updateFile(`apps/${appName}/.browserslistrc`, `IE 11`);

await testGeneratedApp(appName, {
checkStyles: false,
checkProdBuild: true,
checkLinter: false,
checkE2E: false,
});

const filesToCheck = [
`dist/apps/${appName}/prod/polyfills.es5.js`,
`dist/apps/${appName}/prod/main.es5.js`,
];

checkFilesExist(...filesToCheck);

expect(readFile(`dist/apps/${appName}/prod/index.html`)).toContain(
`<script src="main.esm.js" type="module"></script><script src="main.es5.js" nomodule defer></script>`
);
}, 120000);

it('should be able to add a redux slice', async () => {
ensureProject();
const appName = uniq('app');
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"@types/react-redux": "7.1.5",
"@types/react-router-dom": "5.1.3",
"@types/webpack": "^4.4.24",
"@types/yargs": "^11.0.0",
"@types/yargs": "^15.0.5",
"@typescript-eslint/eslint-plugin": "^2.19.2",
"@typescript-eslint/experimental-utils": "^2.19.2",
"@typescript-eslint/parser": "^2.19.2",
Expand All @@ -101,7 +101,7 @@
"@zeit/next-sass": "1.0.1",
"@zeit/next-stylus": "1.0.1",
"ajv": "6.10.2",
"angular": "1.7.9",
"angular": "1.8.0",
"app-root-path": "^2.0.1",
"autoprefixer": "9.7.4",
"axios": "^0.19.0",
Expand Down Expand Up @@ -233,8 +233,7 @@
"webpack-sources": "1.4.3",
"webpack-subresource-integrity": "1.1.0-rc.6",
"worker-plugin": "3.2.0",
"yargs": "^11.0.0",
"yargs-parser": "10.0.0",
"yargs": "15.4.1",
"zone.js": "^0.10.0",
"@nrwl/nx-cloud": "10.1.0-beta.2"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ describe('app', () => {
const workspaceJson = readJsonInTree(result, 'workspace.json');

expect(workspaceJson.projects['my-app'].schematics).toEqual({
'@nrwl/angular:component': {
'@schematics/angular:component': {
style: 'scss',
},
});
Expand Down
21 changes: 0 additions & 21 deletions packages/angular/src/schematics/application/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,27 +480,6 @@ function updateProject(options: NormalizedSchema): Rule {
options.appProjectRoot
);

const angularSchematicNames = [
'class',
'component',
'directive',
'guard',
'module',
'pipe',
'service',
];

if (fixedProject.schematics) {
angularSchematicNames.forEach((type) => {
const schematic = `@schematics/angular:${type}`;
if (schematic in fixedProject.schematics) {
fixedProject.schematics[`@nrwl/angular:${type}`] =
fixedProject.schematics[schematic];
delete fixedProject.schematics[schematic];
}
});
}

delete fixedProject.architect.test;

fixedProject.architect.lint.options.tsConfig = fixedProject.architect.lint.options.tsConfig.filter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export function updateProject(options: NormalizedSchema): Rule {
if (options.style !== 'css') {
fixedProject.schematics = {
...fixedProject.schematics,
'@nrwl/angular:component': {
'@schematics/angular:component': {
style: options.style,
},
};
Expand Down
2 changes: 1 addition & 1 deletion packages/angular/src/schematics/library/library.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ describe('lib', () => {
const workspaceJson = readJsonInTree(result, 'workspace.json');

expect(workspaceJson.projects['my-lib'].schematics).toEqual({
'@nrwl/angular:component': {
'@schematics/angular:component': {
style: 'scss',
},
});
Expand Down

0 comments on commit 694aa0c

Please sign in to comment.