代码拉取完成,页面将自动刷新
同步操作将从 含浪/nzh 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
var path = require("path");
var gulp = require("gulp");
var mocha = require("gulp-mocha");
var mochaPhantomjs = require("gulp-mocha-phantomjs");
var browserify = require("gulp-browserify");
var uglify = require("gulp-uglify");
var rename = require("gulp-rename");
var header = require("gulp-header");
var rollup = require("rollup");
var commonjs = require("rollup-plugin-commonjs");
var resolve = require("rollup-plugin-node-resolve");
// var istanbul = require("gulp-istanbul");
var package = require("./package.json");
var banner =
'/*!\n' +
' * ' + package.name + ' v' + package.version + '\n' +
' * Homepage ' + package.homepage + '\n' +
' * License ' + package.license + '\n' +
' */\n'
var outputDir = 'dist/'
gulp.task('build', ['test-server','rollup','min'], function () {
// return gulp.src('./browser-source/*.js')
// .pipe(browserify())
// .pipe(header(banner))
// .pipe(gulp.dest('./dist'))
// .pipe(uglify())
// .pipe(header(banner))
// .pipe(rename({
// suffix:".min"
// }))
// .pipe(gulp.dest('./dist'));
// return rollup.rollup({
// input: './nzh.js',
// plugins: [
// resolve(),
// commonjs()
// ]
// }).then(function (bundle) {
// return bundle.write({
// file: './dist1/nzh.js',
// format: 'umd',
// name: 'Nzh',
// banner: banner,
// sourcemap: false
// })
// })
})
function runRollup(input, output) {
var inputopt = {
// input: './nzh.js',
plugins: [
resolve(),
commonjs()
]
}
var outputopt = {
// file: './dist/nzh.js',
format: 'umd',
name: 'Nzh',
banner: banner,
sourcemap: false
}
return rollup.rollup(Object.assign({},inputopt,{
input: input
})).then(function (bundle) {
return bundle.write(Object.assign({},outputopt,{
file: output,
}))
})
}
gulp.task('rollup', function () {
return Promise.all([
runRollup('./nzh.js',outputDir + 'nzh.js'),
runRollup('./cn.js',outputDir + 'nzh.cn.js'),
runRollup('./hk.js',outputDir + 'nzh.hk.js'),
])
})
gulp.task('min',['rollup'],function () {
return gulp.src(['dist/!(*.min).js'])
.pipe(uglify())
.pipe(header(banner))
.pipe(rename({
suffix:".min"
}))
.pipe(gulp.dest(outputDir));
})
// gulp.task('pre-test', function () {
// return gulp.src(['src/**/*.js'])
// // Covering files
// .pipe(istanbul())
// // Force `require` to return covered files
// .pipe(istanbul.hookRequire());
// });
// gulp.task('test', ['pre-test'], function () {
// return gulp.src('test/mocha_*.js', {read: false})
// .pipe(mocha({reporter: 'dot'}))
// // Creating the reports after tests ran
// .pipe(istanbul.writeReports())
// // Enforce a coverage of at least 90%
// .pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } }));
// });
gulp.task('test', ['test-server', 'test-browser'])
gulp.task('test-server', function () {
return gulp.src('test/test_mocha.js', { read: false })
.pipe(mocha({ reporter: 'dot' }))
});
gulp.task('output-testjs-browser', ['test-server'], function () {
return gulp.src('test/test_mocha.js')
.pipe(browserify({ insertGlobals: true }))
.pipe(rename({
basename: "tests"
}))
.pipe(gulp.dest('test/browser'));
})
gulp.task('test-browser', ['output-testjs-browser', 'build'], function () {
return gulp.src('test/browser/test.html')
.pipe(mochaPhantomjs({ reporter: 'dot' }))
})
gulp.task('test-docs', ['build'], function () {
})
gulp.task('default', ['build', 'test']);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。