From 4c1e383fa8ed3494081ef2b758e82634b35fde40 Mon Sep 17 00:00:00 2001 From: Eason chiu <76670758@qq.com> Date: Fri, 18 Jun 2021 14:43:16 +0800 Subject: [PATCH 1/7] =?UTF-8?q?chore:=20=F0=9F=A4=96=20fix=20package.json?= =?UTF-8?q?=20->=20scripts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/__tests__/crypto.test.js | 26 +++++++++++++++++--------- package.json | 15 ++++++++------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/lib/__tests__/crypto.test.js b/lib/__tests__/crypto.test.js index 3349ee6..7aa8edf 100644 --- a/lib/__tests__/crypto.test.js +++ b/lib/__tests__/crypto.test.js @@ -1,4 +1,4 @@ -import {Encrypt, Decrypt} from '../crypto' +import { Encrypt, Decrypt } from '../crypto'; describe('Encrypt AES', () => { it('with empty', () => { @@ -10,13 +10,17 @@ describe('Encrypt AES', () => { }); it('valid oject data', () => { - const data = {name: '测试123'} - expect(Encrypt.AES(data, '1234567887654321')).toBe('egm/Mle8irv5rcW8KiYIP1ctnN/sh3k/KwpYvwyhjVg='); + const data = { name: '测试123' }; + expect(Encrypt.AES(data, '1234567887654321')).toBe( + 'egm/Mle8irv5rcW8KiYIP1ctnN/sh3k/KwpYvwyhjVg=', + ); }); it('valid Array data', () => { - const data = ['1', '2', '测试123'] - expect(Encrypt.AES(data, '1234567887654321')).toBe('GHRDr875WQZmG69cTBTvbaDBhT7IjN/lC8l5cfoHz2U='); + const data = ['1', '2', '测试123']; + expect(Encrypt.AES(data, '1234567887654321')).toBe( + 'GHRDr875WQZmG69cTBTvbaDBhT7IjN/lC8l5cfoHz2U=', + ); }); }); @@ -34,12 +38,16 @@ describe('Decrypt AES', () => { }); it('valid oject data', () => { - const data = {name: '测试123'} - expect(Decrypt.AES('egm/Mle8irv5rcW8KiYIP1ctnN/sh3k/KwpYvwyhjVg=', '1234567887654321')).toBe(JSON.stringify(data)); + const data = { name: '测试123' }; + expect(Decrypt.AES('egm/Mle8irv5rcW8KiYIP1ctnN/sh3k/KwpYvwyhjVg=', '1234567887654321')).toBe( + JSON.stringify(data), + ); }); it('valid Array data', () => { - const data = ['1', '2', '测试123'] - expect(Decrypt.AES('GHRDr875WQZmG69cTBTvbaDBhT7IjN/lC8l5cfoHz2U=', '1234567887654321')).toBe(JSON.stringify(data)); + const data = ['1', '2', '测试123']; + expect(Decrypt.AES('GHRDr875WQZmG69cTBTvbaDBhT7IjN/lC8l5cfoHz2U=', '1234567887654321')).toBe( + JSON.stringify(data), + ); }); }); diff --git a/package.json b/package.json index a264f90..007f22d 100644 --- a/package.json +++ b/package.json @@ -14,18 +14,19 @@ ], "scripts": { "start": "cross-env NODE_ENV=development PACKAGE=development node scripts/start.js", - "build": "npm run lint && cross-env NODE_ENV=production PACKAGE=production node scripts/build.js", + "build": "cross-env NODE_ENV=production PACKAGE=production node scripts/build.js", "release": "sh scripts/release.sh", + "clean": "rimraf build", + "ci": "yarn commit", "commit": "git-cz", "test": "jest --no-cache", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", - "prettier": "prettier -c --write '**/*'", - "lint": "npm run lint:ts", + "prettier": "prettier -c --write '**/*.ts'", + "lint": "tsc --build tsconfig.build.json && node node_modules/tslint/bin/tslint -c ./tslint.json -p ./tsconfig.build.json", "lint-staged": "lint-staged", - "lint:ts": "tsc --build tsconfig.build.json && node node_modules/tslint/bin/tslint -c ./tslint.json -p ./tsconfig.build.json", - "prepublish": "npm run lint && npm run test", - "np": "np --yolo --no-yarn", - "publish": "npm run build && npm run np" + "np": "np --no-cleanup --yolo --no-publish", + "publish": "yarn clean && yarn prettier && yarn lint && yarn build && yarn np", + "prepublishOnly": "yarn publish" }, "publishConfig": { "registry": "http://registry.npmjs.org" From 351d9dfd5742e5666e174f39216ba277fd0442de Mon Sep 17 00:00:00 2001 From: Eason chiu <76670758@qq.com> Date: Fri, 18 Jun 2021 14:50:06 +0800 Subject: [PATCH 2/7] =?UTF-8?q?fix:=20=F0=9F=90=9B=20fix=20package.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 007f22d..00f9b6a 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,7 @@ "lint": "tsc --build tsconfig.build.json && node node_modules/tslint/bin/tslint -c ./tslint.json -p ./tsconfig.build.json", "lint-staged": "lint-staged", "np": "np --no-cleanup --yolo --no-publish", - "publish": "yarn clean && yarn prettier && yarn lint && yarn build && yarn np", - "prepublishOnly": "yarn publish" + "prepublishOnly": "yarn clean && yarn prettier && yarn lint && yarn build && yarn np" }, "publishConfig": { "registry": "http://registry.npmjs.org" From 580c826ebe050dc3ba88825c04ad3b96c85b77a7 Mon Sep 17 00:00:00 2001 From: Eason chiu <76670758@qq.com> Date: Fri, 18 Jun 2021 14:58:14 +0800 Subject: [PATCH 3/7] =?UTF-8?q?chore:=20=F0=9F=A4=96=20fix=20publish-tips?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 ++- scripts/publish-tips.js | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 scripts/publish-tips.js diff --git a/package.json b/package.json index 00f9b6a..a2f0a76 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,8 @@ "husky": { "hooks": { "commit-msg": "node scripts/verify-commit-msg.js", - "pre-commit": "lint-staged" + "pre-commit": "lint-staged", + "pre-push": "node scripts/publish-tips.js" } }, "lint-staged": { diff --git a/scripts/publish-tips.js b/scripts/publish-tips.js new file mode 100644 index 0000000..9af1ff8 --- /dev/null +++ b/scripts/publish-tips.js @@ -0,0 +1,8 @@ +const chalk = require('chalk'); + +console.log(); +console.log( + ` ${chalk.bgWhite.black(' 请使用')}${chalk.bgRed.black(' npm publish ')}${chalk.bgWhite.black( + '发布代码,会自动检查代码、打包、修改版本号等... ', + )} `, +); From b94aa7be438d96285758341dc82509fce808e0c0 Mon Sep 17 00:00:00 2001 From: Eason chiu <76670758@qq.com> Date: Fri, 18 Jun 2021 15:02:13 +0800 Subject: [PATCH 4/7] =?UTF-8?q?test:=20=F0=9F=92=8D=20test=20publish?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/verify-commit-msg.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/verify-commit-msg.js b/scripts/verify-commit-msg.js index 7d1f1c6..308278a 100644 --- a/scripts/verify-commit-msg.js +++ b/scripts/verify-commit-msg.js @@ -7,6 +7,8 @@ const packageJson = require('../package.json'); const commitRE = /^(revert: )?(feat|fix|polish|docs|style|refactor|perf|test|workflow|ci|chore|types|build)(\(.+\))?: .{1,50}/; +console.log(` ${chalk.bgRed.white(msg)} `); + if (!commitRE.test(msg) && packageJson.version !== msg) { console.log(); console.error(` ${chalk.bgRed.white(' ERROR ')} 无效的提交信息`); From 33551262c8e1bb3203deeeb82e86dcbce6415551 Mon Sep 17 00:00:00 2001 From: Eason chiu <76670758@qq.com> Date: Fri, 18 Jun 2021 15:03:15 +0800 Subject: [PATCH 5/7] =?UTF-8?q?test:=20=F0=9F=92=8D=20test=20publish?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/verify-commit-msg.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/verify-commit-msg.js b/scripts/verify-commit-msg.js index 308278a..bf3cfac 100644 --- a/scripts/verify-commit-msg.js +++ b/scripts/verify-commit-msg.js @@ -7,7 +7,7 @@ const packageJson = require('../package.json'); const commitRE = /^(revert: )?(feat|fix|polish|docs|style|refactor|perf|test|workflow|ci|chore|types|build)(\(.+\))?: .{1,50}/; -console.log(` ${chalk.bgRed.white(msg)} `); +console.log(`Commit: ${chalk.bgRed.white(msg)}`); if (!commitRE.test(msg) && packageJson.version !== msg) { console.log(); From 21f9e8d7bb8b28f52d61bfa47e9c0404a62cc303 Mon Sep 17 00:00:00 2001 From: Eason chiu <76670758@qq.com> Date: Fri, 18 Jun 2021 15:05:14 +0800 Subject: [PATCH 6/7] =?UTF-8?q?fix:=20=F0=9F=90=9B=20fix=20verify=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/verify-commit-msg.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/verify-commit-msg.js b/scripts/verify-commit-msg.js index bf3cfac..5414a69 100644 --- a/scripts/verify-commit-msg.js +++ b/scripts/verify-commit-msg.js @@ -9,7 +9,7 @@ const commitRE = /^(revert: )?(feat|fix|polish|docs|style|refactor|perf|test|wor console.log(`Commit: ${chalk.bgRed.white(msg)}`); -if (!commitRE.test(msg) && packageJson.version !== msg) { +if (!commitRE.test(msg) && packageJson.version !== msg && !/^v/.test(msg)) { console.log(); console.error(` ${chalk.bgRed.white(' ERROR ')} 无效的提交信息`); process.exit(1); From 2e0b2d215008b2e1b9f4ecc85a9f766a08cc4276 Mon Sep 17 00:00:00 2001 From: Eason chiu <76670758@qq.com> Date: Fri, 18 Jun 2021 15:07:34 +0800 Subject: [PATCH 7/7] v0.3.49 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a2f0a76..c59d0a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "auto-libs", - "version": "0.3.48", + "version": "0.3.49", "description": "凹凸 公用组件", "main": "build/index", "types": "build/index",