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

Support for packages that doesnt require building #516

Closed
xhyrom opened this issue Jun 4, 2023 · 14 comments
Closed

Support for packages that doesnt require building #516

xhyrom opened this issue Jun 4, 2023 · 14 comments
Labels
enhancement New feature or request

Comments

@xhyrom
Copy link

xhyrom commented Jun 4, 2023

No description provided.

@dianjuar
Copy link
Member

dianjuar commented Jun 5, 2023

Hello @xhyrom
Thanks for opening an issue with your feature request.

Can you explain better why you think this is a great idea?

I just discovered that Nx has libraries that don't require build.
Can you provide some examples?
I want the library generator to look deeper into the library's behavior.

@xhyrom
Copy link
Author

xhyrom commented Jun 7, 2023

Hello @xhyrom Thanks for opening an issue with your feature request.

Can you explain better why you think this is a great idea?

I just discovered that Nx has libraries that don't require build. Can you provide some examples? I want the library generator to look deeper into the library's behavior.

https://github.com/xHyroM/things/tree/main/packages/colour-palette or https://github.com/xHyroM/things/tree/main/packages/configs are a great example, as they don't need any build step and just need to be published to npm

@dianjuar
Copy link
Member

dianjuar commented Jun 7, 2023

@xhyrom I guess you can use the option --no-build along with --dist-folder-path and point to your library path. That should do the work.

I recommend putting those options in the publish/deploy target of your project.json to establish a standard in your project and avoid putting them on the console whenever you want to publish.


Something I noticed in the code provided is no project.json on your libraries projects. I need to familiarize myself with this Nx approach.

@xhyrom
Copy link
Author

xhyrom commented Jun 7, 2023

I think --no-build still requires to have build inside project.json but doesn't just run it.

@xhyrom
Copy link
Author

xhyrom commented Jun 16, 2023

@dianjuar and also could you help me more what to exactly put inside project.json? i just found https://github.com/bikecoders/ngx-deploy-npm#-configuration-file- but its for workspace.json

also pnpm nx generate ngx-deploy-npm:install throws There is no publishable libraries in this workspace

EDIT: i did it

@dianjuar
Copy link
Member

dianjuar commented Jun 20, 2023

and also could you help me more what to exactly put inside project.json? i just found https://github.com/bikecoders/ngx-deploy-npm#-configuration-file- but its for workspace.json

also pnpm nx generate ngx-deploy-npm:install throws There is no publishable libraries in this workspace

ngx-deploy-npm was not designed for projects that don't require a build process, pnpm nx generate ngx-deploy-npm: install will look at all the projects in your workspace and filter out the ones that don't need a build. That was intended only to configure the publishable ones because, in Nx, you can have projects that are not publishable.

I guess that we need to do a better job of detecting the publishable projects and not base the criteria on if they are buildable or not.

To work around that problem, you must create the configuration by hand on your project.json.


Also, workspace.json in the docs is referring to the project.json. I need to update the documentation as well.

@dianjuar
Copy link
Member

@xhyrom to be able to have more context and more information for the required work to land this feature I would like to understand how those libraries are created.

I would like to know which library generator did you use.

  • It was created bypass hand?
  • There is an Nx generator to create those libs.
  • It's a community generator?

@xhyrom
Copy link
Author

xhyrom commented Jun 20, 2023

I just manually created folders inside packages/ and then added package.json

I read in nx documentation that package.json and project.json are merged and it creates full project informations.

For now, I'm just doing what you said - adding noBuild and empty commands array for build.

@dianjuar
Copy link
Member

I read in nx documentation that package.json and project.json are merged and it creates full project information.

I didn't know that it was a thing. Interesting 🤔.
That explains why I didn't see any project.json in your libs.

@dianjuar
Copy link
Member

dianjuar commented Jun 20, 2023

For now, I'm just doing what you said - adding noBuild and empty commands array for build.

That is a workaround.

  • Use the --no-build param.
  • Creating a fake build target.

I have everything that I need to implement the feature. The steps that I have detected so far are:

  • Update the publishable projects detection in the install generator
    • Currently, we are basing it on if the library is buildable.
  • According to your feedback, the deploy target requires a build process.
    • We need to update that to make it optional. Providing the --no-build parameter for non-buildable libraries is nonsense.
  • As we are build based, I know that we look in the dist folder for the bundle when it's time to publish. That's something we need to change since everything I need to publish is on the projects root.

Also, it would be interesting if we create a integration test to track those kinds of projects.

@dianjuar dianjuar added the enhancement New feature or request label Jun 20, 2023
@dianjuar
Copy link
Member

@xhyrom, would you like to test this functionality on the next RC (Release Candidate) Version of ngx-deploy-npm?

[email protected] is still a work in progress and already has significant changes.

I want to test in a real-world scenario and ensure everything looks good before launching the next minor version (V7.1.0).

@xhyrom
Copy link
Author

xhyrom commented Aug 15, 2023

Sure, ill be happy ❤️

dianjuar added a commit that referenced this issue Aug 22, 2023
New options required for install generator. `--project` and `--dist-folder-path` are now required to
install the configuration of a project

BREAKING CHANGE: Drop the option `--projects`, now, each project needs to be specified
independently. The option `--dist-folder-path` is added and required to create the configuration on
a new library

#516
@dianjuar
Copy link
Member

dianjuar commented Aug 30, 2023

@xhyrom I haven't forgotten about this change.

Just that the changes are massive, your contribution was the right push we needed to realize that we can simplify things a lot.

We are planning on making the experimental release on [email protected]

dianjuar added a commit that referenced this issue Sep 15, 2023
New options required for install generator. `--project` and `--dist-folder-path` are now required to
install the configuration of a project

BREAKING CHANGE: Drop the option `--projects`, now, each project needs to be specified
independently. The option `--dist-folder-path` is added and required to create the configuration on
a new library

#516
This was referenced Jan 16, 2024
@dianjuar
Copy link
Member

Thank you, @xhyrom , for opening the issue and telling us your problem.
For input was deterministic to take action and move this project in the right direction.

It required considerable work, so I decided not to launch a beta version as promised.

The changes are available in version 8.0.0.
You can find more information on how to apply the introduced breaking changes in this blog post

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants