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

Deploy command fails in an Nx repo #145

Closed
batbrain9392 opened this issue Feb 21, 2022 · 9 comments · Fixed by #166 · 4 remaining pull requests
Closed

Deploy command fails in an Nx repo #145

batbrain9392 opened this issue Feb 21, 2022 · 9 comments · Fixed by #166 · 4 remaining pull requests

Comments

@batbrain9392
Copy link

batbrain9392 commented Feb 21, 2022

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
Copy link
Author

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

@batbrain9392
Copy link
Author

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

@JohannesHoppe
Copy link
Member

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
Copy link
Member

I'm going to track the wrong default value for cname in a separate issue: #154

@dianjuar
Copy link
Contributor

dianjuar commented Nov 9, 2022

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.

@JohannesHoppe
Copy link
Member

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

So many great plans, so little time in life!

@dianjuar
Copy link
Contributor

dianjuar commented Nov 11, 2022

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 ngworker/lumberjack#136

@dianjuar
Copy link
Contributor

dianjuar commented Nov 11, 2022

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
Copy link
Contributor

I just remembered that I had to share this.

I no longer share the vision of using an Nx Plugin on an Angular Workspace. In January 2024, I dropped support for Angular Workspace on one of my Nx Plugins. To support Nx and Angular workspaces without major problems, you must have two different packages, and from the maintainer's standpoint, it is just too much work.

I share more in detail this thought on a blog post

Drop support for Angular workspaces 🅰️

The Angular workspace support started to be a load for the maintainers. Several times, the compatibility bridge Nx Devkit offered began to crumble until it didn't work anymore.

The Nx ecosystem has continued evolving, and some of the original designs don't quite fit nowadays in Nx, but they do on Angular workspaces. That difference between both ecosystems makes us understand that to continue offering support for Angular workspaces, we must create and maintain two packages with separate approaches that benefit each workspace.

We have learned in these four years about maintaining packages that the work of a maintainer is hard. Maintaining two different NPM Packages would require considerable effort. We decided to focus on what brings the most value to our current users, and Nx Workspaces is the best way to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment