Skip to content

Commit

Permalink
update to Nx v10.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckyMaler authored and ZachJW34 committed Oct 14, 2020
1 parent d6f4a70 commit b989aed
Show file tree
Hide file tree
Showing 31 changed files with 590 additions and 654 deletions.
3 changes: 2 additions & 1 deletion .eslintrc → .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
}
]
}
]
],
"@typescript-eslint/explicit-module-boundary-types": "off"
},
"overrides": [
{
Expand Down
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"recommendations": [
"ms-vscode.vscode-typescript-tslint-plugin",
"esbenp.prettier-vscode"
"esbenp.prettier-vscode",
"firsttris.vscode-jest-runner"
]
}
4 changes: 2 additions & 2 deletions apps/docusaurus-e2e/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
name: 'docusaurus-e2e',
preset: '../../jest.config.js',
displayName: 'docusaurus-e2e',
preset: '../../jest.preset.js',
coverageDirectory: '../../coverage/apps/docusaurus-e2e',
};
4 changes: 2 additions & 2 deletions apps/nuxt-e2e/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
name: 'nuxt-e2e',
preset: '../../jest.config.js',
displayName: 'nuxt-e2e',
preset: '../../jest.preset.js',
coverageDirectory: '../../coverage/apps/nuxt-e2e',
};
19 changes: 19 additions & 0 deletions apps/nuxt-e2e/tests/nuxt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
ensureNxProject,
runNxCommandAsync,
uniq,
updateFile,
} from '@nrwl/nx-plugin/testing';
describe('nuxt e2e', () => {
it('should generate app', async (done) => {
Expand Down Expand Up @@ -50,6 +51,24 @@ describe('nuxt e2e', () => {
done();
}, 300000);

it('should report lint error in index.vue', async (done) => {
const appName = uniq('app');
ensureNxProject('@nx-plus/nuxt', 'dist/libs/nuxt');
await runNxCommandAsync(`generate @nx-plus/nuxt:app ${appName}`);

updateFile(
`apps/${appName}/pages/index.vue`,
'<script lang="ts">{}</script>'
);

const result = await runNxCommandAsync(`lint ${appName}`, {
silenceError: true,
});
expect(result.stderr).toContain('Lint errors found in the listed files.');

done();
}, 300000);

describe('--directory subdir', () => {
it('should generate app', async (done) => {
const appName = uniq('app');
Expand Down
4 changes: 2 additions & 2 deletions apps/vue-e2e/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
name: 'vue-e2e',
preset: '../../jest.config.js',
displayName: 'vue-e2e',
preset: '../../jest.preset.js',
coverageDirectory: '../../coverage/apps/vue-e2e',
};
19 changes: 19 additions & 0 deletions apps/vue-e2e/tests/vue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
runNxCommandAsync,
tmpProjPath,
uniq,
updateFile,
} from '@nrwl/nx-plugin/testing';
import * as cp from 'child_process';

Expand Down Expand Up @@ -152,6 +153,24 @@ describe('vue e2e', () => {
done();
}, 300000);

it('should report lint error in App.vue', async (done) => {
const appName = uniq('app');
ensureNxProject('@nx-plus/vue', 'dist/libs/vue');
await runNxCommandAsync(`generate @nx-plus/vue:app ${appName}`);

updateFile(
`apps/${appName}/src/App.vue`,
'<script lang="ts">{}</script>'
);

const result = await runNxCommandAsync(`lint ${appName}`, {
silenceError: true,
});
expect(result.stderr).toContain('Lint errors found in the listed files.');

done();
}, 300000);

describe('--directory subdir', () => {
it('should generate app', async (done) => {
const appName = uniq('app');
Expand Down
12 changes: 5 additions & 7 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module.exports = {
testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'],
transform: {
'^.+\\.(ts|js|html)$': 'ts-jest',
},
resolver: '@nrwl/jest/plugins/resolver',
moduleFileExtensions: ['ts', 'js', 'html'],
coverageReporters: ['html'],
projects: [
'<rootDir>/libs/docusaurus',
'<rootDir>/libs/vue',
'<rootDir>/libs/nuxt',
],
};
3 changes: 3 additions & 0 deletions jest.preset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const nxPreset = require('@nrwl/jest/preset');

module.exports = { ...nxPreset };
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../.eslintrc",
"extends": "../../.eslintrc.json",
"rules": {},
"ignorePatterns": ["!**/*"]
}
4 changes: 2 additions & 2 deletions libs/docusaurus/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module.exports = {
name: 'docusaurus',
preset: '../../jest.config.js',
preset: '../../jest.preset.js',
transform: {
'^.+\\.[tj]sx?$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'],
coverageDirectory: '../../coverage/libs/docusaurus',
globals: { 'ts-jest': { tsConfig: '<rootDir>/tsconfig.spec.json' } },
displayName: 'docusaurus',
};
8 changes: 4 additions & 4 deletions libs/docusaurus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
"@nrwl/workspace": "^10.0.0"
},
"dependencies": {
"@angular-devkit/architect": "0.1000.7",
"@angular-devkit/core": "10.0.7",
"@angular-devkit/schematics": "10.0.7",
"@angular-devkit/architect": "0.1001.4",
"@angular-devkit/core": "10.1.4",
"@angular-devkit/schematics": "10.1.4",
"rxjs": "6.5.5",
"typescript": "3.9.7"
"typescript": "4.0.3"
},
"ng-update": {
"migrations": "./migrations.json"
Expand Down
2 changes: 1 addition & 1 deletion libs/nuxt/.eslintrc → libs/nuxt/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../.eslintrc",
"extends": "../../.eslintrc.json",
"rules": {},
"ignorePatterns": ["!**/*"]
}
4 changes: 2 additions & 2 deletions libs/nuxt/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module.exports = {
name: 'nuxt',
preset: '../../jest.config.js',
preset: '../../jest.preset.js',
transform: {
'^.+\\.[tj]sx?$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'],
coverageDirectory: '../../coverage/libs/nuxt',
globals: { 'ts-jest': { tsConfig: '<rootDir>/tsconfig.spec.json' } },
displayName: 'nuxt',
};
6 changes: 3 additions & 3 deletions libs/nuxt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
"@nrwl/workspace": "^10.0.0"
},
"dependencies": {
"@angular-devkit/architect": "0.1000.7",
"@angular-devkit/core": "10.0.7",
"@angular-devkit/schematics": "10.0.7",
"@angular-devkit/architect": "0.1001.4",
"@angular-devkit/core": "10.1.4",
"@angular-devkit/schematics": "10.1.4",
"@nrwl/cypress": "^10.0.0",
"@nrwl/jest": "^10.0.0",
"@nrwl/linter": "^10.0.0",
Expand Down
6 changes: 3 additions & 3 deletions libs/nuxt/src/schematics/application/schematic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('nuxt schematic', () => {
browserTarget: 'my-app:build:production',
dev: false,
});
expect(lint.builder).toBe('@nrwl/linter:lint');
expect(lint.builder).toBe('@nrwl/linter:eslint');
expect(test.builder).toBe('@nrwl/jest:jest');

expect(workspaceJson.projects['my-app-e2e']).toBeDefined();
Expand All @@ -71,7 +71,7 @@ describe('nuxt schematic', () => {

const eslintConfig = tree.readContent('apps/my-app/.eslintrc.js');
expect(eslintConfig).toContain(`extends: [
'../../.eslintrc',
'../../.eslintrc.json',
'@nuxtjs/eslint-config-typescript',
'plugin:nuxt/recommended',
'prettier',
Expand Down Expand Up @@ -167,7 +167,7 @@ describe('nuxt schematic', () => {

const eslintConfig = tree.readContent('apps/subdir/my-app/.eslintrc.js');
expect(eslintConfig).toContain(`extends: [
'../../../.eslintrc',
'../../../.eslintrc.json',
'@nuxtjs/eslint-config-typescript',
'plugin:nuxt/recommended',
'prettier',
Expand Down
24 changes: 15 additions & 9 deletions libs/nuxt/src/schematics/application/schematic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ function addEsLint(options: NormalizedSchema): Rule {
'prettier',
'prettier/@typescript-eslint',
],
parserOptions: {
extraFileExtensions: ['.vue'],
},
rules: {},
};

Expand All @@ -103,24 +106,27 @@ function addEsLint(options: NormalizedSchema): Rule {
...generateProjectLint(
options.projectRoot,
`${options.projectRoot}/tsconfig.json`,
Linter.EsLint
Linter.EsLint,
[`${options.projectRoot}/**/*.{ts,js,vue}`]
),
});
}),
addLintFiles(options.projectRoot, Linter.EsLint, {
localConfig: eslintConfig,
}),
// Extending the root ESLint config should be the first value in the
// app's local ESLint config extends array.
updateJsonInTree(`${options.projectRoot}/.eslintrc`, (json) => {
updateJsonInTree(`${options.projectRoot}/.eslintrc.json`, (json) => {
// Extending the root ESLint config should be the first value in the
// app's local ESLint config extends array.
json.extends.unshift(json.extends.pop());
json.ignorePatterns = [...(json.ignorePatterns || []), '.eslintrc.js'];
return json;
}),
(tree: Tree) => {
const configPath = `${options.projectRoot}/.eslintrc`;
const configPath = `${options.projectRoot}/.eslintrc.json`;
const content = tree.read(configPath).toString('utf-8').trim();
tree.rename(configPath, `${configPath}.js`);
tree.overwrite(`${configPath}.js`, `module.exports = ${content};`);
const newConfigPath = configPath.slice(0, -2);
tree.rename(configPath, newConfigPath);
tree.overwrite(newConfigPath, `module.exports = ${content};`);
},
]);
}
Expand Down Expand Up @@ -149,8 +155,8 @@ function addJest(options: NormalizedSchema): Rule {
(tree: Tree) => {
const content = tags.stripIndent`
module.exports = {
name: '${options.projectName}',
preset: '${offsetFromRoot(options.projectRoot)}jest.config.js',
displayName: '${options.projectName}',
preset: '${offsetFromRoot(options.projectRoot)}jest.preset.js',
transform: {
'.*\\.(vue)$': 'vue-jest',
'^.+\\.ts$': 'ts-jest',
Expand Down
2 changes: 1 addition & 1 deletion libs/vue/.eslintrc → libs/vue/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../.eslintrc",
"extends": "../../.eslintrc.json",
"rules": {},
"ignorePatterns": ["!**/*"]
}
4 changes: 2 additions & 2 deletions libs/vue/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module.exports = {
name: 'vue',
preset: '../../jest.config.js',
preset: '../../jest.preset.js',
transform: {
'^.+\\.[tj]sx?$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'],
coverageDirectory: '../../coverage/libs/vue',
globals: { 'ts-jest': { tsConfig: '<rootDir>/tsconfig.spec.json' } },
displayName: 'vue',
};
8 changes: 4 additions & 4 deletions libs/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
"@nrwl/workspace": "^10.0.0"
},
"dependencies": {
"@angular-devkit/architect": "0.1000.7",
"@angular-devkit/core": "10.0.7",
"@angular-devkit/schematics": "10.0.7",
"@angular-devkit/architect": "0.1001.4",
"@angular-devkit/core": "10.1.4",
"@angular-devkit/schematics": "10.1.4",
"@nrwl/cypress": "^10.0.0",
"@nrwl/jest": "^10.0.0",
"@nrwl/linter": "^10.0.0",
Expand All @@ -46,7 +46,7 @@
"stylus": "^0.54.7",
"stylus-loader": "^3.0.2",
"tsconfig-paths-webpack-plugin": "3.3.0",
"typescript": "3.9.7"
"typescript": "4.0.3"
},
"ng-update": {
"migrations": "./migrations.json"
Expand Down
2 changes: 2 additions & 0 deletions libs/vue/src/builders/browser/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ export interface BrowserBuilderSchema extends JsonObject {
productionSourceMap: boolean;
css: {
requireModuleExtension: boolean;
// eslint-disable-next-line @typescript-eslint/ban-types
extract: boolean | object;
sourceMap: boolean;
// eslint-disable-next-line @typescript-eslint/ban-types
loaderOptions: object;
};
stdin: boolean;
Expand Down
3 changes: 3 additions & 0 deletions libs/vue/src/builders/dev-server/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ export interface DevServerBuilderSchema extends JsonObject {
publicPath?: string;
css: {
requireModuleExtension?: boolean;
// eslint-disable-next-line @typescript-eslint/ban-types
extract?: boolean | object;
sourceMap?: boolean;
// eslint-disable-next-line @typescript-eslint/ban-types
loaderOptions: object;
};
// eslint-disable-next-line @typescript-eslint/ban-types
devServer: object;
}
2 changes: 2 additions & 0 deletions libs/vue/src/builders/library/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ export interface LibraryBuilderSchema extends JsonObject {
inlineVue: boolean;
css: {
requireModuleExtension: boolean;
// eslint-disable-next-line @typescript-eslint/ban-types
extract: boolean | object;
sourceMap: boolean;
// eslint-disable-next-line @typescript-eslint/ban-types
loaderOptions: object;
};
formats: string;
Expand Down
6 changes: 3 additions & 3 deletions libs/vue/src/schematics/application/schematic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('application schematic', () => {
expect(serve.configurations.production).toEqual({
browserTarget: 'my-app:build:production',
});
expect(lint.builder).toBe('@nrwl/linter:lint');
expect(lint.builder).toBe('@nrwl/linter:eslint');
expect(test.builder).toBe('@nrwl/jest:jest');

expect(workspaceJson.projects['my-app-e2e']).toBeDefined();
Expand Down Expand Up @@ -94,7 +94,7 @@ describe('application schematic', () => {

const eslintConfig = tree.readContent('apps/my-app/.eslintrc.js');
expect(eslintConfig).toContain(`extends: [
'../../.eslintrc',
'../../.eslintrc.json',
'plugin:vue/essential',
'@vue/typescript/recommended',
'prettier',
Expand Down Expand Up @@ -402,7 +402,7 @@ describe('application schematic', () => {

const eslintConfig = tree.readContent('apps/subdir/my-app/.eslintrc.js');
expect(eslintConfig).toContain(`extends: [
'../../../.eslintrc',
'../../../.eslintrc.json',
'plugin:vue/essential',
'@vue/typescript/recommended',
'prettier',
Expand Down
Loading

0 comments on commit b989aed

Please sign in to comment.