esoftplay 0.0.257 → 0.0.258
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 +78 -95
- package/package.json +1 -1
package/bin/build.js
CHANGED
|
@@ -17,6 +17,17 @@ const pathJSTimer = DIR + "node_modules/react-native/Libraries/Core/Timers/JSTim
|
|
|
17
17
|
const lowercasePrompt = 'if (/^[a-z]/.test(component.name)) {'
|
|
18
18
|
const pathLowercasePrompt = DIR + 'node_modules/@react-navigation/core/src/useNavigationBuilder.tsx'
|
|
19
19
|
|
|
20
|
+
// helper that always writes synchronously and logs
|
|
21
|
+
function writeFileSyncWithLog(path, data, options) {
|
|
22
|
+
try {
|
|
23
|
+
fs.writeFileSync(path, data, options || { encoding: 'utf8' });
|
|
24
|
+
console.log(`${path} has been written`);
|
|
25
|
+
} catch (e) {
|
|
26
|
+
console.error(`failed to write ${path}`, e);
|
|
27
|
+
throw e;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
20
31
|
if (fs.existsSync(packjson)) {
|
|
21
32
|
let txt = fs.readFileSync(packjson, 'utf8');
|
|
22
33
|
let $package
|
|
@@ -43,10 +54,7 @@ if (fs.existsSync(packjson)) {
|
|
|
43
54
|
"esoftplay-web",
|
|
44
55
|
"esoftplay-web-pwa"
|
|
45
56
|
]
|
|
46
|
-
|
|
47
|
-
if (err) throw err;
|
|
48
|
-
console.log('package.json has been updated');
|
|
49
|
-
});
|
|
57
|
+
writeFileSyncWithLog(packjson, JSON.stringify($package, null, 2));
|
|
50
58
|
}
|
|
51
59
|
|
|
52
60
|
/* Update app.json */
|
|
@@ -75,15 +83,9 @@ if (fs.existsSync(packjson)) {
|
|
|
75
83
|
}
|
|
76
84
|
}
|
|
77
85
|
}
|
|
78
|
-
|
|
79
|
-
if (err) throw err;
|
|
80
|
-
console.log('config.json has been created');
|
|
81
|
-
});
|
|
86
|
+
writeFileSyncWithLog(confjson, JSON.stringify($config, null, 2));
|
|
82
87
|
if (!fs.existsSync(conflivejson)) {
|
|
83
|
-
|
|
84
|
-
if (err) throw err;
|
|
85
|
-
console.log('config.live.json has been created');
|
|
86
|
-
});
|
|
88
|
+
writeFileSyncWithLog(conflivejson, JSON.stringify($config, null, 2));
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
let $appjson = {}
|
|
@@ -149,10 +151,7 @@ if (fs.existsSync(packjson)) {
|
|
|
149
151
|
console.warn("Skipping copy: ./node_modules/esoftplay/assets/plugins not found");
|
|
150
152
|
}
|
|
151
153
|
// execSync("mkdir -p ./raw && cp -rf ./node_modules/esoftplay/assets/plugins ./raw/")
|
|
152
|
-
|
|
153
|
-
if (err) throw err;
|
|
154
|
-
console.log('app.json has been updated');
|
|
155
|
-
});
|
|
154
|
+
writeFileSyncWithLog(appjson, JSON.stringify($appjson, null, 2));
|
|
156
155
|
}
|
|
157
156
|
/* Fix Code android timers */
|
|
158
157
|
if (fs.existsSync(pathJSTimer)) {
|
|
@@ -213,10 +212,7 @@ if (fs.existsSync(packjson)) {
|
|
|
213
212
|
}
|
|
214
213
|
}`
|
|
215
214
|
|
|
216
|
-
|
|
217
|
-
if (err) throw err;
|
|
218
|
-
console.log('eas.json has been updated');
|
|
219
|
-
})
|
|
215
|
+
writeFileSyncWithLog(easjson, easconfg);
|
|
220
216
|
|
|
221
217
|
const babelconf = `module.exports = function (api) {
|
|
222
218
|
api.cache(true);
|
|
@@ -229,10 +225,7 @@ if (fs.existsSync(packjson)) {
|
|
|
229
225
|
};
|
|
230
226
|
|
|
231
227
|
`
|
|
232
|
-
|
|
233
|
-
if (err) throw err;
|
|
234
|
-
console.log('babel.config.js has been updated');
|
|
235
|
-
})
|
|
228
|
+
writeFileSyncWithLog(babelconfig, babelconf)
|
|
236
229
|
/* Update App.js */
|
|
237
230
|
const TSconfig = `{\n\
|
|
238
231
|
"compilerOptions": {\n\
|
|
@@ -258,10 +251,7 @@ if (fs.existsSync(packjson)) {
|
|
|
258
251
|
"node_modules"\n\
|
|
259
252
|
]\n\
|
|
260
253
|
}`
|
|
261
|
-
|
|
262
|
-
if (err) throw err;
|
|
263
|
-
console.log('tsconfig has been created');
|
|
264
|
-
});
|
|
254
|
+
writeFileSyncWithLog(tsconfig, TSconfig);
|
|
265
255
|
|
|
266
256
|
const GitIgnore = `
|
|
267
257
|
.expo*/
|
|
@@ -285,10 +275,7 @@ yarn.lock
|
|
|
285
275
|
yarn-error.log
|
|
286
276
|
|
|
287
277
|
`
|
|
288
|
-
|
|
289
|
-
if (err) throw err;
|
|
290
|
-
console.log('.gitignore has been created');
|
|
291
|
-
});
|
|
278
|
+
writeFileSyncWithLog(gitignore, GitIgnore);
|
|
292
279
|
|
|
293
280
|
const AppJS = `import { LibNotification } from 'esoftplay/cache/lib/notification/import';
|
|
294
281
|
import { UserIndex } from 'esoftplay/cache/user/index/import';
|
|
@@ -365,78 +352,74 @@ export default function App() {
|
|
|
365
352
|
"typescript",
|
|
366
353
|
]
|
|
367
354
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
if (exlib == '@expo/vector-icons') {
|
|
377
|
-
installExpoLibs.push(exlib)
|
|
378
|
-
}
|
|
379
|
-
} else {
|
|
380
|
-
console.log("⚙⚙⚙ INSTALLING ... " + exlib)
|
|
355
|
+
writeFileSyncWithLog(appts, AppJS);
|
|
356
|
+
try { fs.unlinkSync(appjs); } catch (e) { }
|
|
357
|
+
let installExpoLibs = []
|
|
358
|
+
let installDevLibs = []
|
|
359
|
+
expoLib.forEach((exlib) => {
|
|
360
|
+
if (fs.existsSync("../../node_modules/" + exlib)) {
|
|
361
|
+
console.log(exlib + " is Exist, Skipped")
|
|
362
|
+
if (exlib == '@expo/vector-icons') {
|
|
381
363
|
installExpoLibs.push(exlib)
|
|
382
364
|
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
console.log(devlib + " is Exist, Skipped")
|
|
387
|
-
} else {
|
|
388
|
-
console.log("⚙⚙⚙ INSTALLING ... " + devlib)
|
|
389
|
-
installDevLibs.push(devlib)
|
|
390
|
-
}
|
|
391
|
-
})
|
|
392
|
-
if (!fs.existsSync(DIR + 'modules'))
|
|
393
|
-
fs.mkdirSync(DIR + 'modules')
|
|
394
|
-
let cmd = "cd ../../ "
|
|
395
|
-
if (installDevLibs.length > 0) {
|
|
396
|
-
// console.log(installDevLibs)
|
|
397
|
-
cmd += "&& bun add " + installDevLibs.join(" ") + " --dev "
|
|
398
|
-
}
|
|
399
|
-
if (installExpoLibs.length > 0) {
|
|
400
|
-
// console.log(installExpoLibs)
|
|
401
|
-
cmd += "&& npx expo install " + installExpoLibs.join(" ")
|
|
402
|
-
}
|
|
403
|
-
console.log((JSON.stringify({ cmd }, undefined, 2)))
|
|
404
|
-
execSync(cmd + "|| true")
|
|
405
|
-
// execSync("cd ../../ && bun install --verbose || true")
|
|
406
|
-
execSync("cd ../../ && bun ./node_modules/esoftplay/bin/router.js || true")
|
|
407
|
-
execSync("cd ../../ && bun ./node_modules/esoftplay/bin/locale.js || true")
|
|
408
|
-
// execSync("cd ../../ && eas update:configure || true")
|
|
409
|
-
console.log('App.js has been replace to App.tsx');
|
|
410
|
-
// if (appjson)
|
|
411
|
-
// /* bugfix AsyncStorage @firebase, remove this section if firebase has update the AsyncStorage */
|
|
412
|
-
if (fs.existsSync('../@firebase/app/dist/index.rn.cjs.js')) {
|
|
413
|
-
let firebaseText = fs.readFileSync('../@firebase/app/dist/index.rn.cjs.js', 'utf8')
|
|
414
|
-
firebaseText = firebaseText.replace("var AsyncStorage = require('react-native').AsyncStorage;", "var AsyncStorage = require('@react-native-async-storage/async-storage').default;")
|
|
415
|
-
fs.writeFileSync('../@firebase/app/dist/index.rn.cjs.js', firebaseText)
|
|
365
|
+
} else {
|
|
366
|
+
console.log("⚙⚙⚙ INSTALLING ... " + exlib)
|
|
367
|
+
installExpoLibs.push(exlib)
|
|
416
368
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
const dfiles = files.filter((file) => file.includes('d.ts'))
|
|
422
|
-
dfiles.map((dfile, i) => {
|
|
423
|
-
const rdfile = fs.readFileSync('../@expo/vector-icons/build/' + dfile, { encoding: 'utf8' })
|
|
424
|
-
const names = (/import\("\.\/createIconSet"\)\.Icon<((.*))\,.*>/g).exec(rdfile);
|
|
425
|
-
if (names && names[1].includes('|')) {
|
|
426
|
-
esoftplayIcon += 'export type ' + dfile.replace('.d.ts', 'Types') + ' = ' + names[1] + '\n';
|
|
427
|
-
}
|
|
428
|
-
})
|
|
429
|
-
fs.writeFileSync('../@expo/vector-icons/build/esoftplay_icons.ts', esoftplayIcon)
|
|
430
|
-
})
|
|
369
|
+
})
|
|
370
|
+
devLibs.forEach((devlib) => {
|
|
371
|
+
if (fs.existsSync("../../node_modules/" + devlib)) {
|
|
372
|
+
console.log(devlib + " is Exist, Skipped")
|
|
431
373
|
} else {
|
|
432
|
-
console.log("
|
|
374
|
+
console.log("⚙⚙⚙ INSTALLING ... " + devlib)
|
|
375
|
+
installDevLibs.push(devlib)
|
|
433
376
|
}
|
|
434
|
-
|
|
435
|
-
|
|
377
|
+
})
|
|
378
|
+
if (!fs.existsSync(DIR + 'modules'))
|
|
379
|
+
fs.mkdirSync(DIR + 'modules')
|
|
380
|
+
let cmd = "cd ../../ "
|
|
381
|
+
if (installDevLibs.length > 0) {
|
|
382
|
+
cmd += "&& bun add " + installDevLibs.join(" ") + " --dev "
|
|
383
|
+
}
|
|
384
|
+
if (installExpoLibs.length > 0) {
|
|
385
|
+
cmd += "&& npx expo install " + installExpoLibs.join(" ")
|
|
386
|
+
}
|
|
387
|
+
console.log((JSON.stringify({ cmd }, undefined, 2)))
|
|
388
|
+
execSync(cmd + "|| true")
|
|
389
|
+
execSync("cd ../../ && bun ./node_modules/esoftplay/bin/router.js || true")
|
|
390
|
+
execSync("cd ../../ && bun ./node_modules/esoftplay/bin/locale.js || true")
|
|
391
|
+
console.log('App.js has been replace to App.tsx');
|
|
392
|
+
if (fs.existsSync('../@firebase/app/dist/index.rn.cjs.js')) {
|
|
393
|
+
let firebaseText = fs.readFileSync('../@firebase/app/dist/index.rn.cjs.js', 'utf8')
|
|
394
|
+
firebaseText = firebaseText.replace("var AsyncStorage = require('react-native').AsyncStorage;", "var AsyncStorage = require('@react-native-async-storage/async-storage').default;")
|
|
395
|
+
fs.writeFileSync('../@firebase/app/dist/index.rn.cjs.js', firebaseText)
|
|
396
|
+
}
|
|
397
|
+
if (fs.existsSync('../@expo/vector-icons')) {
|
|
398
|
+
let esoftplayIcon = ''
|
|
399
|
+
const files = fs.readdirSync('../@expo/vector-icons/build');
|
|
400
|
+
const dfiles = files.filter((file) => file.includes('d.ts'))
|
|
401
|
+
dfiles.map((dfile, i) => {
|
|
402
|
+
const rdfile = fs.readFileSync('../@expo/vector-icons/build/' + dfile, { encoding: 'utf8' })
|
|
403
|
+
const names = (/import\("\.\/createIconSet"\)\.Icon<((.*))\,.*>/g).exec(rdfile);
|
|
404
|
+
if (names && names[1].includes('|')) {
|
|
405
|
+
esoftplayIcon += 'export type ' + dfile.replace('.d.ts', 'Types') + ' = ' + names[1] + '\n';
|
|
406
|
+
}
|
|
407
|
+
})
|
|
408
|
+
fs.writeFileSync('../@expo/vector-icons/build/esoftplay_icons.ts', esoftplayIcon)
|
|
409
|
+
} else {
|
|
410
|
+
console.log("@expo/vector-icons not installed")
|
|
411
|
+
}
|
|
412
|
+
console.log('Please wait until processes has finished...');
|
|
436
413
|
}
|
|
437
414
|
} else {
|
|
438
415
|
console.log(packjson + " not found!!")
|
|
439
416
|
}
|
|
417
|
+
|
|
418
|
+
// ensure we always exit when script finishes (particularly for postinstall hooks)
|
|
419
|
+
if (require.main === module) {
|
|
420
|
+
process.exit(0);
|
|
421
|
+
}
|
|
422
|
+
|
|
440
423
|
// packjson scripts
|
|
441
424
|
// "preuninstall": "cd ../../ && bun ./node_modules/.bin/esoftplay stop",
|
|
442
425
|
// "postuninstall": "bun ./bin/build.js uninstall",
|