lucy-cli 2.0.0-alpha.5 → 2.0.0-alpha.6
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/dist/init.js +20 -15
- package/files/expo/metro.config.js +25 -1
- package/files/expo/tsconfig.json +1 -0
- package/package.json +3 -2
- package/src/init.ts +25 -21
package/dist/init.js
CHANGED
@@ -163,12 +163,12 @@ const init_expo = () => {
|
|
163
163
|
const terminal = yield* Terminal.Terminal;
|
164
164
|
const fs = yield* FileSystem.FileSystem;
|
165
165
|
const path = yield* Path.Path;
|
166
|
-
const resolutions = {
|
167
|
-
"@wix/sdk@1.15.24": "patch:@wix/sdk@npm:1.15.24#./patches/@wix-sdk-npm-1.15.24-1adbec98e9.patch",
|
168
|
-
};
|
169
166
|
const yarn = Command.make("yarn", "add", "nativewind", "react-native-reanimated@~3.17.4", "react-native-safe-area-context@5.4.0", "@wix/sdk@1.15.24", "@wix/data", "expo-standard-web-crypto", "effect", "node-libs-react-native", "util", "events", "tailwindcss-animate").pipe(Command.stdout("inherit"), // Stream stdout to process.stdout
|
170
167
|
Command.exitCode // Get the exit code
|
171
168
|
);
|
169
|
+
const yarnVersion = Command.make("yarn", "set", "version", "berry").pipe(Command.stdout("inherit"), // Stream stdout to process.stdout
|
170
|
+
Command.exitCode // Get the exit code
|
171
|
+
);
|
172
172
|
const yarnDev = Command.make("yarn", "add", "--dev", "tailwindcss@^3.4.17", "prettier-plugin-tailwindcss@^0.5.11", "@styled/typescript-styled-plugin", "typescript-eslint-language-service", "eslint-config-prettier", "eslint-plugin-jsdoc", "eslint-plugin-named-import-spacing", "eslint-plugin-only-warn", "eslint-plugin-react", "eslint-plugin-react-hooks", "eslint-plugin-simple-import-sort", "@next/eslint-plugin-next", "@styled/typescript-styled-plugin", "@stylelint/postcss-css-in-js", "@typescript-eslint/parser", "typescript-eslint", "typescript-eslint-language-service", "@total-typescript/ts-reset", "expo-doctor", "tsx").pipe(Command.stdout("inherit"), // Stream stdout to process.stdout
|
173
173
|
Command.exitCode // Get the exit code
|
174
174
|
);
|
@@ -207,13 +207,6 @@ const init_expo = () => {
|
|
207
207
|
return yield* Effect.logError("Lucy is already initialized in this project. Please run this command in an empty directory.");
|
208
208
|
const baseFiles = yield* fs.readDirectory(config.config.filesFolder + '/expo');
|
209
209
|
yield* Effect.forEach(baseFiles, (file) => fs.copy(path.join(config.config.filesFolder, 'expo', file), path.join(config.config.cwd, file), { overwrite: true }));
|
210
|
-
let res = yield* yarn;
|
211
|
-
res = yield* yarnDev;
|
212
|
-
console.log("🐕 " + 'npx');
|
213
|
-
res = yield* npx;
|
214
|
-
if (res !== 0) {
|
215
|
-
return yield* Effect.logError("Failed to install Expo dependencies. Please check the error message above.");
|
216
|
-
}
|
217
210
|
const newScripts = {
|
218
211
|
"dev": "expo start",
|
219
212
|
"start": "expo start",
|
@@ -223,7 +216,7 @@ const init_expo = () => {
|
|
223
216
|
"reset": "tsx ./scripts/reset-project.ts",
|
224
217
|
"format": "prettier --write \"./*.json\" \"**/*.{ts,tsx,md,json,jsonc,json5}\"",
|
225
218
|
"prebuild": "expo prebuild",
|
226
|
-
"pods": "
|
219
|
+
"pods": "npxpod-install",
|
227
220
|
"build:dev": "eas build --local --profile development",
|
228
221
|
"build:sim": "eas build --local --profile ios-simulator",
|
229
222
|
"build:prev": "eas build --local --profile preview",
|
@@ -241,7 +234,6 @@ const init_expo = () => {
|
|
241
234
|
};
|
242
235
|
packageJson.resolutions = {
|
243
236
|
...packageJson.resolutions,
|
244
|
-
...resolutions,
|
245
237
|
};
|
246
238
|
packageJson.expo = {
|
247
239
|
doctor: {
|
@@ -252,9 +244,22 @@ const init_expo = () => {
|
|
252
244
|
};
|
253
245
|
yield* fs.writeFileString(path.join(config.config.cwd, 'package.json'), JSON.stringify(packageJson, null, 2));
|
254
246
|
yield* fs.remove(path.join(config.config.cwd, "package-lock.json"), { force: true });
|
255
|
-
|
256
|
-
|
257
|
-
|
247
|
+
let res = yield* yarnVersion;
|
248
|
+
if (res !== 0) {
|
249
|
+
return yield* Effect.logError("Failed to set Yarn version. Please check the error message above.");
|
250
|
+
}
|
251
|
+
res = yield* yarn;
|
252
|
+
if (res !== 0) {
|
253
|
+
return yield* Effect.logError("Failed to install dependencies. Please check the error message above.");
|
254
|
+
}
|
255
|
+
res = yield* yarnDev;
|
256
|
+
if (res !== 0) {
|
257
|
+
return yield* Effect.logError("Failed to install dev dependencies. Please check the error message above.");
|
258
|
+
}
|
259
|
+
res = yield* npx;
|
260
|
+
if (res !== 0) {
|
261
|
+
return yield* Effect.logError("Failed to install Expo dependencies. Please check the error message above.");
|
262
|
+
}
|
258
263
|
});
|
259
264
|
};
|
260
265
|
export const init = () => {
|
@@ -3,7 +3,16 @@
|
|
3
3
|
// @ts-nocheck
|
4
4
|
const { getDefaultConfig } = require('expo/metro-config');
|
5
5
|
const { withNativeWind } = require('nativewind/metro');
|
6
|
+
const path = require('path');
|
6
7
|
|
8
|
+
const ALIASES_WEB = {
|
9
|
+
'@wix/sdk': path.resolve(__dirname, './node_modules/@wix/sdk/cjs/build/index.js'),
|
10
|
+
// Example: redirect imports of 'some-native-library' to a web-compatible mock
|
11
|
+
// 'some-native-library': path.resolve(__dirname, 'src/mocks/some-native-library.web.js'),
|
12
|
+
|
13
|
+
// You can add your @wix/sdk aliases here if needed
|
14
|
+
// '@wix/sdk-something': path.resolve(__dirname, 'src/wix/sdk-something-web.js'),
|
15
|
+
};
|
7
16
|
const config = (() => {
|
8
17
|
let config = getDefaultConfig(__dirname);
|
9
18
|
const { transformer, resolver } = config;
|
@@ -15,6 +24,21 @@ const config = (() => {
|
|
15
24
|
};
|
16
25
|
|
17
26
|
config.resolver.unstable_enablePackageExports = false;
|
27
|
+
// config.resolver.unstable_conditionsByPlatform = ['ios', 'android']
|
28
|
+
config.resolver.resolveRequest = (context, moduleName, platform) => {
|
29
|
+
if (platform === 'web') {
|
30
|
+
console.log('Resolving for web:', moduleName);
|
31
|
+
// Check if the module name is in our alias map
|
32
|
+
const alias = ALIASES_WEB[moduleName];
|
33
|
+
if (alias) {
|
34
|
+
console.log(`Aliasing '${moduleName}' to '${alias}'`);
|
35
|
+
// If it is, resolve to the new path
|
36
|
+
return context.resolveRequest(context, alias, platform);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
// Ensure you call the default resolver for everything else.
|
40
|
+
return context.resolveRequest(context, moduleName, platform);
|
41
|
+
};
|
18
42
|
|
19
43
|
config.resolver.extraNodeModules = {
|
20
44
|
...config.resolver.extraNodeModules,
|
@@ -29,6 +53,6 @@ const config = (() => {
|
|
29
53
|
|
30
54
|
return config;
|
31
55
|
})();
|
32
|
-
console.log('Using Metro config:', JSON.stringify(config, null, 2));
|
56
|
+
// console.log('Using Metro config:', JSON.stringify(config, null, 2));
|
33
57
|
module.exports = withNativeWind(config, { input: './global.css' });
|
34
58
|
|
package/files/expo/tsconfig.json
CHANGED
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"type": "module",
|
3
3
|
"name": "lucy-cli",
|
4
|
-
"version": "2.0.0-alpha.
|
4
|
+
"version": "2.0.0-alpha.6",
|
5
5
|
"description": "Lucy Framework for WIX Studio Editor",
|
6
6
|
"main": ".dist/index.js",
|
7
7
|
"scripts": {
|
@@ -102,5 +102,6 @@
|
|
102
102
|
"i": "^0.3.7",
|
103
103
|
"npm": "^11.0.0",
|
104
104
|
"ts-node": "^10.9.1"
|
105
|
-
}
|
105
|
+
},
|
106
|
+
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
|
106
107
|
}
|
package/src/init.ts
CHANGED
@@ -195,9 +195,6 @@ const init_expo = () => {
|
|
195
195
|
const fs = yield* FileSystem.FileSystem;
|
196
196
|
const path = yield* Path.Path;
|
197
197
|
|
198
|
-
const resolutions = {
|
199
|
-
"@wix/sdk@1.15.24": "patch:@wix/sdk@npm:1.15.24#./patches/@wix-sdk-npm-1.15.24-1adbec98e9.patch",
|
200
|
-
}
|
201
198
|
const yarn = Command.make(
|
202
199
|
"yarn",
|
203
200
|
"add",
|
@@ -216,6 +213,15 @@ const init_expo = () => {
|
|
216
213
|
Command.stdout("inherit"), // Stream stdout to process.stdout
|
217
214
|
Command.exitCode // Get the exit code
|
218
215
|
)
|
216
|
+
const yarnVersion = Command.make(
|
217
|
+
"yarn",
|
218
|
+
"set",
|
219
|
+
"version",
|
220
|
+
"berry"
|
221
|
+
).pipe(
|
222
|
+
Command.stdout("inherit"), // Stream stdout to process.stdout
|
223
|
+
Command.exitCode // Get the exit code
|
224
|
+
)
|
219
225
|
|
220
226
|
const yarnDev = Command.make(
|
221
227
|
"yarn",
|
@@ -310,19 +316,6 @@ const init_expo = () => {
|
|
310
316
|
(file) => fs.copy(path.join(config.config.filesFolder, 'expo', file), path.join(config.config.cwd, file), { overwrite: true })
|
311
317
|
)
|
312
318
|
|
313
|
-
let res = yield* yarn
|
314
|
-
if (res !== 0) {
|
315
|
-
return yield* Effect.logError("Failed to install dependencies. Please check the error message above.");
|
316
|
-
}
|
317
|
-
res = yield* yarnDev
|
318
|
-
if (res !== 0) {
|
319
|
-
return yield* Effect.logError("Failed to install dev dependencies. Please check the error message above.");
|
320
|
-
}
|
321
|
-
res = yield* npx
|
322
|
-
if (res !== 0) {
|
323
|
-
return yield* Effect.logError("Failed to install Expo dependencies. Please check the error message above.");
|
324
|
-
}
|
325
|
-
|
326
319
|
const newScripts = {
|
327
320
|
"dev": "expo start",
|
328
321
|
"start": "expo start",
|
@@ -352,7 +345,6 @@ const init_expo = () => {
|
|
352
345
|
};
|
353
346
|
packageJson.resolutions = {
|
354
347
|
...packageJson.resolutions,
|
355
|
-
...resolutions,
|
356
348
|
};
|
357
349
|
packageJson.expo = {
|
358
350
|
doctor: {
|
@@ -365,11 +357,23 @@ const init_expo = () => {
|
|
365
357
|
yield* fs.writeFileString(path.join(config.config.cwd, 'package.json'), JSON.stringify(packageJson, null, 2));
|
366
358
|
yield* fs.remove(path.join(config.config.cwd, "package-lock.json"), { force: true })
|
367
359
|
|
368
|
-
yield* Command.make("yarn").pipe(
|
369
|
-
Command.stdout("inherit"), // Stream stdout to process.stdout
|
370
|
-
Command.exitCode // Get the exit code
|
371
|
-
)
|
372
360
|
|
361
|
+
let res = yield* yarnVersion;
|
362
|
+
if (res !== 0) {
|
363
|
+
return yield* Effect.logError("Failed to set Yarn version. Please check the error message above.");
|
364
|
+
}
|
365
|
+
res = yield* yarn
|
366
|
+
if (res !== 0) {
|
367
|
+
return yield* Effect.logError("Failed to install dependencies. Please check the error message above.");
|
368
|
+
}
|
369
|
+
res = yield* yarnDev
|
370
|
+
if (res !== 0) {
|
371
|
+
return yield* Effect.logError("Failed to install dev dependencies. Please check the error message above.");
|
372
|
+
}
|
373
|
+
res = yield* npx
|
374
|
+
if (res !== 0) {
|
375
|
+
return yield* Effect.logError("Failed to install Expo dependencies. Please check the error message above.");
|
376
|
+
}
|
373
377
|
})
|
374
378
|
}
|
375
379
|
|