Skip to content

Commit fd2d1fb

Browse files
committed
refactor: use TRAVIS_BUILD_WEB_URL and require Angular 18+
- Use TRAVIS_BUILD_WEB_URL instead of constructing URL manually (works for .org, .com, and enterprise installations) - Update README to require Angular 18+ (not 17) - Fix misleading browserTarget comment in builder.ts - Remove dead Travis CI link from standalone docs
1 parent ac2e701 commit fd2d1fb

File tree

7 files changed

+17
-21
lines changed

7 files changed

+17
-21
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,15 @@ If this is not the folder that you want to serve, you should explicitly specify
9696
ng deploy --dir=dist/test/browser
9797
```
9898

99-
This new build logic is a breaking change, therefore `angular-cli-ghpages` v2 only supports Angular 17 and higher.
99+
This new build logic is a breaking change, therefore `angular-cli-ghpages` v2 requires Angular 18 or higher.
100100
For previous versions of Angular, use `angular-cli-ghpages` v1.x.
101101

102102
## ⚠️ Prerequisites <a name="prerequisites"></a>
103103

104104
This command has the following prerequisites:
105105

106106
- Git 1.9 or higher (execute `git --version` to check your version)
107-
- Angular project created via [Angular CLI](https://github.com/angular/angular-cli) v17 or greater
107+
- Angular project created via [Angular CLI](https://github.com/angular/angular-cli) v18 or greater
108108
- older Angular projects can still use a v1.x version or use the standalone program. See the documentation at [README_standalone](https://github.com/angular-schule/angular-cli-ghpages/blob/master/docs/README_standalone.md).
109109

110110
## 🚀 Quick Start (local development) <a name="quickstart-local"></a>

docs/README_standalone.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ If you need automatic build integration, use `ng deploy` instead of the standalo
9191
9292
## Extra
9393
94-
For your convenience, the command will recognize the [environment variable](https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings) `GH_TOKEN` and will replace this pattern in the `--repo` string.
95-
96-
In example, the following command runs [on our Travis-CI](https://travis-ci.org/angular-buch/book-monkey2):
94+
For your convenience, the command will recognize the environment variable `GH_TOKEN` and will replace this pattern in the `--repo` string.
9795
9896
```bash
9997
npx angular-cli-ghpages --repo=https://GH_TOKEN@github.com/<username>/<repositoryname>.git --name="Displayed Username" --email=mail@example.org

