Skip to content

Commit aaff2d7

Browse files
committed
fix(ci): add checkout and npm ci for module resolution in version tests
Node.js resolves modules from the file's location, not the project's. When ng-add.js is npm-linked from dist/, it needs @angular-devkit/core resolvable by traversing up to src/node_modules.
1 parent cf41b95 commit aaff2d7

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

.github/workflows/main.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,26 @@ jobs:
3434
# Test ng add and ng deploy across multiple Angular versions (sequentially)
3535
# This catches breaking changes in angular.json structure
3636
# Each test creates its own git repo and deploys locally to verify the full flow
37+
#
38+
# Why checkout + npm ci? The ng-add.js requires @angular-devkit/core which must
39+
# be resolvable from the dist folder. Node.js resolves modules by traversing up
40+
# from the file's location, so we need src/node_modules available.
3741
test-angular-versions:
3842
needs: build-and-test
3943
runs-on: ubuntu-latest
4044

4145
steps:
46+
- uses: actions/checkout@v4
47+
4248
- uses: actions/setup-node@v4
4349
with:
4450
node-version: 22
51+
cache: npm
52+
cache-dependency-path: src/package-lock.json
53+
54+
- name: Install dependencies for module resolution
55+
working-directory: src
56+
run: npm ci
4557

4658
- name: Configure git
4759
run: |
@@ -52,12 +64,14 @@ jobs:
5264
uses: actions/download-artifact@v4
5365
with:
5466
name: dist
55-
path: dist
67+
path: src/dist
5668

5769
- name: Link angular-cli-ghpages
58-
working-directory: dist
70+
working-directory: src/dist
5971
run: npm link
6072

73+
# Test projects are created OUTSIDE the repo to get their own git repos
74+
# (Angular CLI creates a git repo by default with --defaults)
6175
- name: Test Angular 18
6276
run: |
6377
cd /tmp

0 commit comments

Comments
 (0)