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

Migrate Nx workspace #347

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
8 changes: 4 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nrwl/nx"],
"plugins": ["@nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
Expand All @@ -23,12 +23,12 @@
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"extends": ["plugin:@nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
}
]
Expand Down
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getJestProjects } from '@nrwl/jest';
import { getJestProjects } from '@nx/jest';

export default {
projects: getJestProjects(),
Expand Down
16 changes: 14 additions & 2 deletions jest.preset.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
const nxPreset = require('@nrwl/jest/preset').default;
const nxPreset = require('@nx/jest/preset').default;

module.exports = { ...nxPreset };
module.exports = {
...nxPreset,
/* TODO: Update to latest Jest snapshotFormat
* By default Nx has kept the older style of Jest Snapshot formats
* to prevent breaking of any existing tests with snapshots.
* It's recommend you update to the latest format.
* You can do this by removing snapshotFormat property
* and running tests with --update-snapshot flag.
* Example: "nx affected --targets=test --update-snapshot"
* More info: https://jestjs.io/docs/upgrading-to-jest29#snapshot-format
*/
snapshotFormat: { escapeString: true, printBasicPrototype: true },
};
4 changes: 2 additions & 2 deletions libs/rx/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"files": ["*.ts"],
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
Expand All @@ -29,7 +29,7 @@
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
]
Expand Down
15 changes: 8 additions & 7 deletions libs/rx/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ export default {
displayName: 'rx',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
},
globals: {},
coverageDirectory: '../../coverage/libs/rx',
transform: {
'^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular',
'^.+\\.(ts|mjs|js|html)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
],
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
snapshotSerializers: [
Expand Down
7 changes: 4 additions & 3 deletions libs/rx/project.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "rx",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"sourceRoot": "libs/rx/src",
"prefix": "ngry",
"targets": {
"build": {
"executor": "@nrwl/angular:package",
"executor": "@nx/angular:package",
"outputs": ["{workspaceRoot}/dist/libs/rx"],
"options": {
"project": "libs/rx/ng-package.json"
Expand All @@ -21,7 +22,7 @@
"defaultConfiguration": "production"
},
"test": {
"executor": "@nrwl/jest:jest",
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/libs/rx"],
"options": {
"jestConfig": "libs/rx/jest.config.ts",
Expand All @@ -30,7 +31,7 @@
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": ["libs/rx/**/*.ts", "libs/rx/**/*.html"]
}
Expand Down
4 changes: 2 additions & 2 deletions libs/store/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"files": ["*.ts"],
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
Expand All @@ -29,7 +29,7 @@
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
]
Expand Down
15 changes: 8 additions & 7 deletions libs/store/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ export default {
displayName: 'store',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
},
globals: {},
coverageDirectory: '../../coverage/libs/store',
transform: {
'^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular',
'^.+\\.(ts|mjs|js|html)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
],
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
snapshotSerializers: [
Expand Down
7 changes: 4 additions & 3 deletions libs/store/project.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "store",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"sourceRoot": "libs/store/src",
"prefix": "ngry",
"targets": {
"build": {
"executor": "@nrwl/angular:package",
"executor": "@nx/angular:package",
"outputs": ["{workspaceRoot}/dist/libs/store"],
"options": {
"project": "libs/store/ng-package.json"
Expand All @@ -21,7 +22,7 @@
"defaultConfiguration": "production"
},
"test": {
"executor": "@nrwl/jest:jest",
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/libs/store"],
"options": {
"jestConfig": "libs/store/jest.config.ts",
Expand All @@ -30,7 +31,7 @@
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": ["libs/store/**/*.ts", "libs/store/**/*.html"]
}
Expand Down
4 changes: 2 additions & 2 deletions libs/translate/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"files": ["*.ts"],
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
Expand All @@ -29,7 +29,7 @@
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
]
Expand Down
15 changes: 8 additions & 7 deletions libs/translate/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ export default {
displayName: 'translate',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
},
globals: {},
coverageDirectory: '../../coverage/libs/translate',
transform: {
'^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular',
'^.+\\.(ts|mjs|js|html)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
],
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
snapshotSerializers: [
Expand Down
7 changes: 4 additions & 3 deletions libs/translate/project.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "translate",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"sourceRoot": "libs/translate/src",
"prefix": "ngry",
"targets": {
"build": {
"executor": "@nrwl/angular:package",
"executor": "@nx/angular:package",
"outputs": ["{workspaceRoot}/dist/libs/translate"],
"options": {
"project": "libs/translate/ng-package.json"
Expand All @@ -21,7 +22,7 @@
"defaultConfiguration": "production"
},
"test": {
"executor": "@nrwl/jest:jest",
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/libs/translate"],
"options": {
"jestConfig": "libs/translate/jest.config.ts",
Expand All @@ -30,7 +31,7 @@
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"libs/translate/**/*.ts",
Expand Down
8 changes: 2 additions & 6 deletions libs/translate/src/lib/integration/router/title.resolve.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { Inject, Injectable, Optional, Self, SkipSelf } from '@angular/core';
import {
ActivatedRouteSnapshot,
Resolve,
RouterStateSnapshot,
} from '@angular/router';
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { map } from 'rxjs';
import { StandalonePhrase } from '../../standalone-phrase';
import { useLanguage } from '../../use-language';
Expand All @@ -12,7 +8,7 @@ import { ROUTE_TITLE_PARAMS } from './route-title-params.token';
import { ROUTE_TITLE_PHRASE } from './route-title-phrase.token';

@Injectable()
export class TitleResolve implements Resolve<string> {
export class TitleResolve {
private readonly language = useLanguage();

get path(): readonly TitleResolve[] {
Expand Down
6 changes: 3 additions & 3 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@
]
},
"generators": {
"@nrwl/angular:application": {
"@nx/angular:application": {
"style": "scss",
"linter": "eslint",
"unitTestRunner": "jest",
"e2eTestRunner": "none"
},
"@nrwl/angular:library": {
"@nx/angular:library": {
"linter": "eslint",
"unitTestRunner": "jest"
},
"@nrwl/angular:component": {
"@nx/angular:component": {
"style": "scss"
}
},
Expand Down
Loading
Loading