0

I have multi angular projects and i will use the multi-components that I created to use in other my projects. My projects is:

 + shop
   - src
     - app
     - components
   - e2e
   - angular.json
   - package.json
   - tsconfig.json

 + site
    - src
      - app
      - components
    - e2e
    - angular.json
    - package.json
    - tsconfig.json

    ....

I will create multi-component in npm for use in all my projects. How i create npm package?

2 Answers 2

4

you could create a library with

ng generate library my-library

and move your components to projects/my-library.

To build it, you can run

ng build my-library

The result of the build will be a publishable npm package. To publish it, run

cd dist/my-library
npm publish

see https://angular.io/guide/creating-libraries and https://angular.io/cli/generate#library

Sign up to request clarification or add additional context in comments.

Comments

1

Find it. Use from Verdaccio package.

Comments

Your Answer

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.