Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: provide default value for remote option #194

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure we need this? I always thought there are some defaults in gh-pages and/or git?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see, #194

"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