Skip to content
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
18 changes: 12 additions & 6 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,13 +23,19 @@
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"rules": {}
"extends": ["plugin:@nx/typescript"],
"rules": {
"@typescript-eslint/no-extra-semi": "error",
"no-extra-semi": "off"
}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"rules": {}
"extends": ["plugin:@nx/javascript"],
"rules": {
"@typescript-eslint/no-extra-semi": "error",
"no-extra-semi": "off"
}
}
]
}
2 changes: 1 addition & 1 deletion .github/workflows/ngx-aws-deploy-s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
node-version: [20.x, 22.x]

env:
NX_BRANCH: ${{ github.event.number }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ngx-aws-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
node-version: [20.x, 22.x]

env:
NX_BRANCH: ${{ github.event.number }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/nx-migrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ jobs:
- name: Install dependencies
run: npm install

- name: Check if @nrwl/workspace is outdated
- name: Check if @nx/workspace is outdated
id: nrwl-workspace-outdated
run: |
IS_OUTDATED=$(test ! -z "$(npm outdated @nrwl/workspace)" && echo true || echo false)
IS_OUTDATED=$(test ! -z "$(npm outdated @nx/workspace)" && echo true || echo false)
echo $IS_OUTDATED
echo "::set-output name=outdated::$IS_OUTDATED"

- name: Update @nrwl/workspace
- name: Update @nx/workspace
if: steps.nrwl-workspace-outdated.outputs.outdated == 'true'
run: npx nx migrate latest

Expand All @@ -45,7 +45,7 @@ jobs:
echo $HAS_MIGRATIONS
echo "::set-output name=has_migrations::$HAS_MIGRATIONS"

- name: Run @nrwl/workspace migrations
- name: Run @nx/workspace migrations
if: steps.nrwl-workspace-has-migrations.outputs.has_migrations == 'true'
run: npx nx migrate --run-migrations

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ testem.log
.DS_Store
Thumbs.db

migrations.json
migrations.json
.nx
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@

/dist
/coverage

/.nx/cache
/.nx/workspace-data
13 changes: 5 additions & 8 deletions apps/demo-app-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/demo-app-e2e/src",
"projectType": "application",
"tags": [],
"implicitDependencies": ["demo-app"],
"targets": {
"e2e": {
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/demo-app-e2e/cypress.json",
"tsConfig": "apps/demo-app-e2e/tsconfig.e2e.json",
Expand All @@ -18,12 +20,7 @@
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": ["apps/demo-app-e2e/**/*.{js,ts}"]
}
"executor": "@nx/eslint:lint"
}
},
"tags": [],
"implicitDependencies": ["demo-app"]
}
}
2 changes: 1 addition & 1 deletion apps/demo-app-e2e/src/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)

const { preprocessTypescript } = require('@nrwl/cypress/plugins/preprocessor');
const { preprocessTypescript } = require('@nx/cypress/plugins/preprocessor');

