diff --git a/src/deploy/schema.json b/src/deploy/schema.json index f7b5595..2274f23 100644 --- a/src/deploy/schema.json +++ b/src/deploy/schema.json @@ -26,7 +26,8 @@ }, "remote": { "type": "string", - "description": "Provide the remote name. If no value is provided, `origin` is used. Has no function if --repo is set." + "description": "Provide the remote name. If no value is provided, `origin` is used. Has no function if --repo is set.", + "default": "origin" }, "repo": { "type": "string", diff --git a/src/engine/engine.spec.ts b/src/engine/engine.spec.ts index 1833539..85c12c9 100644 --- a/src/engine/engine.spec.ts +++ b/src/engine/engine.spec.ts @@ -83,6 +83,22 @@ describe('engine', () => { expect(finalOptions.repo).toMatch(/angular-schule\/angular-cli-ghpages/); }); + + describe('remote', () => { + it('should use the provided remote if --remote is set', async () => { + const options = { remote: 'foobar', repo: 'xxx' }; + const finalOptions = await engine.prepareOptions(options, logger); + + expect(finalOptions.remote).toBe('foobar'); + }); + + it('should use the origin remote if --remote is not set', async () => { + const options = { repo: 'xxx' }; + const finalOptions = await engine.prepareOptions(options, logger); + + expect(finalOptions.remote).toBe('origin'); + }); + }); }); describe('prepareOptions - handling dotfiles, notfound, and nojekyll', () => { diff --git a/src/engine/engine.ts b/src/engine/engine.ts index 5f47e19..57ada08 100644 --- a/src/engine/engine.ts +++ b/src/engine/engine.ts @@ -297,6 +297,7 @@ async function publishViaGhPages( { dir, repo: options.repo || 'current working directory (which must be a git repo in this case) will be used to commit & push', + remote: options.remote, message: options.message, branch: options.branch, name: options.name ? `the name '${options.username} will be used for the commit` : 'local or global git user name will be used for the commit',