Skip to content

Commit eecc376

Browse files
feat(core)!: migrate to angular 20 (#219)
## PR Checklist Please check if your PR fulfills the following requirements: - [x] The commit message follows our guidelines: CONTRIBUTING.md#commit - [x] Tests for the changes have been added (for bug fixes / features) - [x] Docs have been added / updated (for bug fixes / features) ## PR Type What kind of change does this PR introduce? <!-- Please check the one that applies to this PR using "x". --> ``` [ ] Bugfix [x] Feature [ ] Code style update (formatting, local variables) [ ] Refactoring (no functional changes, no api changes) [ ] Build related changes [ ] CI related changes [ ] Documentation content changes [ ] Other... Please describe: ``` ## What is the current behavior? We support up to Angular 19 Fixes: #218 ## What is the new behavior? Add support for Angular 20 ## Does this PR introduce a breaking change? ``` [x] Yes [ ] No ``` The new version is only compatible with Angular 20 --------- Co-authored-by: Nacho Vazquez <[email protected]>
1 parent 620d37f commit eecc376

File tree

21 files changed

+6528
-4150
lines changed

21 files changed

+6528
-4150
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ jobs:
122122
run: pnpm run configure-sonar-report-paths
123123

124124
- name: SonarCloud Scan
125-
uses: sonarsource/sonarcloud-github-action@v3.1.0
125+
uses: SonarSource/sonarqube-scan-action@v5.2.0
126126
env:
127127
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128128
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/release.yml

Lines changed: 54 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,73 @@
1-
name: Release NPM packages
2-
3-
env:
4-
NODE_OPTIONS: --max-old-space-size=6144
5-
NX_MAX_PARALLEL: 2
1+
name: Release
62

73
on:
8-
workflow_dispatch:
9-
inputs:
10-
release_as:
11-
type: 'choice'
12-
description: 'The release type. It can be one of: major, minor, patch, premajor, preminor, prepatch, or prerelease. Defaults to "patch"'
13-
required: true
14-
default: 'patch'
15-
options:
16-
- major
17-
- minor
18-
- patch
19-
- premajor
20-
- preminor
21-
- prepatch
22-
- prerelease
4+
release:
5+
types: [published]
236

247
jobs:
258
release:
269
runs-on: ubuntu-latest
27-
28-
# Only release from the main branch
29-
if: github.ref == 'refs/heads/main'
10+
permissions:
11+
contents: read
12+
id-token: write # needed for provenance data generation
3013

3114
steps:
32-
- uses: actions/checkout@v4
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
3317
with:
34-
# Necessary for nx affected commands
3518
fetch-depth: 0
36-
- name: Setup
37-
uses: ./.github/actions/setup
19+
filter: tree:0
20+
21+
- uses: pnpm/action-setup@v2
3822
with:
39-
git_bot_token: ${{ secrets.GIT_BOT_TOKEN }}
23+
version: 9
4024

41-
- name: Release @ngworker/lumberjack
42-
env:
43-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
44-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45-
GH_TOKEN: ${{ secrets.GH_TOKEN }}
46-
# Generates the changelog commit and tags and pushes them to Github.
47-
# Use two post actions to Create a release in Github and for Publishing the package to NPM
25+
- uses: actions/setup-node@v4
26+
with:
27+
node-version: 20
28+
cache: 'pnpm'
29+
registry-url: 'https://registry.npmjs.org'
30+
31+
- run: pnpm install --frozen-lockfile
32+
33+
- name: Print Environment Info
34+
run: npx nx report
4835
shell: bash
49-
run: pnpm exec nx version ngworker-lumberjack --releaseAs=${{ github.event.inputs.release_as }}
5036

51-
# Needed if we want to automize multiple releases with the affected commands.
52-
- name: Tag last-release
37+
- name: Extract Project from GitHub Release Tag
38+
id: extract-project
39+
run: |
40+
RELEASE_TAG=${{ github.event.release.tag_name }}
41+
PROJECT_NAME=$(echo $RELEASE_TAG | sed -E 's/(.+)@v.*/\1/')
42+
echo "PROJECT_NAME=$PROJECT_NAME" >> $GITHUB_ENV
43+
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
44+
echo "Project name: $PROJECT_NAME extracted from tag: $RELEASE_TAG"
5345
shell: bash
54-
run: git tag -f last-release
5546

56-
- name: Push changes
57-
uses: ad-m/github-push-action@master
58-
with:
59-
github_token: ${{ secrets.GH_TOKEN }}
60-
branch: ${{ github.ref }}
61-
force: true
62-
tags: true
47+
- name: Determine if Prerelease
48+
id: check-prerelease
49+
run: |
50+
IS_PRERELEASE=${{ github.event.release.prerelease }}
51+
NPM_TAG="latest"
52+
if [ "$IS_PRERELEASE" = "true" ]; then
53+
NPM_TAG="next"
54+
fi
55+
echo "NPM_TAG=$NPM_TAG" >> $GITHUB_ENV
56+
echo "Publishing with NPM tag: $NPM_TAG"
57+
shell: bash
58+
59+
- name: Build
60+
run: pnpm exec nx build ${{ env.PROJECT_NAME }}
61+
shell: bash
62+
63+
- name: Publish Package
64+
shell: bash
65+
run: pnpm exec nx release publish --projects=${{ env.PROJECT_NAME }} --tag=${{ env.NPM_TAG }}
66+
env:
67+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
68+
NPM_CONFIG_PROVENANCE: true
69+
# This is needed for actions/setup-node authentication to work
70+
npm_config_registry: https://registry.npmjs.org
6371

6472
deploy-docs:
6573
name: '[Merge] Deploy docs to GitHub Pages'

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,5 @@ migrations.json
5151
.nx/cache
5252
.nx/workspace-data
5353
.angular
54+
.cursor/rules/nx-rules.mdc
55+
.github/instructions/nx.instructions.md

e2e/docs/lumberjack-docs-app-e2e/cypress.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@ export default defineConfig({
1212
ciWebServerCommand: 'nx run docs-lumberjack-docs-app:start',
1313
}),
1414
baseUrl: 'http://localhost:3000',
15+
// Please ensure you use `cy.origin()` when navigating between domains and remove this option.
16+
// See https://docs.cypress.io/app/references/migration-guide#Changes-to-cyorigin
17+
injectDocumentDomain: true,
1518
},
1619
});

