From 9628399bc003c32661e46c333a85eb6835efdb54 Mon Sep 17 00:00:00 2001 From: Johannes Hoppe Date: Wed, 18 Nov 2020 00:51:44 +0100 Subject: [PATCH 01/11] work in progress --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 10991bb..e6b5156 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ If you already have an existing Angular project on GitHub, skip step 1 and 2. ```sh ng deploy your-angular-project --base-href=// ``` - + Please be aware of the `--base-href` option. It is necessary when your project will be deployed to a non-root folder. See more details below. 5. Your project should be available at `https://.github.io/`. @@ -172,7 +172,7 @@ ng deploy --cname=example.org See the option [--cname](#cname) for more information! -#### --configuration + #### --repo From 17021abfd6c47c2b721301a9f68a5690797d6d69 Mon Sep 17 00:00:00 2001 From: Johannes Hoppe Date: Wed, 18 Nov 2020 09:22:04 +0100 Subject: [PATCH 02/11] docs: keeping track of all the forks --- docs/README_contributors.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/README_contributors.md b/docs/README_contributors.md index 24881fd..7e639ff 100644 --- a/docs/README_contributors.md +++ b/docs/README_contributors.md @@ -167,3 +167,14 @@ Just execute `npx prettier --write '**/*'` and the code is formated automaticall Please ignore the errors for now. ([error] No parser could be inferred for file) We are still working on this, see https://github.com/angular-schule/ngx-deploy-starter/issues/10 . + +## Keeping track of all the forks + +[ngx-deploy-starter](https://github.com/angular-schule/ngx-deploy-starter/) and +[angular-cli-ghpages](https://github.com/angular-schule/angular-cli-ghpages/) (both developed by Johannes Hoppe) are follow-up projects of the depcrecated [ngx-gh demo](https://github.com/mgechev/ngx-gh). +This project was a follow-up of the deploy shematics from the [angularfire](https://github.com/angular/angularfire/) project. + +To stay in sync with the stuff that the Angular team is doing, we want to keep an eye on the following files + +- [builder.ts](https://github.com/angular/angularfire/blob/master/src/schematics/deploy/builder.ts) +- [actions.ts](https://github.com/angular/angularfire/blob/master/src/schematics/deploy/actions.ts) From 452a8859b036ee537949e42e7deec4b264a5bddf Mon Sep 17 00:00:00 2001 From: Johannes Hoppe Date: Wed, 18 Nov 2020 10:41:25 +0100 Subject: [PATCH 03/11] chore: migrate from `configuration` to `buildTarget` - only unit tests are evaluated right now - no real tests were done yet --- src/deploy/actions.spec.ts | 21 ++++++++++++++------- src/deploy/actions.ts | 32 +++++++++++++++----------------- src/deploy/builder.ts | 4 ++-- 3 files changed, 31 insertions(+), 26 deletions(-) diff --git a/src/deploy/actions.spec.ts b/src/deploy/actions.spec.ts index 7c2a8f3..bd40c51 100644 --- a/src/deploy/actions.spec.ts +++ b/src/deploy/actions.spec.ts @@ -6,6 +6,7 @@ import { Target } from '@angular-devkit/architect/src'; import { JsonObject, logging } from '@angular-devkit/core'; +import { BuildTarget } from 'interfaces'; import deploy from './actions'; @@ -13,13 +14,16 @@ let context: BuilderContext; const mockEngine = { run: (_: string, __: any, __2: any) => Promise.resolve() }; const PROJECT = 'pirojok-project'; +const BUILD_TARGET: BuildTarget = { + name: `${PROJECT}:build:production` +}; describe('Deploy Angular apps', () => { beforeEach(() => initMocks()); it('should invoke the builder', async () => { const spy = spyOn(context, 'scheduleTarget').and.callThrough(); - await deploy(mockEngine, context, 'host', {}); + await deploy(mockEngine, context, BUILD_TARGET, {}); expect(spy).toHaveBeenCalledWith( { @@ -33,7 +37,7 @@ describe('Deploy Angular apps', () => { it('should invoke the builder with the baseHref', async () => { const spy = spyOn(context, 'scheduleTarget').and.callThrough(); - await deploy(mockEngine, context, 'host', { baseHref: '/folder' }); + await deploy(mockEngine, context, BUILD_TARGET, { baseHref: '/folder' }); expect(spy).toHaveBeenCalledWith( { @@ -47,16 +51,16 @@ describe('Deploy Angular apps', () => { it('should invoke engine.run', async () => { const spy = spyOn(mockEngine, 'run').and.callThrough(); - await deploy(mockEngine, context, 'host', {}); + await deploy(mockEngine, context, BUILD_TARGET, {}); - expect(spy).toHaveBeenCalledWith('host', {}, context.logger); + expect(spy).toHaveBeenCalledWith('dist/some-folder', {}, context.logger); }); describe('error handling', () => { it('throws if there is no target project', async () => { context.target = undefined; try { - await deploy(mockEngine, context, 'host', {}); + await deploy(mockEngine, context, BUILD_TARGET, {}); fail(); } catch (e) { expect(e.message).toMatch(/Cannot execute the build target/); @@ -73,7 +77,7 @@ describe('Deploy Angular apps', () => { result: Promise.resolve(createBuilderOutputMock(false)) } as BuilderRun); try { - await deploy(mockEngine, context, 'host', {}); + await deploy(mockEngine, context, BUILD_TARGET, {}); fail(); } catch (e) { expect(e.message).toEqual('Error while building the app.'); @@ -102,7 +106,10 @@ const initMocks = () => { validateOptions: _ => Promise.resolve({} as any), getBuilderNameForTarget: () => Promise.resolve(''), analytics: null as any, - getTargetOptions: (_: Target) => Promise.resolve({}), + getTargetOptions: (_: Target) => + Promise.resolve({ + outputPath: 'dist/some-folder' + }), reportProgress: (_: number, __?: number, ___?: string) => {}, reportStatus: (_: string) => {}, reportRunning: () => {}, diff --git a/src/deploy/actions.ts b/src/deploy/actions.ts index b15f242..c741624 100644 --- a/src/deploy/actions.ts +++ b/src/deploy/actions.ts @@ -1,6 +1,6 @@ import { BuilderContext, - targetFromTargetString, + targetFromTargetString } from '@angular-devkit/architect'; import { json, logging } from '@angular-devkit/core'; @@ -19,6 +19,7 @@ export default async function deploy( buildTarget: BuildTarget, options: Schema ) { + // 1. BUILD if (options.noBuild) { context.logger.info(`đŸ“Ļ Skipping build`); } else { @@ -26,28 +27,24 @@ export default async function deploy( throw new Error('Cannot execute the build target'); } - const configuration = options.configuration - ? options.configuration - : 'production'; + // baseHref (from @angular-devkit/build-angular:browser) + // can be overriden here directly from the deployment builder options, + // since this feature is the most important switch when deploying the github const overrides = { - ...(options.baseHref && { baseHref: options.baseHref }), + ...(options.baseHref && { baseHref: options.baseHref }) }; - context.logger.info( - `đŸ“Ļ Building "${ - context.target.project - }". Configuration: "${configuration}".${ - options.baseHref ? ' Your base-href: "' + options.baseHref + '"' : '' - }` - ); + context.logger.info(`đŸ“Ļ Building "${context.target.project}"`); + context.logger.info(`đŸ“Ļ Build target "${buildTarget.name}"`); + + // options.baseHref ? ' Your base-href: "' + options.baseHref + '"' : '' const build = await context.scheduleTarget( + targetFromTargetString(buildTarget.name), { - target: 'build', - project: context.target.project, - configuration, - }, - overrides as json.JsonObject + ...buildTarget.options, + ...overrides + } ); const buildResult = await build.result; @@ -56,6 +53,7 @@ export default async function deploy( } } + // 2. DEPLOYMENT const buildOptions = await context.getTargetOptions( targetFromTargetString(buildTarget.name) ); diff --git a/src/deploy/builder.ts b/src/deploy/builder.ts index 06164e3..68233e5 100644 --- a/src/deploy/builder.ts +++ b/src/deploy/builder.ts @@ -1,7 +1,7 @@ import { BuilderContext, BuilderOutput, - createBuilder, + createBuilder } from '@angular-devkit/architect'; import * as engine from '../engine/engine'; @@ -17,7 +17,7 @@ export default createBuilder( } const buildTarget = { - name: `${context.target.project}:build:production`, + name: options.buildTarget || `${context.target.project}:build:production` }; try { From b300026d46c57003338e816b198fe3492e6c2728 Mon Sep 17 00:00:00 2001 From: Johannes Hoppe Date: Wed, 18 Nov 2020 10:46:46 +0100 Subject: [PATCH 04/11] ci: bump node version to see if this fixes the break cause it works on my machine (tm) --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3b5c577..73c6509 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,10 +10,10 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Use Node.js 10.x + - name: Use Node.js 12.x uses: actions/setup-node@v1 with: - node-version: 10.x + node-version: 12.x - name: Prepare run: | From b950b05516b05eb006d13278decdecff9bd771a6 Mon Sep 17 00:00:00 2001 From: Johannes Hoppe Date: Wed, 18 Nov 2020 15:35:06 +0100 Subject: [PATCH 05/11] Revert "ci: bump node version to see if this fixes the break" This reverts commit b300026d46c57003338e816b198fe3492e6c2728. --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 73c6509..3b5c577 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,10 +10,10 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Use Node.js 12.x + - name: Use Node.js 10.x uses: actions/setup-node@v1 with: - node-version: 12.x + node-version: 10.x - name: Prepare run: | From 5e009dcd40168d9d09145c2efe5153b2c18429e0 Mon Sep 17 00:00:00 2001 From: Johannes Hoppe Date: Wed, 18 Nov 2020 21:40:43 +0100 Subject: [PATCH 06/11] tweaking dependencies / peerDependencies as seen in angularfire: https://github.com/angular/angularfire/blob/2ce41aa0af8c5f42df65f5ac5b2b5a50fb6f4300/package.json#L41-L68 commander has some breaking changes, so let's risk nothing here and rollback --- src/package-lock.json | 319 ++++++++---------------------------------- src/package.json | 16 +-- 2 files changed, 69 insertions(+), 266 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index 340bcb4..1add1b4 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -5,19 +5,19 @@ "requires": true, "dependencies": { "@angular-devkit/architect": { - "version": "0.1100.0", - "resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.1100.0.tgz", - "integrity": "sha512-JFPEpEgxJGk5eaJsEilQNI5rOAKCawMdGFAq1uBlYeXSt3iMfFfn//ayvIsE7L2y5b4MC0rzafWSNyDSP3+WuA==", + "version": "0.1100.2", + "resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.1100.2.tgz", + "integrity": "sha512-wSMMM8eBPol48OtvIyrIq2H9rOIiJmrPEtPbH0BSuPX0B8BckVImeTPzloqxSrpul4tY7Iwx0zwISDEgb59Vbw==", "dev": true, "requires": { - "@angular-devkit/core": "11.0.0", + "@angular-devkit/core": "11.0.2", "rxjs": "6.6.3" } }, "@angular-devkit/core": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-11.0.0.tgz", - "integrity": "sha512-fXZtSs3J4S12hboi3om1FA+QS0e8nuQMyzl2nkmtuhcELUFMmSrEl36dtCni5e7Svs46BUAZ5w8EazIkgGQDJg==", + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-11.0.2.tgz", + "integrity": "sha512-vUmmUNmNM9oRcDmt0PunU/ayglo0apq4pGL9Z5jj6alf2WwEiTcGHjyuZSDIO9MOLi41519jp3mDx79qXvvyww==", "dev": true, "requires": { "ajv": "6.12.6", @@ -25,41 +25,15 @@ "magic-string": "0.25.7", "rxjs": "6.6.3", "source-map": "0.7.3" - }, - "dependencies": { - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - } } }, "@angular-devkit/schematics": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-11.0.0.tgz", - "integrity": "sha512-oCz9E0thA5WdGDuv6biu3X5kw5/vNE4ZZOKT2sHBQMpAuuDYrDpfTYQJjXQtjfXWvmlr8L8aqDD9N4HXsE4Esw==", + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-11.0.2.tgz", + "integrity": "sha512-unNewc+Y9ofrdKxXNoSHKUL6wvV8Vgh2nJMTLI1VAw8nfqgWphI+s5XwbVzog65nhZ10xJeaUm9u5R8pxLDpQg==", "dev": true, "requires": { - "@angular-devkit/core": "11.0.0", + "@angular-devkit/core": "11.0.2", "ora": "5.1.0", "rxjs": "6.6.3" } @@ -108,6 +82,12 @@ "source-map": "^0.5.0" }, "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -774,9 +754,9 @@ } }, "@types/babel__template": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.0.3.tgz", - "integrity": "sha512-uCoznIPDmnickEi6D0v11SBpW0OuVqHJCa7syXqQHy5uktSCreIlt0iglsCnmvz8yCb38hGcWeseA8cWJSwv5Q==", + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.0.tgz", + "integrity": "sha512-NTPErx4/FiPCGScH7foPyr+/1Dkzkni+rHiYHHoTjvwou7AQzJkNeD60A9CXRy+ZEN2B1bggmkTMCDb+Mv5k+A==", "dev": true, "requires": { "@babel/parser": "^7.1.0", @@ -857,9 +837,9 @@ "dev": true }, "@types/node": { - "version": "14.14.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.7.tgz", - "integrity": "sha512-Zw1vhUSQZYw+7u5dAwNbIA9TuTotpzY/OF7sJM9FqPOF3SPjKnxrjoTktXDZgUjybf4cWVBP7O8wvKdSaGHweg==", + "version": "14.14.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.8.tgz", + "integrity": "sha512-z/5Yd59dCKI5kbxauAJgw6dLPzW+TNOItNE00PkpzNwUIEwdj/Lsqwq94H5DdYBX7C13aRA0CY32BK76+neEUA==", "dev": true }, "@types/normalize-package-data": { @@ -887,9 +867,9 @@ "dev": true }, "@types/yargs": { - "version": "15.0.9", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.9.tgz", - "integrity": "sha512-HmU8SeIRhZCWcnRskCs36Q1Q00KBV6Cqh/ora8WN1+22dY07AZdn6Gel8QZ3t26XYPImtcL8WV/eqjhVmMEw4g==", + "version": "15.0.10", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.10.tgz", + "integrity": "sha512-z8PNtlhrj7eJNLmrAivM7rjBESG6JwC5xP3RVk12i/8HVP7Xnx/sEmERnRImyEuUaJfO942X0qMOYsoupaJbZQ==", "dev": true, "requires": { "@types/yargs-parser": "*" @@ -1495,9 +1475,9 @@ } }, "commander": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.0.tgz", - "integrity": "sha512-zP4jEKbe8SHzKJYQmq8Y9gYjtO/POJLgIdKgV7B9qNmABVFVc+ctqSX6iXh4mCpJfRBOabiZ2YKPg8ciDw6C+Q==" + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", + "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==" }, "commondir": { "version": "1.0.1", @@ -1581,6 +1561,14 @@ "semver": "^5.5.0", "shebang-command": "^1.2.0", "which": "^1.2.9" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } } }, "cssom": { @@ -2178,66 +2166,12 @@ "commondir": "^1.0.1", "make-dir": "^3.0.2", "pkg-dir": "^4.1.0" - }, - "dependencies": { - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "requires": { - "p-locate": "^4.1.0" - } - }, - "make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "requires": { - "semver": "^6.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "requires": { - "p-limit": "^2.2.0" - } - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" - }, - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "requires": { - "find-up": "^4.0.0" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" - } } }, "find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, "requires": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" @@ -2886,14 +2820,6 @@ "@istanbuljs/schema": "^0.1.2", "istanbul-lib-coverage": "^3.0.0", "semver": "^6.3.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } } }, "istanbul-lib-report": { @@ -3653,7 +3579,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, "requires": { "p-locate": "^4.1.0" } @@ -3682,57 +3607,6 @@ "dev": true, "requires": { "chalk": "^4.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } } }, "lru-queue": { @@ -3757,17 +3631,8 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, "requires": { "semver": "^6.0.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } } }, "make-error": { @@ -4047,6 +3912,14 @@ "resolve": "^1.10.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } } }, "normalize-path": { @@ -4192,72 +4065,6 @@ "mute-stream": "0.0.8", "strip-ansi": "^6.0.0", "wcwidth": "^1.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "dev": true - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } } }, "p-each-series": { @@ -4273,9 +4080,9 @@ "dev": true }, "p-limit": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", - "integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "requires": { "p-try": "^2.0.0" } @@ -4284,7 +4091,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, "requires": { "p-limit": "^2.2.0" } @@ -4330,8 +4136,7 @@ "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" }, "path-is-absolute": { "version": "1.0.1", @@ -4399,7 +4204,6 @@ "version": "4.2.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, "requires": { "find-up": "^4.0.0" } @@ -5027,10 +4831,9 @@ } }, "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" }, "semver-compare": { "version": "1.0.0", @@ -5096,9 +4899,9 @@ "optional": true }, "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", "dev": true }, "sisteransi": { @@ -5363,9 +5166,9 @@ } }, "stack-utils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.2.tgz", - "integrity": "sha512-0H7QK2ECz3fyZMzQ8rH0j2ykpfbnd20BFtfg/SqVC2+sCTtcw0aDTGB7dk+de4U4uUeuz6nOtJcrkFFLG1B0Rg==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.3.tgz", + "integrity": "sha512-gL//fkxfWUsIlFL2Tl42Cl6+HFALEaB1FU76I/Fy+oZjRreP7OPMXFlGbxM7NQsI0ZpUfw76sHnv0WNYuTb7Iw==", "dev": true, "requires": { "escape-string-regexp": "^2.0.0" @@ -5853,9 +5656,9 @@ "dev": true }, "uri-js": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", - "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz", + "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==", "dev": true, "requires": { "punycode": "^2.1.0" diff --git a/src/package.json b/src/package.json index 1c36749..3566af1 100644 --- a/src/package.json +++ b/src/package.json @@ -49,9 +49,9 @@ }, "homepage": "https://github.com/angular-schule/angular-cli-ghpages/#readme", "devDependencies": { - "@angular-devkit/architect": "^0.1100.0", - "@angular-devkit/core": "^11.0.0", - "@angular-devkit/schematics": "^11.0.0", + "@angular-devkit/architect": ">= 0.900 < 0.1200", + "@angular-devkit/core": "^9.0.0 || ^10.0.0 || ^11.0.0", + "@angular-devkit/schematics": "^9.0.0 || ^10.0.0 || ^11.0.0", "@types/fs-extra": "^9.0.4", "@types/jest": "^26.0.15", "@types/node": "^14.14.7", @@ -63,15 +63,15 @@ "pretty-quick": "^3.1.0", "rimraf": "^3.0.2", "ts-jest": "^26.4.4", - "typescript": "^4.0.5" + "typescript": ">=4.0.0 <4.1.0" }, "peerDependencies": { - "@angular-devkit/architect": ">=0.1100.0", - "@angular-devkit/core": ">=11.0.0", - "@angular-devkit/schematics": ">=11.0.0" + "@angular-devkit/architect": ">= 0.900 < 0.1200", + "@angular-devkit/core": "^9.0.0 || ^10.0.0 || ^11.0.0", + "@angular-devkit/schematics": "^9.0.0 || ^10.0.0 || ^11.0.0" }, "dependencies": { - "commander": "^6.2.0", + "commander": "^3.0.0-0", "fs-extra": "^9.0.1", "gh-pages": "^3.1.0" }, From 891ee8c0b438507a532b4aad15ed27804dae6c67 Mon Sep 17 00:00:00 2001 From: Johannes Hoppe Date: Wed, 18 Nov 2020 22:01:10 +0100 Subject: [PATCH 07/11] fixing build and tests, cleanup see https://github.com/angular-schule/ngx-deploy-starter/issues/10 --- README.md | 32 +++++++++++++++++--------------- docs/README_contributors.md | 10 +--------- src/.prettierignore | 1 + src/.prettierrc | 4 +++- src/angular-cli-ghpages | 2 +- src/deploy/actions.spec.ts | 2 +- src/deploy/schema.json | 6 ++---- src/engine/engine.ts | 2 +- src/ng-add.spec.ts | 2 +- src/ng-add.ts | 8 ++++---- src/package.json | 7 ++++++- 11 files changed, 38 insertions(+), 38 deletions(-) create mode 100644 src/.prettierignore diff --git a/README.md b/README.md index e6b5156..3b55151 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ 4. [🚀 Continuous Delivery](#continuous-delivery) 5. [đŸ“Ļ Options](#options) - [--base-href](#base-href) - - [--configuration](#configuration) + - [--build-target](#build-target) - [--no-build](#no-build) - [--repo](#repo) - [--message](#message) @@ -172,19 +172,20 @@ ng deploy --cname=example.org See the option [--cname](#cname) for more information! - +This command causes the `--configuration` setting to have no effect. #### --repo @@ -313,7 +314,7 @@ This can be very useful because it outputs what would happen without doing anyth To avoid all these command-line cmd options, you can write down your configuration in the `angular.json` file in the `options` attribute of your deploy project's architect. Just change the kebab-case to lower camel case. This is the notation of all options in lower camel case: - baseHref -- configuration +- buildTarget - noBuild - repo - message @@ -346,11 +347,12 @@ becomes } ``` -And just run `ng deploy` 😄. +Now you can just run `ng deploy` without all the options in the command line! 😄 > **ℹī¸ Hint** > > You can always use the [--dry-run](#dry-run) option to verify if your configuration is right. +> The project will build but not deploy. ## 🌍 Environments @@ -358,8 +360,8 @@ We have seen `angular-cli-ghpages` running on various environments, like Travis Please share your knowledge by writing an article about how to set up the deployment. 1. [GitHub Actions](https://github.com/angular-schule/angular-cli-ghpages/blob/master/docs/README_environment_github_actions.md) by [Dharmen Shah](https://github.com/shhdharmen) -2. TODO: Travis CI -3. TODO: CircleCI +2. Travis CI +3. CircleCI ## ⁉ī¸ FAQ diff --git a/docs/README_contributors.md b/docs/README_contributors.md index 7e639ff..01754ac 100644 --- a/docs/README_contributors.md +++ b/docs/README_contributors.md @@ -8,7 +8,6 @@ - [4. Testing](#4-testing) - [Testing the standalone CLI](#testing-the-standalone-cli) - [Publish to NPM](#publish-to-npm) -- [Usage of Prettier Formatter](#usage-of-prettier-formatter) ## How to start @@ -154,20 +153,13 @@ Use VSCode and debug the task `Launch Standalone Program`. ``` cd angular-cli-ghpages/src -npx prettier --write '**/*' +npm run prettier npm run build npm run test npm publish dist npm dist-tag add angular-cli-ghpages@0.6.0-rc.0 next ``` -## Usage of Prettier Formatter - -Just execute `npx prettier --write '**/*'` and the code is formated automatically. -Please ignore the errors for now. ([error] No parser could be inferred for file) - -We are still working on this, see https://github.com/angular-schule/ngx-deploy-starter/issues/10 . - ## Keeping track of all the forks [ngx-deploy-starter](https://github.com/angular-schule/ngx-deploy-starter/) and diff --git a/src/.prettierignore b/src/.prettierignore new file mode 100644 index 0000000..1521c8b --- /dev/null +++ b/src/.prettierignore @@ -0,0 +1 @@ +dist diff --git a/src/.prettierrc b/src/.prettierrc index 544138b..b0a179d 100644 --- a/src/.prettierrc +++ b/src/.prettierrc @@ -1,3 +1,5 @@ { - "singleQuote": true + "singleQuote": true, + "trailingComma": "none", + "arrowParens": "avoid" } diff --git a/src/angular-cli-ghpages b/src/angular-cli-ghpages index f1640aa..866606a 100644 --- a/src/angular-cli-ghpages +++ b/src/angular-cli-ghpages @@ -74,7 +74,7 @@ var consoleLogger = { var dir = path.join(process.cwd(), commander.dir); -engine.run(dir, commander, consoleLogger).catch(function(error) { +engine.run(dir, commander, consoleLogger).catch(function (error) { consoleLogger.error('❌ An error occurred when trying to deploy:'); consoleLogger.error(error.message); process.exit(1); diff --git a/src/deploy/actions.spec.ts b/src/deploy/actions.spec.ts index bd40c51..eb204f8 100644 --- a/src/deploy/actions.spec.ts +++ b/src/deploy/actions.spec.ts @@ -119,7 +119,7 @@ const initMocks = () => { Promise.resolve({ result: Promise.resolve(createBuilderOutputMock(true)) } as BuilderRun) - }; + } as any; }; const createBuilderOutputMock = (success: boolean): BuilderOutput => { diff --git a/src/deploy/schema.json b/src/deploy/schema.json index 8322531..49461ff 100644 --- a/src/deploy/schema.json +++ b/src/deploy/schema.json @@ -7,11 +7,9 @@ "type": "string", "description": "Base url for the application being built. Same as `ng build --base-href=/XXX/`." }, - "configuration": { + "buildTarget": { "type": "string", - "default": "production", - "description": "A named build target, as specified in the `configurations` section of angular.json. Each named target is accompanied by a configuration of option defaults for that target. Same as `ng build --configuration=XXX`.", - "alias": "c" + "description": "A named build target, as specified in the `configurations` section of angular.json . Each named target is accompanied by a configuration of option defaults for that target. This is equivalent as calling the command `ng build --configuration=XXX`." }, "noBuild": { "type": "boolean", diff --git a/src/engine/engine.ts b/src/engine/engine.ts index 6b9eacb..e3eda27 100644 --- a/src/engine/engine.ts +++ b/src/engine/engine.ts @@ -54,7 +54,7 @@ export async function prepareOptions( let debuglog = util.debuglog; util.debuglog = set => { if (set === 'gh-pages') { - return function() { + return function () { let message = util.format.apply(util, arguments); logger.info(message); }; diff --git a/src/ng-add.spec.ts b/src/ng-add.spec.ts index 39f2fdf..82c4c1f 100644 --- a/src/ng-add.spec.ts +++ b/src/ng-add.spec.ts @@ -129,7 +129,7 @@ describe('ng-add', () => { function generateAngularJson() { return { - defaultProject: PROJECT_NAME, + defaultProject: PROJECT_NAME as string | undefined, projects: { [PROJECT_NAME]: { projectType: 'application', diff --git a/src/ng-add.ts b/src/ng-add.ts index 53559f5..9131c87 100644 --- a/src/ng-add.ts +++ b/src/ng-add.ts @@ -2,13 +2,13 @@ import { JsonParseMode, parseJson } from '@angular-devkit/core'; import { SchematicContext, SchematicsException, - Tree, + Tree } from '@angular-devkit/schematics'; import { Workspace } from './interfaces'; function getWorkspace(host: Tree): { path: string; workspace: Workspace } { const possibleFiles = ['/angular.json', '/.angular.json']; - const path = possibleFiles.filter((path) => host.exists(path))[0]; + const path = possibleFiles.filter(path => host.exists(path))[0]; const configBuffer = host.read(path); if (configBuffer === null) { @@ -25,7 +25,7 @@ function getWorkspace(host: Tree): { path: string; workspace: Workspace } { return { path, - workspace, + workspace }; } interface NgAddOptions { @@ -74,7 +74,7 @@ export const ngAdd = (options: NgAddOptions) => ( project.architect['deploy'] = { builder: 'angular-cli-ghpages:deploy', - options: {}, + options: {} }; tree.overwrite(workspacePath, JSON.stringify(workspace, null, 2)); diff --git a/src/package.json b/src/package.json index 3566af1..7215a57 100644 --- a/src/package.json +++ b/src/package.json @@ -9,7 +9,8 @@ }, "scripts": { "build": "rimraf dist && json2ts deploy/schema.json > deploy/schema.d.ts && tsc && copyfiles builders.json collection.json ng-add-schema.json package.json angular-cli-ghpages deploy/schema.json dist && copyfiles ../README.md dist/README.md", - "test": "jest" + "test": "jest", + "prettier": "prettier --write ." }, "schematics": "./collection.json", "builders": "./builders.json", @@ -92,6 +93,10 @@ "jsx", "json", "node" + ], + "testPathIgnorePatterns": [ + "/node_modules/", + "/dist/" ] } } From 3626cf0e552c4bd481826a9aadc5a3a7f59afdfb Mon Sep 17 00:00:00 2001 From: Johannes Hoppe Date: Tue, 24 Nov 2020 22:28:59 +0100 Subject: [PATCH 08/11] minor: docs + removes astronaut emoij MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... since 👨‍🚀 emoij is combined (🧑‍🚀) and breaks on some cmds --- LICENSE | 2 +- README.md | 6 +++--- docs/README_contributors.md | 10 +++++++--- src/engine/engine.ts | 4 ++-- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/LICENSE b/LICENSE index d4cf43e..5fd2b0b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2017-2019 Johannes Hoppe +Copyright (c) 2017-2020 Johannes Hoppe Copyright (c) 2019 Minko Gechev Permission is hereby granted, free of charge, to any person obtaining a copy of diff --git a/README.md b/README.md index 3b55151..b3ed555 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ A detailed changelog is available in the [releases](https://github.com/angular-schule/angular-cli-ghpages/releases) section. -With this latest release, **GitHub Actions** becomes a first citizen alongside Travis CI and CircleCi. The token `GITHUB_TOKEN` is now supported. Learn everything you need to know in the following article. +**GitHub Actions** is now a first citizen alongside Travis CI and CircleCi. The token `GITHUB_TOKEN` is now supported. Learn everything you need to know in the following article. [![Banner](https://angular-schule.github.io/website-articles/blog/2020-01-everything-github/everything-github.png)](https://angular.schule/blog/2020-01-everything-github) @@ -49,7 +49,7 @@ In this article we show several tools from the GitHub universe to launch a websi This command has the following prerequisites: - Git 1.9 or higher (execute `git --version` to check your version) -- Angular project created via [Angular CLI](https://github.com/angular/angular-cli) v8.3.0 or greater (execute `ng update @angular/cli @angular/core` to upgrade your project if necessary) +- Angular project created via [Angular CLI](https://github.com/angular/angular-cli) v9.0.0 or greater (execute `ng update` to upgrade your project if necessary) - older Angular projects can still use the standalone program. See the documentation at [README_standalone](https://github.com/angular-schule/angular-cli-ghpages/blob/master/docs/README_standalone.md). ## 🚀 Quick Start (local development) @@ -57,7 +57,7 @@ This command has the following prerequisites: This quick start assumes that you are starting from scratch. If you already have an existing Angular project on GitHub, skip step 1 and 2. -1. Install the latest version of the Angular CLI (v8.3.0 or greater) globally +1. Install the latest version of the Angular CLI globally and create a new Angular project. ```sh diff --git a/docs/README_contributors.md b/docs/README_contributors.md index 01754ac..71aee52 100644 --- a/docs/README_contributors.md +++ b/docs/README_contributors.md @@ -27,15 +27,19 @@ This may be useful when you want to try the latest non-published version of this Follow the instructions for [checking and updating the Angular CLI version](#angular-cli) and then link the package. -### 1. Angular CLI +### 1. Optional: Latest Angular version -1. Install the next version of the Angular CLI. +This builder requires the method `getTargetOptions()` from the Angular DevKit which was introduced [here](https://github.com/angular/angular-cli/pull/13825/files). +All Angular projects with Angular 9 and greater are supposed to be compatible. (Actually it works with some versions of 8.x too, but you want to be up to date anyway, don't you?) +Execute the next three steps, if your test-project is still older. + +1. Install the latest version of the Angular CLI. ```sh npm install -g @angular/cli ``` -2. Run `ng version`, make sure you have installed Angular CLI v8.3.0 or greater. +2. Run `ng version`, to make sure you have installed Angular v9.0.0 or greater. 3. Update your existing project using the command: diff --git a/src/engine/engine.ts b/src/engine/engine.ts index e3eda27..d01095e 100644 --- a/src/engine/engine.ts +++ b/src/engine/engine.ts @@ -32,7 +32,7 @@ export async function run( await publishViaGhPages(ghpages, dir, options, logger); logger.info( - '🚀 Successfully published via angular-cli-ghpages! Have a nice day!' + '🌟 Successfully published via angular-cli-ghpages! Have a nice day!' ); } @@ -259,7 +259,7 @@ async function publishViaGhPages( return; } - logger.info('👨‍🚀 Uploading via git, please wait...'); + logger.info('🚀 Uploading via git, please wait...'); // do NOT (!!) await ghPages.publish, // the promise is implemented in such a way that it always succeeds – even on errors! From 59677ec53db23fc12d978dd0001f87e2c4d30d90 Mon Sep 17 00:00:00 2001 From: Johannes Hoppe Date: Tue, 24 Nov 2020 23:24:28 +0100 Subject: [PATCH 09/11] docs: breaking change, 1.0.0-rc.1 --- README.md | 40 +++++++++++++++++++++++++++++++++++++++- src/package.json | 4 ++-- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b3ed555..c1d663c 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,29 @@ A detailed changelog is available in the [releases](https://github.com/angular-schule/angular-cli-ghpages/releases) section. -**GitHub Actions** is now a first citizen alongside Travis CI and CircleCi. The token `GITHUB_TOKEN` is now supported. Learn everything you need to know in the following article. +**⚠ī¸ BREAKING CHANGE (v1)** + +Starting with version 1 the option `--configuration` was renamed to `--build-target`. + +BEFORE (_does not work_): + +``` +ng deploy --configuration=test +``` + +NOW: + +``` +ng deploy --build-target=test +``` + +If you use the old syntax, you will probably receive the following error: + +> An unhandled exception occurred: Configuration 'test' is not set in the workspace. + +
+ +**🐙 GitHub Actions** is now a first citizen alongside Travis CI and CircleCi. The token `GITHUB_TOKEN` is now supported. Learn everything you need to know in the following article. [![Banner](https://angular-schule.github.io/website-articles/blog/2020-01-everything-github/everything-github.png)](https://angular.schule/blog/2020-01-everything-github) @@ -187,6 +209,22 @@ Most projects have a default configuration and a production configuration (commo This is equivalent as calling the command `ng build --configuration=XXX`." This command has no effect if the option `--no-build` is active. +**⚠ī¸ BREAKING CHANGE (v1)** + +This option was called `--configuration` in previous versions. + +BEFORE (_does not work_): + +``` +ng deploy --configuration=test +``` + +NOW: + +``` +ng deploy --build-target=test +``` + #### --no-build - **optional** diff --git a/src/package.json b/src/package.json index 7215a57..389c085 100644 --- a/src/package.json +++ b/src/package.json @@ -1,7 +1,7 @@ { "name": "angular-cli-ghpages", - "version": "0.6.2", - "description": "Deploy your Angular app to GitHub pages directly from the Angular CLI.", + "version": "1.0.0-rc.1", + "description": "Deploy your Angular app to GitHub pages directly from the Angular CLI. (ng deploy)", "main": "index.js", "bin": { "angular-cli-ghpages": "angular-cli-ghpages", From 685a204aed5bdf3dae8990e713ff5e23fc7c0093 Mon Sep 17 00:00:00 2001 From: Johannes Hoppe Date: Tue, 24 Nov 2020 23:33:02 +0100 Subject: [PATCH 10/11] docs: suggestion from @fmalcher --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c1d663c..92e964f 100644 --- a/README.md +++ b/README.md @@ -235,7 +235,7 @@ ng deploy --build-target=test Skip build process during deployment. This can be used when you are sure that you haven't changed anything and want to deploy with the latest artifact. -This command causes the `--configuration` setting to have no effect. +This command causes the `--build-target` setting to have no effect. #### --repo From aca06c6a78d581df8c57111c17c508f515e4c169 Mon Sep 17 00:00:00 2001 From: Johannes Hoppe Date: Tue, 24 Nov 2020 23:43:40 +0100 Subject: [PATCH 11/11] Apply suggestions from code review many thanks to @fmalcher Co-authored-by: Ferdinand Malcher --- README.md | 8 ++++---- docs/README_contributors.md | 8 ++++---- src/deploy/schema.json | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 92e964f..9c1f68a 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ If you use the old syntax, you will probably receive the following error:
-**🐙 GitHub Actions** is now a first citizen alongside Travis CI and CircleCi. The token `GITHUB_TOKEN` is now supported. Learn everything you need to know in the following article. +**🐙 GitHub Actions** is now properly supported alongside Travis CI and CircleCi. The token `GITHUB_TOKEN` is also supported. Learn everything you need to know in the following article. [![Banner](https://angular-schule.github.io/website-articles/blog/2020-01-everything-github/everything-github.png)](https://angular.schule/blog/2020-01-everything-github) @@ -199,14 +199,14 @@ See the option [--cname](#cname) for more information! - **optional** - Default: `undefined` (string) - Example: - - `ng deploy` – Angular project is build in `production` mode + - `ng deploy` – Angular project is built in `production` mode - `ng deploy --build-target=test` – Angular project is using the build configuration `test` (this configuration must exist in the `angular.json` file) -If no buildTarget is set, the `production` build of the default project will be chosen. +If no `buildTarget` is set, the `production` build of the default project will be chosen. The `buildTarget` simply points to an existing build configuration for your project, as specified in the `configurations` section of `angular.json`. Most projects have a default configuration and a production configuration (commonly activated by using the `--prod` flag) but it is possible to specify as many build configurations as needed. -This is equivalent as calling the command `ng build --configuration=XXX`." +This is equivalent to calling the command `ng build --configuration=XXX`. This command has no effect if the option `--no-build` is active. **⚠ī¸ BREAKING CHANGE (v1)** diff --git a/docs/README_contributors.md b/docs/README_contributors.md index 71aee52..33ee9aa 100644 --- a/docs/README_contributors.md +++ b/docs/README_contributors.md @@ -31,7 +31,7 @@ Follow the instructions for [checking and updating the Angular CLI version](#ang This builder requires the method `getTargetOptions()` from the Angular DevKit which was introduced [here](https://github.com/angular/angular-cli/pull/13825/files). All Angular projects with Angular 9 and greater are supposed to be compatible. (Actually it works with some versions of 8.x too, but you want to be up to date anyway, don't you?) -Execute the next three steps, if your test-project is still older. +Execute the next three steps, if your test project is still older. 1. Install the latest version of the Angular CLI. @@ -167,10 +167,10 @@ npm dist-tag add angular-cli-ghpages@0.6.0-rc.0 next ## Keeping track of all the forks [ngx-deploy-starter](https://github.com/angular-schule/ngx-deploy-starter/) and -[angular-cli-ghpages](https://github.com/angular-schule/angular-cli-ghpages/) (both developed by Johannes Hoppe) are follow-up projects of the depcrecated [ngx-gh demo](https://github.com/mgechev/ngx-gh). -This project was a follow-up of the deploy shematics from the [angularfire](https://github.com/angular/angularfire/) project. +[angular-cli-ghpages](https://github.com/angular-schule/angular-cli-ghpages/) (both developed by Johannes Hoppe) are follow-up projects of the deprecated [ngx-gh demo](https://github.com/mgechev/ngx-gh). +This project was a follow-up of the deploy schematics from the [angularfire](https://github.com/angular/angularfire/) project. -To stay in sync with the stuff that the Angular team is doing, we want to keep an eye on the following files +To stay in sync with the stuff the Angular team is doing, you might want to keep an eye on the following files: - [builder.ts](https://github.com/angular/angularfire/blob/master/src/schematics/deploy/builder.ts) - [actions.ts](https://github.com/angular/angularfire/blob/master/src/schematics/deploy/actions.ts) diff --git a/src/deploy/schema.json b/src/deploy/schema.json index 49461ff..774064d 100644 --- a/src/deploy/schema.json +++ b/src/deploy/schema.json @@ -9,7 +9,7 @@ }, "buildTarget": { "type": "string", - "description": "A named build target, as specified in the `configurations` section of angular.json . Each named target is accompanied by a configuration of option defaults for that target. This is equivalent as calling the command `ng build --configuration=XXX`." + "description": "A named build target, as specified in the `configurations` section of angular.json. Each named target is accompanied by a configuration of option defaults for that target. This is equivalent to calling the command `ng build --configuration=XXX`." }, "noBuild": { "type": "boolean",