Skip to content

Commit 0671722

Browse files
authored
fix: provide default value for remote option (#194)
1 parent 5433e40 commit 0671722

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

src/deploy/schema.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
},
2727
"remote": {
2828
"type": "string",
29-
"description": "Provide the remote name. If no value is provided, `origin` is used. Has no function if --repo is set."
29+
"description": "Provide the remote name. If no value is provided, `origin` is used. Has no function if --repo is set.",
30+
"default": "origin"
3031
},
3132
"repo": {
3233
"type": "string",

src/engine/engine.spec.ts

+16
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,22 @@ describe('engine', () => {
8383

8484
expect(finalOptions.repo).toMatch(/angular-schule\/angular-cli-ghpages/);
8585
});
86+
87+
describe('remote', () => {
88+
it('should use the provided remote if --remote is set', async () => {
89+
const options = { remote: 'foobar', repo: 'xxx' };
90+
const finalOptions = await engine.prepareOptions(options, logger);
91+
92+
expect(finalOptions.remote).toBe('foobar');
93+
});
94+
95+
it('should use the origin remote if --remote is not set', async () => {
96+
const options = { repo: 'xxx' };
97+
const finalOptions = await engine.prepareOptions(options, logger);
98+
99+
expect(finalOptions.remote).toBe('origin');
100+
});
101+
});
86102
});
87103

88104
describe('prepareOptions - handling dotfiles, notfound, and nojekyll', () => {

src/engine/engine.ts

+1
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ async function publishViaGhPages(
297297
{
298298
dir,
299299
repo: options.repo || 'current working directory (which must be a git repo in this case) will be used to commit & push',
300+
remote: options.remote,
300301
message: options.message,
301302
branch: options.branch,
302303
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',

0 commit comments

Comments
 (0)