lucy-cli 2.0.0-alpha.1 → 2.0.0-alpha.11

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.
Files changed (38) hide show
  1. package/dist/init.js +44 -18
  2. package/files/expo/.prettierrc.js +16 -0
  3. package/files/expo/.yarnrc.yml +1 -1
  4. package/files/expo/assets/fonts/SpaceMono-Regular.ttf +0 -0
  5. package/files/expo/assets/images/adaptive-icon.png +0 -0
  6. package/files/expo/assets/images/favicon.png +0 -0
  7. package/files/expo/assets/images/icon.png +0 -0
  8. package/files/expo/assets/images/splash-icon.png +0 -0
  9. package/files/expo/babel.config.js +7 -6
  10. package/files/expo/components/.gitkeep +0 -0
  11. package/files/expo/components/ui/.gitkeep +0 -0
  12. package/files/expo/constants/theme.ts +17 -17
  13. package/files/expo/eas.json +9 -3
  14. package/files/expo/{eslint.config.js → eslint.config.mjs} +15 -19
  15. package/files/expo/hooks/useColorScheme.ts +13 -7
  16. package/files/expo/index.ts +11 -0
  17. package/files/expo/lib/data.ts +36 -33
  18. package/files/expo/lib/utils/index.ts +7 -2
  19. package/files/expo/lib/utils/polyfills.ts +1 -1
  20. package/files/expo/lib/wix/client.ts +3 -5
  21. package/files/expo/lib/wix/error.ts +3 -0
  22. package/files/expo/lib/wix/index.ts +1 -0
  23. package/files/expo/metro.config.js +57 -0
  24. package/files/expo/scripts/reset-project.ts +116 -0
  25. package/files/expo/tailwind.config.js +61 -196
  26. package/files/expo/tsconfig.json +32 -26
  27. package/package.json +3 -2
  28. package/src/init.ts +62 -21
  29. package/files/expo/.env +0 -1
  30. package/files/expo/.prettierrc.json +0 -16
  31. package/files/expo/app/(tabs)/_layout.tsx +0 -45
  32. package/files/expo/app/_layout.tsx +0 -45
  33. package/files/expo/constants/Colors.ts +0 -27
  34. package/files/expo/hooks/useColorScheme.web.ts +0 -21
  35. package/files/expo/hooks/useColorSchemeRN.ts +0 -1
  36. package/files/expo/hooks/useThemeColor.ts +0 -21
  37. /package/files/expo/{readme.md → README.md} +0 -0
  38. /package/files/expo/{types/nativewind-env.d.ts → nativewind-env.d.ts} +0 -0
package/dist/init.js CHANGED
@@ -157,22 +157,22 @@ import { JsonSchema } from "./schemas/index.js";
157
157
  // console.log(blue.underline(`🐕 => Updated file ${orange(filePath)}`));
158
158
  // }
159
159
  // }