e2e/docs/lumberjack-docs-app-e2e/project.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,9 @@
55
"projectType": "application",
66
"tags": ["scope:internal", "type:e2e"],
77
"implicitDependencies": ["docs-lumberjack-docs-app"],
8-
"targets": {}
8+
"targets": {
9+
"e2e": {
10+
"dependsOn": ["start"]
11+
}
12+
}
913
}

e2e/examples/lumberjack-app-e2e/.eslintrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
{
66
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
77
"rules": {}
8+
},
9+
{
10+
"files": ["*.ts"],
11+
"rules": {
12+
"@angular-eslint/prefer-standalone": "off"
13+
}
814
}
915
]
1016
}

e2e/examples/lumberjack-app-e2e/cypress.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@ export default defineConfig({
1212
ciWebServerCommand: 'nx run examples-lumberjack-app:serve-static',
1313
}),
1414
baseUrl: 'http://localhost:4200',
15+
// Please ensure you use `cy.origin()` when navigating between domains and remove this option.
16+
// See https://docs.cypress.io/app/references/migration-guide#Changes-to-cyorigin
17+
injectDocumentDomain: true,
1518
},
1619
});

nx.json

Lines changed: 67 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,62 @@
11
{
22
"$schema": "./node_modules/nx/schemas/nx-schema.json",
3-
"cli": { "packageManager": "pnpm" },
3+
"cli": {
4+
"packageManager": "pnpm"
5+
},
46
"generators": {
57
"@nx/angular:application": {
68
"e2eTestRunner": "cypress",
79
"linter": "eslint",
810
"style": "scss",
911
"unitTestRunner": "jest"
1012
},
11-
"@nx/angular:library": { "linter": "eslint", "unitTestRunner": "jest" },
12-
"@nx/angular:component": { "style": "scss" }
13+
"@nx/angular:library": {
14+
"linter": "eslint",
15+
"unitTestRunner": "jest"
16+
},
17+
"@nx/angular:component": {
18+
"style": "scss"
19+
}
1320
},
1421
"defaultProject": "examples-lumberjack-app",
1522
"targetDefaults": {
1623
"build": {
17-
"dependsOn": [{ "target": "build", "dependencies": true }],
24+
"dependsOn": [
25+
{
26+
"target": "build",
27+
"dependencies": true
28+
}
29+
],
1830
"inputs": ["production", "^production"],
1931
"cache": true
2032
},
21-
"e2e": { "inputs": ["default", "^production"], "cache": true },
22-
"e2e-ci": { "inputs": ["default", "^production"], "cache": true },
23-
"start": { "dependsOn": ["^build"], "inputs": ["production", "^production"] },
24-
"build-package": { "cache": true },
33+
"e2e": {
34+
"inputs": ["default", "^production"],
35+
"cache": true
36+
},
37+
"e2e-ci": {
38+
"inputs": ["default", "^production"],
39+
"cache": true
40+
},
41+
"start": {
42+
"dependsOn": ["^build"],
43+
"inputs": ["production", "^production"]
44+
},
45+
"build-package": {
46+
"cache": true
47+
},
2548
"@nx/jest:jest": {
2649
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"],
2750
"cache": true,
28-
"options": { "passWithNoTests": true },
29-
"configurations": { "ci": { "ci": true, "codeCoverage": true } }
51+
"options": {
52+
"passWithNoTests": true
53+
},
54+
"configurations": {
55+
"ci": {
56+
"ci": true,
57+
"codeCoverage": true
58+
}
59+
}
3060
},
3161
"@nx/eslint:lint": {
3262
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"],
@@ -41,7 +71,10 @@
4171
"dependsOn": ["^^build", "^build:production"]
4272
}
4373
},
44-
"workspaceLayout": { "appsDir": "e2e", "libsDir": "packages" },
74+
"workspaceLayout": {
75+
"appsDir": "e2e",
76+
"libsDir": "packages"
77+
},
4578
"namedInputs": {
4679
"default": ["{projectRoot}/**/*", "sharedGlobals", "projectSpecificFiles"],
4780
"sharedGlobals": [],
@@ -79,5 +112,27 @@
79112
}
80113
],
81114
"nxCloudAccessToken": "OTNjMDE5MjItZjQ3Mi00NTM0LTgxNjYtODBjY2EyMTgzYzhlfHJlYWQtd3JpdGU=",
82-
"defaultBase": "main"
115+
"defaultBase": "main",
116+
"release": {
117+
"releaseTagPattern": "v{version}",
118+
"projects": ["ngworker-lumberjack"],
119+
"projectsRelationship": "independent",
120+
"version": {
121+
"useLegacyVersioning": false,
122+
"preVersionCommand": "pnpm exec nx run-many -t build",
123+
"conventionalCommits": true
124+
},
125+
"git": {
126+
"commit": true,
127+
"commitArgs": "--no-verify"
128+
},
129+
"changelog": {
130+
"projectChangelogs": {
131+
"createRelease": "github",
132+
"file": false
133+
},
134+
"workspaceChangelog": false,
135+
"commitMessageFormat": "conventional"
136+
}
137+
}
83138
}

