jsir 2.0.2 → 2.0.3
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/cmd/oaa.js +17 -2
- package/package.json +1 -1
- package/util.js +8 -3
package/cmd/oaa.js
CHANGED
|
@@ -31,7 +31,22 @@ let _haveWrapperInput = true
|
|
|
31
31
|
let _workspaceConfigFile = 'workspace.json';
|
|
32
32
|
let _exit = false
|
|
33
33
|
|
|
34
|
-
const
|
|
34
|
+
const _data = {}
|
|
35
|
+
const $data = {
|
|
36
|
+
get: (key, val) => {
|
|
37
|
+
if (!(key in _data) && val !== undefined) {
|
|
38
|
+
_data[key] = val
|
|
39
|
+
}
|
|
40
|
+
return _data[key]
|
|
41
|
+
},
|
|
42
|
+
set: (key, val) => {
|
|
43
|
+
_data[key] = val
|
|
44
|
+
},
|
|
45
|
+
del: (key) => {
|
|
46
|
+
delete _data[key]
|
|
47
|
+
},
|
|
48
|
+
keys: () => Object.keys(_data)
|
|
49
|
+
}
|
|
35
50
|
const $homeDir = getLibDataDir()
|
|
36
51
|
const $lib = {...require('../util')}
|
|
37
52
|
|
|
@@ -372,7 +387,7 @@ function rename(dir, oldName, newName) {
|
|
|
372
387
|
if (_fs.existsSync(_new)) {
|
|
373
388
|
warn(`${_new} already exist`)
|
|
374
389
|
} else {
|
|
375
|
-
_fs.
|
|
390
|
+
_fs.renameSync(old, _new)
|
|
376
391
|
info(`${_new} renamed`)
|
|
377
392
|
}
|
|
378
393
|
_cmdMap = {
|
package/package.json
CHANGED
package/util.js
CHANGED
|
@@ -473,12 +473,17 @@ function getConfig(key, defaultVal) {
|
|
|
473
473
|
if (writeFlag) {
|
|
474
474
|
fs.writeFileSync(configFile, JSON.stringify(config, null, 2))
|
|
475
475
|
}
|
|
476
|
-
|
|
477
|
-
|
|
476
|
+
let val = getVl(config[key], defaultVal)
|
|
477
|
+
if (typeof val === "string") {
|
|
478
|
+
val = trim(val)
|
|
479
|
+
}
|
|
480
|
+
return val
|
|
478
481
|
}
|
|
479
482
|
|
|
480
483
|
function setConfig(key, val) {
|
|
481
|
-
val
|
|
484
|
+
if (typeof val === "string") {
|
|
485
|
+
val = trim(val)
|
|
486
|
+
}
|
|
482
487
|
let configInit = {}
|
|
483
488
|
if (key) {
|
|
484
489
|
configInit[key] = val
|