Skip to content

Commit

Permalink
fix: provide default value for remote option (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmalcher authored Oct 22, 2024
1 parent 5433e40 commit 0671722
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/deploy/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 16 additions & 0 deletions src/engine/engine.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
1 change: 1 addition & 0 deletions src/engine/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 0671722

Please sign in to comment.