package.json

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@
2828
},
2929
"packageManager": "[email protected]",
3030
"dependencies": {
31-
"@angular/animations": "19.0.0",
32-
"@angular/common": "19.0.0",
33-
"@angular/compiler": "19.0.0",
34-
"@angular/core": "19.0.0",
35-
"@angular/forms": "19.0.0",
36-
"@angular/platform-browser": "19.0.0",
37-
"@angular/platform-browser-dynamic": "19.0.0",
38-
"@angular/router": "19.0.0",
31+
"@angular/animations": "20.0.3",
32+
"@angular/common": "20.0.3",
33+
"@angular/compiler": "20.0.3",
34+
"@angular/core": "20.0.3",
35+
"@angular/forms": "20.0.3",
36+
"@angular/platform-browser": "20.0.3",
37+
"@angular/platform-browser-dynamic": "20.0.3",
38+
"@angular/router": "20.0.3",
3939
"@docusaurus/core": "3.3.2",
4040
"@docusaurus/preset-classic": "3.3.2",
4141
"@mdx-js/react": "^3.0.1",
@@ -49,30 +49,29 @@
4949
"zone.js": "0.14.6"
5050
},
5151
"devDependencies": {
52-
"@angular-devkit/build-angular": "19.0.2",
53-
"@angular-devkit/core": "19.0.2",
54-
"@angular-devkit/schematics": "19.0.2",
55-
"@angular-eslint/eslint-plugin": "18.4.2",
56-
"@angular-eslint/eslint-plugin-template": "18.4.2",
57-
"@angular-eslint/template-parser": "18.4.2",
58-
"@angular/cli": "19.0.2",
59-
"@angular/compiler-cli": "19.0.0",
60-
"@angular/language-service": "19.0.0",
52+
"@angular-devkit/build-angular": "20.0.2",
53+
"@angular-devkit/core": "20.0.2",
54+
"@angular-devkit/schematics": "20.0.2",
55+
"@angular-eslint/eslint-plugin": "20.0.0",
56+
"@angular-eslint/eslint-plugin-template": "20.0.0",
57+
"@angular-eslint/template-parser": "20.0.0",
58+
"@angular/cli": "20.0.2",
59+
"@angular/compiler-cli": "20.0.3",
60+
"@angular/language-service": "20.0.3",
6161
"@commitlint/cli": "19.0.1",
6262
"@commitlint/config-conventional": "19.0.0",
6363
"@docusaurus/module-type-aliases": "3.3.2",
6464
"@docusaurus/types": "3.0.0",
65-
"@jscutlery/semver": "^5.3.1",
66-
"@nx/angular": "20.1.3",
67-
"@nx/cypress": "20.1.3",
68-
"@nx/devkit": "20.1.3",
69-
"@nx/eslint": "20.1.3",
70-
"@nx/eslint-plugin": "20.1.3",
71-
"@nx/jest": "20.1.3",
72-
"@nx/js": "20.1.3",
73-
"@nx/web": "20.1.3",
74-
"@nx/workspace": "20.1.3",
75-
"@schematics/angular": "19.0.2",
65+
"@nx/angular": "21.1.3",
66+
"@nx/cypress": "21.1.3",
67+
"@nx/devkit": "21.1.3",
68+
"@nx/eslint": "21.1.3",
69+
"@nx/eslint-plugin": "21.1.3",
70+
"@nx/jest": "21.1.3",
71+
"@nx/js": "21.1.3",
72+
"@nx/web": "21.1.3",
73+
"@nx/workspace": "21.1.3",
74+
"@schematics/angular": "20.0.2",
7675
"@swc-node/register": "1.9.2",
7776
"@swc/core": "1.5.7",
7877
"@swc/helpers": "0.5.12",
@@ -85,9 +84,9 @@
8584
"@typescript-eslint/utils": "7.18.0",
8685
"autoprefixer": "^10.4.0",
8786
"copy": "0.3.2",
88-
"cypress": "13.13.0",
87+
"cypress": "14.4.1",
8988
"eslint": "8.57.0",
90-
"eslint-config-prettier": "9.1.0",
89+
"eslint-config-prettier": "10.1.5",
9190
"eslint-plugin-cypress": "2.15.1",
9291
"eslint-plugin-etc": "2.0.2",
9392
"eslint-plugin-ordered-imports": "0.6.0",
@@ -97,10 +96,9 @@
9796
"husky": "8.0.2",
9897
"jest": "29.7.0",
9998
"jest-environment-jsdom": "29.7.0",
100-
"jest-preset-angular": "14.3.3",
101-
"ng-packagr": "18.2.1",
102-
"ngx-deploy-npm": "^8.0.0",
103-
"nx": "20.1.3",
99+
"jest-preset-angular": "14.4.2",
100+
"ng-packagr": "19.2.2",
101+
"nx": "21.1.3",
104102
"postcss": "8.4.18",
105103
"postcss-import": "14.1.0",
106104
"postcss-preset-env": "7.5.0",
@@ -110,6 +108,6 @@
110108
"rimraf": "3.0.2",
111109
"ts-jest": "29.1.0",
112110
"ts-node": "10.9.1",
113-
"typescript": "5.5.4"
111+
"typescript": "5.8.3"
114112
}
115113
}

0 commit comments

Comments
 (0)