Angular 包发布

Angular 包发布

架设npm包管理器

创建编译项目批处理文件

新建批处理文件build.bat,并输入以下内容

@title 编译  By 石鹏飞 20191227
ng build node-chart --configuration production
@echo 编译完成

执行build.bat文件,进行编译

创建登录npm包管理器批处理文件

新建批处理文件npmLogin.bat,并输入以下内容

@title 编译  By 石鹏飞 20191227
npm login  --registry http://192.168.1.254:4873/
@echo 登录完成

创建发布包排除文件

创建.npmignore文件,并配置要排除的文件

# 打包忽略文件

.DS_Store
index.html
build.bat
npmLogin.bat
node_modules
/src/assets
/src/test
/src/iisnode
/src/data
/src/app/data
/src/app/app.component.html
/src/app/app.component.scss
/src/app/app.component.spec.ts
/src/app/app.component.ts
/src/app/app.config.ts
/src/app/app.module.ts
/src/app/app.routes.ts
/src/main.ts
/src/ubdex.html
/src/favicon.ico
/src/styles.scss

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
.vscode
.angular
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
.editorconfig
.gitignore
.browserslistrc
.eslintrc.js
angular.json
package.json
package-lock.json
babel.config.js
publish.bat
tsconfig.json

创建包发布批处理文件

创建批处理文件publish.bat,并输入以下命令

@title 发布包  By 石鹏飞 20191227
@call build
@call npmLogin
cd dist/node-chart
npm publish --registry http://192.168.1.254:4873/
@echo 发布完成
pause

dist/node-chart为项目编译好的文件

执行publish.bat文件,发布Angular项目

这些批处理需要放在项目的根文件夹下

posted @ 2024-12-18 10:50  $("#阿飞")  阅读(20)  评论(0)    收藏  举报