module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
Expand Down
6 changes: 6 additions & 0 deletions apps/demo-app/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts"],
"rules": {
"@angular-eslint/prefer-standalone": "off"
}
}
]
}
17 changes: 9 additions & 8 deletions apps/demo-app/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@ export default {
displayName: 'demo-app',

setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {
'ts-jest': {
stringifyContentPathRegex: '\\.(html|svg)$',

tsconfig: '<rootDir>/tsconfig.spec.json',
},
},
globals: {},
coverageDirectory: '../../coverage/apps/demo-app',
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
transform: {
'^.+.(ts|mjs|js|html)$': 'jest-preset-angular',
'^.+.(ts|mjs|js|html)$': [
'jest-preset-angular',
{
stringifyContentPathRegex: '\\.(html|svg)$',

tsconfig: '<rootDir>/tsconfig.spec.json',
},
],
},
transformIgnorePatterns: ['node_modules/(?!.*.mjs$)'],
preset: '../../jest.preset.js',
Expand Down
24 changes: 10 additions & 14 deletions apps/demo-app/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
"name": "demo-app",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/demo-app/src",
"prefix": "ngx-aws-deploy",
"tags": [],
"generators": {
"@schematics/angular:component": {
"style": "scss"
}
},
"sourceRoot": "apps/demo-app/src",
"prefix": "ngx-aws-deploy",
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:browser",
Expand Down Expand Up @@ -62,31 +63,27 @@
"serve": {
"executor": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "demo-app:build"
"buildTarget": "demo-app:build"
},
"configurations": {
"production": {
"browserTarget": "demo-app:build:production"
"buildTarget": "demo-app:build:production"
}
}
},
"extract-i18n": {
"executor": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "demo-app:build"
"buildTarget": "demo-app:build"
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": ["apps/demo-app/src/**/*.ts"]
}
"executor": "@nx/eslint:lint"
},
"test": {
"executor": "@nrwl/jest:jest",
"executor": "@nx/jest:jest",
"options": {
"jestConfig": "apps/demo-app/jest.config.ts",
"passWithNoTests": true
"jestConfig": "apps/demo-app/jest.config.ts"
},
"outputs": ["{workspaceRoot}/coverage/apps/demo-app"]
},
Expand All @@ -100,6 +97,5 @@
}
}
}
},
"tags": []
}
}
12 changes: 4 additions & 8 deletions apps/demo-app/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ <h1>Welcome to {{ title }}!</h1>
</header>
<main>
<h2>Resources &amp; Tools</h2>
<p>
Thank you for using and showing some ♥ for Nx.
</p>
<p>Thank you for using and showing some ♥ for Nx.</p>
<div class="flex github-star-container">
<a
href="https://github.com/nrwl/nx"
Expand All @@ -35,9 +33,7 @@ <h2>Resources &amp; Tools</h2>
</div>
</a>
</div>
<p>
Here are some links to help you get started.
</p>
<p>Here are some links to help you get started.</p>
<ul class="resources">
<li class="col-span-2">
<a
Expand Down Expand Up @@ -91,10 +87,10 @@ <h2>Next Steps</h2>
<summary>Add UI library</summary>
<pre>
# Generate UI lib
ng g @nrwl/angular:lib ui
ng g &#64;nx/angular:lib ui

# Add a component
ng g @nrwl/angular:component xyz --project ui</pre
ng g &#64;nx/angular:component xyz --project ui</pre
>
</details>
<details>
Expand Down
1 change: 1 addition & 0 deletions apps/demo-app/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Component } from '@angular/core';
selector: 'ngx-aws-deploy-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
standalone: false,
})
export class AppComponent {
title = 'demo-app';
Expand Down
30 changes: 20 additions & 10 deletions decorate-angular-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ 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 @@ -46,24 +48,32 @@ function symlinkNgCLItoNxCLI() {
* 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));
Comment on lines +52 to +53
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Use block braces for ifs, whiles, etc. (use-braces)

Suggested change
if (fs.existsSync(nxPath + ext))
fs.writeFileSync(ngPath + ext, fs.readFileSync(nxPath + ext));
if (fs.existsSync(nxPath + ext)) {
fs.writeFileSync(ngPath + ext, fs.readFileSync(nxPath + ext));
}


ExplanationIt is recommended to always use braces and create explicit statement blocks.

Using the allowed syntax to just write a single statement can lead to very confusing
situations, especially where subsequently a developer might add another statement
while forgetting to add the braces (meaning that this wouldn't be included in the condition).

});
} else {
// If unix-based, symlink
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 });
} 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('@nrwl/cli/lib/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' });
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',
});
}
4 changes: 2 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const { getJestProjects } = require('@nrwl/jest');
const { getJestProjectsAsync } = require('@nx/jest');

export default { projects: getJestProjects() };
export default async () => ({ projects: await getJestProjectsAsync() });
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 },
};
6 changes: 2 additions & 4 deletions libs/ngx-aws-deploy/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
export default {
displayName: 'ngx-aws-deploy',

globals: {
'ts-jest': { tsconfig: '<rootDir>/tsconfig.spec.json' },
},
globals: {},
transform: {
'^.+\\.[tj]sx?$': 'ts-jest',
'^.+\\.[tj]sx?$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/libs/ngx-aws-deploy',
Expand Down
6 changes: 3 additions & 3 deletions libs/ngx-aws-deploy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
"author": "Jeffrey Bosch",
"license": "MIT",
"dependencies": {
"@angular-devkit/architect": ">=0.1402.6",
"@angular-devkit/core": ">=14.2.6",
"@angular-devkit/schematics": ">=14.2.6",
"@angular-devkit/architect": ">=0.0.1800.0",
"@angular-devkit/core": ">=18.0.0",
"@angular-devkit/schematics": ">=18.0.0",
"aws-sdk": "^2.1238.0",
"glob": "^10.3.3",
"mime-types": "^2.1.35"
Expand Down
Loading