Deployment to the test and production environment program nodejs scripts
feature: It is mainly used in vuejs development,base srouce path
dist
,output pathrelease
npm install pubt -D
Usage
# init --configuration file generation
./node_modules/.bin/pubt --init
# test --Deployment testing environment
./node_modules/.bin/pubt test --inpath [path] --outpant [path]
# normal: test -n dist -o release/test
# prod --Deployment production environment
./node_modules/.bin/pubt prod --inpath [path] --outpant [path]
# normal: prod -n dist -o release/prod
npm install pubt -g
Usage
# init --configuration file generation
pubt --init
# test --Deployment testing environment
pubt test # normal: pubt test -n dist -o release/test
# prod --Deployment production environment
pubt prod # normal: pubt test -n dist -o release/prod
module.exports = {
"test": {
"API_ROOT": 'ip:port'
},
"prod": {
"API_ROOT": 'ip:port'
}
}
Use The handlebars
format replacement,For example, you configure the keyword API_ROOT
,
So your API code should be {{ API_ROOT }}
The code fields and the key words in the configuration file should be replaced one by one.
An example of a corresponding configuration:
const apiUrl = process.env.NODE_ENV === 'production' ? '{{ API_RROT }}' : 'http://172.xx.xx.xxx:8080/'
./node_modules/pubt/bin/pubt