1

I am newbie to Angular4 and need some helps I am finding the way to make common Angular module for other to reuse like Angular Material for example

After the research, I have some questions as below

  1. Should I publish to git or npm
  2. Can current version of CLI 1.2.4 help on pack and publish
  3. I found two library https://www.npmjs.com/package/angular-npm-module-seed and https://github.com/jvandemo/generator-angular2-library. Should I use them or there is another ways
  4. What is the common ways you guys do on sharing component with team

Thanks for all you helps

Edit: I am using Angular CLI to create project

asked Aug 8, 2017 at 10:31

2 Answers 2

2

If you gonna use the module inside the same project (aka same application) then it's easier to simply make it as a part of the application and import it in the root module.

Else, if you want to make a standalone module it's best to publish it to npm and use as a dependency. Then your team can reuse it in any project by simply adding it to package.json.

Here's a reference on how to create an angular 4 node module: http://blog.angular-university.io/how-to-create-an-angular-2-library-and-how-to-consume-it-jspm-vs-webpack/

answered Aug 8, 2017 at 10:38
Sign up to request clarification or add additional context in comments.

Comments

2

I must say that you are thinking in right direction. The preferred method is to use generator-angular2-library and generate a skeleton. You may publish it to npm repo or your own private repo if your organization provides one. Here is an article that should help you achieving this: https://medium.com/@cyrilletuzi/how-to-build-and-publish-an-angular-module-7ad19c0b4464

answered Aug 8, 2017 at 10:43

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.