| Start |
|---|
| Simplest package Here we are sharing some minimal workflow to build and publish an Angular 2+ npm package. Configuration filesWe need some config files to tell .gitignoreFirst we create a .npmignoreSecond we create a gulpfile.jsWe need to create a index.d.tsThe index.jsThis is the package entry point. When you install this package using NPM and import in your application, you just need to pass the package name and your application will learn where to find any EXPORTED component of your package. We used package.jsonThis file is used to configure your npm publication and defines the necessary packages to it to work. dist/tsconfig.jsonCreate a dist folder and place this file inside. This file is used to tell Typescript how to compile your application. Where to to get the typescript folder and where to put the compiled files. After create the configuration files, we must create our component and module.
This component receives a click and displays a message. It is used like a html tag src/angular-x-minimal-npm-package.component.tssrc/angular-x-minimal-npm-package.component.htmlsrc/angular-x-data-table.component.csssrc/angular-x-minimal-npm-package.module.tsAfter that, you must compile, build and publish your package. Build and compileFor build we use To build and compile, run the following command at the root of your package:
This will trigger the chain and you will end up with your build in PublishNow we just need to publish our package so we can install it through npm. For that, just run the command:
That is all!!! |
Read Article
https://develop.horje.com/learn/1434/reference