src/deploy/builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { BuildTarget } from '../interfaces';
1616
// https://github.com/angular/angularfire/blob/master/src/schematics/deploy/builder.ts
1717
export default createBuilder(
1818
async (options: Schema, context: BuilderContext): Promise<BuilderOutput> => {
19-
// browserTarget was removed in Angular 19, we require Angular 18+
19+
// browserTarget is not supported - use buildTarget instead
2020
if ((options as Record<string, unknown>).browserTarget) {
2121
context.logger.error('❌ The "browserTarget" option is not supported.');
2222
context.logger.error(' Use "buildTarget" instead.');

src/engine/engine.prepare-options-helpers.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('prepareOptions helpers - intensive tests', () => {
2929
delete process.env.TRAVIS_COMMIT;
3030
delete process.env.TRAVIS_COMMIT_MESSAGE;
3131
delete process.env.TRAVIS_REPO_SLUG;
32-
delete process.env.TRAVIS_BUILD_ID;
32+
delete process.env.TRAVIS_BUILD_WEB_URL;
3333
delete process.env.CIRCLECI;
3434
delete process.env.CIRCLE_PROJECT_USERNAME;
3535
delete process.env.CIRCLE_PROJECT_REPONAME;
@@ -311,7 +311,7 @@ describe('prepareOptions helpers - intensive tests', () => {
311311
process.env.TRAVIS_COMMIT_MESSAGE = 'Fix bug in component';
312312
process.env.TRAVIS_REPO_SLUG = 'user/repo';
313313
process.env.TRAVIS_COMMIT = 'abc123def456';
314-
process.env.TRAVIS_BUILD_ID = '987654321';
314+
process.env.TRAVIS_BUILD_WEB_URL = 'https://app.travis-ci.com/user/repo/builds/987654321';
315315

316316
const options: helpers.PreparedOptions = {
317317
message: baseMessage,
@@ -325,7 +325,7 @@ describe('prepareOptions helpers - intensive tests', () => {
325325
const expectedMessage =
326326
'Deploy to gh-pages -- Fix bug in component \n\n' +
327327
'Triggered by commit: https://github.com/user/repo/commit/abc123def456\n' +
328-
'Travis CI build: https://travis-ci.org/user/repo/builds/987654321';
328+
'Travis CI build: https://app.travis-ci.com/user/repo/builds/987654321';
329329

330330
expect(options.message).toBe(expectedMessage);
331331
});
@@ -394,7 +394,7 @@ describe('prepareOptions helpers - intensive tests', () => {
394394
process.env.TRAVIS_COMMIT_MESSAGE = 'Update docs';
395395
process.env.TRAVIS_REPO_SLUG = 'org/repo';
396396
process.env.TRAVIS_COMMIT = 'abc123';
397-
process.env.TRAVIS_BUILD_ID = '111';
397+
process.env.TRAVIS_BUILD_WEB_URL = 'https://app.travis-ci.com/org/repo/builds/111';
398398

399399
process.env.CIRCLECI = 'true';
400400
process.env.CIRCLE_PROJECT_USERNAME = 'org';

src/engine/engine.prepare-options-helpers.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,8 @@ export function appendCIMetadata(options: PreparedOptions): void {
143143
'/commit/' +
144144
(process.env.TRAVIS_COMMIT || '') +
145145
'\n' +
146-
'Travis CI build: https://travis-ci.org/' +
147-
(process.env.TRAVIS_REPO_SLUG || '') +
148-
'/builds/' +
149-
(process.env.TRAVIS_BUILD_ID || '');
146+
'Travis CI build: ' +
147+
(process.env.TRAVIS_BUILD_WEB_URL || '');
150148
}
151149

152150
if (process.env.CIRCLECI) {

src/parameter-tests/edge-cases.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('Edge Case Tests', () => {
3434
delete process.env.TRAVIS_COMMIT_MESSAGE;
3535
delete process.env.TRAVIS_REPO_SLUG;
3636
delete process.env.TRAVIS_COMMIT;
37-
delete process.env.TRAVIS_BUILD_ID;
37+
delete process.env.TRAVIS_BUILD_WEB_URL;
3838
delete process.env.CIRCLECI;
3939
delete process.env.CIRCLE_PROJECT_USERNAME;
4040
delete process.env.CIRCLE_PROJECT_REPONAME;
@@ -319,11 +319,11 @@ describe('Edge Case Tests', () => {
319319
const expectedMessage =
320320
'Deploy -- \n\n' +
321321
'Triggered by commit: https://github.com//commit/\n' +
322-
'Travis CI build: https://travis-ci.org//builds/';
322+
'Travis CI build: ';
323323

324324
const options = { message };
325325
process.env.TRAVIS = 'true';
326-
// Missing other Travis env vars
326+
// Missing other Travis env vars (including TRAVIS_BUILD_WEB_URL)
327327

328328
const finalOptions = await engine.prepareOptions(options, logger);
329329

src/parameter-tests/parameter-passthrough.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('Parameter Passthrough Tests', () => {
3333
delete process.env.TRAVIS_COMMIT_MESSAGE;
3434
delete process.env.TRAVIS_REPO_SLUG;
3535
delete process.env.TRAVIS_COMMIT;
36-
delete process.env.TRAVIS_BUILD_ID;
36+
delete process.env.TRAVIS_BUILD_WEB_URL;
3737
delete process.env.CIRCLECI;
3838
delete process.env.CIRCLE_PROJECT_USERNAME;
3939
delete process.env.CIRCLE_PROJECT_REPONAME;
@@ -182,18 +182,18 @@ describe('Parameter Passthrough Tests', () => {
182182
const commitMsg = 'Test commit';
183183
const repoSlug = 'test/repo';
184184
const commitSha = 'abc123';
185-
const buildId = '456';
185+
const buildWebUrl = 'https://app.travis-ci.com/test/repo/builds/456';
186186
const expectedMessage =
187187
'Deploy -- Test commit \n\n' +
188188
'Triggered by commit: https://github.com/test/repo/commit/abc123\n' +
189-
'Travis CI build: https://travis-ci.org/test/repo/builds/456';
189+
'Travis CI build: https://app.travis-ci.com/test/repo/builds/456';
190190

191191
const options = { message: baseMessage };
192192
process.env.TRAVIS = 'true';
193193
process.env.TRAVIS_COMMIT_MESSAGE = commitMsg;
194194
process.env.TRAVIS_REPO_SLUG = repoSlug;
195195
process.env.TRAVIS_COMMIT = commitSha;
196-
process.env.TRAVIS_BUILD_ID = buildId;
196+
process.env.TRAVIS_BUILD_WEB_URL = buildWebUrl;
197197

198198
const finalOptions = await engine.prepareOptions(options, logger);
199199

0 commit comments

Comments
 (0)