angular-cli-ghpages icon indicating copy to clipboard operation
angular-cli-ghpages copied to clipboard

Deploy command fails in an Nx repo

Open batbrain9392 opened this issue 2 years ago • 4 comments

Reproduction steps:

  1. Create an Nx repo
  2. npm i angular-cli-ghpages -D && npx nx g angular-cli-ghpages:ng-add
  3. npx nx deploy

Error: Property 'cname' does not match the schema. 'false' should be a 'string'.

Repo: https://github.com/batbrain9392/ng-media-utils/tree/setup-gh-pages

batbrain9392 avatar Feb 21 '22 10:02 batbrain9392

Solved it by adding cname flag manually as github.com along with base-href.

batbrain9392 avatar Feb 25 '22 00:02 batbrain9392

However, npx nx deploy didn't work in Github Actions. I suppose I'll have to use a dedicated action like GitHub Pages action.

batbrain9392 avatar Feb 25 '22 01:02 batbrain9392

I'm sure that a couple of changes are necessary so that angular-cli-ghpages could also run in a nx workspace. Help would be highly appreciated!

JohannesHoppe avatar Jul 06 '22 21:07 JohannesHoppe

I'm going to track the wrong default value for cname in a separate issue: https://github.com/angular-schule/angular-cli-ghpages/issues/154

JohannesHoppe avatar Jul 06 '22 21:07 JohannesHoppe

In my experience, making a schematic run in an Nx Workspace is tricky and hacky. You have constantly made changes (maintenance) to have it running without problems.

On the other hand, it is considerably a lot simpler to run an Nx Plugin in an Angular Workspace.

What I would suggest to solve this problem is to migrate the project to a NxPlugin. It will be THE refactor, but I believe it is a good thing if we consider the long term.

I made that jump on ngx-deploy-npm, and it has paid off. The DX (Development Experience) is at sky levels of satisfaction. Also, allowing the project to not only cover Angular projects but the opportunity to support a lot more technologies is encouraging.

dianjuar avatar Nov 09 '22 17:11 dianjuar

Your PR: Screenshot 2022-11-09 at 18 53 54

So many great plans, so little time in life!

JohannesHoppe avatar Nov 09 '22 17:11 JohannesHoppe

Some files are autogenerated, but it's still a long path.

Here is another project that migrated to be an Nx Plugin with 321 files https://github.com/ngworker/lumberjack/pull/136

dianjuar avatar Nov 11 '22 07:11 dianjuar

The most satisfying thing is the ability to reach other technologies with almost no changes. ngx-deploy-npm went from supporting only Angular libraries to supporting a broader set of technologies.

https://github.com/bikecoders/ngx-deploy-npm#supported-library-generators image

angular-cli-ghpages could deploy React Apps and Next Apps. I guess the change would be so significant that the name needs to change too 🤣🤣🤣🤣

dianjuar avatar Nov 11 '22 07:11 dianjuar