esoftplay 0.0.138 → 0.0.139-b
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 +23 -13
- package/bin/cli.js +8 -1
- package/bin/connector.js +38 -0
- package/bin/router.js +8 -6
- package/modules/lib/curl.ts +4 -0
- package/modules/lib/infinite.tsx +21 -13
- package/modules/lib/slidingup.tsx +4 -4
- package/modules/lib/worker.tsx +1 -6
- package/package.json +1 -1
package/bin/build.js
CHANGED
|
@@ -28,7 +28,7 @@ if (fs.existsSync(packjson)) {
|
|
|
28
28
|
/* ADD SCRIPTS.PRESTART AND SCRIPTS.POSTSTOP */
|
|
29
29
|
|
|
30
30
|
if (args[0] == "install") {
|
|
31
|
-
$package.scripts.start = "esp start &&
|
|
31
|
+
$package.scripts.start = "esp start && bunx expo start --dev-client"
|
|
32
32
|
$package.trustedDependencies = [
|
|
33
33
|
"esoftplay",
|
|
34
34
|
"esoftplay-android-print",
|
|
@@ -162,6 +162,7 @@ if (fs.existsSync(packjson)) {
|
|
|
162
162
|
},
|
|
163
163
|
"build": {
|
|
164
164
|
"development": {
|
|
165
|
+
"bun": "1.1.0",
|
|
165
166
|
"developmentClient": true,
|
|
166
167
|
"distribution": "internal",
|
|
167
168
|
"ios": {
|
|
@@ -170,11 +171,13 @@ if (fs.existsSync(packjson)) {
|
|
|
170
171
|
"channel": "default"
|
|
171
172
|
},
|
|
172
173
|
"development_build": {
|
|
174
|
+
"bun": "1.1.0",
|
|
173
175
|
"developmentClient": true,
|
|
174
176
|
"distribution": "internal",
|
|
175
177
|
"channel": "default"
|
|
176
178
|
},
|
|
177
179
|
"preview": {
|
|
180
|
+
"bun": "1.1.0",
|
|
178
181
|
"distribution": "internal",
|
|
179
182
|
"ios": {
|
|
180
183
|
"simulator": true
|
|
@@ -182,6 +185,7 @@ if (fs.existsSync(packjson)) {
|
|
|
182
185
|
"channel": "default"
|
|
183
186
|
},
|
|
184
187
|
"preview_build": {
|
|
188
|
+
"bun": "1.1.0",
|
|
185
189
|
"distribution": "internal",
|
|
186
190
|
"android": {
|
|
187
191
|
"buildType": "apk"
|
|
@@ -189,6 +193,7 @@ if (fs.existsSync(packjson)) {
|
|
|
189
193
|
"channel": "default"
|
|
190
194
|
},
|
|
191
195
|
"production": {
|
|
196
|
+
"bun": "1.1.0",
|
|
192
197
|
"channel": "default"
|
|
193
198
|
}
|
|
194
199
|
},
|
|
@@ -360,24 +365,29 @@ export default UserIndex`;
|
|
|
360
365
|
if (!fs.existsSync(DIR + 'modules'))
|
|
361
366
|
fs.mkdirSync(DIR + 'modules')
|
|
362
367
|
let cmd = "cd ../../ "
|
|
363
|
-
if (installDevLibs.length > 0)
|
|
368
|
+
if (installDevLibs.length > 0) {
|
|
369
|
+
// console.log(installDevLibs)
|
|
364
370
|
cmd += "&& bun add " + installDevLibs.join(" ") + " --dev "
|
|
365
|
-
|
|
366
|
-
|
|
371
|
+
}
|
|
372
|
+
if (installExpoLibs.length > 0) {
|
|
373
|
+
// console.log(installExpoLibs)
|
|
374
|
+
cmd += "&& bunx expo install " + installExpoLibs.join(" ")
|
|
375
|
+
}
|
|
376
|
+
console.log((JSON.stringify({ cmd }, undefined, 2)))
|
|
367
377
|
execSync(cmd + "|| true")
|
|
368
|
-
execSync("cd ../../ && bun install || true")
|
|
378
|
+
// execSync("cd ../../ && bun install --verbose || true")
|
|
369
379
|
execSync("cd ../../ && bun ./node_modules/esoftplay/bin/router.js || true")
|
|
370
380
|
execSync("cd ../../ && bun ./node_modules/esoftplay/bin/locale.js || true")
|
|
371
381
|
// execSync("cd ../../ && eas update:configure || true")
|
|
372
382
|
console.log('App.js has been replace to App.tsx');
|
|
373
|
-
if (appjson)
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
/* end AsyncStorage @firebase section */
|
|
383
|
+
// if (appjson)
|
|
384
|
+
// /* bugfix AsyncStorage @firebase, remove this section if firebase has update the AsyncStorage */
|
|
385
|
+
if (fs.existsSync('../@firebase/app/dist/index.rn.cjs.js')) {
|
|
386
|
+
let firebaseText = fs.readFileSync('../@firebase/app/dist/index.rn.cjs.js', 'utf8')
|
|
387
|
+
firebaseText = firebaseText.replace("var AsyncStorage = require('react-native').AsyncStorage;", "var AsyncStorage = require('@react-native-async-storage/async-storage').default;")
|
|
388
|
+
fs.writeFileSync('../@firebase/app/dist/index.rn.cjs.js', firebaseText)
|
|
389
|
+
}
|
|
390
|
+
// /* end AsyncStorage @firebase section */
|
|
381
391
|
if (fs.existsSync('../@expo/vector-icons')) {
|
|
382
392
|
let esoftplayIcon = ''
|
|
383
393
|
fs.readdir('../@expo/vector-icons/build', (err, files) => {
|
package/bin/cli.js
CHANGED
|
@@ -81,6 +81,10 @@ switch (args[0]) {
|
|
|
81
81
|
case "check":
|
|
82
82
|
doctor()
|
|
83
83
|
break
|
|
84
|
+
case "cm":
|
|
85
|
+
case "connect-module":
|
|
86
|
+
command('bun ./node_modules/esoftplay/bin/connector.js')
|
|
87
|
+
break
|
|
84
88
|
case "b":
|
|
85
89
|
case "build":
|
|
86
90
|
buildPrepare(true)
|
|
@@ -677,6 +681,7 @@ Pastikan data sudah benar sebelum anda melanjutkan, lanjut publish ketikkan runt
|
|
|
677
681
|
esplibs.forEach((key) => {
|
|
678
682
|
stringBuilder += ("\n" + key + ": " + pack.dependencies[key])
|
|
679
683
|
})
|
|
684
|
+
stringBuilder += "\n\nversionName: " + (ajson.expo.ios.buildNumber || ajson.expo.android.versionCode) + '-' + (last_id + 1) + ""
|
|
680
685
|
const { exec } = require('child_process');
|
|
681
686
|
exec("publisher=$(npx expo whoami &); echo $publisher;", (error, stdout, stderr) => {
|
|
682
687
|
if (error) {
|
|
@@ -717,6 +722,7 @@ Pastikan data sudah benar sebelum anda melanjutkan, lanjut publish ketikkan runt
|
|
|
717
722
|
esplibs.forEach((key) => {
|
|
718
723
|
stringBuilder += ("\n" + key + ": " + pack.dependencies[key])
|
|
719
724
|
})
|
|
725
|
+
stringBuilder += "\n\nversionName: " + (ajson.expo.ios.buildNumber || ajson.expo.android.versionCode) + '-' + (last_id + 1) + ""
|
|
720
726
|
const { exec } = require('child_process');
|
|
721
727
|
exec("publisher=$(npx expo whoami &); echo $publisher;", (error, stdout, stderr) => {
|
|
722
728
|
if (error) {
|
|
@@ -1210,7 +1216,7 @@ function switchStatus(status) {
|
|
|
1210
1216
|
if (cjson.hasOwnProperty('config')) {
|
|
1211
1217
|
if (cjson.config.hasOwnProperty('build')) {
|
|
1212
1218
|
const [usr, pwd] = cjson.config.build
|
|
1213
|
-
command(`
|
|
1219
|
+
command(`eas logout && expect -c 'spawn eas login; expect "Email or username"; send "${usr}\r"; expect "Password"; send "${pwd}\r"; expect eof;'`)
|
|
1214
1220
|
}
|
|
1215
1221
|
}
|
|
1216
1222
|
}
|
|
@@ -1250,6 +1256,7 @@ function help() {
|
|
|
1250
1256
|
"\n - bc|build-cancel : untuk cancel build prepare",
|
|
1251
1257
|
"\n - f|file : untuk check status file",
|
|
1252
1258
|
"\n - c|check : untuk check status",
|
|
1259
|
+
"\n - cm|connect-module : untuk update module berdasarkan source",
|
|
1253
1260
|
"\n - create-master [moduleName] : untuk create master module terpisah",
|
|
1254
1261
|
"\n - d|debug : untuk ubah status DEBUG",
|
|
1255
1262
|
"\n - l|live : untuk ubah status LIVE",
|
package/bin/connector.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
|
|
3
|
+
if (fs.existsSync('./raw/connected.json')) {
|
|
4
|
+
const { source, modules } = JSON.parse(fs.readFileSync('./raw/connected.json'))
|
|
5
|
+
const currentProject = './modules/';
|
|
6
|
+
|
|
7
|
+
if (source) {
|
|
8
|
+
if (modules.length > 0) {
|
|
9
|
+
modules.forEach((module) => {
|
|
10
|
+
const ext = [
|
|
11
|
+
'.ts',
|
|
12
|
+
'.tsx',
|
|
13
|
+
'.js',
|
|
14
|
+
'.debug.ts',
|
|
15
|
+
'.debug.tsx',
|
|
16
|
+
'.debug.js',
|
|
17
|
+
'.live.ts',
|
|
18
|
+
'.live.tsx',
|
|
19
|
+
'.live.js',
|
|
20
|
+
]
|
|
21
|
+
ext.forEach((fext) => {
|
|
22
|
+
const _source = source + "/modules/" + module + fext;
|
|
23
|
+
const _destination = currentProject + module + fext;
|
|
24
|
+
|
|
25
|
+
if (fs.existsSync(_source)) {
|
|
26
|
+
const file = fs.readFileSync(_source, { encoding: 'utf8' })
|
|
27
|
+
const [mod] = module.split('/')
|
|
28
|
+
if (!fs.existsSync(currentProject + mod)) {
|
|
29
|
+
fs.mkdirSync(currentProject + mod)
|
|
30
|
+
}
|
|
31
|
+
fs.writeFileSync(_destination, file, { encoding: 'utf8' })
|
|
32
|
+
console.log('>_ ' + module + fext + ' connected!')
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
package/bin/router.js
CHANGED
|
@@ -248,7 +248,7 @@ function createRouter() {
|
|
|
248
248
|
for (const module in Modules) {
|
|
249
249
|
for (const task in Modules[module]) {
|
|
250
250
|
nav = module + '/' + task;
|
|
251
|
-
if (NavsExclude[nav] == false) {
|
|
251
|
+
if (NavsExclude[nav] == false && !task.includes(".debug") && !task.includes(".live")) {
|
|
252
252
|
Navigations.push(nav);
|
|
253
253
|
}
|
|
254
254
|
AllRoutes.push(nav)
|
|
@@ -412,11 +412,13 @@ export interface EspArgsInterface {
|
|
|
412
412
|
const orientation = NavsOrientation[nav]
|
|
413
413
|
const [module, task] = nav.split('/')
|
|
414
414
|
const comp = ucword(module) + ucword(task)
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
415
|
+
if (!task.includes(".debug") && !task.includes(".live")) {
|
|
416
|
+
importer.push(`import { ${comp} } from ${'"esoftplay/cache/' + module + '/' + task + '/import"'} `)
|
|
417
|
+
if (orientation)
|
|
418
|
+
screens.push("\t\t\t\t" + "<Stack.Screen name={\"" + nav + "\"} options={{ orientation: '" + orientation + "' }} component={" + comp + "} />")
|
|
419
|
+
else
|
|
420
|
+
screens.push("\t\t\t\t" + "<Stack.Screen name={\"" + nav + "\"} component={" + comp + "} />")
|
|
421
|
+
}
|
|
420
422
|
})
|
|
421
423
|
|
|
422
424
|
let N = Nav5(importer.join("\n"), screens.join("\n"))
|
package/modules/lib/curl.ts
CHANGED
|
@@ -323,6 +323,10 @@ export default class m {
|
|
|
323
323
|
if ((/^[A-z]+:\/\//g).test(uri)) {
|
|
324
324
|
this.setUrl(uri)
|
|
325
325
|
this.setUri("")
|
|
326
|
+
const protocol = uri.split("://")[0]
|
|
327
|
+
if (protocol != esp.config("protocol")) {
|
|
328
|
+
reportApiError(uri, `INCONSISTENCY PROTOCOL ${protocol} != ${esp.config("protocol")} at config`)
|
|
329
|
+
}
|
|
326
330
|
} else {
|
|
327
331
|
this.setUri(uri)
|
|
328
332
|
this.setUrl(esp.config("url"))
|
package/modules/lib/infinite.tsx
CHANGED
|
@@ -17,6 +17,8 @@ export interface LibInfiniteProps {
|
|
|
17
17
|
isDebug?: 0 | 1,
|
|
18
18
|
initialData?: any[],
|
|
19
19
|
injectData?: any,
|
|
20
|
+
onRefresh?: () => void
|
|
21
|
+
onResponseEdit?: (res: any) => any,
|
|
20
22
|
onDataChange?: (data: any, page: number) => void
|
|
21
23
|
onResult?: (res: any, uri: string) => void,
|
|
22
24
|
filterData?: (item: any, index: number, array: any[]) => boolean,
|
|
@@ -61,7 +63,7 @@ export interface LibInfiniteState {
|
|
|
61
63
|
error: string
|
|
62
64
|
}
|
|
63
65
|
|
|
64
|
-
export default class m extends LibComponent<LibInfiniteProps, LibInfiniteState>{
|
|
66
|
+
export default class m extends LibComponent<LibInfiniteProps, LibInfiniteState> {
|
|
65
67
|
|
|
66
68
|
isStop: boolean = false
|
|
67
69
|
page: number | undefined = 0
|
|
@@ -106,16 +108,17 @@ export default class m extends LibComponent<LibInfiniteProps, LibInfiniteState>{
|
|
|
106
108
|
if (!this.pages.includes(page)) {
|
|
107
109
|
this.pages.push(page)
|
|
108
110
|
new LibCurl().withHeader(this.props?.customHeader || {})(url, post,
|
|
109
|
-
(
|
|
111
|
+
(_res, msg) => {
|
|
112
|
+
const data = this.props.onResponseEdit ? this.props.onResponseEdit(_res) : _res
|
|
110
113
|
if (this.props.isDebug) {
|
|
111
|
-
esp.log(
|
|
114
|
+
esp.log(data);
|
|
112
115
|
}
|
|
113
|
-
this.props.onResult && this.props.onResult(
|
|
116
|
+
this.props.onResult && this.props.onResult(data, url)
|
|
114
117
|
const update = () => {
|
|
115
118
|
this.props.onDataChange && this.props.onDataChange(this.state.data || [], this.page)
|
|
116
119
|
}
|
|
117
|
-
let mainIndex: any = this.props.mainIndex &&
|
|
118
|
-
if (mainIndex.list.length == 0 ||
|
|
120
|
+
let mainIndex: any = this.props.mainIndex && data[this.props.mainIndex] || data
|
|
121
|
+
if (mainIndex.list.length == 0 || data.list == '') {
|
|
119
122
|
this.page = page
|
|
120
123
|
this.isStop = true
|
|
121
124
|
this.setState((state: LibInfiniteState, props: LibInfiniteProps) => {
|
|
@@ -132,6 +135,7 @@ export default class m extends LibComponent<LibInfiniteProps, LibInfiniteState>{
|
|
|
132
135
|
this.setState((state: LibInfiniteState, props: LibInfiniteProps) => {
|
|
133
136
|
const latestData = [...state.data, ...mainIndex.list]
|
|
134
137
|
return {
|
|
138
|
+
error: '',
|
|
135
139
|
data: page == 0
|
|
136
140
|
? (typeof this.props?.filterData == 'function' ? mainIndex.list.filter(this.props.filterData) : mainIndex.list)
|
|
137
141
|
: (typeof this.props?.filterData == 'function' ? latestData.filter(this.props.filterData) : latestData),
|
|
@@ -146,6 +150,7 @@ export default class m extends LibComponent<LibInfiniteProps, LibInfiniteState>{
|
|
|
146
150
|
this.page = page
|
|
147
151
|
this.isStop = true
|
|
148
152
|
this.setState({
|
|
153
|
+
data: [],
|
|
149
154
|
error: msg?.message,
|
|
150
155
|
})
|
|
151
156
|
}, this.props.isDebug
|
|
@@ -155,10 +160,10 @@ export default class m extends LibComponent<LibInfiniteProps, LibInfiniteState>{
|
|
|
155
160
|
|
|
156
161
|
componentDidUpdate(prevProps: LibInfiniteProps, prevState: LibInfiniteState): void {
|
|
157
162
|
if (this.props.initialData != undefined && prevProps.initialData != this.props.initialData && this.props.initialData.length != 0 && this.state.data.length == 0) {
|
|
158
|
-
this.setState({ data: this.props.initialData })
|
|
163
|
+
this.setState({ data: this.props.initialData, error: "" })
|
|
159
164
|
}
|
|
160
165
|
if (this.props.injectData !== undefined && !isEqual(this.props.injectData, this.state.data)) {
|
|
161
|
-
this.setState({ data: this.props.injectData })
|
|
166
|
+
this.setState({ data: this.props.injectData, error: "" })
|
|
162
167
|
}
|
|
163
168
|
}
|
|
164
169
|
|
|
@@ -179,17 +184,22 @@ export default class m extends LibComponent<LibInfiniteProps, LibInfiniteState>{
|
|
|
179
184
|
const { data, error } = this.state
|
|
180
185
|
const { errorView, refreshEnabled } = this.props
|
|
181
186
|
// const AutoLayoutViewNativeComponent = require("@shopify/flash-list/src/native/auto-layout/AutoLayoutViewNativeComponent")
|
|
182
|
-
const List = /* !!AutoLayoutViewNativeComponent ? FlashList : */ FlashList
|
|
183
187
|
return (
|
|
184
188
|
<View style={{ flex: 1 }} >
|
|
185
189
|
{
|
|
186
190
|
(!data || data.length) == 0 && !this.isStop ?
|
|
187
191
|
this.props.LoadingView || <LibLoading />
|
|
188
192
|
:
|
|
189
|
-
<
|
|
193
|
+
<FlashList
|
|
190
194
|
ref={this.flatlist}
|
|
191
195
|
data={data || []}
|
|
192
|
-
onRefresh={
|
|
196
|
+
onRefresh={
|
|
197
|
+
((refreshEnabled == undefined) || refreshEnabled)
|
|
198
|
+
? () => {
|
|
199
|
+
this.loadData()
|
|
200
|
+
this.props?.onRefresh?.()
|
|
201
|
+
}
|
|
202
|
+
: () => { }}
|
|
193
203
|
refreshing={false}
|
|
194
204
|
keyExtractor={this._keyExtractor}
|
|
195
205
|
nestedScrollEnabled
|
|
@@ -207,8 +217,6 @@ export default class m extends LibComponent<LibInfiniteProps, LibInfiniteState>{
|
|
|
207
217
|
showsVerticalScrollIndicator={false}
|
|
208
218
|
estimatedItemSize={this.props.staticHeight || 100}
|
|
209
219
|
initialNumToRender={5}
|
|
210
|
-
maxToRenderPerBatch={10}
|
|
211
|
-
windowSize={10}
|
|
212
220
|
ListFooterComponent={
|
|
213
221
|
(!this.isStop) ? <View style={{ padding: 20 }} ><LibLoading /></View> : (this.props?.ListEndedComponent || <View style={{ height: 50 }} />)
|
|
214
222
|
}
|
|
@@ -13,7 +13,7 @@ export interface LibSlidingupProps {
|
|
|
13
13
|
export interface LibSlidingupState {
|
|
14
14
|
show: boolean,
|
|
15
15
|
}
|
|
16
|
-
export default class m extends LibComponent<LibSlidingupProps, LibSlidingupState>{
|
|
16
|
+
export default class m extends LibComponent<LibSlidingupProps, LibSlidingupState> {
|
|
17
17
|
|
|
18
18
|
_show: boolean = false
|
|
19
19
|
animValue: any = new Animated.Value(LibStyle.height)
|
|
@@ -46,7 +46,7 @@ export default class m extends LibComponent<LibSlidingupProps, LibSlidingupState
|
|
|
46
46
|
Keyboard.dismiss()
|
|
47
47
|
if (this.props.children) {
|
|
48
48
|
this.setState({ show: true }, () => {
|
|
49
|
-
|
|
49
|
+
const timer = setTimeout(() => {
|
|
50
50
|
this._toggleSubview(true)
|
|
51
51
|
clearTimeout(timer)
|
|
52
52
|
}, 1);
|
|
@@ -83,8 +83,8 @@ export default class m extends LibComponent<LibSlidingupProps, LibSlidingupState
|
|
|
83
83
|
const { show } = this.state
|
|
84
84
|
if (!show) return null
|
|
85
85
|
return (
|
|
86
|
-
<LibKeyboard_avoid style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>
|
|
87
|
-
<View style={{ flex: 1, backgroundColor: 'rgba(0,0,0,0.5)', justifyContent: 'flex-end',
|
|
86
|
+
<LibKeyboard_avoid style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, zIndex: 999999 }}>
|
|
87
|
+
<View style={{ flex: 1, backgroundColor: 'rgba(0,0,0,0.5)', justifyContent: 'flex-end', }}>
|
|
88
88
|
<TouchableOpacity style={{ flex: 1 }} activeOpacity={1} onPress={() => this.hide()} />
|
|
89
89
|
<Animated.View style={{ transform: [{ translateY: this.animValue }] }} >
|
|
90
90
|
{this.props.children}
|
package/modules/lib/worker.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import esp from 'esoftplay/esp';
|
|
|
3
3
|
import useGlobalSubscriber from 'esoftplay/subscribe';
|
|
4
4
|
import { createTimeout } from 'esoftplay/timeout';
|
|
5
5
|
import React, { useEffect, useRef } from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import { View } from 'react-native';
|
|
7
7
|
import WebView from 'react-native-webview';
|
|
8
8
|
|
|
9
9
|
export interface LibUseworkerArgs {
|
|
@@ -50,11 +50,6 @@ export default function m(props: LibUseworkerProps): any {
|
|
|
50
50
|
|
|
51
51
|
useEffect(() => {
|
|
52
52
|
ref.current?.injectJavaScript(`\n${require('./out')}\n`)
|
|
53
|
-
const c = AppState.addEventListener('focus', (status) => {
|
|
54
|
-
if (status == 'active')
|
|
55
|
-
ref.current?.injectJavaScript(`\n${require('./out')}\n`)
|
|
56
|
-
})
|
|
57
|
-
return () => c.remove()
|
|
58
53
|
}, [])
|
|
59
54
|
|
|
60
55
|
subs.useSubscribe(() => {
|