160
- const yarn = Command.make("yarn").pipe(Command.stdout("inherit"), // Stream stdout to process.stdout
161
- Command.exitCode // Get the exit code
162
- );
163
160
  const init_expo = () => {
164
161
  return Effect.gen(function* () {
165
162
  const config = yield* Config;
166
163
  const terminal = yield* Terminal.Terminal;
167
164
  const fs = yield* FileSystem.FileSystem;
168
165
  const path = yield* Path.Path;
169
- const yarn = Command.make("yarn", "add", "nativewind", "react-native-reanimated@~3.17.4", "react-native-safe-area-context@5.4.0", "@wix/sdk", "@wix/data", "expo-standard-web-crypto").pipe(Command.stdout("inherit"), // Stream stdout to process.stdout
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
  );
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").pipe(Command.stdout("inherit"), // Stream stdout to process.stdout
169
+ const yarnVersion = Command.make("yarn", "set", "version", "berry").pipe(Command.stdout("inherit"), // Stream stdout to process.stdout
173
170
  Command.exitCode // Get the exit code
174
171
  );
175
- const npx = Command.make("npx", "expo", "install", "tailwindcss-animate", "class-variance-authority", "clsx", "tailwind-merge", "expo-crypto").pipe(Command.stdout("inherit"), // Stream stdout to process.stdout
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
+ Command.exitCode // Get the exit code
174
+ );
175
+ const npx = Command.make("npx", "expo", "install", "tailwindcss-animate", "class-variance-authority", "clsx", "tailwind-merge", "expo-crypto", "react-dom", "react-native-web", "@expo/metro-runtime", "expo-system-ui").pipe(Command.stdout("inherit"), // Stream stdout to process.stdout
176
176
  Command.exitCode // Get the exit code
177
177
  );
178
178
  const projectName = config.config.cwd.split('/').pop() || 'expo-project';
@@ -194,7 +194,7 @@ const init_expo = () => {
194
194
  if (nonGitFiles.length > 0)
195
195
  return yield* Effect.logError("The current directory is not empty. Please run this command in an empty directory.");
196
196
  if (!expoAppReady) {
197
- const initExpo = Command.make("npx", "create-expo-app@latest", projectName).pipe(Command.stdout("inherit"), // Stream stdout to process.stdout
197
+ const initExpo = Command.make("npx", "create-expo-app@latest", projectName, "--template", "blank-typescript", "--no-install").pipe(Command.stdout("inherit"), // Stream stdout to process.stdout
198
198
  Command.exitCode // Get the exit code
199
199
  );
200
200
  yield* initExpo;
@@ -205,13 +205,6 @@ const init_expo = () => {
205
205
  }
206
206
  if (lucyInitialized)
207
207
  return yield* Effect.logError("Lucy is already initialized in this project. Please run this command in an empty directory.");
208
- console.log("Expo project initialized with app.json:", projectName);
209
- let res = yield* npx;
210
- res = yield* yarn;
211
- res = yield* yarnDev;
212
- if (res !== 0) {
213
- return yield* Effect.logError("Failed to install Expo dependencies. Please check the error message above.");
214
- }
215
208
  const baseFiles = yield* fs.readDirectory(config.config.filesFolder + '/expo');
216
209
  yield* Effect.forEach(baseFiles, (file) => fs.copy(path.join(config.config.filesFolder, 'expo', file), path.join(config.config.cwd, file), { overwrite: true }));
217
210
  const newScripts = {
@@ -220,20 +213,53 @@ const init_expo = () => {
220
213
  "android": "expo start --android",
221
214
  "ios": "expo start --ios",
222
215
  "web": "expo start --web",
216
+ "reset": "tsx ./scripts/reset-project.ts",
223
217
  "format": "prettier --write \"./*.json\" \"**/*.{ts,tsx,md,json,jsonc,json5}\"",
224
- "build:ios": "eas build --platform ios --local --profile preview",
225
- "build:android": "eas build --platform android --local --profile preview",
226
- "build:web": "eas build --platform web --local --profile preview",
218
+ "prebuild": "expo prebuild",
219
+ "pods": "npxpod-install",
220
+ "build:dev": "eas build --local --profile development",
221
+ "build:sim": "eas build --local --profile ios-simulator",
222
+ "build:prev": "eas build --local --profile preview",
223
+ "build:prod": "eas build --local --profile production",
224
+ "build:web": "expo export --platform web",
225
+ "doctor": "expo-doctor",
226
+ "eas-build-pre-install": "corepack enable && yarn set version 4"
227
227
  };
228
228
  const packageJsonPath = path.join(config.config.cwd, "package.json");
229
229
  const packageJsonRaw = yield* fs.readFile(packageJsonPath);
230
230
  const packageJson = Schema.decodeUnknownSync(JsonSchema)(packageJsonRaw.toString());
231
231
  packageJson.scripts = {
232
232
  ...packageJson.scripts,
233
- ...newScripts
233
+ ...newScripts,
234
+ };
235
+ packageJson.resolutions = {
236
+ ...packageJson.resolutions,
237
+ };
238
+ packageJson.expo = {
239
+ doctor: {
240
+ reactNativeDirectoryCheck: {
241
+ listUnknownPackages: false,
242
+ },
243
+ }
234
244
  };
235
245
  yield* fs.writeFileString(path.join(config.config.cwd, 'package.json'), JSON.stringify(packageJson, null, 2));
236
246
  yield* fs.remove(path.join(config.config.cwd, "package-lock.json"), { force: true });
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
+ }
237
263
  });
238
264
  };
239
265
  export const init = () => {
@@ -0,0 +1,16 @@
1
+ module.exports = {
2
+ printWidth: 80,
3
+ tabWidth: 4,
4
+ useTabs: true,
5
+ singleQuote: true,
6
+ trailingComma: 'all',
7
+ plugins: ['prettier-plugin-tailwindcss'],
8
+ overrides: [
9
+ {
10
+ files: ['**/*.{json,jsonc,json5}', '*.{json,jsonc,json5}'],
11
+ options: {
12
+ useTabs: true
13
+ }
14
+ }
15
+ ]
16
+ };
@@ -1,3 +1,3 @@
1
1
  nodeLinker: node-modules
2
-
3
2
  npmRegistryServer: "https://registry.npmjs.org/"
3
+ patchFolder: patches
@@ -1,9 +1,10 @@
1
1
  module.exports = function(api) {
2
- api.cache(true);
2
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
3
+ api.cache(true);
3
4
 
4
- return {
5
- presets: [["babel-preset-expo", {
6
- jsxImportSource: "nativewind"
7
- }], "nativewind/babel"],
8
- };
5
+ return {
6
+ presets: [['babel-preset-expo', {
7
+ jsxImportSource: 'nativewind'
8
+ }], 'nativewind/babel'],
9
+ };
9
10
  };
File without changes
File without changes
@@ -1,18 +1,18 @@
1
1
  export const NAV_THEME = {
2
- light: {
3
- background: 'hsl(0 0% 100%)', // background
4
- border: 'hsl(240 5.9% 90%)', // border
5
- card: 'hsl(0 0% 100%)', // card
6
- notification: 'hsl(0 84.2% 60.2%)', // destructive
7
- primary: 'hsl(240 5.9% 10%)', // primary
8
- text: 'hsl(240 10% 3.9%)', // foreground
9
- },
10
- dark: {
11
- background: 'hsl(240 10% 3.9%)', // background
12
- border: 'hsl(240 3.7% 15.9%)', // border
13
- card: 'hsl(240 10% 3.9%)', // card
14
- notification: 'hsl(0 72% 51%)', // destructive
15
- primary: 'hsl(0 0% 98%)', // primary
16
- text: 'hsl(0 0% 98%)', // foreground
17
- },
18
- };
2
+ light: {
3
+ background: 'hsl(0 0% 100%)', // background
4
+ border: 'hsl(240 5.9% 90%)', // border
5
+ card: 'hsl(0 0% 100%)', // card
6
+ notification: 'hsl(0 84.2% 60.2%)', // destructive
7
+ primary: 'hsl(240 5.9% 10%)', // primary
8
+ text: 'hsl(240 10% 3.9%)', // foreground
9
+ },
10
+ dark: {
11
+ background: 'hsl(240 10% 3.9%)', // background
12
+ border: 'hsl(240 3.7% 15.9%)', // border
13
+ card: 'hsl(240 10% 3.9%)', // card
14
+ notification: 'hsl(0 72% 51%)', // destructive
15
+ primary: 'hsl(0 0% 98%)', // primary
16
+ text: 'hsl(0 0% 98%)', // foreground
17
+ },
18
+ };
@@ -5,7 +5,9 @@
5
5
  "build": {
6
6
  "development": {
7
7
  "developmentClient": true,
8
- "distribution": "internal"
8
+ "distribution": "internal",
9
+ "environment": "development",
10
+ "env": {}
9
11
  },
10
12
  "ios-simulator": {
11
13
  "extends": "development",
@@ -14,10 +16,14 @@
14
16
  }
15
17
  },
16
18
  "preview": {
17
- "distribution": "internal"
19
+ "distribution": "internal",
20
+ "environment": "preview",
21
+ "env": {}
18
22
  },
19
23
  "production": {
20
- "autoIncrement": true
24
+ "autoIncrement": true,
25
+ "environment": "production",
26
+ "env": {}
21
27
  }
22
28
  },
23
29
  "submit": {
@@ -1,10 +1,8 @@
1
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
1
2
  // https://docs.expo.dev/guides/using-eslint/
2
- const { defineConfig } = require('eslint/config');
3
- const expoConfig = require('eslint-config-expo/flat');
4
-
5
3
  import eslint from '@eslint/js';
4
+ import expoConfig from 'eslint-config-expo/flat.js';
6
5
  // @ts-ignore
7
- import importPlugin from 'eslint-plugin-import';
8
6
  import jsdoc from 'eslint-plugin-jsdoc';
9
7
  import namedImportSpacing from 'eslint-plugin-named-import-spacing';
10
8
  import simpleImportSort from 'eslint-plugin-simple-import-sort';
@@ -13,31 +11,28 @@ import tseslint from 'typescript-eslint';
13
11
 
14
12
  export default tseslint.config(
15
13
  eslint.configs.recommended,
14
+ // eslint-disable-next-line import/no-named-as-default-member
16
15
  tseslint.configs.recommendedTypeChecked,
17
16
  jsdoc.configs['flat/recommended-typescript'],
18
- expoConfig,
17
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
18
+ expoConfig,
19
19
  {
20
20
  ignores: ['dist/*'],
21
21
  },
22
22
  {
23
23
  plugins: {
24
- '@typescript-eslint': tseslint.plugin,
25
24
  'simple-import-sort': simpleImportSort,
26
- import: importPlugin,
27
25
  'named-import-spacing': namedImportSpacing,
28
- jsdoc,
29
26
  },
30
27
  settings: {
31
28
  'import/resolver': {
32
29
  typescript: {
33
- project: [
34
- 'typescript/tsconfig.json',
35
- 'lib/tsconfig.json'
36
- ],
30
+ project: './tsconfig.json',
37
31
  }
38
32
  }
39
33
  },
40
34
  languageOptions: {
35
+ // eslint-disable-next-line import/no-named-as-default-member
41
36
  parser: tseslint.parser,
42
37
  parserOptions: {
43
38
  projectService: true,
@@ -99,7 +94,7 @@ export default tseslint.config(
99
94
  'no-multi-spaces': 'error',
100
95
  'import/newline-after-import': ['error', { count: 1 }],
101
96
  'named-import-spacing/named-import-spacing': 2,
102
- 'no-unused-vars': 'warn',
97
+ '@typescript-eslint/no-unused-vars': 'warn',
103
98
  'import/no-unresolved': [0],
104
99
  'no-forbidden-relative-imports': [0],
105
100
  '@typescript-eslint/triple-slash-reference': 'off',
@@ -119,8 +114,13 @@ export default tseslint.config(
119
114
  '@typescript-eslint/naming-convention': [
120
115
  'error',
121
116
  {
122
- selector: ['variable', 'function'],
123
- format: ['camelCase'],
117
+ selector: ['variable'],
118
+ format: ['camelCase', 'UPPER_CASE'],
119
+ leadingUnderscore: 'allow',
120
+ },
121
+ {
122
+ selector: ['function'],
123
+ format: ['camelCase', 'PascalCase'],
124
124
  leadingUnderscore: 'allow',
125
125
  },
126
126
  {
@@ -175,10 +175,6 @@ export default tseslint.config(
175
175
  selector: 'typeLike',
176
176
  format: ['PascalCase'],
177
177
  },
178
- {
179
- selector: 'function',
180
- format: ['UPPER_CASE'],
181
- },
182
178
  ],
183
179
  },
184
180
  },
@@ -1,11 +1,17 @@
1
1
  import { useColorScheme as useNativewindColorScheme } from 'nativewind';
2
2
 
3
+ /**
4
+ * Custom hook to get the current color scheme and provide methods to change it.
5
+ * This hook uses the nativewind's useColorScheme to access the color scheme.
6
+ * @returns An object containing the current color scheme, a method to set the color scheme,
7
+ */
3
8
  export function useColorScheme() {
4
- const { colorScheme, setColorScheme, toggleColorScheme } = useNativewindColorScheme();
5
- return {
6
- colorScheme: colorScheme ?? 'dark',
7
- isDarkColorScheme: colorScheme === 'dark',
8
- setColorScheme,
9
- toggleColorScheme,
10
- };
9
+ const { colorScheme, setColorScheme, toggleColorScheme } = useNativewindColorScheme();
10
+
11
+ return {
12
+ colorScheme: colorScheme ?? 'dark',
13
+ isDarkColorScheme: colorScheme === 'dark',
14
+ setColorScheme,
15
+ toggleColorScheme,
16
+ };
11
17
  }
@@ -0,0 +1,11 @@
1
+ import '@/global.css';
2
+ import '@/lib/utils/polyfills';
3
+
4
+ import { registerRootComponent } from 'expo';
5
+
6
+ import App from './App';
7
+
8
+ // registerRootComponent calls AppRegistry.registerComponent('main', () => App);
9
+ // It also ensures that whether you load the app in Expo Go or in a native build,
10
+ // the environment is set up appropriately
11
+ registerRootComponent(App);
@@ -1,45 +1,48 @@
1
1
  import { Effect, Schedule, Schema } from 'effect';
2
- import { client, ClientError } from './wixClient';
2
+
3
+ import { client, ClientError } from './wix';
3
4
 
4
5
  const dataSchema = Schema.Struct({
5
- source: Schema.String,
6
- content: Schema.String,
7
- _id: Schema.String,
8
- _owner: Schema.String,
9
- _createdDate: Schema.Any,
10
- _updatedDate: Schema.Any,
6
+ source: Schema.String,
7
+ content: Schema.String,
8
+ _id: Schema.String,
9
+ _owner: Schema.String,
10
+ _createdDate: Schema.Any,
11
+ _updatedDate: Schema.Any,
11
12
  });
12
13
 
13
- const COLLECTION_NAME = "dailySpiritQuotes";
14
+ const COLLECTION_NAME = 'dailySpiritQuotes';
14
15
 
15
16
  export const getQuote = () => Effect.gen(function* () {
16
- const count = yield* Effect.retry(Effect.tryPromise({
17
- try: () => client.items.query(COLLECTION_NAME).count(),
18
- catch: (error) => {
19
- console.error('Error fetching quotes:', error);
20
- Effect.fail(new ClientError());
21
- }
22
- }), Schedule.fromDelays(50, 100, 200, 400, 800));
23
-
24
- if (count === 0) {
25
- return yield* Effect.fail(new Error("No quotes found in the collection."));
26
- }
17
+ const count = yield* Effect.retry(Effect.tryPromise({
18
+ try: () => client.items.query(COLLECTION_NAME).count(),
19
+ catch: (error) => {
20
+ console.error('Error fetching quotes:', error);
21
+ Effect.fail(new ClientError());
22
+ }
23
+ }), Schedule.fromDelays(50, 100, 200, 400, 800));
24
+
25
+ if (count === 0) {
26
+ return yield* Effect.fail(new Error('No quotes found in the collection.'));
27
+ }
27
28
 
28
- const randomIndex = Math.floor(Math.random() * count);
29
+ const randomIndex = Math.floor(Math.random() * count);
29
30
 
30
- const data = yield* Effect.retry(Effect.tryPromise({
31
- try: () => client.items.query(COLLECTION_NAME).skip(randomIndex).limit(1).find(),
32
- catch: (error) => {
33
- console.error('Error fetching quotes:', error);
34
- Effect.fail(new ClientError());
35
- }
36
- }), Schedule.fromDelays(50, 100, 200, 400, 800));
31
+ const data = yield* Effect.retry(Effect.tryPromise({
32
+ try: () => client.items.query(COLLECTION_NAME).skip(randomIndex).limit(1).find(),
33
+ catch: (error) => {
34
+ console.error('Error fetching quotes:', error);
35
+ Effect.fail(new ClientError());
36
+ }
37
+ }), Schedule.fromDelays(50, 100, 200, 400, 800));
37
38
 
38
- yield* Effect.logDebug(`Fetched ${JSON.stringify(data, null, 2)}`);
39
+ yield* Effect.logDebug(`Fetched ${JSON.stringify(data, null, 2)}`);
39
40
 
40
- const quote = yield* Schema.decodeUnknown(dataSchema)(data.items[0]);
41
- return { source: quote.source, content: quote.content }
41
+ const quote = yield* Schema.decodeUnknown(dataSchema)(data.items[0]);
42
+
43
+ return { source: quote.source, content: quote.content };
42
44
  }).pipe(Effect.catchAll((error) => {
43
- console.error('Failed to fetch quote:', error);
44
- return Effect.succeed({ source: 'The Lord', content: 'The ways of the Lord are inscrutable.'});
45
- }))
45
+ console.error('Failed to fetch quote:', error);
46
+
47
+ return Effect.succeed({ source: 'The Lord', content: 'The ways of the Lord are inscrutable.' });
48
+ }));
@@ -1,6 +1,11 @@
1
- import { clsx, type ClassValue } from 'clsx';
1
+ import { type ClassValue, clsx } from 'clsx';
2
2
  import { twMerge } from 'tailwind-merge';
3
3
 
4
+ /**
5
+ * Combines class names and merges Tailwind CSS classes.
6
+ * @param inputs - The class names to combine.
7
+ * @returns A string of combined class names.
8
+ */
4
9
  export function cn(...inputs: ClassValue[]) {
5
- return twMerge(clsx(inputs));
10
+ return twMerge(clsx(inputs));
6
11
  }
@@ -1,5 +1,5 @@
1
1
 
2
- import { polyfillWebCrypto } from "expo-standard-web-crypto";
2
+ import { polyfillWebCrypto } from 'expo-standard-web-crypto';
3
3
  // import { Platform } from 'react-native';
4
4
  // // import polyfill from 'react-native-polyfill-globals';
5
5
  // import { TextDecoder, TextEncoder } from "text-encoding";
@@ -1,14 +1,12 @@
1
1
  import { items } from '@wix/data';
2
2
  import { createClient, OAuthStrategy } from '@wix/sdk';
3
- import { Data } from 'effect';
4
3
 
5
- const clientId = process.env.EXPO_PUBLIC_WIX_CLIENT_ID || "";
4
+ const clientId = process.env.EXPO_PUBLIC_WIX_CLIENT_ID || '';
6
5
 
7
6
  //To access the Wix APIs, create a client with the createClient() function imported from the @wix/sdk package.
8
7
  export const client = createClient({
9
- modules: { items },
10
- auth: OAuthStrategy({ clientId: clientId }),
8
+ modules: { items },
9
+ auth: OAuthStrategy({ clientId: clientId }),
11
10
  });
12
- export class ClientError extends Data.TaggedError('ErrorParserError') {}
13
11
 
14
12
 
@@ -0,0 +1,3 @@
1
+ import { Data } from 'effect';
2
+
3
+ export class ClientError extends Data.TaggedError('ErrorParserError') {}
@@ -1 +1,2 @@
1
1
  export { client } from './client';
2
+ export { ClientError } from './error';
@@ -0,0 +1,57 @@
1
+ /* eslint-disable @typescript-eslint/no-require-imports */
2
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3
+ // @ts-nocheck
4
+ const { getDefaultConfig } = require('expo/metro-config');
5
+ const { withNativeWind } = require('nativewind/metro');
6
+ const path = require('path');
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
+ };
16
+ const config = (() => {
17
+ let config = getDefaultConfig(__dirname);
18
+ const { transformer, resolver } = config;
19
+ config.transformer = {
20
+ ...transformer,
21
+ };
22
+ config.resolver = {
23
+ ...resolver,
24
+ };
25
+
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
+ // Check if the module name is in our alias map
31
+ const alias = ALIASES_WEB[moduleName];
32
+ if (alias) {
33
+ console.log(`Aliasing '${moduleName}' to '${alias}'`);
34
+ // If it is, resolve to the new path
35
+ return context.resolveRequest(context, alias, platform);
36
+ }
37
+ }
38
+ // Ensure you call the default resolver for everything else.
39
+ return context.resolveRequest(context, moduleName, platform);
40
+ };
41
+
42
+ config.resolver.extraNodeModules = {
43
+ ...config.resolver.extraNodeModules,
44
+ ...require('node-libs-react-native'),
45
+ // 'node:buffer': require.resolve('buffer/'),
46
+ // 'node:crypto': require.resolve('react-native-crypto/'),
47
+ // 'node:util': require.resolve('util/'),
48
+ // 'node:http': require.resolve('stream-http/'),
49
+ // 'node:https': require.resolve('https-browserify/'),
50
+ // 'node:events': require.resolve('events/'),
51
+ };
52
+
53
+ return config;
54
+ })();
55
+ // console.log('Using Metro config:', JSON.stringify(config, null, 2));
56
+ module.exports = withNativeWind(config, { input: './global.css' });
57
+