esoftplay 0.0.256 → 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/bin/cli.js +9 -8
- 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",
|
package/bin/cli.js
CHANGED
|
@@ -1220,6 +1220,7 @@ function build() {
|
|
|
1220
1220
|
}
|
|
1221
1221
|
|
|
1222
1222
|
const local = args[1] == 'local' ? ' --local' : ''
|
|
1223
|
+
const prelocal = args[1] == 'local' ? "EAS_LOCAL_BUILD_WORKINGDIR=~/expo-eas " : ""
|
|
1223
1224
|
const Named = args[2] || ""
|
|
1224
1225
|
const types = isWeb
|
|
1225
1226
|
?
|
|
@@ -1236,7 +1237,7 @@ function build() {
|
|
|
1236
1237
|
[
|
|
1237
1238
|
{
|
|
1238
1239
|
name: "1. IOS (Development) - Simulator",
|
|
1239
|
-
cmd: "eas build --platform ios --profile development --clear-cache" + local,
|
|
1240
|
+
cmd: prelocal + "eas build --platform ios --profile development --clear-cache" + local,
|
|
1240
1241
|
pre: () => {
|
|
1241
1242
|
configAvailable(true)
|
|
1242
1243
|
devClientPre(appjson)
|
|
@@ -1245,7 +1246,7 @@ function build() {
|
|
|
1245
1246
|
},
|
|
1246
1247
|
{
|
|
1247
1248
|
name: "2. IOS (Development) - Non Simulator",
|
|
1248
|
-
cmd: "eas build --platform ios --profile development_build --clear-cache" + local,
|
|
1249
|
+
cmd: prelocal + "eas build --platform ios --profile development_build --clear-cache" + local,
|
|
1249
1250
|
pre: () => {
|
|
1250
1251
|
configAvailable(true)
|
|
1251
1252
|
devClientPre(appjson)
|
|
@@ -1254,7 +1255,7 @@ function build() {
|
|
|
1254
1255
|
},
|
|
1255
1256
|
{
|
|
1256
1257
|
name: "3. IOS (Preview) - Simulator",
|
|
1257
|
-
cmd: "eas build --platform ios --profile preview --clear-cache" + local,
|
|
1258
|
+
cmd: prelocal + "eas build --platform ios --profile preview --clear-cache" + local,
|
|
1258
1259
|
pre: () => {
|
|
1259
1260
|
configAvailable(true)
|
|
1260
1261
|
devClientPos(appjson)
|
|
@@ -1263,7 +1264,7 @@ function build() {
|
|
|
1263
1264
|
},
|
|
1264
1265
|
{
|
|
1265
1266
|
name: "4. IOS (Preview) - Non Simulator",
|
|
1266
|
-
cmd: "eas build --platform ios --profile preview_build --clear-cache" + local,
|
|
1267
|
+
cmd: prelocal + "eas build --platform ios --profile preview_build --clear-cache" + local,
|
|
1267
1268
|
pre: () => {
|
|
1268
1269
|
configAvailable(true)
|
|
1269
1270
|
devClientPos(appjson)
|
|
@@ -1272,7 +1273,7 @@ function build() {
|
|
|
1272
1273
|
},
|
|
1273
1274
|
{
|
|
1274
1275
|
name: "5. IOS (Production) - ipa",
|
|
1275
|
-
cmd: "eas build --platform ios --profile production --clear-cache" + local,
|
|
1276
|
+
cmd: prelocal + "eas build --platform ios --profile production --clear-cache" + local,
|
|
1276
1277
|
pre: () => {
|
|
1277
1278
|
configAvailable(true)
|
|
1278
1279
|
devClientPos(appjson)
|
|
@@ -1281,7 +1282,7 @@ function build() {
|
|
|
1281
1282
|
},
|
|
1282
1283
|
{
|
|
1283
1284
|
name: "6. Android (Development) - apk",
|
|
1284
|
-
cmd: "eas build --platform android --profile development --clear-cache" + local,
|
|
1285
|
+
cmd: prelocal + "eas build --platform android --profile development --clear-cache" + local,
|
|
1285
1286
|
pre: () => {
|
|
1286
1287
|
configAvailable(true)
|
|
1287
1288
|
devClientPre(appjson)
|
|
@@ -1290,7 +1291,7 @@ function build() {
|
|
|
1290
1291
|
},
|
|
1291
1292
|
{
|
|
1292
1293
|
name: "7. Android (Preview) - apk",
|
|
1293
|
-
cmd: "eas build --platform android --profile preview --clear-cache" + local,
|
|
1294
|
+
cmd: prelocal + "eas build --platform android --profile preview --clear-cache" + local,
|
|
1294
1295
|
pre: () => {
|
|
1295
1296
|
configAvailable(true)
|
|
1296
1297
|
devClientPos(appjson)
|
|
@@ -1299,7 +1300,7 @@ function build() {
|
|
|
1299
1300
|
},
|
|
1300
1301
|
{
|
|
1301
1302
|
name: "8. Android (Production) - aab",
|
|
1302
|
-
cmd: "eas build --platform android --profile production --clear-cache" + local,
|
|
1303
|
+
cmd: prelocal + "eas build --platform android --profile production --clear-cache" + local,
|
|
1303
1304
|
pre: () => {
|
|
1304
1305
|
configAvailable(true)
|
|
1305
1306
|
devClientPos(appjson)
|