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

Display GitHub Pages URL after ng deploy #107

Closed

Conversation

masaxsuzu
Copy link
Contributor

I am generating this pull request w.r.t this Issue #94.

In this PR, I have one limitation: I assume only 'github.io' pages. Custom domain page is not intended.
For custom domain page users, unexpected url would be displayed.

@masaxsuzu
Copy link
Contributor Author

Messege to be shown is like 🚀 Successfully published https://masaxsuzu.github.io/angular-cli-ghpages via angular-cli-ghpages! Have a nice day!

$ angular-cli-ghpages --dry-run
...
Dry-run / SKIPPED: publishing folder "/home/masaxsuzu/ws/angular-cli-ghpages/src/dist" with the following options: {
  "dir": "/home/masaxsuzu/ws/angular-cli-ghpages/src/dist",
  "repo": "https://github.com/masaxsuzu/angular-cli-ghpages",
  "message": "Auto-generated commit",
  "branch": "gh-pages",
  "user": "falsy: local or global git username & email properties will be taken",
  "silent": true,
  "dotfiles": true,
  "cname": "falsy: no CNAME file will be created"
}
🚀 Successfully published https://masaxsuzu.github.io/angular-cli-ghpages via angular-cli-ghpages! Have a nice day!

@@ -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 ${options.ghPagesUrl}via angular-cli-ghpages! Have a nice day!`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
`🚀 Successfully published ${options.ghPagesUrl}via angular-cli-ghpages! Have a nice day!`
`🚀 Successfully published ${options.ghPagesUrl} via angular-cli-ghpages! Have a nice day!`

@@ -278,3 +282,20 @@ async function getRemoteUrl(options) {
const git = new Git(process.cwd(), options.git);
return await git.getRemoteUrl(options.remote);
}

function tryParseGhPagesUrl(options: any): any {
Copy link
Contributor

@d-koppenhagen d-koppenhagen Jun 27, 2020

Choose a reason for hiding this comment

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

options and return value shouldn't be typeof any

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Than you for the review.
Type of options is actually too complex to define in a function.

Instead of adding tryParseGhPagesUrl, it is enough to parse url in prepareOptions function.
What do you think?

if (options.repo) {
    // Not assume custom domain page
    let trimEndDotGit = options.repo
      .replace(/\/\s*$/, '')
      .replace(/\.git\s*$/, '');

    const matchEndsWithRepoName = trimEndDotGit.match(/github.com(\/|:)(.*)\/(.*)$/);
    if (matchEndsWithRepoName) {
      options.ghPagesUrl = `https://${matchEndsWithRepoName[2]}.github.io/${matchEndsWithRepoName[3]}`;
    }
}

return options;

@@ -10,5 +10,6 @@ export const defaults = {
cname: undefined,
dryRun: false,
remote: 'origin',
ghPagesUrl: '',
Copy link
Contributor

Choose a reason for hiding this comment

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

probably the prop should just be named url? @JohannesHoppe / @fmalcher what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

First of all: Thanks for the PR! It's a great start..🤗

Regarding this part:
I don't think this should be an option at all. There is no need to set this via options, it should be only shown in the output. Such a change would also make the overall PR smaller!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree with your point: There is no need to set this via options.
Anyway, I'll make another patch to apply the feedback.

`tryParseGhPagesUrl` is short, thus I think that it is not a problem to include it into `prepareOptions`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants