feat: 3.0.5

This commit is contained in:
tackchen 2021-12-17 12:03:04 +08:00
parent 28e1c3e9e4
commit 59ad497ee7
5 changed files with 68 additions and 11 deletions

View File

@ -87,6 +87,8 @@ function copyToNPM () {
gulp.src(['src/cnchar/main/package.json']) gulp.src(['src/cnchar/main/package.json'])
.pipe(gulp.dest('npm/packages/cnchar')); .pipe(gulp.dest('npm/packages/cnchar'));
copyCncharTypes(gulpReadme);
alias.forEach(alia => { alias.forEach(alia => {
gulp.src(`src/cnchar/alias/${alia}/package.json`) gulp.src(`src/cnchar/alias/${alia}/package.json`)
.pipe(gulp.dest(`npm/packages/${alia}`)); .pipe(gulp.dest(`npm/packages/${alia}`));
@ -97,6 +99,13 @@ function copyToNPM () {
}); });
} }
function copyCncharTypes (gulpReadme) {
gulp.src(['src/cnchar-types/**/*.ts', 'src/cnchar-types/package.json'])
.pipe(gulp.dest('npm/packages/cnchar-types'));
gulpReadme.pipe(gulp.dest(`npm/packages/cnchar-types`));
}
function copyLatest () { function copyLatest () {
// gulp.src(`dist/*.${version}.min.js`) // gulp.src(`dist/*.${version}.min.js`)
// .pipe(rename(function (path) { // .pipe(rename(function (path) {
@ -126,4 +135,5 @@ function copyLatest () {
.pipe(gulp.dest('npm/packages/hanzi-util-base')); .pipe(gulp.dest('npm/packages/hanzi-util-base'));
} }
task(); task();

View File

@ -10,7 +10,7 @@ async function main () {
const publish = 'npm publish '; const publish = 'npm publish ';
const publishPackage = `${publish}npm/packages/`; const publishPackage = `${publish}npm/packages/`;
const publishAll = `${publishPackage}cnchar-all`; const publishAll = `${publishPackage}cnchar-all`;
const publishTypes = `${publish}src/cnchar-types`; const publishTypes = `${publishPackage}cnchar-types`;
const publishMain = `${publishPackage}cnchar`; const publishMain = `${publishPackage}cnchar`;
let cmds = []; let cmds = [];
let cmdConsole = []; let cmdConsole = [];
@ -49,11 +49,24 @@ async function main () {
]; ];
} }
console.log(`Start Publish... [0/${cmds.length}]`); console.log(`Start Publish... [0/${cmds.length}]`);
const errorList = [];
for (let i = 0; i < cmds.length; i++) { for (let i = 0; i < cmds.length; i++) {
await exec(cmds[i]); const {success, stderr} = await exec(cmds[i]); {
if (success) {
console.log(`${cmdConsole[i]} publish success. [${i + 1}/${cmds.length}]`); console.log(`${cmdConsole[i]} publish success. [${i + 1}/${cmds.length}]`);
} else {
console.log(stderr);
console.log(`${cmdConsole[i]} publish fail!. [${i + 1}/${cmds.length}]`);
errorList.push(cmdConsole[i]);
}
}
} }
console.log('Finished!'); console.log('Finished!');
if (errorList.length > 0) {
console.log(`Fail Items: ${cmdConsole.toString()}`);
}
} }
main(); main();

33
helper/publish.sh Executable file
View File

@ -0,0 +1,33 @@
###
# @Author: tackchen
# @Date: 2021-12-16 17:39:00
# @LastEditors: tackchen
# @FilePath: /cnchar/helper/publish.sh
# @Description: Coding something
###
#!/bin/bash
# cd $(cd `dirname $0`; pwd)
# cd ../npm/packages
# bast_path=$(pwd)
# echo "$bast_path/cnchar"
# packages=("cnchar" "cnchar-poly" )
# for package in ${packages[@]}
# do
# echo "The value is: $package"
# done
# cd $(cd `dirname $0`; pwd)
# cd ../npm/packages
# bast_path=$(pwd)
# files=$(ls $bast_path)
# for filename in ${files[@]}
# do
# echo "$bast_path/$filename"
# done

View File

@ -45,13 +45,14 @@ async function exec (cmd) {
return new Promise(resolve => { return new Promise(resolve => {
childProcess.exec(cmd, function (error, stdout, stderr) { childProcess.exec(cmd, function (error, stdout, stderr) {
if (error) { if (error) {
throw new Error('publish error'); resolve({success: false, stdout, stderr});
} } else {
resolve({ resolve({
success: true, success: true,
stdout, stdout,
stderr stderr
}); });
}
}); });
}); });
} }

View File

@ -1,5 +1,5 @@
{ {
"name": "cnchar-types", "name": "cnchar-types",
"version": "3.0.2", "version": "3.0.5",
"lockfileVersion": 1 "lockfileVersion": 1
} }