mazey 4.0.6 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +990 -990
- package/coverage/clover.xml +1238 -0
- package/coverage/coverage-final.json +2 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.esm.js.html +12646 -0
- package/coverage/lcov-report/index.html +116 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov.info +2548 -0
- package/lib/browser.d.ts +90 -0
- package/lib/browser.d.ts.map +1 -0
- package/lib/calc.d.ts +106 -0
- package/lib/calc.d.ts.map +1 -0
- package/lib/debug.d.ts +40 -0
- package/lib/debug.d.ts.map +1 -0
- package/lib/dom.d.ts +164 -0
- package/lib/dom.d.ts.map +1 -0
- package/lib/event.d.ts +76 -0
- package/lib/event.d.ts.map +1 -0
- package/lib/global.d.ts +87 -0
- package/lib/index.cjs.js +2 -2
- package/lib/index.d.ts +10 -2040
- package/lib/index.d.ts.map +1 -1
- package/lib/index.esm.js +2 -2
- package/lib/load.d.ts +169 -0
- package/lib/load.d.ts.map +1 -0
- package/lib/mazey.min.js +2 -2
- package/lib/perf.d.ts +199 -0
- package/lib/perf.d.ts.map +1 -0
- package/lib/store.d.ts +216 -0
- package/lib/store.d.ts.map +1 -0
- package/lib/typing.d.ts +88 -74
- package/lib/url.d.ts +246 -0
- package/lib/url.d.ts.map +1 -0
- package/lib/util.d.ts +841 -0
- package/lib/util.d.ts.map +1 -0
- package/package.json +124 -122
- package/scripts/README.md +0 -38
- package/scripts/build-helper.js +0 -76
- package/scripts/dev.js +0 -23
- package/scripts/env-win.sh +0 -2
- package/scripts/git-helper.js +0 -155
- package/scripts/mac-build.sh +0 -8
- package/scripts/release.js +0 -9
- package/scripts/rollup.config.mjs +0 -152
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAAE,YAAY,EAAE,eAAe,EAC3C,YAAY,EAAE,qBAAqB,EACrB,UAAU,EACxB,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EACxD,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAkBrC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAE3C;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAG7D;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAG7D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAG7D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQzC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CASjD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GA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gB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAU/C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,UAAU,CAAC,OAAO,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,EAAE,MAAM,SAAe,GAAG,MAAM,CAwB1F;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAG1D;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGnD;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAWjD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,aAAa,KAAK,aAAa,EACzF,QAAQ,EAAE,CAAC,EACX,OAAO,GAAE,kBAAuB,EAChC,SAAS,GAAE,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,OAErC,GACA,IAAI,CA2BN;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAM5D;AAED;;;;GAIG;AACH,wBAAsB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEzD"}
|
package/package.json
CHANGED
|
@@ -1,122 +1,124 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mazey",
|
|
3
|
-
"version": "4.0
|
|
4
|
-
"description": "A functional library for daily front-end work.",
|
|
5
|
-
"main": "lib/index.cjs.js",
|
|
6
|
-
"module": "lib/index.esm.js",
|
|
7
|
-
"typings": "lib/index.d.ts",
|
|
8
|
-
"types": "lib/index.d.ts",
|
|
9
|
-
"mainEntryPointFilePath": "lib/index.d.ts",
|
|
10
|
-
"directories": {
|
|
11
|
-
"lib": "./lib"
|
|
12
|
-
},
|
|
13
|
-
"unpkg": "lib/mazey.min.js",
|
|
14
|
-
"jsdelivr": "lib/mazey.min.js",
|
|
15
|
-
"scripts": {
|
|
16
|
-
"dev": "webpack serve --config ./scripts/webpack.config.dev.js --open",
|
|
17
|
-
"build": "cross-env SCRIPTS_NPM_PACKAGE_DEBUG=close SCRIPTS_NPM_PACKAGE_VERSION=$npm_package_version rollup --config ./scripts/rollup.config.mjs",
|
|
18
|
-
"build:debug": "cross-env SCRIPTS_NPM_PACKAGE_DEBUG=open SCRIPTS_NPM_PACKAGE_VERSION=$npm_package_version rollup --config ./scripts/rollup.config.mjs",
|
|
19
|
-
"test": "jest",
|
|
20
|
-
"test:debug": "npm run build:debug && npm run test",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"release
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
"@babel/
|
|
70
|
-
"@babel/plugin-transform-
|
|
71
|
-
"@babel/plugin-transform-
|
|
72
|
-
"@babel/
|
|
73
|
-
"@babel/preset-
|
|
74
|
-
"@babel/
|
|
75
|
-
"@babel/runtime
|
|
76
|
-
"@
|
|
77
|
-
"@commitlint/
|
|
78
|
-
"@
|
|
79
|
-
"@rollup/plugin-
|
|
80
|
-
"@rollup/plugin-
|
|
81
|
-
"@
|
|
82
|
-
"@
|
|
83
|
-
"@typescript-eslint/
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"eslint
|
|
90
|
-
"eslint-
|
|
91
|
-
"eslint-plugin-
|
|
92
|
-
"eslint-plugin-
|
|
93
|
-
"eslint-plugin-
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"jest
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"rollup
|
|
106
|
-
"rollup-plugin-
|
|
107
|
-
"rollup-plugin-
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"webpack
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "mazey",
|
|
3
|
+
"version": "4.1.0",
|
|
4
|
+
"description": "A functional library for daily front-end work.",
|
|
5
|
+
"main": "lib/index.cjs.js",
|
|
6
|
+
"module": "lib/index.esm.js",
|
|
7
|
+
"typings": "lib/index.d.ts",
|
|
8
|
+
"types": "lib/index.d.ts",
|
|
9
|
+
"mainEntryPointFilePath": "lib/index.d.ts",
|
|
10
|
+
"directories": {
|
|
11
|
+
"lib": "./lib"
|
|
12
|
+
},
|
|
13
|
+
"unpkg": "lib/mazey.min.js",
|
|
14
|
+
"jsdelivr": "lib/mazey.min.js",
|
|
15
|
+
"scripts": {
|
|
16
|
+
"dev": "webpack serve --config ./scripts/webpack.config.dev.js --open",
|
|
17
|
+
"build": "cross-env SCRIPTS_NPM_PACKAGE_DEBUG=close SCRIPTS_NPM_PACKAGE_VERSION=$npm_package_version rollup --config ./scripts/rollup.config.mjs",
|
|
18
|
+
"build:debug": "cross-env SCRIPTS_NPM_PACKAGE_DEBUG=open SCRIPTS_NPM_PACKAGE_VERSION=$npm_package_version rollup --config ./scripts/rollup.config.mjs",
|
|
19
|
+
"test": "jest",
|
|
20
|
+
"test:debug": "npm run build:debug && npm run test",
|
|
21
|
+
"test:coverage": "npm run build:debug && npx jest --coverage",
|
|
22
|
+
"lint:fix": "eslint --ext 'js,ts,tsx' --fix ./src ./test ./scripts",
|
|
23
|
+
"docs": "typedoc --readme ./README.md --excludeProtected --excludePrivate --excludeInternal --hideGenerator",
|
|
24
|
+
"preview": "npm run build && npm run test",
|
|
25
|
+
"release": "npm run preview && cross-env SCRIPTS_NPM_PACKAGE_VERSION=$npm_package_version node ./scripts/release.js",
|
|
26
|
+
"release:win": "bash scripts/shell/env-win.sh && npm i --registry=https://registry.npmmirror.com && npm run release"
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "git+https://github.com/mazeyqian/mazey.git"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"front-end",
|
|
34
|
+
"load",
|
|
35
|
+
"math",
|
|
36
|
+
"url",
|
|
37
|
+
"style",
|
|
38
|
+
"css",
|
|
39
|
+
"debounce",
|
|
40
|
+
"throttle",
|
|
41
|
+
"trim",
|
|
42
|
+
"clone",
|
|
43
|
+
"json",
|
|
44
|
+
"random",
|
|
45
|
+
"dom",
|
|
46
|
+
"hash",
|
|
47
|
+
"storage",
|
|
48
|
+
"cookie",
|
|
49
|
+
"calculate",
|
|
50
|
+
"formula",
|
|
51
|
+
"browser",
|
|
52
|
+
"performance",
|
|
53
|
+
"pwa",
|
|
54
|
+
"console",
|
|
55
|
+
"function",
|
|
56
|
+
"typescript"
|
|
57
|
+
],
|
|
58
|
+
"author": {
|
|
59
|
+
"name": "Cheng",
|
|
60
|
+
"email": "mazeyqian@gmail.com",
|
|
61
|
+
"url": "https://github.com/mazeyqian"
|
|
62
|
+
},
|
|
63
|
+
"license": "MIT",
|
|
64
|
+
"bugs": {
|
|
65
|
+
"url": "https://github.com/mazeyqian/mazey/issues"
|
|
66
|
+
},
|
|
67
|
+
"homepage": "https://github.com/mazeyqian/mazey#readme",
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@babel/core": "^7.23.2",
|
|
70
|
+
"@babel/plugin-transform-class-properties": "^7.22.5",
|
|
71
|
+
"@babel/plugin-transform-object-rest-spread": "^7.22.15",
|
|
72
|
+
"@babel/plugin-transform-runtime": "^7.23.2",
|
|
73
|
+
"@babel/preset-env": "^7.23.2",
|
|
74
|
+
"@babel/preset-typescript": "^7.23.2",
|
|
75
|
+
"@babel/runtime": "^7.23.2",
|
|
76
|
+
"@babel/runtime-corejs3": "^7.23.2",
|
|
77
|
+
"@commitlint/cli": "^17.8.1",
|
|
78
|
+
"@commitlint/config-conventional": "^17.8.1",
|
|
79
|
+
"@rollup/plugin-babel": "^6.0.3",
|
|
80
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
81
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
82
|
+
"@types/jquery": "^3.5.29",
|
|
83
|
+
"@typescript-eslint/eslint-plugin": "^6.12.0",
|
|
84
|
+
"@typescript-eslint/parser": "^6.12.0",
|
|
85
|
+
"clean-webpack-plugin": "^4.0.0",
|
|
86
|
+
"core-js": "^3.33.2",
|
|
87
|
+
"cross-env": "^7.0.3",
|
|
88
|
+
"date-fns": "^2.30.0",
|
|
89
|
+
"eslint": "^8.54.0",
|
|
90
|
+
"eslint-config-standard": "^17.1.0",
|
|
91
|
+
"eslint-plugin-import": "^2.29.0",
|
|
92
|
+
"eslint-plugin-node": "^11.1.0",
|
|
93
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
94
|
+
"eslint-plugin-standard": "^4.1.0",
|
|
95
|
+
"execa": "^7.2.0",
|
|
96
|
+
"html-webpack-plugin": "^5.5.3",
|
|
97
|
+
"husky": "^8.0.3",
|
|
98
|
+
"jest": "^29.7.0",
|
|
99
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
100
|
+
"jquery": "^3.7.1",
|
|
101
|
+
"lint-staged": "^14.0.1",
|
|
102
|
+
"markdown-toc": "^1.2.0",
|
|
103
|
+
"prettier": "^2.8.8",
|
|
104
|
+
"prettier-eslint-cli": "^8.0.1",
|
|
105
|
+
"rollup": "^3.29.4",
|
|
106
|
+
"rollup-plugin-cleaner": "^1.0.0",
|
|
107
|
+
"rollup-plugin-copy": "^3.4.0",
|
|
108
|
+
"rollup-plugin-dts": "^6.1.0",
|
|
109
|
+
"rollup-plugin-typescript2": "^0.34.1",
|
|
110
|
+
"ts-loader": "^9.4.4",
|
|
111
|
+
"tslib": "^2.6.2",
|
|
112
|
+
"typedoc": "^0.25.4",
|
|
113
|
+
"typescript": "5.3.2",
|
|
114
|
+
"webpack": "^5.89.0",
|
|
115
|
+
"webpack-cli": "^5.1.4",
|
|
116
|
+
"webpack-dev-server": "^4.15.1"
|
|
117
|
+
},
|
|
118
|
+
"husky": {
|
|
119
|
+
"hooks": {
|
|
120
|
+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
|
|
121
|
+
"pre-commit": "lint-staged"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
package/scripts/README.md
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# scripts
|
|
2
|
-
|
|
3
|
-
## release
|
|
4
|
-
|
|
5
|
-
Release this project with version by `process.env.VERSION` or `package.json`.
|
|
6
|
-
|
|
7
|
-
Usage:
|
|
8
|
-
|
|
9
|
-
```javascript
|
|
10
|
-
const pkgVersion = process.env.VERSION || require('../package.json').version;
|
|
11
|
-
release(pkgVersion);
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
It will be more straightforward if you use the development dependence CrossEnv.
|
|
15
|
-
|
|
16
|
-
```shell
|
|
17
|
-
# Install
|
|
18
|
-
npm i cross-env -D
|
|
19
|
-
|
|
20
|
-
# scripts
|
|
21
|
-
cross-env SCRIPTS_NPM_PACKAGE_VERSION=$npm_package_version node ./scripts/release.js
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
```javascript
|
|
25
|
-
// release.js
|
|
26
|
-
release();
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
<!-- @param {string} ver Version
|
|
30
|
-
@returns {void} -->
|
|
31
|
-
|
|
32
|
-
## generateToc
|
|
33
|
-
|
|
34
|
-
Generate table of contents for the markdown file.
|
|
35
|
-
|
|
36
|
-
<!-- @param {string} path Path of markdown file.
|
|
37
|
-
@param {array} options.hiddenHeadings Hidden headings.
|
|
38
|
-
@returns {void} -->
|
package/scripts/build-helper.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
-
/* eslint-disable no-undef */
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const _resolve = (_path) => path.resolve(__dirname, _path);
|
|
5
|
-
const format = require('date-fns/format');
|
|
6
|
-
const toc = require('markdown-toc');
|
|
7
|
-
const fs = require('fs');
|
|
8
|
-
// Generate version: 20210308.072903
|
|
9
|
-
const genVersion = () => {
|
|
10
|
-
const d = new Date();
|
|
11
|
-
const version = format(d, 'yyyyMMdd.HHmmss');
|
|
12
|
-
return version;
|
|
13
|
-
};
|
|
14
|
-
const version = genVersion();
|
|
15
|
-
const defaultHiddenHeadings = [
|
|
16
|
-
'mazey',
|
|
17
|
-
'Install',
|
|
18
|
-
'Usage',
|
|
19
|
-
'Contributing',
|
|
20
|
-
'License',
|
|
21
|
-
'API Examples',
|
|
22
|
-
'Development Environment',
|
|
23
|
-
'Returns',
|
|
24
|
-
'Scripts',
|
|
25
|
-
'Node.js',
|
|
26
|
-
'TypeScript',
|
|
27
|
-
'Table of Contents',
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Generate table of contents for the markdown file.
|
|
32
|
-
*
|
|
33
|
-
* @param {string} path Path of markdown file.
|
|
34
|
-
* @param {array} options.hiddenHeadings Hidden headings.
|
|
35
|
-
* @returns {void}
|
|
36
|
-
*/
|
|
37
|
-
const generateToc = (path = '../README.md', options = {
|
|
38
|
-
hiddenHeadings: defaultHiddenHeadings,
|
|
39
|
-
}) => {
|
|
40
|
-
console.log('Generating Table of Contents...');
|
|
41
|
-
options = Object.assign({
|
|
42
|
-
hiddenHeadings: defaultHiddenHeadings,
|
|
43
|
-
}, options);
|
|
44
|
-
const RMFilePath = _resolve(path);
|
|
45
|
-
// https://melvingeorge.me/blog/get-all-the-contents-from-file-as-string-nodejs
|
|
46
|
-
console.log('running...');
|
|
47
|
-
const buffer = fs.readFileSync(RMFilePath);
|
|
48
|
-
const fileContent = buffer.toString();
|
|
49
|
-
// https://github.com/jonschlinkert/markdown-toc
|
|
50
|
-
const removeUnnecessaryHeadings = (str) => {
|
|
51
|
-
return !options.hiddenHeadings.some(v => {
|
|
52
|
-
return str.includes(v);
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
let tocContent = toc(fileContent, {
|
|
56
|
-
filter: removeUnnecessaryHeadings,
|
|
57
|
-
bullets: [ '-', '-' ],
|
|
58
|
-
}).content;
|
|
59
|
-
tocContent = tocContent.replace(/[ ]{4}/gm, '');
|
|
60
|
-
tocContent = '<!-- toc - begin -->\n' + '- Generated with ❤️\n' + tocContent;
|
|
61
|
-
tocContent = tocContent + '\n<!-- toc - end -->';
|
|
62
|
-
// Insert to file.
|
|
63
|
-
// https://stackoverflow.com/questions/14177087/replace-a-string-in-a-file-with-nodejs
|
|
64
|
-
let newFileContent = fileContent;
|
|
65
|
-
// https://stackoverflow.com/questions/1979884/how-to-use-javascript-regex-over-multiple-lines
|
|
66
|
-
newFileContent = newFileContent.replace(/<!-- toc - begin -->[\s\S]*<!-- toc - end -->/gm, tocContent);
|
|
67
|
-
console.log('running...');
|
|
68
|
-
fs.writeFileSync(RMFilePath, newFileContent);
|
|
69
|
-
console.log('Generating Table of Contents is done.');
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
module.exports = {
|
|
73
|
-
_resolve,
|
|
74
|
-
version,
|
|
75
|
-
generateToc,
|
|
76
|
-
};
|
package/scripts/dev.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-undef */
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
3
|
-
// const execa = require('execa');
|
|
4
|
-
const { generateToc } = require('./build-helper');
|
|
5
|
-
|
|
6
|
-
(async () => {
|
|
7
|
-
// const { stdout: pushMsg = '' } = await execa('git', ['push'], { stdio: 'pipe' })
|
|
8
|
-
// .catch(error => {
|
|
9
|
-
// console.log('error:', error.message);
|
|
10
|
-
// });
|
|
11
|
-
// try {
|
|
12
|
-
// await execa('git', ['push'], { stdio: 'pipe' });
|
|
13
|
-
// } catch (error) {
|
|
14
|
-
// console.log('error:', error.message);
|
|
15
|
-
// const { stdout: currentBranch } = await execa('git', ['branch', '--show-current'], { stdio: 'pipe' });
|
|
16
|
-
// console.log('currentBranch:', currentBranch); // currentBranch: fix/rollup_dependences_mon_oct_31st_2022
|
|
17
|
-
// await execa('git', ['push', '--set-upstream', 'origin', currentBranch]);
|
|
18
|
-
// }
|
|
19
|
-
// console.log('pushMsg:', pushMsg);
|
|
20
|
-
// const cb = await getGitCurrentBranch('fix returns value');
|
|
21
|
-
// console.log('bbb', cb);
|
|
22
|
-
generateToc();
|
|
23
|
-
})();
|
package/scripts/env-win.sh
DELETED
package/scripts/git-helper.js
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
-
/* eslint-disable no-undef */
|
|
3
|
-
// Git Helper
|
|
4
|
-
const execa = require('execa');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Release this project with version by `process.env.VERSION` or `package.json`.
|
|
8
|
-
*
|
|
9
|
-
* Usage:
|
|
10
|
-
*
|
|
11
|
-
* ```javascript
|
|
12
|
-
* const pkgVersion = process.env.VERSION || require('../package.json').version;
|
|
13
|
-
* release(pkgVersion);
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* It will be more straightforward if you use the development dependence CrossEnv.
|
|
17
|
-
*
|
|
18
|
-
* ```shell
|
|
19
|
-
* # Install
|
|
20
|
-
* npm i cross-env -D
|
|
21
|
-
*
|
|
22
|
-
* # scripts
|
|
23
|
-
* cross-env SCRIPTS_NPM_PACKAGE_VERSION=$npm_package_version node ./scripts/release.js
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* ```javascript
|
|
27
|
-
* // release.js
|
|
28
|
-
* release();
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* @param {string} ver Version
|
|
32
|
-
* @returns {void}
|
|
33
|
-
*/
|
|
34
|
-
async function release (ver, { canGenerateToc = false, defaultBranch = 'main' } = {}) {
|
|
35
|
-
if (!ver) {
|
|
36
|
-
ver = process.env.SCRIPTS_NPM_PACKAGE_VERSION;
|
|
37
|
-
}
|
|
38
|
-
if (!ver) {
|
|
39
|
-
console.error('Fail to get the current version.');
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const { generateToc } = require('./build-helper');
|
|
43
|
-
const releaseVersion = `v${ver}`;
|
|
44
|
-
const { stdout: releaseStdout } = await execa('echo', [ `Start release ${releaseVersion}...` ]);
|
|
45
|
-
console.log(releaseStdout);
|
|
46
|
-
// Generating Table of Contents
|
|
47
|
-
if (canGenerateToc) {
|
|
48
|
-
generateToc();
|
|
49
|
-
}
|
|
50
|
-
// Commit
|
|
51
|
-
await gitCommit(`${releaseVersion} stage`);
|
|
52
|
-
// Marge
|
|
53
|
-
await gitMergeMaster2Release(defaultBranch);
|
|
54
|
-
// Build
|
|
55
|
-
await execa('npm', [ 'run', 'preview' ]);
|
|
56
|
-
await execa('npm', [ 'publish' ]);
|
|
57
|
-
// Commit Again
|
|
58
|
-
await gitCommit(releaseVersion);
|
|
59
|
-
// Push
|
|
60
|
-
console.log('Pushing to the remote Git...');
|
|
61
|
-
// await execa('git', ['tag', '-a', `${releaseVersion}`, '-m', `Release ${releaseVersion}`]);
|
|
62
|
-
// await execa('git', ['push', 'origin', `refs/tags/${releaseVersion}`]);
|
|
63
|
-
await gitTagPush(releaseVersion);
|
|
64
|
-
await gitPush();
|
|
65
|
-
console.log('All done.');
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Push git tag.
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* ```
|
|
73
|
-
* await gitTagPush('v1.0.0');
|
|
74
|
-
* ```
|
|
75
|
-
*
|
|
76
|
-
* @param {string} ver Release version
|
|
77
|
-
* @returns {boolean} Is success
|
|
78
|
-
*/
|
|
79
|
-
async function gitTagPush (ver = '') {
|
|
80
|
-
if (!ver) {
|
|
81
|
-
console.error('Fail to get the current version.');
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
if (!ver.startsWith('v')) {
|
|
85
|
-
ver = `v${ver}`;
|
|
86
|
-
}
|
|
87
|
-
await execa('git', [ 'tag', '-a', `${ver}`, '-m', `Release ${ver}` ]);
|
|
88
|
-
await execa('git', [ 'push', 'origin', `refs/tags/${ver}` ]);
|
|
89
|
-
return true;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Push code.
|
|
94
|
-
*/
|
|
95
|
-
async function gitPush () {
|
|
96
|
-
try {
|
|
97
|
-
await execa('git', [ 'push' ], { stdio: 'pipe' });
|
|
98
|
-
} catch (error) {
|
|
99
|
-
console.log('Error:', error.message);
|
|
100
|
-
const { stdout: currentBranch } = await execa('git', [ 'branch', '--show-current' ], { stdio: 'pipe' });
|
|
101
|
-
console.log(`Current Branch: ${currentBranch}`);
|
|
102
|
-
await execa('git', [ 'push', '--set-upstream', 'origin', currentBranch ]);
|
|
103
|
-
}
|
|
104
|
-
return true;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Merge master to current branch.
|
|
109
|
-
*/
|
|
110
|
-
async function gitMergeMaster2Release (defaultBranch = 'main') {
|
|
111
|
-
const currentBranch = await getGitCurrentBranch();
|
|
112
|
-
await execa('git', [ 'checkout', defaultBranch ]);
|
|
113
|
-
await execa('git', [ 'pull' ]);
|
|
114
|
-
await execa('git', [ 'checkout', currentBranch ]);
|
|
115
|
-
await execa('git', [ 'merge', defaultBranch ]);
|
|
116
|
-
return true;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Get git current branch.
|
|
121
|
-
*/
|
|
122
|
-
async function getGitCurrentBranch () {
|
|
123
|
-
let currentBranch = '';
|
|
124
|
-
try {
|
|
125
|
-
({ stdout: currentBranch } = await execa('git', [ 'branch', '--show-current' ], { stdio: 'pipe' }));
|
|
126
|
-
} catch (error) {
|
|
127
|
-
({ stdout: currentBranch } = await execa('git', [ 'rev-parse', '--abbrev-ref', 'HEAD' ], { stdio: 'pipe' }));
|
|
128
|
-
}
|
|
129
|
-
console.log(`Current Branch: ${currentBranch}`);
|
|
130
|
-
return currentBranch;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Commit current code.
|
|
135
|
-
*/
|
|
136
|
-
async function gitCommit (releaseVersion = 0) {
|
|
137
|
-
const { stdout: diffStdout } = await execa('git', [ 'diff' ], { stdio: 'pipe' });
|
|
138
|
-
if (diffStdout) {
|
|
139
|
-
console.log('Committing changes...');
|
|
140
|
-
await execa('git', [ 'add', '-A' ]);
|
|
141
|
-
await execa('git', [ 'commit', '-m', `release: ${releaseVersion}` ]);
|
|
142
|
-
} else {
|
|
143
|
-
console.log('No changes to commit.');
|
|
144
|
-
}
|
|
145
|
-
return true;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
module.exports = {
|
|
149
|
-
release,
|
|
150
|
-
gitPush,
|
|
151
|
-
gitMergeMaster2Release,
|
|
152
|
-
getGitCurrentBranch,
|
|
153
|
-
gitCommit,
|
|
154
|
-
gitTagPush,
|
|
155
|
-
};
|
package/scripts/mac-build.sh
DELETED
package/scripts/release.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
-
/* eslint-disable no-undef */
|
|
3
|
-
// release
|
|
4
|
-
const { release } = require('./git-helper');
|
|
5
|
-
const pkgVersion = process.env.SCRIPTS_NPM_PACKAGE_VERSION || process.env.VERSION || require('../package.json').version;
|
|
6
|
-
|
|
7
|
-
console.log('release: SCRIPTS_NPM_PACKAGE_VERSION', process.env.SCRIPTS_NPM_PACKAGE_VERSION);
|
|
8
|
-
|
|
9
|
-
release(pkgVersion, { canGenerateToc: true });
|