Comparing version 1.0.2 to 1.0.3
@@ -6,2 +6,5 @@ #!/usr/bin/env node | ||
const path = require('path'); | ||
const server = require('../src/function/server.js'); | ||
const shelljs = require('shelljs'); | ||
const deal = require('../src/function/deal.js'); | ||
@@ -25,4 +28,4 @@ const version = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json'), 'utf8')).version; | ||
commander.version(version) | ||
commander.command('init') | ||
@@ -35,6 +38,6 @@ .option('-y --yes') | ||
} | ||
if (!fs.existsSync(REAL_GULP_CONFIG)) { | ||
fs.copySync(GULP_CONFIG, REAL_GULP_CONFIG); | ||
msg.info('gulp配置文件创建成功, 请根据项目情况进行配置'); | ||
} | ||
// if (!fs.existsSync(REAL_GULP_CONFIG)) { | ||
// fs.copySync(GULP_CONFIG, REAL_GULP_CONFIG); | ||
// msg.info('gulp配置文件创建成功, 请根据项目情况进行配置'); | ||
// } | ||
if (!fs.existsSync(REAL_WEBPACK_CONFIG)) { | ||
@@ -57,6 +60,18 @@ fs.copySync(WEBPACK_CONFIG, REAL_WEBPACK_CONFIG); | ||
msg.notice('now,你可以运行npm run dev命令,在指定的8007端口查看你的项目。'); | ||
msg.notice('或者,你也可以运行npm run build命令,获取用于线上的代码'); | ||
msg.notice('now,你可以运行zero dev --port 命令,在指定的8007端口查看你的项目。'); | ||
msg.notice('或者,你也可以运行zero dist命令,获取用于线上的代码'); | ||
msg.hehe(); | ||
}) | ||
commander.command('dev') | ||
.option('-p --port <port>') | ||
.description('开发环境') | ||
.action(function(port){ | ||
deal('dev',port.port); | ||
//server('dev',port.port); | ||
}) | ||
commander.command('dist') | ||
.description('生产环境') | ||
.action(function(params){ | ||
deal('dist'); | ||
}) | ||
commander.parse(process.argv); |
{ | ||
"name": "riot-zero", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "", | ||
@@ -21,4 +21,18 @@ "main": "index.js", | ||
"fs-extra": "^3.0.1", | ||
"mockjs": "^1.0.1-beta3" | ||
"gulp": "^3.9.1", | ||
"gulp-autoprefixer": "^4.0.0", | ||
"gulp-bird": "0.0.5", | ||
"gulp-concat": "^2.6.1", | ||
"gulp-less": "^3.3.2", | ||
"gulp-minify-css": "^1.2.4", | ||
"gulp-minify-html": "^1.0.6", | ||
"gulp-rev": "^7.1.2", | ||
"gulp-riot": "^1.1.1", | ||
"gulp-strip-debug": "^1.1.0", | ||
"gulp-uglify": "^3.0.0", | ||
"gulp-usemin": "^0.3.28", | ||
"mockjs": "^1.0.1-beta3", | ||
"shelljs": "^0.7.8", | ||
"webpack-stream": "^3.2.0" | ||
} | ||
} |
@@ -19,3 +19,3 @@ # riot-zero | ||
```shell | ||
npm run dev | ||
zero dev -p 8081 | ||
``` | ||
@@ -25,3 +25,3 @@ | ||
```shell | ||
npm run build | ||
zero dist | ||
``` |
@@ -62,9 +62,9 @@ const gulp = require('gulp'); | ||
*/ | ||
gulp.task('dev-serve',function(){ | ||
nodemon({ | ||
script: 'server.js', | ||
ext: 'js', | ||
watch: ['server.js'] | ||
}); | ||
}) | ||
// gulp.task('dev-serve',function(){ | ||
// nodemon({ | ||
// script: 'server.js', | ||
// ext: 'js', | ||
// watch: ['server.js'] | ||
// }); | ||
// }) | ||
@@ -74,3 +74,3 @@ /* | ||
*/ | ||
gulp.task('dev',['riot','webpack','less','dev-serve'],function(){ | ||
gulp.task('dev',['riot','webpack','less'],function(){ | ||
gulp.watch(['src/tag/**/*.tag'], ['riot','webpack']); | ||
@@ -77,0 +77,0 @@ gulp.watch(['src/js/*.js', '!src/js/tags.js'], ['webpack']); |
@@ -6,6 +6,2 @@ { | ||
"main": "index.js", | ||
"scripts": { | ||
"dev": "gulp dev", | ||
"build": "gulp dist" | ||
}, | ||
"keywords": [], | ||
@@ -12,0 +8,0 @@ "author": "", |
@@ -1,27 +0,22 @@ | ||
const bird = require('gulp-bird'); | ||
var server = { | ||
"8007": { | ||
//静态文件根目录 | ||
"basePath": "./src", | ||
} | ||
}; | ||
//转发规则——静态服务器没有响应的或者忽略的请求将根据一下规则转发 | ||
var transpondRules = { | ||
"8007": { | ||
//目标服务器的ip和端口,域名也可,但注意不要被host了 | ||
targetServer: { | ||
"port": "80", | ||
"host": "tieba.baidu.com", | ||
"replaceHeaders": true, //当为true时,如果cookie or header中有相同key,则替换 | ||
"headers": { | ||
"cookie": "BDUSS=kM4am82QXpyazRVdEIzMUxKWGJKSERCeXR-N0p-ck5ydVlZRU55MnFrRmROVzlaSUFBQUFBJCQAAAAAAAAAAAEAAACLfV6bAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAF2oR1ldqEdZW", | ||
Host: "tieba.baidu.com", | ||
Referer: "http://tieba.baidu.com/" | ||
const conf = { | ||
server:{ | ||
port:'8007', | ||
basePath:'./src' | ||
}, | ||
transpondRules:{ | ||
targetServer:{ | ||
port: '80', | ||
host: 'tieba.baidu.com', | ||
replaceHeaders: true, | ||
header:{ | ||
cookie:'BDUSS=kM4am82QXpyazRVdEIzMUxKWGJKSERCeXR-N0p-ck5ydVlZRU55MnFrRmROVzlaSUFBQUFBJCQAAAAAAAAAAAEAAACLfV6bAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAF2oR1ldqEdZW', | ||
Host:'tieba.baidu.com', | ||
Referer:'http://tieba.baidu.com/' | ||
} | ||
}, | ||
}, | ||
"ajaxOnly": false | ||
ajaxOnly:false | ||
} | ||
}; | ||
bird.start(server, transpondRules); | ||
module.exports = conf; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25039
23
605
17
5