esoftplay 0.0.109-x → 0.0.110
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/bin/build.js +10 -12
- package/bin/router.js +21 -20
- package/esp.ts +16 -14
- package/package.json +1 -1
package/bin/build.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// @ts-check
|
|
3
|
-
const {
|
|
3
|
+
const { execSync } = require('child_process');
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const DIR = "../../"
|
|
6
6
|
const packjson = DIR + "package.json"
|
|
@@ -118,15 +118,15 @@ if (fs.existsSync(packjson)) {
|
|
|
118
118
|
|
|
119
119
|
|
|
120
120
|
const babelconf = `module.exports = function (api) {
|
|
121
|
-
api.cache(true);
|
|
121
|
+
api.cache(true);
|
|
122
122
|
|
|
123
|
-
let plugins = []
|
|
123
|
+
let plugins = []
|
|
124
124
|
|
|
125
|
-
if (process.env["ENV"] === "prod") {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
plugins.push("react-native-reanimated/plugin")
|
|
125
|
+
if (process.env["ENV"] === "prod") {
|
|
126
|
+
plugins.push("transform-remove-console");
|
|
127
|
+
plugins.push("transform-react-native-style-optimizer");
|
|
128
|
+
}
|
|
129
|
+
plugins.push("react-native-reanimated/plugin")
|
|
130
130
|
return {
|
|
131
131
|
presets: ["babel-preset-expo"],
|
|
132
132
|
plugins
|
|
@@ -310,10 +310,8 @@ export default function App() {
|
|
|
310
310
|
cmd += "&& yarn add " + installDevLibs.join(" ") + " --dev "
|
|
311
311
|
if (installExpoLibs.length > 0)
|
|
312
312
|
cmd += "&& expo install " + installExpoLibs.join(" ")
|
|
313
|
-
cmd += " && npm i -s esoftplay"
|
|
314
|
-
|
|
315
|
-
exec(cmd)
|
|
316
|
-
}, 100);
|
|
313
|
+
// cmd += " && npm i -s esoftplay"
|
|
314
|
+
execSync(cmd)
|
|
317
315
|
console.log('App.js has been replace to App.tsx');
|
|
318
316
|
// /* bugfix AsyncStorage @firebase, remove this section if firebase has update the AsyncStorage */
|
|
319
317
|
// if (fs.existsSync('../@firebase/app/dist/index.rn.cjs.js')) {
|
package/bin/router.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
// @ts-check
|
|
2
3
|
/* EXECUTED ON `ESP START` TO BUILD FILE CACHES */
|
|
3
4
|
const fs = require('fs');
|
|
4
5
|
var checks = ['./node_modules/esoftplay/modules/', './modules/', './templates/'];
|
|
@@ -9,29 +10,29 @@ var replacer = new RegExp(/(?:\-|\.(?:ios|android))?\.(?:jsx|js|ts|tsx)$/);
|
|
|
9
10
|
var Text = "";
|
|
10
11
|
const rngh = "./node_modules/react-native-gesture-handler/react-native-gesture-handler.d.ts"
|
|
11
12
|
|
|
12
|
-
const curPackjson = require('../package.json')
|
|
13
|
-
const mainPackjson = require('../../../package.json')
|
|
13
|
+
// const curPackjson = require('../package.json')
|
|
14
|
+
// const mainPackjson = require('../../../package.json')
|
|
14
15
|
|
|
15
|
-
function getNestedObjectValue(obj, keys) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
16
|
+
// function getNestedObjectValue(obj, keys) {
|
|
17
|
+
// if (keys.length > 0) {
|
|
18
|
+
// var key = keys.shift();
|
|
19
|
+
// if (key in obj) {
|
|
20
|
+
// return getNestedObjectValue(obj[key], keys);
|
|
21
|
+
// } else {
|
|
22
|
+
// return null;
|
|
23
|
+
// }
|
|
24
|
+
// } else {
|
|
25
|
+
// return obj;
|
|
26
|
+
// }
|
|
27
|
+
// }
|
|
27
28
|
|
|
28
29
|
|
|
29
|
-
const prjVersion = getNestedObjectValue(mainPackjson, ['dependencies', 'esoftplay'])
|
|
30
|
-
if (prjVersion && prjVersion.includes(curPackjson.version)) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
30
|
+
// const prjVersion = getNestedObjectValue(mainPackjson, ['dependencies', 'esoftplay'])
|
|
31
|
+
// if (prjVersion && prjVersion.includes(curPackjson.version)) {
|
|
32
|
+
// try {
|
|
33
|
+
// console.log("\x1b[31m", "VERSI esoftplay tidak SESUAI " + mainPackjson.dependencies.esoftplay + " != " + curPackjson.version + " ✘", "\x1b[0m")
|
|
34
|
+
// } catch (error) { }
|
|
35
|
+
// }
|
|
35
36
|
|
|
36
37
|
if (fs.existsSync(rngh)) {
|
|
37
38
|
fs.unlink(rngh, (err) => { })
|
package/esp.ts
CHANGED
|
@@ -13,20 +13,22 @@ let conf = require('../../config.json');
|
|
|
13
13
|
let lconf = require('../../config.live.json');
|
|
14
14
|
|
|
15
15
|
export default (() => {
|
|
16
|
-
function mergeDeep(target,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
for (let key in source) {
|
|
21
|
-
if (source.hasOwnProperty(key)) {
|
|
22
|
-
if (source[key] && typeof source[key] === 'object') {
|
|
23
|
-
target[key] = mergeDeep(target[key], source[key]);
|
|
24
|
-
} else {
|
|
25
|
-
target[key] = source[key];
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
16
|
+
function mergeDeep(target: any, source: any): any {
|
|
17
|
+
const isObject = (obj) => obj && typeof obj === 'object';
|
|
18
|
+
if (!isObject(target) || !isObject(source)) {
|
|
19
|
+
return source;
|
|
29
20
|
}
|
|
21
|
+
Object.keys(source).forEach(key => {
|
|
22
|
+
const targetValue = target[key];
|
|
23
|
+
const sourceValue = source[key];
|
|
24
|
+
if (Array.isArray(targetValue) && Array.isArray(sourceValue)) {
|
|
25
|
+
target[key] = targetValue.concat(sourceValue);
|
|
26
|
+
} else if (isObject(targetValue) && isObject(sourceValue)) {
|
|
27
|
+
target[key] = mergeDeep(Object.assign({}, targetValue), sourceValue);
|
|
28
|
+
} else {
|
|
29
|
+
target[key] = sourceValue;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
30
32
|
return target;
|
|
31
33
|
}
|
|
32
34
|
app = mergeDeep(app, conf)
|
|
@@ -87,7 +89,7 @@ export default (() => {
|
|
|
87
89
|
function lang(moduleTask: string, langName: string, ...stringToBe: string[]): string {
|
|
88
90
|
let string = esp.assets("locale/" + langId() + ".json")?.[moduleTask]?.[langName]
|
|
89
91
|
if (!string) {
|
|
90
|
-
string = esp.assets("locale/id.json")[moduleTask][langName]
|
|
92
|
+
string = esp.assets("locale/id.json")?.[moduleTask]?.[langName]
|
|
91
93
|
}
|
|
92
94
|
function sprintf(string: string, index: number) {
|
|
93
95
|
if (stringToBe[index] != undefined) {
|