esoftplay 0.0.118-e → 0.0.118-h
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/_cache.ts +3 -3
- package/bin/build.js +10 -3
- package/bin/cli.js +15 -5
- package/package.json +1 -1
package/_cache.ts
CHANGED
|
@@ -45,7 +45,7 @@ export default (() => {
|
|
|
45
45
|
STORAGE.setItem(o.persistKey, JSON.stringify(value))
|
|
46
46
|
}
|
|
47
47
|
if (o?.listener) {
|
|
48
|
-
o?.listener?.(ns instanceof Function ? ns(value
|
|
48
|
+
o?.listener?.(ns instanceof Function ? ns(value) : ns)
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
};
|
|
@@ -69,7 +69,7 @@ export default (() => {
|
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
function useCache(): [T, (newCache: T | ((oldCache: T) => T)) => void, () => void] {
|
|
72
|
-
let l = R.useRef<T>(value
|
|
72
|
+
let l = R.useRef<T>(value).current;
|
|
73
73
|
|
|
74
74
|
const sl = (ns: T | ((oldCache: T) => T)) => {
|
|
75
75
|
l = ns instanceof Function ? ns(l) : ns
|
|
@@ -80,6 +80,6 @@ export default (() => {
|
|
|
80
80
|
return [l, set, del];
|
|
81
81
|
};
|
|
82
82
|
useCacheIdx++
|
|
83
|
-
return { useCache, get: () => value
|
|
83
|
+
return { useCache, get: () => value, set: set };
|
|
84
84
|
}
|
|
85
85
|
})()
|
package/bin/build.js
CHANGED
|
@@ -24,7 +24,10 @@ const pathLowercasePrompt = DIR + 'node_modules/@react-navigation/core/src/useNa
|
|
|
24
24
|
|
|
25
25
|
if (fs.existsSync(packjson)) {
|
|
26
26
|
let txt = fs.readFileSync(packjson, 'utf8');
|
|
27
|
-
let $package
|
|
27
|
+
let $package
|
|
28
|
+
try {
|
|
29
|
+
$package = JSON.parse(txt)
|
|
30
|
+
} catch (error) { }
|
|
28
31
|
let args = process.argv.slice(2);
|
|
29
32
|
|
|
30
33
|
/* ADD SCRIPTS.PRESTART AND SCRIPTS.POSTSTOP */
|
|
@@ -41,7 +44,9 @@ if (fs.existsSync(packjson)) {
|
|
|
41
44
|
if (args[0] == "install") {
|
|
42
45
|
let $config = {}
|
|
43
46
|
if (fs.existsSync(confjson))
|
|
44
|
-
|
|
47
|
+
try {
|
|
48
|
+
$config = JSON.parse(fs.readFileSync(confjson, 'utf8')) || {};
|
|
49
|
+
} catch (error) { }
|
|
45
50
|
if (!$config.hasOwnProperty('config')) {
|
|
46
51
|
$config.config = {
|
|
47
52
|
"domain": "domain.com",
|
|
@@ -72,7 +77,9 @@ if (fs.existsSync(packjson)) {
|
|
|
72
77
|
|
|
73
78
|
let $appjson = {}
|
|
74
79
|
if (fs.existsSync(appjson))
|
|
75
|
-
|
|
80
|
+
try {
|
|
81
|
+
$appjson = JSON.parse(fs.readFileSync(appjson, 'utf8')) || {};
|
|
82
|
+
} catch (error) { }
|
|
76
83
|
if (!$appjson.expo.hasOwnProperty('android')) {
|
|
77
84
|
$appjson.expo.android = {
|
|
78
85
|
"useNextNotificationsApi": true,
|
package/bin/cli.js
CHANGED
|
@@ -223,10 +223,20 @@ function createMaster(module_name) {
|
|
|
223
223
|
throw "Mohon install esoftplay package terlebih dahulu"
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
+
function readAsJson(path) {
|
|
227
|
+
let out = ""
|
|
228
|
+
try {
|
|
229
|
+
out = JSON.parse(fs.readFileSync(path, { encoding: 'utf8' }))
|
|
230
|
+
} catch(e) {
|
|
231
|
+
|
|
232
|
+
}
|
|
233
|
+
return out;
|
|
234
|
+
}
|
|
235
|
+
|
|
226
236
|
function injectConfig(configPath) {
|
|
227
237
|
if (fs.existsSync(configPath)) {
|
|
228
|
-
const exsConf =
|
|
229
|
-
const conf =
|
|
238
|
+
const exsConf = readAsJson(configPath)
|
|
239
|
+
const conf = readAsJson("./config.json")
|
|
230
240
|
let _cf = merge({ config: conf }, exsConf)
|
|
231
241
|
fs.writeFileSync(configPath, JSON.stringify({..._cf}, undefined, 2))
|
|
232
242
|
}
|
|
@@ -256,9 +266,9 @@ function createMaster(module_name) {
|
|
|
256
266
|
|
|
257
267
|
/* inject lang */
|
|
258
268
|
if (fs.existsSync("./id.json")) {
|
|
259
|
-
let moduleLang =
|
|
269
|
+
let moduleLang = readAsJson("./id.json")
|
|
260
270
|
if (fs.existsSync("../../assets/locale/id.json")) {
|
|
261
|
-
let projectLang =
|
|
271
|
+
let projectLang = readAsJson("../../assets/locale/id.json")
|
|
262
272
|
let _lg = merge(moduleLang, projectLang)
|
|
263
273
|
moduleLang = {..._lg}
|
|
264
274
|
}
|
|
@@ -267,7 +277,7 @@ function createMaster(module_name) {
|
|
|
267
277
|
|
|
268
278
|
/* inject libs */
|
|
269
279
|
if (fs.existsSync("./libs.json")) {
|
|
270
|
-
let libs =
|
|
280
|
+
let libs = readAsJson("./libs.json")
|
|
271
281
|
let libsToSkip = []
|
|
272
282
|
libs.forEach((element, index) => {
|
|
273
283
|
console.log(element.split("@")[0])
|