lucy-cli 2.0.0-alpha.2 → 2.0.0-alpha.4
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 +37 -16
- package/files/expo/.prettierrc.js +16 -0
- package/files/expo/.yarnrc.yml +1 -1
- package/files/expo/assets/fonts/SpaceMono-Regular.ttf +0 -0
- package/files/expo/assets/images/adaptive-icon.png +0 -0
- package/files/expo/assets/images/favicon.png +0 -0
- package/files/expo/assets/images/icon.png +0 -0
- package/files/expo/assets/images/splash-icon.png +0 -0
- package/files/expo/babel.config.js +7 -6
- package/files/expo/components/.gitkeep +0 -0
- package/files/expo/components/ui/.gitkeep +0 -0
- package/files/expo/constants/theme.ts +17 -17
- package/files/expo/{eslint.config.js → eslint.config.mjs} +15 -19
- package/files/expo/hooks/useColorScheme.ts +13 -7
- package/files/expo/index.ts +11 -0
- package/files/expo/lib/data.ts +36 -33
- package/files/expo/lib/utils/index.ts +7 -2
- package/files/expo/lib/utils/polyfills.ts +1 -1
- package/files/expo/lib/wix/client.ts +3 -5
- package/files/expo/lib/wix/error.ts +3 -0
- package/files/expo/lib/wix/index.ts +1 -0
- package/files/expo/metro.config.js +34 -0
- package/files/expo/patches/@wix-sdk-npm-1.15.24-1adbec98e9.patch +20 -0
- package/files/expo/scripts/reset-project.ts +116 -0
- package/files/expo/tailwind.config.js +61 -196
- package/files/expo/tsconfig.json +31 -26
- package/package.json +1 -1
- package/src/init.ts +52 -20
- package/files/expo/.prettierrc.json +0 -16
- package/files/expo/app/(tabs)/_layout.tsx +0 -45
- package/files/expo/app/_layout.tsx +0 -45
- package/files/expo/constants/Colors.ts +0 -27
- package/files/expo/hooks/useColorScheme.web.ts +0 -21
- package/files/expo/hooks/useColorSchemeRN.ts +0 -1
- package/files/expo/hooks/useThemeColor.ts +0 -21
- /package/files/expo/{readme.md → README.md} +0 -0
- /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
|
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
|
+
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
170
|
Command.exitCode // Get the exit code
|
171
171
|
);
|
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
|
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
|
);
|
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
|
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,35 +205,56 @@ 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
|
-
|
209
|
-
|
210
|
-
res = yield* yarn;
|
208
|
+
const baseFiles = yield* fs.readDirectory(config.config.filesFolder + '/expo');
|
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
211
|
res = yield* yarnDev;
|
212
|
+
console.log("🐕 " + 'npx');
|
213
|
+
res = yield* npx;
|
212
214
|
if (res !== 0) {
|
213
215
|
return yield* Effect.logError("Failed to install Expo dependencies. Please check the error message above.");
|
214
216
|
}
|
215
|
-
const baseFiles = yield* fs.readDirectory(config.config.filesFolder + '/expo');
|
216
|
-
yield* Effect.forEach(baseFiles, (file) => fs.copy(path.join(config.config.filesFolder, 'expo', file), path.join(config.config.cwd, file), { overwrite: true }));
|
217
217
|
const newScripts = {
|
218
218
|
"dev": "expo start",
|
219
219
|
"start": "expo start",
|
220
220
|
"android": "expo start --android",
|
221
221
|
"ios": "expo start --ios",
|
222
222
|
"web": "expo start --web",
|
223
|
+
"reset": "tsx ./scripts/reset-project.ts",
|
223
224
|
"format": "prettier --write \"./*.json\" \"**/*.{ts,tsx,md,json,jsonc,json5}\"",
|
224
|
-
"
|
225
|
-
"
|
226
|
-
"build:
|
225
|
+
"prebuild": "expo prebuild",
|
226
|
+
"pods": "npx pod-install",
|
227
|
+
"build:dev": "eas build --local --profile development",
|
228
|
+
"build:sim": "eas build --local --profile ios-simulator",
|
229
|
+
"build:prev": "eas build --local --profile preview",
|
230
|
+
"build:prod": "eas build --local --profile production",
|
231
|
+
"build:web": "expo export --platform web",
|
232
|
+
"doctor": "expo-doctor",
|
233
|
+
"eas-build-pre-install": "corepack enable && yarn set version 4"
|
227
234
|
};
|
228
235
|
const packageJsonPath = path.join(config.config.cwd, "package.json");
|
229
236
|
const packageJsonRaw = yield* fs.readFile(packageJsonPath);
|
230
237
|
const packageJson = Schema.decodeUnknownSync(JsonSchema)(packageJsonRaw.toString());
|
231
238
|
packageJson.scripts = {
|
232
239
|
...packageJson.scripts,
|
233
|
-
...newScripts
|
240
|
+
...newScripts,
|
241
|
+
};
|
242
|
+
packageJson.resolutions = {
|
243
|
+
...packageJson.resolutions,
|
244
|
+
...resolutions,
|
245
|
+
};
|
246
|
+
packageJson.expo = {
|
247
|
+
doctor: {
|
248
|
+
reactNativeDirectoryCheck: {
|
249
|
+
listUnknownPackages: false,
|
250
|
+
},
|
251
|
+
}
|
234
252
|
};
|
235
253
|
yield* fs.writeFileString(path.join(config.config.cwd, 'package.json'), JSON.stringify(packageJson, null, 2));
|
236
254
|
yield* fs.remove(path.join(config.config.cwd, "package-lock.json"), { force: true });
|
255
|
+
yield* Command.make("yarn").pipe(Command.stdout("inherit"), // Stream stdout to process.stdout
|
256
|
+
Command.exitCode // Get the exit code
|
257
|
+
);
|
237
258
|
});
|
238
259
|
};
|
239
260
|
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
|
+
};
|
package/files/expo/.yarnrc.yml
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module.exports = function(api) {
|
2
|
-
|
2
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
3
|
+
api.cache(true);
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
+
};
|
@@ -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
|
-
|
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'
|
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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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);
|
package/files/expo/lib/data.ts
CHANGED
@@ -1,45 +1,48 @@
|
|
1
1
|
import { Effect, Schedule, Schema } from 'effect';
|
2
|
-
|
2
|
+
|
3
|
+
import { client, ClientError } from './wix';
|
3
4
|
|
4
5
|
const dataSchema = Schema.Struct({
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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 =
|
14
|
+
const COLLECTION_NAME = 'dailySpiritQuotes';
|
14
15
|
|
15
16
|
export const getQuote = () => Effect.gen(function* () {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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
|
-
|
29
|
+
const randomIndex = Math.floor(Math.random() * count);
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
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
|
-
|
39
|
+
yield* Effect.logDebug(`Fetched ${JSON.stringify(data, null, 2)}`);
|
39
40
|
|
40
|
-
|
41
|
-
|
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
|
-
|
44
|
-
|
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 {
|
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
|
-
|
10
|
+
return twMerge(clsx(inputs));
|
6
11
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
import { polyfillWebCrypto } from
|
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
|
-
|
10
|
-
|
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,34 @@
|
|
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
|
+
|
7
|
+
const config = (() => {
|
8
|
+
let config = getDefaultConfig(__dirname);
|
9
|
+
const { transformer, resolver } = config;
|
10
|
+
config.transformer = {
|
11
|
+
...transformer,
|
12
|
+
};
|
13
|
+
config.resolver = {
|
14
|
+
...resolver,
|
15
|
+
};
|
16
|
+
|
17
|
+
config.resolver.unstable_enablePackageExports = false;
|
18
|
+
|
19
|
+
config.resolver.extraNodeModules = {
|
20
|
+
...config.resolver.extraNodeModules,
|
21
|
+
...require('node-libs-react-native'),
|
22
|
+
// 'node:buffer': require.resolve('buffer/'),
|
23
|
+
// 'node:crypto': require.resolve('react-native-crypto/'),
|
24
|
+
// 'node:util': require.resolve('util/'),
|
25
|
+
// 'node:http': require.resolve('stream-http/'),
|
26
|
+
// 'node:https': require.resolve('https-browserify/'),
|
27
|
+
// 'node:events': require.resolve('events/'),
|
28
|
+
};
|
29
|
+
|
30
|
+
return config;
|
31
|
+
})();
|
32
|
+
console.log('Using Metro config:', JSON.stringify(config, null, 2));
|
33
|
+
module.exports = withNativeWind(config, { input: './global.css' });
|
34
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
diff --git a/build/auth/AppStrategy.js b/build/auth/AppStrategy.js
|
2
|
+
index 36a3bbf1ef7c6e8e52f0eb3d7a20713c505ed483..1c59bf6eda0acf2a3d094a8f665a4c5f75709175 100644
|
3
|
+
--- a/build/auth/AppStrategy.js
|
4
|
+
+++ b/build/auth/AppStrategy.js
|
5
|
+
@@ -1,5 +1,7 @@
|
6
|
+
import { parsePublicKeyIfEncoded } from '../helpers.js';
|
7
|
+
import { getTokenInfo } from '../get-token-info.js';
|
8
|
+
+import { jwtVerify, importSPKI } from 'jose';
|
9
|
+
+
|
10
|
+
/**
|
11
|
+
* Creates an authentication strategy for Wix Apps OAuth installation process.
|
12
|
+
* Use this authentication strategy when making requests to Wix APIs from your Wix App backend.
|
13
|
+
@@ -212,7 +214,6 @@ export function AppStrategy(opts) {
|
14
|
+
if (!opts.publicKey) {
|
15
|
+
throw new Error('Missing public key. Make sure to pass it to the AppStrategy');
|
16
|
+
}
|
17
|
+
- const { jwtVerify, importSPKI } = await import('jose');
|
18
|
+
const publicKey = await importSPKI(parsePublicKeyIfEncoded(opts.publicKey), 'RS256');
|
19
|
+
const decoded = await jwtVerify(token, publicKey, verifyCallerClaims
|
20
|
+
? {
|
@@ -0,0 +1,116 @@
|
|
1
|
+
#!/usr/bin/env ts-node
|
2
|
+
/* eslint-disable no-console */
|
3
|
+
|
4
|
+
/**
|
5
|
+
* This script is used to reset the project to a blank state.
|
6
|
+
* It deletes or moves the /app, /components, /hooks, /scripts, and /constants directories to /app-example based on user input and creates a new /app directory with an index.tsx and _layout.tsx file.
|
7
|
+
* You can remove the `reset-project` script from package.json and safely delete this file after running it.
|
8
|
+
*/
|
9
|
+
|
10
|
+
import fs from 'fs';
|
11
|
+
import path from 'path';
|
12
|
+
import { createInterface } from 'readline/promises';
|
13
|
+
|
14
|
+
const root = process.cwd();
|
15
|
+
const oldDirs = ['app', 'components', 'hooks', 'constants', 'scripts'];
|
16
|
+
const exampleDir = 'app-example';
|
17
|
+
const newAppDir = 'app';
|
18
|
+
const exampleDirPath = path.join(root, exampleDir);
|
19
|
+
|
20
|
+
const indexContent = `import { Text, View } from "react-native";
|
21
|
+
|
22
|
+
export default function Index() {
|
23
|
+
return (
|
24
|
+
<View
|
25
|
+
style={{
|
26
|
+
flex: 1,
|
27
|
+
justifyContent: "center",
|
28
|
+
alignItems: "center",
|
29
|
+
}}
|
30
|
+
>
|
31
|
+
<Text>Edit app/index.tsx to edit this screen.</Text>
|
32
|
+
</View>
|
33
|
+
);
|
34
|
+
}
|
35
|
+
`;
|
36
|
+
|
37
|
+
const layoutContent = `import { Stack } from "expo-router";
|
38
|
+
|
39
|
+
export default function RootLayout() {
|
40
|
+
return <Stack />;
|
41
|
+
}
|
42
|
+
`;
|
43
|
+
|
44
|
+
const moveDirectories = async (userInput: string) => {
|
45
|
+
if (userInput === 'y') {
|
46
|
+
// Create the app-example directory
|
47
|
+
await fs.promises.mkdir(exampleDirPath, { recursive: true });
|
48
|
+
console.log(`📁 /${exampleDir} directory created.`);
|
49
|
+
}
|
50
|
+
|
51
|
+
// Move old directories to new app-example directory or delete them
|
52
|
+
for (const dir of oldDirs) {
|
53
|
+
const oldDirPath = path.join(root, dir);
|
54
|
+
if (fs.existsSync(oldDirPath)) {
|
55
|
+
if (userInput === 'y') {
|
56
|
+
const newDirPath = path.join(root, exampleDir, dir);
|
57
|
+
await fs.promises.rename(oldDirPath, newDirPath);
|
58
|
+
console.log(`➡️ /${dir} moved to /${exampleDir}/${dir}.`);
|
59
|
+
} else {
|
60
|
+
await fs.promises.rm(oldDirPath, { recursive: true, force: true });
|
61
|
+
console.log(`❌ /${dir} deleted.`);
|
62
|
+
}
|
63
|
+
} else {
|
64
|
+
console.log(`➡️ /${dir} does not exist, skipping.`);
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
// Create new /app directory
|
69
|
+
const newAppDirPath = path.join(root, newAppDir);
|
70
|
+
await fs.promises.mkdir(newAppDirPath, { recursive: true });
|
71
|
+
console.log('\n📁 New /app directory created.');
|
72
|
+
|
73
|
+
// Create index.tsx
|
74
|
+
const indexPath = path.join(newAppDirPath, 'index.tsx');
|
75
|
+
await fs.promises.writeFile(indexPath, indexContent);
|
76
|
+
console.log('📄 app/index.tsx created.');
|
77
|
+
|
78
|
+
// Create _layout.tsx
|
79
|
+
const layoutPath = path.join(newAppDirPath, '_layout.tsx');
|
80
|
+
await fs.promises.writeFile(layoutPath, layoutContent);
|
81
|
+
console.log('📄 app/_layout.tsx created.');
|
82
|
+
|
83
|
+
console.log('\n✅ Project reset complete. Next steps:');
|
84
|
+
console.log(
|
85
|
+
`1. Run \`npx expo start\` to start a development server.\n2. Edit app/index.tsx to edit the main screen.${
|
86
|
+
userInput === 'y'
|
87
|
+
? `\n3. Delete the /${exampleDir} directory when you're done referencing it.`
|
88
|
+
: ''
|
89
|
+
}`
|
90
|
+
);
|
91
|
+
};
|
92
|
+
|
93
|
+
const main = async () => {
|
94
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
95
|
+
try {
|
96
|
+
const answer = await rl.question('Do you want to move existing files to /app-example instead of deleting them? (Y/n): ');
|
97
|
+
const userInput = answer.trim().toLowerCase() || 'y';
|
98
|
+
if (userInput === 'y' || userInput === 'n') {
|
99
|
+
await moveDirectories(userInput);
|
100
|
+
} else {
|
101
|
+
console.log("❌ Invalid input. Please enter 'Y' or 'N'.");
|
102
|
+
process.exit(1);
|
103
|
+
}
|
104
|
+
} catch (error) {
|
105
|
+
if (error instanceof Error) {
|
106
|
+
console.error(`❌ Error during script execution: ${error.message}`);
|
107
|
+
} else {
|
108
|
+
console.error('❌ An unexpected error occurred:', error);
|
109
|
+
}
|
110
|
+
process.exit(1);
|
111
|
+
} finally {
|
112
|
+
rl.close();
|
113
|
+
}
|
114
|
+
};
|
115
|
+
|
116
|
+
void main();
|