Skip to content

Commit 8ef0bcc

Browse files
ksroda-saclaude
andcommitted
Add build:ci/test:ci scripts for Angular; CI prefers them when present
User-facing yarn build/test stay clean. CI uses build:ci/test:ci which auto-create environment.ts from the example so build doesn't fail. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6f618d6 commit 8ef0bcc

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

.github/workflows/test-js.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,17 @@ jobs:
5252
fi
5353
- name: Build
5454
working-directory: ${{ matrix.project }}
55-
run: yarn build
55+
run: |
56+
if grep -q '"build:ci"' package.json; then
57+
yarn build:ci
58+
else
59+
yarn build
60+
fi
5661
- name: Test
5762
working-directory: ${{ matrix.project }}
5863
run: |
59-
if grep -q '"test"' package.json; then
64+
if grep -q '"test:ci"' package.json; then
65+
yarn test:ci
66+
elif grep -q '"test"' package.json; then
6067
yarn test
6168
fi

samples/angular/login-pkce/package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55
"version": "0.0.1",
66
"scripts": {
77
"ensure-env": "test -f src/environments/environment.ts || cp src/environments/environment.example.ts src/environments/environment.ts",
8-
"check-env": "test -f src/environments/environment.ts || (echo 'ERROR: src/environments/environment.ts not found. Copy src/environments/environment.example.ts to src/environments/environment.ts and fill in the values.' && exit 1)",
9-
"prestart": "yarn check-env",
10-
"prebuild": "yarn ensure-env",
11-
"pretest": "yarn ensure-env",
128
"start": "ng serve --ssl --port 4250",
139
"build": "ng build",
10+
"build:ci": "yarn ensure-env && yarn build",
1411
"test": "ng test",
12+
"test:ci": "yarn ensure-env && yarn test",
1513
"format": "prettier --write .",
1614
"format:check": "prettier --check ."
1715
},

samples/angular/token-refresh/package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55
"version": "0.0.1",
66
"scripts": {
77
"ensure-env": "test -f src/environments/environment.ts || cp src/environments/environment.example.ts src/environments/environment.ts",
8-
"check-env": "test -f src/environments/environment.ts || (echo 'ERROR: src/environments/environment.ts not found. Copy src/environments/environment.example.ts to src/environments/environment.ts and fill in the values.' && exit 1)",
9-
"prestart": "yarn check-env",
10-
"prebuild": "yarn ensure-env",
11-
"pretest": "yarn ensure-env",
128
"start": "ng serve --ssl --port 4250",
139
"build": "ng build",
10+
"build:ci": "yarn ensure-env && yarn build",
1411
"test": "ng test",
12+
"test:ci": "yarn ensure-env && yarn test",
1513
"format": "prettier --write .",
1614
"format:check": "prettier --check ."
1715
},

0 commit comments

Comments
 (0)