feat: 构建流程
This commit is contained in:
parent
bb3ebec042
commit
6d7c6a7285
|
@ -9,7 +9,7 @@ let files = [
|
|||
'../npm/trad/package.json',
|
||||
'../npm/draw/package.json',
|
||||
'../npm/cnchar/package.json',
|
||||
'../npm/cnchar-all/package.json',
|
||||
'../npm/all/package.json',
|
||||
'../npm/hanzi-util/package.json',
|
||||
'../npm/hanzi-util-base/package.json',
|
||||
];
|
||||
|
@ -24,7 +24,7 @@ function modVersion () {
|
|||
});
|
||||
}
|
||||
let depFiles = [
|
||||
'../npm/cnchar-all/package.json',
|
||||
'../npm/all/package.json',
|
||||
'../npm/hanzi-util/package.json',
|
||||
'../npm/hanzi-util-base/package.json'
|
||||
];
|
||||
|
@ -66,25 +66,37 @@ function copyToNPM () {
|
|||
.pipe(gulp.dest('npm/trad'));
|
||||
|
||||
gulp.src(['src/main/index.d.ts', 'LICENSE'])
|
||||
.pipe(gulp.dest('npm/cnchar-all'))
|
||||
.pipe(gulp.dest('npm/all'))
|
||||
.pipe(gulp.dest('npm/hanzi-util'))
|
||||
.pipe(gulp.dest('npm/hanzi-util-base'));
|
||||
}
|
||||
function copyLatest () {
|
||||
gulp.src(`dist/*.${version}.min.js`)
|
||||
// gulp.src(`dist/*.${version}.min.js`)
|
||||
// .pipe(rename(function (path) {
|
||||
// path.basename = path.basename.replace(version, 'latest');
|
||||
// return path;
|
||||
// }))
|
||||
// .pipe(gulp.dest('dist'));
|
||||
// ['cnchar', 'order', 'poly', 'trad', 'draw'].forEach(name => {
|
||||
// gulp.src(`dist/*.${version}.min.js`)
|
||||
// .pipe(rename(function (path) {
|
||||
// path.basename = path.basename.replace(version + '.', '');
|
||||
// return path;
|
||||
// }))
|
||||
// .pipe(gulp.dest('npm/' + name));
|
||||
// });
|
||||
gulp.src(`npm/all/cnchar.all.min.js`)
|
||||
.pipe(rename(function (path) {
|
||||
path.basename = path.basename.replace(version, 'latest');
|
||||
path.basename = path.basename.replace('cnchar.all.min.js', 'hanzi.util.min.js');
|
||||
return path;
|
||||
}))
|
||||
.pipe(gulp.dest('dist'));
|
||||
['cnchar', 'order', 'poly', 'trad', 'draw'].forEach(name => {
|
||||
gulp.src(`dist/*.${version}.min.js`)
|
||||
.pipe(rename(function (path) {
|
||||
path.basename = path.basename.replace(version + '.', '');
|
||||
return path;
|
||||
}))
|
||||
.pipe(gulp.dest('npm/' + name));
|
||||
});
|
||||
.pipe(gulp.dest('npm/hanzi-util'));
|
||||
gulp.src(`npm/cnchar/cnchar.min.js`)
|
||||
.pipe(rename(function (path) {
|
||||
path.basename = path.basename.replace('cnchar.min.js', 'hanzi.util.base.min.js');
|
||||
return path;
|
||||
}))
|
||||
.pipe(gulp.dest('npm/hanzi-util-base'));
|
||||
}
|
||||
function transEs6ByBabel () {
|
||||
gulp.src('src/main/*.js')
|
||||
|
@ -102,6 +114,10 @@ function transEs6ByBabel () {
|
|||
gulp.src('src/plugin/trad/*.js')
|
||||
.pipe(babel({presets: ['@babel/env']}))
|
||||
.pipe(gulp.dest('npm/trad'));
|
||||
|
||||
gulp.src('src/plugin/all/*.js')
|
||||
.pipe(babel({presets: ['@babel/env']}))
|
||||
.pipe(gulp.dest('npm/all'));
|
||||
}
|
||||
|
||||
task();
|
|
@ -55,4 +55,9 @@
|
|||
2. 增加 齉 字 [nàng 36]
|
||||
3. 无字默认读音修正
|
||||
4. 修改 13 个多音字的默认读音
|
||||
5. 增加 15 个多音词
|
||||
5. 增加 15 个多音词
|
||||
|
||||
### 2.1.0
|
||||
1. 增加cnchar-draw插件,支持可视化绘制汉字笔画,多种模式可选
|
||||
2. 将cdn移至npm包中,改变cdn引用方式,删除dist目录
|
||||
3. 使用vuepress构建文档,工程化重构文档
|
|
@ -2,5 +2,6 @@ var cnchar = require('cnchar');
|
|||
var order = require('cnchar-order');
|
||||
var trad = require('cnchar-trad');
|
||||
var poly = require('cnchar-poly');
|
||||
cnchar.use(order, trad, poly);
|
||||
var draw = require('cnchar-draw');
|
||||
cnchar.use(order, trad, poly, draw);
|
||||
module.exports = cnchar;
|
|
@ -30,6 +30,7 @@
|
|||
"cnchar": "^2.0.9",
|
||||
"cnchar-order": "^2.0.9",
|
||||
"cnchar-poly": "^2.0.9",
|
||||
"cnchar-trad": "^2.0.9"
|
||||
"cnchar-trad": "^2.0.9",
|
||||
"cnchar-draw": "^2.0.9"
|
||||
}
|
||||
}
|
|
@ -25,7 +25,8 @@
|
|||
"build:order": "webpack --config webpack-config/build.plugin.js --env.pluginname=order",
|
||||
"build:trad": "webpack --config webpack-config/build.plugin.js --env.pluginname=trad",
|
||||
"build:draw": "webpack --config webpack-config/build.plugin.js --env.pluginname=draw",
|
||||
"build:plugin": "npm run build:poly && npm run build:order && npm run build:trad && npm run build:draw",
|
||||
"build:all": "webpack --config webpack-config/build.plugin.js --env.pluginname=all",
|
||||
"build:plugin": "npm run build:poly && npm run build:order && npm run build:trad && npm run build:draw && npm run build:all",
|
||||
"build:npm": "node ./helper/build-npm.js",
|
||||
"start": "webpack-dev-server --open --config webpack-config/dev.js",
|
||||
"dev": "webpack-dev-server --open --config webpack-config/dev.js",
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
var cnchar = require('../../main');
|
||||
var order = require('../order');
|
||||
var trad = require('../trad');
|
||||
var poly = require('../poly');
|
||||
var draw = require('../draw');
|
||||
cnchar.use(order, trad, poly, draw);
|
||||
module.exports = cnchar;
|
|
@ -4,11 +4,27 @@ let path = require('path');
|
|||
let tool = require('../helper/tool');
|
||||
tool.write('./src/main/version.js', 'module.exports = \'' + version + '\';');
|
||||
|
||||
// module.exports = {
|
||||
// entry: path.resolve('./', 'src/main/index.js'),
|
||||
// output: {
|
||||
// path: path.resolve('./', 'dist'),
|
||||
// filename: 'cnchar.' + version + '.min.js'
|
||||
// },
|
||||
// module: {
|
||||
// rules: [{
|
||||
// test: /(.js)$/,
|
||||
// use: [{
|
||||
// loader: 'babel-loader',
|
||||
// }]
|
||||
// }]
|
||||
// }
|
||||
// };
|
||||
|
||||
module.exports = {
|
||||
entry: path.resolve('./', 'src/main/index.js'),
|
||||
output: {
|
||||
path: path.resolve('./', 'dist'),
|
||||
filename: 'cnchar.' + version + '.min.js'
|
||||
path: path.resolve('./', 'npm/cnchar'),
|
||||
filename: 'cnchar.min.js'
|
||||
},
|
||||
module: {
|
||||
rules: [{
|
||||
|
|
|
@ -1,14 +1,32 @@
|
|||
|
||||
let version = require('../package.json').version;
|
||||
// let version = require('../package.json').version;
|
||||
let path = require('path');
|
||||
|
||||
// module.exports = (env) => {
|
||||
// let plugin = env.pluginname;
|
||||
// return {
|
||||
// entry: path.resolve('./', 'src/plugin/' + plugin + '/index.js'),
|
||||
// output: {
|
||||
// path: path.resolve('./', 'dist'),
|
||||
// filename: 'cnchar.' + plugin + '.' + version + '.min.js'
|
||||
// },
|
||||
// module: {
|
||||
// rules: [{
|
||||
// test: /(.js)$/,
|
||||
// use: [{
|
||||
// loader: 'babel-loader',
|
||||
// }]
|
||||
// }]
|
||||
// }
|
||||
// };
|
||||
// };
|
||||
module.exports = (env) => {
|
||||
let plugin = env.pluginname;
|
||||
return {
|
||||
entry: path.resolve('./', 'src/plugin/' + plugin + '/index.js'),
|
||||
output: {
|
||||
path: path.resolve('./', 'dist'),
|
||||
filename: 'cnchar.' + plugin + '.' + version + '.min.js'
|
||||
path: path.resolve('./', 'npm/' + plugin),
|
||||
filename: 'cnchar.' + plugin + '.min.js'
|
||||
},
|
||||
module: {
|
||||
rules: [{
|
||||
|
|
Loading…
Reference in New Issue