ky-components v0.0.1-rc
KyComponents
This library was generated with Angular CLI version 10.2.4.
Code scaffolding
Run ng generate component component-name --project ky-components
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module --project ky-components
.
Note: Don't forget to add
--project ky-components
or else it will be added to the default project in yourangular.json
file.
Build
Run ng build ky-components
to build the project. The build artifacts will be stored in the dist/
directory.
Publishing
After building your library with ng build ky-components
, go to the dist folder cd dist/ky-components
and run npm publish
.
Running unit tests
Run ng test ky-components
to execute the unit tests via Karma.
Further help
To get more help on the Angular CLI use ng help
or go check out the Angular CLI Overview and Command Reference page.
组件库发布流程
创建组件库
ng generate library ky-components
创建组件库下的公共组件
ng g m navigation ng g c navigation
组件库打包发布
cd project vim komponents/package.json 修改为最新的version ng build komponents --prod cd public 进入构建目录,这里是publish目录 npm publish
注意
上传组件库的时候不能使用淘宝镜像 npm set registry https://registry.npmjs.org/
组件库的使用
npm i ky-komponents import { KomponentsModule, NavigationModule } from 'ky-komponents'; <ky-navigation mainMenuItems="mainMenuItems" menuMode="menuMode" (toggleMenuEmit)="toggleNavigation()">