@sleeperhq/mini-core 0.0.3 → 0.0.5
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_mini.js +8 -0
- package/mini_packages.json +1 -0
- package/package.json +2 -2
- package/src/components/index.tsx +2 -2
- package/webpack.config.js +6 -6
package/bin/build_mini.js
CHANGED
|
@@ -131,6 +131,13 @@ const setProjectName = (name) => {
|
|
|
131
131
|
fs.writeFileSync(podfilePath, newPodfileString);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
const setUniqueName = (name) => {
|
|
135
|
+
const webpackConfigPath = path.join('node_modules', '@sleeperhq', 'mini-core', 'webpack.config.js');
|
|
136
|
+
const webpackConfigString = fs.readFileSync(webpackConfigPath).toString();
|
|
137
|
+
const newWebpackConfigString = webpackConfigString.replace(/uniqueName: '.*'/, `uniqueName: '${name}'`);
|
|
138
|
+
fs.writeFileSync(webpackConfigPath, newWebpackConfigString);
|
|
139
|
+
}
|
|
140
|
+
|
|
134
141
|
const validateProjectName = (name) => {
|
|
135
142
|
const regex = /^[a-zA-Z0-9_]+$/;
|
|
136
143
|
return regex.test(name);
|
|
@@ -148,6 +155,7 @@ const main = async () => {
|
|
|
148
155
|
if (projectName !== fallback) {
|
|
149
156
|
await spawnProcess(`yarn react-native-rename "${projectName}" --skipAllGitChecks`, "rename command exited with non-zero code");
|
|
150
157
|
setProjectName(projectName);
|
|
158
|
+
setUniqueName(projectName);
|
|
151
159
|
}
|
|
152
160
|
|
|
153
161
|
const commands = getCommands(projectName);
|
package/mini_packages.json
CHANGED
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"react-native-image-pan-zoom": "2.1.12",
|
|
53
53
|
"react-native-image-picker": "4.10.3",
|
|
54
54
|
"react-native-image-resizer": "1.4.5",
|
|
55
|
+
"react-native-interactable": "2.0.1",
|
|
55
56
|
"react-native-iphone-x-helper": "1.3.1",
|
|
56
57
|
"react-native-json-tree": "1.3.0",
|
|
57
58
|
"react-native-keep-awake": "4.0.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleeperhq/mini-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Core library frameworks for developing Sleeper Mini Apps.",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"@react-native-community/cli-platform-apple": "15.0.1",
|
|
43
43
|
"@react-native-community/cli-platform-ios": "15.0.1",
|
|
44
44
|
"@react-native-community/netinfo": "11.3.2",
|
|
45
|
+
"@rspack/plugin-react-refresh": "1.0.0",
|
|
45
46
|
"axios": "0.15.3",
|
|
46
47
|
"babel-loader": "9.1.3",
|
|
47
48
|
"react-native-fast-image": "https://github.com/blitzstudios/react-native-fast-image.git#release/1.4",
|
|
48
49
|
"react-native-linear-gradient": "2.8.3",
|
|
49
50
|
"react-native-rename": "blitzstudios/react-native-rename.git#react-native-rename-v3.2.17-gitpkg",
|
|
50
|
-
"react-refresh": "0.14.0",
|
|
51
51
|
"regenerator-runtime": "0.13.11",
|
|
52
52
|
"rx": "4.1.0",
|
|
53
53
|
"string-replace-loader": "3.1.0",
|
package/src/components/index.tsx
CHANGED
|
@@ -7,10 +7,10 @@ import type {SwitchProps} from '../../declarations/switch';
|
|
|
7
7
|
import { AvatarProps, AvatarLeagueProps, AvatarPlayerProps, AvatarTeamProps } from '../../declarations/avatar';
|
|
8
8
|
|
|
9
9
|
const _SleeperModule = React.lazy(() =>
|
|
10
|
-
Federated.importModule('sleeper', 'index').catch(() => ({
|
|
10
|
+
Federated.importModule('sleeper', 'index').catch((e) => ({
|
|
11
11
|
default: props => {
|
|
12
12
|
console.log(
|
|
13
|
-
`[Sleeper] Failed to load <${props?.component}>. Check connection to the app
|
|
13
|
+
`[Sleeper] Failed to load <${props?.component}>. Check connection to the app. (${e})`,
|
|
14
14
|
);
|
|
15
15
|
return <View />;
|
|
16
16
|
},
|
package/webpack.config.js
CHANGED
|
@@ -80,11 +80,6 @@ module.exports = env => {
|
|
|
80
80
|
*/
|
|
81
81
|
devtool: false,
|
|
82
82
|
context,
|
|
83
|
-
/**
|
|
84
|
-
* `getInitializationEntries` will return necessary entries with setup and initialization code.
|
|
85
|
-
* If you don't want to use Hot Module Replacement, set `hmr` option to `false`. By default,
|
|
86
|
-
* HMR will be enabled in development mode.
|
|
87
|
-
*/
|
|
88
83
|
entry,
|
|
89
84
|
resolve: {
|
|
90
85
|
/**
|
|
@@ -125,6 +120,7 @@ module.exports = env => {
|
|
|
125
120
|
: 'index.ios.bundle',
|
|
126
121
|
chunkFilename: '[name].chunk.bundle',
|
|
127
122
|
publicPath: Repack.getPublicPath({platform, devServer}),
|
|
123
|
+
uniqueName: 'template',
|
|
128
124
|
},
|
|
129
125
|
/**
|
|
130
126
|
* Configures optimization of the built bundle.
|
|
@@ -193,6 +189,7 @@ module.exports = env => {
|
|
|
193
189
|
],
|
|
194
190
|
babelrc: false,
|
|
195
191
|
cacheDirectory: true,
|
|
192
|
+
sourceMaps: true,
|
|
196
193
|
},
|
|
197
194
|
},
|
|
198
195
|
},
|
|
@@ -213,10 +210,13 @@ module.exports = env => {
|
|
|
213
210
|
['@babel/preset-typescript', { allowDeclareFields: true }],
|
|
214
211
|
],
|
|
215
212
|
// sourceType: "unambiguous",
|
|
216
|
-
plugins:
|
|
213
|
+
plugins: devServer && devServer.hmr
|
|
214
|
+
? ['@babel/plugin-transform-runtime', 'module:react-refresh/babel']
|
|
215
|
+
: ['@babel/plugin-transform-runtime'],
|
|
217
216
|
babelrc: false,
|
|
218
217
|
comments: true, // necessary for named chunks
|
|
219
218
|
cacheDirectory: true,
|
|
219
|
+
sourceMaps: true,
|
|
220
220
|
},
|
|
221
221
|
},
|
|
222
222
|
},
|