angular-cli-ghpages: Wrong publish folder for new `application` builder in Angular V17

Angular V17 now use the application builder by default (ref) even if we don’t use SSR. This results in the output files, including index.html, be placed in ${outputPath}/browser instead of ${outputPath}, which breaks the deployment of angular-cli-ghpages.

I propose two potential solutions:

  1. Add a deployment options to specify a relative path to outputPath. e.g. ng deploy --path=/browser, which publishes folder ${outputPath}/browser.

  2. If build.builder in angular.json is set to “@angular-devkit/build-angular:application”, then publishes folder ${outputPath}/browser.

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Reactions: 8
  • Comments: 19 (11 by maintainers)

Most upvoted comments

Using the standalone command, it is possible to use the --dir parameter to specify the output path.

npx angular-cli-ghpages --dir=dist/[PROJECT_NAME]/browser

See reference here: https://github.com/angular-schule/angular-cli-ghpages/blob/main/docs/README_standalone.md#usage-with-angular-cli-6-or-higher

However, I’m still curious about why they decided not to present the --dir option in Deployment Options.

The builder for ng deploy was supposed to work “out of the box” without further configuration. Since the builder also performs the application build, the script itself needs to find out the dist folder path without configuration from outside. This is why we don’t offer the dir option for the deployment builder.

However, this came from a time where build-angular:browser was the only official application builder. Now that there are at least two of them, we have to re-evaluate this. The two solutions proposed above by @david20571015 sound reasonable, and we’ll discuss soon how we can do this properly. If you have any more input or ideas about this, please let us know.

For now, we recommend using the standalone command as described above by @jfcere .

Looks like the angularfire team has now changed their setup like this: https://github.com/angular/angularfire/blob/master/package.json

only dependencies and devDependencies, no peerDependencies any longer. And they skipped all previous version, too. So I think I will try this out too:

FROM

  "peerDependencies": {
    "@angular-devkit/architect": "~0.1700.0",
    "@angular-devkit/core": "^17.0.0",
    "@angular-devkit/schematics": "^17.0.0"
  },
  "dependencies": {
    "commander": "^3.0.0-0",
    "fs-extra": "^11.2.0",
    "gh-pages": "^3.1.0"
  }

TO

  "dependencies": {
    "@angular-devkit/architect": "~0.1700.0",
    "@angular-devkit/core": "^17.0.0",
    "@angular-devkit/schematics": "^17.0.0",
    "commander": "^3.0.0-0",
    "fs-extra": "^11.2.0",
    "gh-pages": "^3.1.0"
  }

I will push a new beta.2 version very soon. @david20571015 Could you please try out an installation again, ideally with your “bogus” setup, too? (having @angular-devkit/architect in the dependencies)