Skip to content

Commit

Permalink
Merge pull request #59 from Boris-Bodin/feature/angular16
Browse files Browse the repository at this point in the history
Feature/angular16
  • Loading branch information
bohoffi authored Oct 28, 2023
2 parents 8968227 + 7f73d28 commit 7c42aba
Show file tree
Hide file tree
Showing 18 changed files with 14,702 additions and 11,521 deletions.
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: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ testem.log
Thumbs.db

.angular

.nx/cache
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

/dist
/coverage

/.nx/cache
7 changes: 2 additions & 5 deletions apps/ngx-localstorage-demo/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
"overrides": [
{
"files": ["*.ts"],
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"extends": ["plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates"],
"rules": {
"@angular-eslint/directive-selector": [
"error",
Expand All @@ -29,7 +26,7 @@
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
]
Expand Down
19 changes: 10 additions & 9 deletions apps/ngx-localstorage-demo/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ export default {
displayName: 'ngx-localstorage-demo',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
},
globals: {},
coverageDirectory: '../../coverage/apps/ngx-localstorage-demo',
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: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
'jest-preset-angular/build/serializers/html-comment'
]
};
9 changes: 5 additions & 4 deletions apps/ngx-localstorage-demo/project.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "ngx-localstorage-demo",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/ngx-localstorage-demo/src",
"prefix": "ngx-localstorage",
Expand Down Expand Up @@ -73,20 +75,19 @@
"defaultConfiguration": "development"
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": ["apps/ngx-localstorage-demo/**/*.ts", "apps/ngx-localstorage-demo/**/*.html"]
}
},
"test": {
"executor": "@nrwl/jest:jest",
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/apps/ngx-localstorage-demo"],
"options": {
"jestConfig": "apps/ngx-localstorage-demo/jest.config.ts",
"passWithNoTests": true
}
}
},
"tags": [],
"name": "ngx-localstorage-demo"
"tags": []
}
15 changes: 6 additions & 9 deletions apps/ngx-localstorage-demo/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
const { createGlobPatternsForDependencies } = require("@nrwl/angular/tailwind");
const { join } = require("path");
const { createGlobPatternsForDependencies } = require('@nx/angular/tailwind');
const { join } = require('path');

module.exports = {
corePlugins: {
preflight: false,
preflight: false
},
content: [
join(__dirname, "src/**/!(*.stories|*.spec).{ts,html}"),
...createGlobPatternsForDependencies(__dirname),
],
content: [join(__dirname, 'src/**/!(*.stories|*.spec).{ts,html}'), ...createGlobPatternsForDependencies(__dirname)],
darkMode: 'media',
theme: {
extend: {},
extend: {}
},
plugins: [],
plugins: []
};
9 changes: 4 additions & 5 deletions decorate-angular-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ const cp = require('child_process');
const isWindows = os.platform() === 'win32';
let output;
try {
output = require('@nrwl/workspace').output;
output = require('@nx/workspace').output;
} catch (e) {
console.warn('Angular CLI could not be decorated to enable computation caching. Please ensure @nrwl/workspace is installed.');
console.warn('Angular CLI could not be decorated to enable computation caching. Please ensure @nx/workspace is installed.');
process.exit(0);
}

Expand All @@ -53,8 +53,7 @@ function symlinkNgCLItoNxCLI() {
// If unix-based, symlink
cp.execSync(`ln -sf ./nx ${ngPath}`);
}
}
catch(e) {
} catch (e) {
output.error({ title: 'Unable to create a symlink from the Angular CLI to the Nx CLI:' + e.message });
throw e;
}
Expand All @@ -64,6 +63,6 @@ try {
symlinkNgCLItoNxCLI();
require('nx/src/adapter/decorate-cli').decorateCli();
output.log({ title: 'Angular CLI has been decorated to enable computation caching.' });
} catch(e) {
} catch (e) {
output.error({ title: 'Decoration of the Angular CLI did not complete successfully' });
}
4 changes: 2 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getJestProjects } from '@nrwl/jest';
import { getJestProjects } from '@nx/jest';

export default {
projects: getJestProjects(),
projects: getJestProjects()
};
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/ngx-localstorage/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"project": "./libs/ngx-localstorage/tsconfig.*?.json"
},
"files": ["*.ts"],
"extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"],
"extends": ["plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates"],
"plugins": ["deprecation"],
"rules": {
"@angular-eslint/directive-selector": [
Expand All @@ -31,7 +31,7 @@
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
]
Expand Down
19 changes: 10 additions & 9 deletions libs/ngx-localstorage/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ export default {
displayName: 'ngx-localstorage',
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/ngx-localstorage',
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: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
'jest-preset-angular/build/serializers/html-comment'
]
};
4 changes: 2 additions & 2 deletions libs/ngx-localstorage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "ngx-localstorage",
"version": "5.0.0",
"peerDependencies": {
"@angular/common": "^15.0.0",
"@angular/core": "^15.0.0"
"@angular/common": ">=15.0.0",
"@angular/core": ">=15.0.0"
},
"dependencies": {
"tslib": "^2.3.0"
Expand Down
11 changes: 6 additions & 5 deletions libs/ngx-localstorage/project.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"name": "ngx-localstorage",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"sourceRoot": "libs/ngx-localstorage/src",
"prefix": "ngx-localstorage",
"targets": {
"build": {
"executor": "@nrwl/angular:package",
"executor": "@nx/angular:package",
"outputs": ["{workspaceRoot}/dist/libs/ngx-localstorage"],
"options": {
"project": "libs/ngx-localstorage/ng-package.json"
Expand All @@ -20,15 +22,15 @@
"defaultConfiguration": "production"
},
"test": {
"executor": "@nrwl/jest:jest",
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/libs/ngx-localstorage"],
"options": {
"jestConfig": "libs/ngx-localstorage/jest.config.ts",
"passWithNoTests": true
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": ["libs/ngx-localstorage/**/*.ts", "libs/ngx-localstorage/**/*.html"]
}
Expand All @@ -41,6 +43,5 @@
}
}
},
"tags": [],
"name": "ngx-localstorage"
"tags": []
}
27 changes: 11 additions & 16 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,38 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"npmScope": "ngx-localstorage",
"affected": {
"defaultBase": "develop"
},
"cli": {
"packageManager": "npm"
},
"tasksRunnerOptions": {
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": ["build", "lint", "test"]
}
}
},
"targetDefaults": {
"build": {
"dependsOn": ["^build"],
"inputs": ["production", "^production"]
"inputs": ["production", "^production"],
"cache": true
},
"test": {
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"]
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"],
"cache": true
},
"lint": {
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"]
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"],
"cache": true
}
},
"generators": {
"@nrwl/angular:application": {
"@nx/angular:application": {
"style": "scss",
"linter": "eslint",
"unitTestRunner": "jest",
"e2eTestRunner": "cypress"
},
"@nrwl/angular:library": {
"@nx/angular:library": {
"linter": "eslint",
"unitTestRunner": "jest"
},
"@nrwl/angular:component": {
"@nx/angular:component": {
"style": "scss"
}
},
Expand All @@ -51,7 +45,8 @@
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
"!{projectRoot}/tsconfig.spec.json",
"!{projectRoot}/jest.config.[jt]s",
"!{projectRoot}/.eslintrc.json"
"!{projectRoot}/.eslintrc.json",
"!{projectRoot}/src/test-setup.[jt]s"
]
}
}
Loading

0 comments on commit 7c42aba

Please sign in to comment.