@zgfe/business-lib 1.1.43 → 1.1.45
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/config.js +21 -0
- package/package.json +4 -3
package/config.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 对关键配置信息进行本地化存储,避免多人项目配置代码冲突
|
|
6
|
+
* @param defaultConfig
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
function getConfig(defaultConfig) {
|
|
10
|
+
const configPath = path.resolve(__dirname, '.config.json');
|
|
11
|
+
if (fs.existsSync(configPath)) {
|
|
12
|
+
const config = fs.readFileSync(configPath, 'utf-8');
|
|
13
|
+
return JSON.parse(config);
|
|
14
|
+
}
|
|
15
|
+
fs.writeFileSync(configPath, JSON.stringify(defaultConfig, null, 2));
|
|
16
|
+
return defaultConfig;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = {
|
|
20
|
+
getConfig,
|
|
21
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.45",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"pre-commit": "lint-staged"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
|
-
"es"
|
|
22
|
+
"es",
|
|
23
|
+
"config.js"
|
|
23
24
|
],
|
|
24
25
|
"lint-staged": {
|
|
25
26
|
"*.{js,jsx,less,md,json}": [
|
|
@@ -59,5 +60,5 @@
|
|
|
59
60
|
"react": "^16.12.0 || ^17.0.0",
|
|
60
61
|
"yorkie": "^2.0.0"
|
|
61
62
|
},
|
|
62
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "e7de87fb82df4120fa0dd1f115a64768dd2c6dfb"
|
|
63
64
|
}
|