add boundle and pm2 start script

This commit is contained in:
yulixing 2019-05-23 19:48:04 +08:00
parent b569d84ad6
commit 8b59cbf451
5 changed files with 65 additions and 3 deletions

View File

@ -1,3 +1,3 @@
{
"presets": ["env"]
"presets": ["node8"]
}

15
boundle.sh Normal file
View File

@ -0,0 +1,15 @@
#!/bin/bash
source /etc/profile
npm install --prefer-offline --loglevel info --unsafe-perm=true --allow-root >> boundle.log
echo 'copy node_modules to /data/publish/node_packages' >> boundle.log
gulp
rm -rf ./src
tar -zcvf garfield.tar.gz ./
mkdir target && mv ./garfield.tar.gz ./target/garfield.tar.gz
echo 'all done' 2>&1 >> boundle.log

18
gulpfile.babel.js Normal file
View File

@ -0,0 +1,18 @@
'use strict';
import gulp from 'gulp';
import babel from 'gulp-babel';
import sourcemaps from 'gulp-sourcemaps';
const compileCode = function() {
return gulp.src(['src/**/*'])
.pipe(sourcemaps.init())
.pipe(babel({
presets: ['node8'],
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('lib/'));
};
gulp.task('default', compileCode);

View File

@ -49,7 +49,10 @@
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.7.0",
"cross-env": "^5.2.0"
"babel-preset-node8": "1.2.0",
"cross-env": "^5.2.0",
"gulp": "3.9.1",
"gulp-babel": "6.1.2",
"gulp-sourcemaps": "^2.6.5"
}
}

26
start.json Normal file
View File

@ -0,0 +1,26 @@
{
"apps": [
{
"name": "pikachu-be",
"script": "lib/app.js",
"cwd": "/data/apps/pikachu-be",
"max_memory_restart": "1024M",
"log_date_format" : "YYYY-MM-DD HH:mm Z",
"watch": true,
"ignore_watch": [
"node_modules",
"logs",
"public",
"fixtures"
],
"instances": 1,
"exec_mode": "cluster",
"env": {
"NODE_ENV": "production"
},
"env_production": {
"NODE_ENV": "production"
}
}
]
}