Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into ngx-pass-code
  • Loading branch information
dineeek committed May 19, 2023
2 parents 4da8dc4 + 8c728a1 commit 1f7d02a
Show file tree
Hide file tree
Showing 19 changed files with 4,816 additions and 3,536 deletions.
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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ the devtools to test, and build projects as well.
Below are our core plugins:

- [Angular](https://angular.io)
- `ng add @nrwl/angular`
- `ng add @nx/angular`
- [React](https://reactjs.org)
- `ng add @nrwl/react`
- Web (no framework frontends)
Expand All @@ -48,7 +48,7 @@ There are also many [community plugins](https://nx.dev/community) you could add.

## Generate an application

Run `ng g @nrwl/angular:app my-app` to generate an application.
Run `ng g @nx/angular:app my-app` to generate an application.

> You can use any of the plugins above to generate applications as well.
Expand All @@ -57,7 +57,7 @@ workspace.

## Generate a library

Run `ng g @nrwl/angular:lib my-lib` to generate a library.
Run `ng g @nx/angular:lib my-lib` to generate a library.

> You can also use any of the plugins above to generate libraries as well.
Expand Down
2 changes: 1 addition & 1 deletion apps/playground-e2e/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from 'cypress'
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset'
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset'

export default defineConfig({
e2e: nxE2EPreset(__dirname)
Expand Down
4 changes: 2 additions & 2 deletions apps/playground-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/playground-e2e/cypress.config.ts",
"devServerTarget": "playground:serve:development",
Expand All @@ -18,7 +18,7 @@
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/playground-e2e/**/*.{js,ts}"]
Expand Down
4 changes: 2 additions & 2 deletions apps/playground/.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 apps/playground/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ export default {
displayName: 'playground',
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/playground',
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
6 changes: 3 additions & 3 deletions apps/playground/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"apps/playground/**/*.ts",
Expand All @@ -83,8 +83,8 @@
}
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["coverage/apps/playground"],
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/apps/playground"],
"options": {
"jestConfig": "apps/playground/jest.config.ts",
"passWithNoTests": true
Expand Down
56 changes: 33 additions & 23 deletions decorate-angular-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,18 @@
* - Delete and reinstall your node_modules
*/

const fs = require('fs');
const os = require('os');
const cp = require('child_process');
const isWindows = os.platform() === 'win32';
let output;
const fs = require('fs')
const os = require('os')
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.');
process.exit(0);
console.warn(
'Angular CLI could not be decorated to enable computation caching. Please ensure @nx/workspace is installed.'
)
process.exit(0)
}

/**
Expand All @@ -39,31 +41,39 @@ try {
*/
function symlinkNgCLItoNxCLI() {
try {
const ngPath = './node_modules/.bin/ng';
const nxPath = './node_modules/.bin/nx';
const ngPath = './node_modules/.bin/ng'
const nxPath = './node_modules/.bin/nx'
if (isWindows) {
/**
* This is the most reliable way to create symlink-like behavior on Windows.
* Such that it works in all shells and works with npx.
*/
['', '.cmd', '.ps1'].forEach(ext => {
if (fs.existsSync(nxPath + ext)) fs.writeFileSync(ngPath + ext, fs.readFileSync(nxPath + ext));
});
;['', '.cmd', '.ps1'].forEach(ext => {
if (fs.existsSync(nxPath + ext))
fs.writeFileSync(ngPath + ext, fs.readFileSync(nxPath + ext))
})
} else {
// If unix-based, symlink
cp.execSync(`ln -sf ./nx ${ngPath}`);
cp.execSync(`ln -sf ./nx ${ngPath}`)
}
}
catch(e) {
output.error({ title: 'Unable to create a symlink from the Angular CLI to the Nx CLI:' + e.message });
throw e;
} catch (e) {
output.error({
title:
'Unable to create a symlink from the Angular CLI to the Nx CLI:' +
e.message
})
throw e
}
}

try {
symlinkNgCLItoNxCLI();
require('nx/src/adapter/decorate-cli').decorateCli();
output.log({ title: 'Angular CLI has been decorated to enable computation caching.' });
} catch(e) {
output.error({ title: 'Decoration of the Angular CLI did not complete successfully' });
symlinkNgCLItoNxCLI()
require('nx/src/adapter/decorate-cli').decorateCli()
output.log({
title: 'Angular CLI has been decorated to enable computation caching.'
})
} catch (e) {
output.error({
title: 'Decoration of the Angular CLI did not complete successfully'
})
}
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/ngx-pass-code/.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 @@ -31,7 +31,7 @@
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
]
Expand Down
15 changes: 8 additions & 7 deletions libs/ngx-pass-code/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ export default {
displayName: 'ngx-pass-code',
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-pass-code',
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
10 changes: 5 additions & 5 deletions libs/ngx-pass-code/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"prefix": "ngx",
"targets": {
"build": {
"executor": "@nrwl/angular:package",
"outputs": ["dist/libs/ngx-pass-code"],
"executor": "@nx/angular:package",
"outputs": ["{workspaceRoot}/dist/libs/ngx-pass-code"],
"options": {
"project": "libs/ngx-pass-code/ng-package.json"
},
Expand All @@ -22,15 +22,15 @@
"defaultConfiguration": "production"
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["coverage/libs/ngx-pass-code"],
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/libs/ngx-pass-code"],
"options": {
"jestConfig": "libs/ngx-pass-code/jest.config.ts",
"passWithNoTests": true
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"libs/ngx-pass-code/**/*.ts",
Expand Down

0 comments on commit 1f7d02a

Please sign in to comment.