aspect-build / rules_js

High-performance Bazel rules for running Node.js tools and building JavaScript projects
https://docs.aspect.build/rules/aspect_rules_js
Apache License 2.0
310 stars 107 forks source link

[FR]: How to automatically generate SRCS and BUILD_DEPS content? Is there a more detailed solution #1914

Open liushuai05 opened 2 months ago

liushuai05 commented 2 months ago

What is the current behavior?

No response

Describe the feature

I want to migrate some projects on my computer to bazel, but I found that SRCS and BUILD_DEPS in BUILD correspond to dependencies in the package.json file. If I want to generate such content, since my project is relatively large and more than one project manually processing is indeed a big project, I may not understand it after reading your documentation. Yes, I did not find the command to automatically generate dependencies from package.json to the BUILD file. I hope you can get help. Thank you very much

Aghassi commented 2 months ago

You will need to explore aspect-cli and gazelle to do build file generation, which is what I think you are asking

liushuai05 commented 2 months ago

You will need to explore aspect-cli and gazelle to do build file generation, which is what I think you are asking

As far as I know, gazelle seems to have only the golang version, but I can't find it in the js field. Can you help me point out where I am going? Thank you for your reply. Thanks for your help. I found rules_nodejs_gazelle based on your clues, but I don't know if it's what I want. I'll take time to learn this toolkit first. https://github.com/benchsci/rules_nodejs_gazelle

Aghassi commented 2 months ago

That is not what I was referring to, that's an alternative solution though. I was referring to https://github.com/aspect-build/aspect-cli/tree/main/gazelle/js

If you plan on using the Aspect solutions, probably best to reach out to the team and get help onboarding. Otherwise, you will be left to piece it together a bit.

liushuai05 commented 2 months ago

That is not what I was referring to, that's an alternative solution though. I was referring to https://github.com/aspect-build/aspect-cli/tree/main/gazelle/js

If you plan on using the Aspect solutions, probably best to reach out to the team and get help onboarding. Otherwise, you will be left to piece it together a bit.

Thanks a lot. I looked at the source code of https://github.com/aspect-build/aspect-CLI/tree/main/gazelle/js, which may be impossible for me (both in terms of time cost and implementation difficulty), because I am a beginner, and I really can't. I plan to use sed of shell to replace the dependency with Build for the time being.