feat: npm
This commit is contained in:
parent
d46969637a
commit
d862406707
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
// 使用 IntelliSense 了解相关属性。
|
||||
// 悬停以查看现有属性的描述。
|
||||
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "pwa-chrome",
|
||||
"request": "launch",
|
||||
"name": "Launch Chrome against localhost",
|
||||
"url": "http://localhost:8080",
|
||||
"webRoot": "${workspaceFolder}"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
const gulp = require('gulp');
|
||||
const rename = require('gulp-rename');
|
||||
const fs = require('fs');
|
||||
const util = require('./tool');
|
||||
const toc = require('gulp-markdown-toc');
|
||||
const version = require('../package.json').version;
|
||||
|
||||
|
@ -25,7 +26,7 @@ function modVersion () {
|
|||
if (!pkg.dependencies) {
|
||||
pkg.dependencies = {};
|
||||
}
|
||||
pkg.dependencies['cnchar-types'] = version;
|
||||
pkg.dependencies['cnchar-types'] = `^${version}`;
|
||||
}
|
||||
fs.writeFile(file.substr(1), JSON.stringify(pkg, null, 4), 'utf8', (err) => {
|
||||
if (err) throw err;
|
||||
|
@ -57,36 +58,39 @@ function task () {
|
|||
|
||||
function buildPluginGulpFiles (plugin) {
|
||||
const path = `src/cnchar/plugin/${plugin}/`;
|
||||
return [`${path}*.d.ts`, `${path}package.json`];
|
||||
return [`${path}index.d.ts`, `${path}package.json`];
|
||||
}
|
||||
|
||||
function gulpPlugin (plugin) {
|
||||
gulp.src(buildPluginGulpFiles(plugin))
|
||||
.pipe(gulp.dest(`npm/${plugin}`));
|
||||
.pipe(gulp.dest(`npm/packages/${plugin}`));
|
||||
}
|
||||
|
||||
function copyToNPM () {
|
||||
let gulpReadme = gulp.src(['helper/README.md', 'LICENSE'])
|
||||
.pipe(toc())
|
||||
.pipe(gulp.dest('.'))
|
||||
.pipe(gulp.dest('npm/cnchar'));
|
||||
.pipe(gulp.dest('npm/packages/cnchar'));
|
||||
|
||||
plugins.forEach(plugin => {
|
||||
gulpReadme = gulpReadme.pipe(gulp.dest(`npm/${plugin}`));
|
||||
gulpReadme = gulpReadme.pipe(gulp.dest(`npm/packages/${plugin}`));
|
||||
});
|
||||
alias.forEach(alia => {
|
||||
gulpReadme = gulpReadme.pipe(gulp.dest(`npm/packages/${alia}`));
|
||||
});
|
||||
|
||||
gulp.src(['src/cnchar/main/*.d.ts'])
|
||||
.pipe(gulp.dest('npm/cnchar'))
|
||||
.pipe(gulp.dest('npm/hanzi-util-base'))
|
||||
.pipe(gulp.dest('npm/cnchar-all'))
|
||||
.pipe(gulp.dest('npm/hanzi-util'));
|
||||
gulp.src(['src/cnchar/main/index.d.ts'])
|
||||
.pipe(gulp.dest('npm/packages/cnchar'))
|
||||
.pipe(gulp.dest('npm/packages/hanzi-util-base'))
|
||||
.pipe(gulp.dest('npm/packages/cnchar-all'))
|
||||
.pipe(gulp.dest('npm/packages/hanzi-util'));
|
||||
|
||||
gulp.src(['src/cnchar/main/package.json'])
|
||||
.pipe(gulp.dest('npm/cnchar'));
|
||||
.pipe(gulp.dest('npm/packages/cnchar'));
|
||||
|
||||
alias.forEach(alia => {
|
||||
gulp.src(`src/cnchar/alias/${alia}/package.json`)
|
||||
.pipe(gulp.dest(`npm/${alia}`));
|
||||
.pipe(gulp.dest(`npm/packages/${alia}`));
|
||||
});
|
||||
|
||||
plugins.forEach(plugin => {
|
||||
|
@ -107,20 +111,30 @@ function copyLatest () {
|
|||
// path.basename = path.basename.replace(version + '.', '');
|
||||
// return path;
|
||||
// }))
|
||||
// .pipe(gulp.dest('npm/' + name));
|
||||
// .pipe(gulp.dest('npm/packages/' + name));
|
||||
// });
|
||||
gulp.src(`npm/cnchar-all/cnchar.all.min.js`)
|
||||
gulp.src(`npm/packages/cnchar-all/cnchar.all.min.js`)
|
||||
.pipe(rename(function (path) {
|
||||
path.basename = path.basename.replace('cnchar.all.min', 'hanzi.util.min');
|
||||
return path;
|
||||
}))
|
||||
.pipe(gulp.dest('npm/hanzi-util'));
|
||||
gulp.src(`npm/cnchar/cnchar.min.js`)
|
||||
.pipe(gulp.dest('npm/packages/hanzi-util'));
|
||||
gulp.src(`npm/packages/cnchar/cnchar.min.js`)
|
||||
.pipe(rename(function (path) {
|
||||
path.basename = path.basename.replace('cnchar.min', 'hanzi.base.min');
|
||||
return path;
|
||||
}))
|
||||
.pipe(gulp.dest('npm/hanzi-util-base'));
|
||||
.pipe(gulp.dest('npm/packages/hanzi-util-base'));
|
||||
}
|
||||
|
||||
function modMinJs () {
|
||||
var file = 'npm/disable-devtool.min.js';
|
||||
util.read(file, (code) => {
|
||||
util.write(file, code.replace(/[a-z]\){/i, (str) => {
|
||||
const n = str[0];
|
||||
return `${str}var _f=${n};${n}=function(){return _f().default};`;
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
task();
|
|
@ -1,9 +1,28 @@
|
|||
let fs = require('fs');
|
||||
const fs = require('fs');
|
||||
|
||||
module.exports = {
|
||||
read: function (file, cb) {
|
||||
fs.readFile(file, 'utf8', (err, code) => {
|
||||
if (err) throw err;
|
||||
cb(code);
|
||||
});
|
||||
},
|
||||
|
||||
write: function (file, txt, cb) {
|
||||
fs.writeFile(file, txt, 'utf8', (err) => {
|
||||
if (err) throw err;
|
||||
if (cb)cb();
|
||||
});
|
||||
},
|
||||
|
||||
pick: function ({data = {}, target, attrs}) {
|
||||
if (!attrs) {
|
||||
attrs = Object.keys(target);
|
||||
}
|
||||
attrs.forEach(name => {
|
||||
if (typeof target[name] !== 'undefined')
|
||||
data[name] = target[name];
|
||||
});
|
||||
return data;
|
||||
}
|
||||
};
|
File diff suppressed because one or more lines are too long
|
@ -1,3 +0,0 @@
|
|||
import HanziWriter from 'cnchar-types/plugin/draw/hanzi-writer';
|
||||
|
||||
export default HanziWriter;
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<script src="./packages/cnchar/cnchar.min.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"name": "cnchar-npm",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "cnchar.min.js",
|
||||
"scripts": {},
|
||||
"unpkg": "cnchar.min.js",
|
||||
"jsdelivr": "cnchar.min.js",
|
||||
"typings": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/theajack/cnchar.git"
|
||||
},
|
||||
"keywords": [
|
||||
"汉字拼音",
|
||||
"汉字笔画数",
|
||||
"汉字笔画顺序",
|
||||
"繁体字",
|
||||
"火星文",
|
||||
"js库",
|
||||
"theajack"
|
||||
],
|
||||
"author": "theajack",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/theajack/cnchar/issues"
|
||||
},
|
||||
"homepage": "https://www.theajack.com/cnchar/",
|
||||
"dependencies": {
|
||||
"cnchar-types": "^2.2.8"
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
"name": "cnchar-all",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "cnchar.all.min.js",
|
||||
"unpkg": "cnchar.all.min.js",
|
||||
"jsdelivr": "cnchar.all.min.js",
|
||||
"typings": "index.d.ts",
|
||||
|
@ -27,6 +27,6 @@
|
|||
},
|
||||
"homepage": "https://www.theajack.com/cnchar/",
|
||||
"dependencies": {
|
||||
"cnchar-types": "2.2.8"
|
||||
"cnchar-types": "^2.2.8"
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -2,7 +2,7 @@
|
|||
"name": "cnchar",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "cnchar.min.js",
|
||||
"scripts": {},
|
||||
"unpkg": "cnchar.min.js",
|
||||
"jsdelivr": "cnchar.min.js",
|
||||
|
@ -27,6 +27,6 @@
|
|||
},
|
||||
"homepage": "https://www.theajack.com/cnchar/",
|
||||
"dependencies": {
|
||||
"cnchar-types": "2.2.8"
|
||||
"cnchar-types": "^2.2.8"
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
"name": "cnchar-draw",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "cnchar.draw.min.js",
|
||||
"unpkg": "cnchar.draw.min.js",
|
||||
"jsdelivr": "cnchar.draw.min.js",
|
||||
"typings": "index.d.ts",
|
||||
|
@ -27,6 +27,6 @@
|
|||
},
|
||||
"homepage": "https://www.theajack.com/cnchar/",
|
||||
"dependencies": {
|
||||
"cnchar-types": "2.2.8"
|
||||
"cnchar-types": "^2.2.8"
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -2,7 +2,7 @@
|
|||
"name": "hanzi-util-base",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "hanzi.base.min.js",
|
||||
"unpkg": "hanzi.base.min.js",
|
||||
"jsdelivr": "hanzi.base.min.js",
|
||||
"typings": "index.d.ts",
|
|
@ -2,7 +2,7 @@
|
|||
"name": "hanzi-util",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "hanzi.util.min.js",
|
||||
"unpkg": "hanzi.util.min.js",
|
||||
"jsdelivr": "hanzi.util.min.js",
|
||||
"typings": "index.d.ts",
|
||||
|
@ -27,6 +27,6 @@
|
|||
},
|
||||
"homepage": "https://www.theajack.com/cnchar/",
|
||||
"dependencies": {
|
||||
"cnchar-types": "2.2.8"
|
||||
"cnchar-types": "^2.2.8"
|
||||
}
|
||||
}}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
"name": "cnchar-idiom",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "cnchar.idiom.min.js",
|
||||
"unpkg": "cnchar.idiom.min.js",
|
||||
"jsdelivr": "cnchar.idiom.min.js",
|
||||
"typings": "index.d.ts",
|
||||
|
@ -27,6 +27,6 @@
|
|||
},
|
||||
"homepage": "https://www.theajack.com/cnchar/",
|
||||
"dependencies": {
|
||||
"cnchar-types": "2.2.8"
|
||||
"cnchar-types": "^2.2.8"
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
"name": "cnchar-order",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "cnchar.order.min.js",
|
||||
"unpkg": "cnchar.order.min.js",
|
||||
"jsdelivr": "cnchar.order.min.js",
|
||||
"typings": "index.d.ts",
|
||||
|
@ -27,6 +27,6 @@
|
|||
},
|
||||
"homepage": "https://www.theajack.com/cnchar/",
|
||||
"dependencies": {
|
||||
"cnchar-types": "2.2.8"
|
||||
"cnchar-types": "^2.2.8"
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
"name": "cnchar-poly",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "cnchar.poly.min.js",
|
||||
"unpkg": "cnchar.poly.min.js",
|
||||
"jsdelivr": "cnchar.poly.min.js",
|
||||
"typings": "index.d.ts",
|
||||
|
@ -27,6 +27,6 @@
|
|||
},
|
||||
"homepage": "https://www.theajack.com/cnchar/",
|
||||
"dependencies": {
|
||||
"cnchar-types": "2.2.8"
|
||||
"cnchar-types": "^2.2.8"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 - present theajack <contact@theajack.com>
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@
|
|||
"name": "cnchar-radical",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "cnchar.radical.min.js",
|
||||
"unpkg": "cnchar.radical.min.js",
|
||||
"jsdelivr": "cnchar.radical.min.js",
|
||||
"typings": "index.d.ts",
|
||||
|
@ -27,6 +27,6 @@
|
|||
},
|
||||
"homepage": "https://www.theajack.com/cnchar/",
|
||||
"dependencies": {
|
||||
"cnchar-types": "2.2.8"
|
||||
"cnchar-types": "^2.2.8"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 - present theajack <contact@theajack.com>
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@
|
|||
"name": "cnchar-trad",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "cnchar.trad.min.js",
|
||||
"unpkg": "cnchar.trad.min.js",
|
||||
"jsdelivr": "cnchar.trad.min.js",
|
||||
"typings": "index.d.ts",
|
||||
|
@ -27,6 +27,6 @@
|
|||
},
|
||||
"homepage": "https://www.theajack.com/cnchar/",
|
||||
"dependencies": {
|
||||
"cnchar-types": "2.2.8"
|
||||
"cnchar-types": "^2.2.8"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 - present theajack <contact@theajack.com>
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@
|
|||
"name": "cnchar-xhy",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "cnchar.xhy.min.js",
|
||||
"unpkg": "cnchar.xhy.min.js",
|
||||
"jsdelivr": "cnchar.xhy.min.js",
|
||||
"typings": "index.d.ts",
|
||||
|
@ -27,6 +27,6 @@
|
|||
},
|
||||
"homepage": "https://www.theajack.com/cnchar/",
|
||||
"dependencies": {
|
||||
"cnchar-types": "2.2.8"
|
||||
"cnchar-types": "^2.2.8"
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
"name": "cnchar-all",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "cnchar.all.min.js",
|
||||
"unpkg": "cnchar.all.min.js",
|
||||
"jsdelivr": "cnchar.all.min.js",
|
||||
"typings": "index.d.ts",
|
||||
|
@ -27,6 +27,6 @@
|
|||
},
|
||||
"homepage": "https://www.theajack.com/cnchar/",
|
||||
"dependencies": {
|
||||
"cnchar-types": "2.2.8"
|
||||
"cnchar-types": "^2.2.8"
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
"name": "hanzi-util-base",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "hanzi.base.min.js",
|
||||
"unpkg": "hanzi.base.min.js",
|
||||
"jsdelivr": "hanzi.base.min.js",
|
||||
"typings": "index.d.ts",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "hanzi-util",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "hanzi.util.min.js",
|
||||
"unpkg": "hanzi.util.min.js",
|
||||
"jsdelivr": "hanzi.util.min.js",
|
||||
"typings": "index.d.ts",
|
||||
|
@ -27,6 +27,6 @@
|
|||
},
|
||||
"homepage": "https://www.theajack.com/cnchar/",
|
||||
"dependencies": {
|
||||
"cnchar-types": "2.2.8"
|
||||
"cnchar-types": "^2.2.8"
|
||||
}
|
||||
}
|
|
@ -18,16 +18,18 @@ export function extendCnChar (): {
|
|||
convert: IConverter;
|
||||
xhy: IXHY;
|
||||
} {
|
||||
|
||||
|
||||
const draw = fn('draw') as unknown as IDraw;
|
||||
const idiom = fn('idiom');
|
||||
const radical = fn('radical') as unknown as IRadical;
|
||||
const xhy = fn('xhy') as unknown as IXHY;
|
||||
|
||||
window.CncharIdiom = idiom;
|
||||
window.CncharDraw = draw;
|
||||
window.CncharRadical = radical;
|
||||
window.CncharXHY = xhy;
|
||||
if (typeof window === 'object') {
|
||||
window.CncharIdiom = idiom;
|
||||
window.CncharDraw = draw;
|
||||
window.CncharRadical = radical;
|
||||
window.CncharXHY = xhy;
|
||||
}
|
||||
|
||||
return {
|
||||
idiom,
|
||||
|
|
|
@ -66,7 +66,7 @@ const cnchar: ICnChar = {
|
|||
...extendCnChar(),
|
||||
};
|
||||
|
||||
function use (...plugins: Array<IPlugin>) {
|
||||
function use (...plugins: Array<IPlugin>): void {
|
||||
plugins.forEach(f => {
|
||||
if (typeof f === 'function') {
|
||||
if (typeof f.init === 'function') {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "cnchar",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "cnchar.min.js",
|
||||
"scripts": {},
|
||||
"unpkg": "cnchar.min.js",
|
||||
"jsdelivr": "cnchar.min.js",
|
||||
|
@ -27,6 +27,6 @@
|
|||
},
|
||||
"homepage": "https://www.theajack.com/cnchar/",
|
||||
"dependencies": {
|
||||
"cnchar-types": "2.2.8"
|
||||
"cnchar-types": "^2.2.8"
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
"name": "cnchar-draw",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "cnchar.draw.min.js",
|
||||
"unpkg": "cnchar.draw.min.js",
|
||||
"jsdelivr": "cnchar.draw.min.js",
|
||||
"typings": "index.d.ts",
|
||||
|
@ -27,6 +27,6 @@
|
|||
},
|
||||
"homepage": "https://www.theajack.com/cnchar/",
|
||||
"dependencies": {
|
||||
"cnchar-types": "2.2.8"
|
||||
"cnchar-types": "^2.2.8"
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
"name": "cnchar-idiom",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "cnchar.idiom.min.js",
|
||||
"unpkg": "cnchar.idiom.min.js",
|
||||
"jsdelivr": "cnchar.idiom.min.js",
|
||||
"typings": "index.d.ts",
|
||||
|
@ -27,6 +27,6 @@
|
|||
},
|
||||
"homepage": "https://www.theajack.com/cnchar/",
|
||||
"dependencies": {
|
||||
"cnchar-types": "2.2.8"
|
||||
"cnchar-types": "^2.2.8"
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
"name": "cnchar-order",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "cnchar.order.min.js",
|
||||
"unpkg": "cnchar.order.min.js",
|
||||
"jsdelivr": "cnchar.order.min.js",
|
||||
"typings": "index.d.ts",
|
||||
|
@ -27,6 +27,6 @@
|
|||
},
|
||||
"homepage": "https://www.theajack.com/cnchar/",
|
||||
"dependencies": {
|
||||
"cnchar-types": "2.2.8"
|
||||
"cnchar-types": "^2.2.8"
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
"name": "cnchar-poly",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "cnchar.poly.min.js",
|
||||
"unpkg": "cnchar.poly.min.js",
|
||||
"jsdelivr": "cnchar.poly.min.js",
|
||||
"typings": "index.d.ts",
|
||||
|
@ -27,6 +27,6 @@
|
|||
},
|
||||
"homepage": "https://www.theajack.com/cnchar/",
|
||||
"dependencies": {
|
||||
"cnchar-types": "2.2.8"
|
||||
"cnchar-types": "^2.2.8"
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
"name": "cnchar-radical",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "cnchar.radical.min.js",
|
||||
"unpkg": "cnchar.radical.min.js",
|
||||
"jsdelivr": "cnchar.radical.min.js",
|
||||
"typings": "index.d.ts",
|
||||
|
@ -27,6 +27,6 @@
|
|||
},
|
||||
"homepage": "https://www.theajack.com/cnchar/",
|
||||
"dependencies": {
|
||||
"cnchar-types": "2.2.8"
|
||||
"cnchar-types": "^2.2.8"
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
"name": "cnchar-trad",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "cnchar.trad.min.js",
|
||||
"unpkg": "cnchar.trad.min.js",
|
||||
"jsdelivr": "cnchar.trad.min.js",
|
||||
"typings": "index.d.ts",
|
||||
|
@ -27,6 +27,6 @@
|
|||
},
|
||||
"homepage": "https://www.theajack.com/cnchar/",
|
||||
"dependencies": {
|
||||
"cnchar-types": "2.2.8"
|
||||
"cnchar-types": "^2.2.8"
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
"name": "cnchar-xhy",
|
||||
"version": "2.2.8",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.js",
|
||||
"main": "cnchar.xhy.min.js",
|
||||
"unpkg": "cnchar.xhy.min.js",
|
||||
"jsdelivr": "cnchar.xhy.min.js",
|
||||
"typings": "index.d.ts",
|
||||
|
@ -27,6 +27,6 @@
|
|||
},
|
||||
"homepage": "https://www.theajack.com/cnchar/",
|
||||
"dependencies": {
|
||||
"cnchar-types": "2.2.8"
|
||||
"cnchar-types": "^2.2.8"
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
// var cnchar = require('./all/index');
|
||||
var cnchar = require('../../npm/all/cnchar.all.min.js');
|
||||
var cnchar = require('../../npm/packages/all/cnchar.all.min.js');
|
||||
|
||||
console.log(cnchar.stroke('一个', 'order'));
|
||||
console.log(cnchar.stroke('長城', 'count', 'order', 'name'));
|
||||
|
|
|
@ -6,23 +6,25 @@
|
|||
// var xhy = require('./xhy/index');
|
||||
// var radical = require('./radical/index');
|
||||
|
||||
var cnchar = require('../../npm/cnchar/cnchar.min.js');
|
||||
var poly = require('../../npm/poly/cnchar.poly.min.js');
|
||||
var order = require('../../npm/order/cnchar.order.min.js');
|
||||
var trad = require('../../npm/trad/cnchar.trad.min.js');
|
||||
var idiom = require('../../npm/idiom/cnchar.idiom.min.js');
|
||||
var xhy = require('../../npm/xhy/cnchar.xhy.min.js');
|
||||
var radical = require('../../npm/radical/cnchar.radical.min.js');
|
||||
var cnchar = require('../../npm/packages/cnchar/cnchar.min.js');
|
||||
// var poly = require('../../npm/packages/poly/cnchar.poly.min.js');
|
||||
// var order = require('../../npm/packages/order/cnchar.order.min.js');
|
||||
// var trad = require('../../npm/packages/trad/cnchar.trad.min.js');
|
||||
// var idiom = require('../../npm/packages/idiom/cnchar.idiom.min.js');
|
||||
// var xhy = require('../../npm/packages/xhy/cnchar.xhy.min.js');
|
||||
// var radical = require('../../npm/packages/radical/cnchar.radical.min.js');
|
||||
// console.log(cnchar);
|
||||
// debugger;
|
||||
|
||||
cnchar.use(order, trad, poly, idiom, xhy, radical);
|
||||
console.log(cnchar.stroke('一个', 'order'));
|
||||
console.log(cnchar.stroke('長城', 'count', 'order', 'name'));
|
||||
console.log(cnchar.orderToWord(['横', '撇', '捺']));
|
||||
console.log('美好的地方'.spell('tone'));
|
||||
console.log('长大了'.spell());
|
||||
console.log('长大了'.spell('poly'));
|
||||
console.log(cnchar.strokeToWord(25, 'simple'));
|
||||
console.log(cnchar.idiom(['五', '', '十', '']));
|
||||
console.log(cnchar.xhy('大水冲了龙王庙'));
|
||||
console.log(cnchar.radical('你好呀'));
|
||||
// cnchar.use(order, trad, poly, idiom, xhy, radical);
|
||||
// console.log(cnchar.stroke('一个', 'order'));
|
||||
// console.log(cnchar.stroke('長城', 'count', 'order', 'name'));
|
||||
// console.log(cnchar.orderToWord(['横', '撇', '捺']));
|
||||
// console.log('美好的地方'.spell('tone'));
|
||||
// console.log('长大了'.spell());
|
||||
// console.log('长大了'.spell('poly'));
|
||||
// console.log(cnchar.strokeToWord(25, 'simple'));
|
||||
// console.log(cnchar.idiom(['五', '', '十', '']));
|
||||
// console.log(cnchar.xhy('大水冲了龙王庙'));
|
||||
// console.log(cnchar.radical('你好呀'));
|
||||
// module.exports = cnchar
|
|
@ -24,12 +24,13 @@ module.exports = {
|
|||
mode: 'production',
|
||||
entry: path.resolve('./', 'src/cnchar/main/index.ts'),
|
||||
output: {
|
||||
path: path.resolve('./', 'npm/cnchar'),
|
||||
path: path.resolve('./', 'npm/packages/cnchar'),
|
||||
filename: 'cnchar.min.js',
|
||||
library: 'cnchar',
|
||||
libraryTarget: 'umd',
|
||||
umdNamedDefine: true,
|
||||
globalObject: 'this'
|
||||
// umdNamedDefine: true,
|
||||
// globalObject: 'this',
|
||||
libraryExport: 'default',
|
||||
},
|
||||
resolve: {
|
||||
extensions: [ '.tsx', '.ts', '.js' ]
|
||||
|
|
|
@ -30,7 +30,7 @@ module.exports = (env) => {
|
|||
mode: 'production',
|
||||
entry: path.resolve('./', `src/cnchar/${dir}/index.ts`),
|
||||
output: {
|
||||
path: path.resolve('./', 'npm/' + plugin),
|
||||
path: path.resolve('./', 'npm/packages/' + plugin),
|
||||
filename: 'cnchar.' + plugin + '.min.js',
|
||||
library: 'cnchar' + plugin[0].toUpperCase() + plugin.substr(1),
|
||||
libraryTarget: 'umd',
|
||||
|
|
Loading…
Reference in New Issue