lucy-cli 1.2.4 → 2.0.0-alpha.1

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 (173) hide show
  1. package/README.md +4 -3
  2. package/dist/args.d.ts +7 -0
  3. package/dist/args.js +23 -0
  4. package/dist/commands.d.ts +3 -0
  5. package/dist/commands.js +18 -0
  6. package/dist/config.d.ts +20 -0
  7. package/dist/config.js +39 -0
  8. package/dist/error.d.ts +17 -0
  9. package/dist/error.js +5 -0
  10. package/dist/helpers.d.ts +1 -32
  11. package/dist/helpers.js +6 -261
  12. package/dist/index.d.ts +2 -52
  13. package/dist/index.js +25 -282
  14. package/dist/init.d.ts +4 -8
  15. package/dist/init.js +245 -160
  16. package/dist/params.d.ts +7 -0
  17. package/dist/params.js +23 -0
  18. package/dist/policy.d.ts +3 -0
  19. package/dist/policy.js +5 -0
  20. package/dist/prepare.d.ts +0 -8
  21. package/dist/prepare.js +20 -19
  22. package/dist/runtime.d.ts +5 -0
  23. package/dist/runtime.js +11 -0
  24. package/dist/schemas/index.d.ts +2 -0
  25. package/dist/schemas/index.js +2 -0
  26. package/dist/schemas/types.js +1 -0
  27. package/dist/states.d.ts +10 -0
  28. package/dist/states.js +7 -0
  29. package/files/expo/.env +1 -0
  30. package/files/expo/.nvmrc +1 -0
  31. package/files/expo/.prettierignore +23 -0
  32. package/files/expo/.prettierrc.json +16 -0
  33. package/files/expo/.yarnrc +1 -0
  34. package/files/expo/.yarnrc.yml +3 -0
  35. package/files/expo/app/(tabs)/_layout.tsx +45 -0
  36. package/files/expo/app/_layout.tsx +45 -0
  37. package/files/expo/babel.config.js +9 -0
  38. package/files/expo/constants/Colors.ts +27 -0
  39. package/files/expo/constants/theme.ts +18 -0
  40. package/files/expo/eas.json +26 -0
  41. package/files/expo/eslint.config.js +185 -0
  42. package/files/expo/global.css +47 -0
  43. package/files/expo/hooks/useColorScheme.ts +11 -0
  44. package/files/expo/hooks/useColorScheme.web.ts +21 -0
  45. package/files/expo/hooks/useColorSchemeRN.ts +1 -0
  46. package/files/expo/hooks/useThemeColor.ts +21 -0
  47. package/files/expo/lib/data.ts +45 -0
  48. package/files/expo/lib/utils/index.ts +6 -0
  49. package/files/expo/lib/utils/polyfills.ts +29 -0
  50. package/files/expo/lib/wix/client.ts +14 -0
  51. package/files/expo/lib/wix/index.ts +1 -0
  52. package/files/expo/lucy.json +8 -0
  53. package/files/expo/readme.md +45 -0
  54. package/files/expo/tailwind.config.js +198 -0
  55. package/files/expo/tsconfig.json +40 -0
  56. package/files/expo/types/nativewind-env.d.ts +1 -0
  57. package/files/expo/types/reset.d.ts +1 -0
  58. package/files/velo/typescript/styles/global.scss +0 -0
  59. package/package.json +14 -11
  60. package/src/args.ts +36 -0
  61. package/src/commands.ts +21 -0
  62. package/src/config.ts +61 -0
  63. package/src/error.ts +4 -0
  64. package/src/helpers.ts +7 -305
  65. package/src/index.ts +29 -362
  66. package/src/init.ts +345 -177
  67. package/src/policy.ts +6 -0
  68. package/src/prepare.ts +19 -19
  69. package/src/runtime.ts +20 -0
  70. package/src/schemas/index.ts +3 -0
  71. package/src/schemas/types.ts +0 -0
  72. package/src/states.ts +15 -0
  73. package/{src/Gulpfile.ts → src copy/Gulpfile.ts } +3 -1
  74. package/{src/gulp/backend.ts → src copy/gulp/backend.ts } +3 -12
  75. package/{src/gulp/checks.ts → src copy/gulp/checks.ts } +2 -6
  76. package/{src/gulp/copy.ts → src copy/gulp/copy.ts } +1 -6
  77. package/src copy/gulp/helpers.ts +26 -0
  78. package/{src/gulp/public.ts → src copy/gulp/public.ts } +1 -6
  79. package/{src/gulp/styles.ts → src copy/gulp/styles.ts } +2 -7
  80. package/{src/gulp/templates.ts → src copy/gulp/templates.ts } +1 -6
  81. package/src copy/helpers.ts +307 -0
  82. package/src copy/index.ts +379 -0
  83. package/src copy/init.ts +183 -0
  84. package/src copy/models.ts +35 -0
  85. package/src copy/prepare.ts +24 -0
  86. package/src copy/schemas/index.ts +0 -0
  87. package/src copy/schemas/types.ts +0 -0
  88. package/src copy/settings.json +67 -0
  89. package/src copy/types.d.ts +8 -0
  90. package/dist/Gulpfile.d.ts +0 -33
  91. package/dist/Gulpfile.js +0 -114
  92. package/dist/cli.d.ts +0 -2
  93. package/dist/cli.js +0 -44
  94. package/dist/dev.d.ts +0 -2
  95. package/dist/dev.js +0 -14
  96. package/dist/gulp/backend copy.d.ts +0 -4
  97. package/dist/gulp/backend copy.js +0 -50
  98. package/dist/gulp/backend.d.ts +0 -3
  99. package/dist/gulp/backend.js +0 -101
  100. package/dist/gulp/checks.d.ts +0 -3
  101. package/dist/gulp/checks.js +0 -209
  102. package/dist/gulp/clean copy.d.ts +0 -2
  103. package/dist/gulp/clean copy.js +0 -19
  104. package/dist/gulp/clean.d.ts +0 -3
  105. package/dist/gulp/clean.js +0 -28
  106. package/dist/gulp/copy.d.ts +0 -2
  107. package/dist/gulp/copy.js +0 -38
  108. package/dist/gulp/docs.d.ts +0 -2
  109. package/dist/gulp/docs.js +0 -27
  110. package/dist/gulp/helpers.d.ts +0 -1
  111. package/dist/gulp/helpers.js +0 -7
  112. package/dist/gulp/pages copy.d.ts +0 -3
  113. package/dist/gulp/pages copy.js +0 -22
  114. package/dist/gulp/pages.d.ts +0 -2
  115. package/dist/gulp/pages.js +0 -36
  116. package/dist/gulp/pipeline.d.ts +0 -1
  117. package/dist/gulp/pipeline.js +0 -28
  118. package/dist/gulp/public.d.ts +0 -2
  119. package/dist/gulp/public.js +0 -54
  120. package/dist/gulp/styles.d.ts +0 -2
  121. package/dist/gulp/styles.js +0 -44
  122. package/dist/gulp/templates.d.ts +0 -2
  123. package/dist/gulp/templates.js +0 -37
  124. package/dist/gulp/test.d.ts +0 -2
  125. package/dist/gulp/test.js +0 -26
  126. package/dist/gulp/types.d.ts +0 -4
  127. package/dist/gulp/types.js +0 -288
  128. package/dist/gulp/watchers.d.ts +0 -9
  129. package/dist/gulp/watchers.js +0 -58
  130. package/dist/init copy.d.ts +0 -8
  131. package/dist/init copy.js +0 -167
  132. package/dist/install.d.ts +0 -2
  133. package/dist/install.js +0 -53
  134. package/dist/settings.json +0 -67
  135. package/dist/start_gulp.d.ts +0 -2
  136. package/dist/start_gulp.js +0 -14
  137. package/dist/sync.d.ts +0 -2
  138. package/dist/sync.js +0 -87
  139. package/src/gulp/helpers.ts +0 -9
  140. /package/{files/.gitmodules → dist/schemas/types.d.ts} +0 -0
  141. /package/files/{typescript/__mocks__/.gitkeep → velo/.gitmodules} +0 -0
  142. /package/files/{.madgerc → velo/.madgerc} +0 -0
  143. /package/files/{.nvmrc → velo/.nvmrc} +0 -0
  144. /package/files/{.stylelintrc.js → velo/.stylelintrc.js} +0 -0
  145. /package/files/{.yarnrc.yml → velo/.yarnrc.yml} +0 -0
  146. /package/files/{currents.config.js → velo/currents.config.js} +0 -0
  147. /package/files/{cypress → velo/cypress}/e2e/base/base.cy.ts +0 -0
  148. /package/files/{cypress → velo/cypress}/fixtures/example.json +0 -0
  149. /package/files/{cypress → velo/cypress}/support/commands.ts +0 -0
  150. /package/files/{cypress → velo/cypress}/support/e2e.ts +0 -0
  151. /package/files/{cypress → velo/cypress}/tsconfig.json +0 -0
  152. /package/files/{cypress.config.mjs → velo/cypress.config.mjs} +0 -0
  153. /package/files/{eslint.config.mjs → velo/eslint.config.mjs} +0 -0
  154. /package/files/{local.tsconfig.json → velo/local.tsconfig.json} +0 -0
  155. /package/files/{typedoc.json → velo/typedoc.json} +0 -0
  156. /package/files/{typescript/pages → velo/typescript/__mocks__}/.gitkeep +0 -0
  157. /package/files/{typescript → velo/typescript}/backend/data.ts +0 -0
  158. /package/files/{typescript → velo/typescript}/backend/events.ts +0 -0
  159. /package/files/{typescript → velo/typescript}/backend/http-functions.ts +0 -0
  160. /package/files/{typescript → velo/typescript}/backend/lib/http-functions/sync.ts +0 -0
  161. /package/files/{typescript → velo/typescript}/backend/permissions.json +0 -0
  162. /package/files/{typescript/public → velo/typescript/pages}/.gitkeep +0 -0
  163. /package/files/{typescript/styles → velo/typescript/public}/.gitkeep +0 -0
  164. /package/files/{typescript → velo/typescript}/public/scss/app.scss +0 -0
  165. /package/files/{typescript/styles/global.scss → velo/typescript/styles/.gitkeep} +0 -0
  166. /package/files/{typescript → velo/typescript}/tsconfig.json +0 -0
  167. /package/files/{vitest.config.ts → velo/vitest.config.ts} +0 -0
  168. /package/{src → src copy}/gulp/clean.ts +0 -0
  169. /package/{src → src copy}/gulp/pages.ts +0 -0
  170. /package/{src → src copy}/gulp/pipeline.ts +0 -0
  171. /package/{src → src copy}/gulp/types.ts +0 -0
  172. /package/{src → src copy}/gulp/watchers.ts +0 -0
  173. /package/{src → src copy}/sync.ts +0 -0
@@ -1,288 +0,0 @@
1
- import gulp from 'gulp';
2
- import * as path from 'path';
3
- import replace from 'gulp-string-replace';
4
- import flatmap from 'gulp-flatmap';
5
- import jeditor from 'gulp-json-editor';
6
- import merge from 'merge-stream';
7
- import * as insert from 'gulp-insert';
8
- import { blue, orange, red, yellow } from '../index.js';
9
- import tap from 'gulp-tap';
10
- export function updateWixTypes(options) {
11
- return () => {
12
- const { publicSettings, backendSettings, masterSettings, pageSettings, replaceOptions } = options;
13
- let count = 0;
14
- const modules = Object.assign({}, options.projectSettings?.modules, options.projectSettings?.lucySettings?.modules);
15
- let localModules = undefined;
16
- if (options.projectSettings?.lucySettings) {
17
- localModules = options.projectSettings.lucySettings.modules;
18
- }
19
- // Add module to publicSettings
20
- publicSettings.compilerOptions.paths['backend/*.web'] = ["../../../typescript/backend/*.web.ts"];
21
- publicSettings.compilerOptions.paths['backend/*.web.js'] = ["../../../typescript/backend/*.web.ts"];
22
- publicSettings.compilerOptions.paths['backend/*'] = ["../../../typescript/backend/*.web.ts"];
23
- publicSettings.compilerOptions.paths['backend/*.jsw'] = ["../../../typescript/backend/*.jsw.ts"];
24
- publicSettings.compilerOptions.paths.mocks = ["../../../typescript/__mocks__/*"];
25
- publicSettings.compilerOptions.paths['types/*'] = ["../../../typescript/types/*"];
26
- publicSettings.compilerOptions.paths['public/*'] = ["../../../typescript/public/*.ts"];
27
- publicSettings.include = [
28
- "../../../typescript/public/**/*",
29
- "../../../typescript/__mocks__/**/*",
30
- // "../../../typescript/backend/**/*.jsw.ts",
31
- // "../../../typescript/backend/**/*.web.ts",
32
- // "../../../typescript/backend/**/*.web"
33
- ];
34
- // Add module to backendSettings
35
- backendSettings.compilerOptions.paths.mocks = ["../../../typescript/__mocks__/*"];
36
- backendSettings.compilerOptions.paths['types/*'] = [`../../../typescript/types/*`];
37
- backendSettings.include = [
38
- "../../../typescript/backend/**/*",
39
- "../../../typescript/__mocks__/**/*",
40
- // "../../../typescript/backend/**/*.jsw.ts",
41
- // "../../../typescript/backend/**/*.web.ts",
42
- // "../../../typescript/backend/**/*.web"
43
- ];
44
- // Add module to masterSettings
45
- masterSettings.compilerOptions.paths['backend/*.web'] = ["../../../typescript/backend/*.web.ts"];
46
- masterSettings.compilerOptions.paths['backend/*.web.js'] = ["../../../typescript/backend/*.web.ts"];
47
- masterSettings.compilerOptions.paths['backend/*'] = ["../../../typescript/backend/*.web.ts"];
48
- masterSettings.compilerOptions.paths['backend/*.jsw'] = ["../../../typescript/backend/*.jsw.ts"];
49
- masterSettings.compilerOptions.paths['types/*'] = ["../../../typescript/types/*"];
50
- masterSettings.include = [
51
- "../../../typescript/public/**/*",
52
- "../../../typescript/__mocks__/**/*",
53
- // "../../../typescript/backend/**/*.jsw.ts",
54
- // "../../../typescript/backend/**/*.web.ts",
55
- // "../../../typescript/backend/**/*.web"
56
- ];
57
- // Add module to pageSettings
58
- pageSettings.compilerOptions.paths['backend/*.web'] = ["../../../typescript/backend/*.web.ts"];
59
- pageSettings.compilerOptions.paths['backend/*.web.js'] = ["../../../typescript/backend/*.web.ts"];
60
- pageSettings.compilerOptions.paths['backend/*'] = ["../../../typescript/backend/*.web.ts"];
61
- pageSettings.compilerOptions.paths['backend/*.jsw'] = ["../../../typescript/backend/*.jsw.ts"];
62
- pageSettings.compilerOptions.paths['types/*'] = ["../../../typescript/types/*"];
63
- pageSettings.compilerOptions.paths['backend/*.jsw'] = ["../../../typescript/backend/*.jsw.ts"];
64
- pageSettings.include = [
65
- "../../../typescript/public/**/*",
66
- "../../../typescript/__mocks__/**/*",
67
- // "../../../typescript/backend/**/*.jsw.ts",
68
- // "../../../typescript/backend/**/*.web.ts",
69
- // "../../../typescript/backend/**/*.web"
70
- ];
71
- if (modules) {
72
- for (const [name] of Object.entries(modules)) {
73
- // Add module to publicSettings
74
- publicSettings.compilerOptions.paths['backend/*.web.js'].push(`../../../${name}/backend/*.web.ts`);
75
- publicSettings.compilerOptions.paths['backend/*.web'].push(`../../../${name}/backend/*.web.ts`);
76
- publicSettings.compilerOptions.paths['backend/*'].push(`../../../${name}/backend/*.web.ts`);
77
- publicSettings.compilerOptions.paths['backend/*.jsw'].push(`../../../${name}/backend/*.jsw.ts`);
78
- publicSettings.compilerOptions.paths['public/*'].push(`../../../${name}/public/*`);
79
- publicSettings.compilerOptions.paths.mocks.push(...[`../../../${name}/__mocks__/*`]);
80
- publicSettings.compilerOptions.paths['types/*'].push(`../../../${name}/types/*`);
81
- publicSettings.include.push(...[
82
- `../../../${name}/public/**/*`,
83
- `../../../${name}__mocks__/**/*`,
84
- // `../../../${name}/backend/**/*.jsw.ts`,
85
- // `../../../${name}/backend/**/*.web.ts`,
86
- // `../../../${name}/backend/**/*.web`
87
- ]);
88
- // Add module to backendSettings
89
- backendSettings.compilerOptions.paths['public/*'].push(`../../../${name}/public/*`);
90
- backendSettings.compilerOptions.paths['backend/*'].push(`../../../${name}/backend/*`);
91
- backendSettings.compilerOptions.paths.mocks.push(...[`../../../${name}/__mocks__/*`]);
92
- backendSettings.compilerOptions.paths['types/*'].push(`../../../${name}/types/*`);
93
- backendSettings.include.push(...[
94
- `../../../${name}/public/**/*`,
95
- `../../../${name}__mocks__/**/*`,
96
- `../../../${name}/backend/**/*`,
97
- // `../../../${name}/backend/**/*.jsw.ts`,
98
- // `../../../${name}/backend/**/*.web.ts`,
99
- // `../../../${name}/backend/**/*.web`
100
- ]);
101
- // Add module to masterSettings
102
- masterSettings.compilerOptions.paths['backend/*.web.js'].push(`../../../${name}/backend/*.web.ts`);
103
- masterSettings.compilerOptions.paths['backend/*.web'].push(`../../../${name}/backend/*.web.ts`);
104
- masterSettings.compilerOptions.paths['backend/*'].push(`../../../${name}/backend/*.web.ts`);
105
- masterSettings.compilerOptions.paths['backend/*.jsw'].push(`../../../${name}/backend/*.jsw.ts`);
106
- masterSettings.compilerOptions.paths['public/*'].push(`../../../${name}/public/*`);
107
- masterSettings.compilerOptions.paths['types/*'].push(`../../../${name}/types/*`);
108
- masterSettings.include.push(...[
109
- `../../../${name}/public/**/*`,
110
- `../../../${name}__mocks__/**/*`,
111
- // `../../../${name}/backend/**/*.jsw.ts`,
112
- // `../../../${name}/backend/**/*.web.ts`,
113
- // `../../../${name}/backend/**/*.web`
114
- ]);
115
- // Add module to pageSettings
116
- pageSettings.compilerOptions.paths['backend/*.web.js'].push(`../../../${name}/backend/*.web.ts`);
117
- pageSettings.compilerOptions.paths['backend/*.web'].push(`../../../${name}/backend/*.web.ts`);
118
- pageSettings.compilerOptions.paths['backend/*'].push(`../../../${name}/backend/*.web.ts`);
119
- pageSettings.compilerOptions.paths['backend/*.jsw'].push(`../../../${name}/backend/*.jsw.ts`);
120
- pageSettings.compilerOptions.paths['public/*'].push(`../../../${name}/public/*`);
121
- pageSettings.compilerOptions.paths['types/*'].push(`../../../${name}/types/*`);
122
- pageSettings.include.push(...[
123
- `../../../${name}/public/**/*`,
124
- `../../../${name}__mocks__/**/*`,
125
- // `../../../${name}/backend/**/*.jsw.ts`,
126
- // `../../../${name}/backend/**/*.web.ts`,
127
- // `../../../${name}/backend/**/*.web`
128
- ]);
129
- }
130
- }
131
- return gulp.src(['./.wix/types/**/*.json', '!./.wix/types/wix-code-types/**/*'])
132
- .pipe(flatmap(function (stream, file) {
133
- count++;
134
- if (file.dirname.endsWith('public')) {
135
- return stream.pipe(jeditor(publicSettings))
136
- .pipe(jeditor((json) => cleanTsConfig(json)))
137
- .pipe(jeditor((json) => processJson(json)))
138
- .pipe(replace('"../backend.d.ts",', '', replaceOptions))
139
- .pipe(replace('"../../../src/backend/\\*\\*/\\*.web.js",', '', replaceOptions));
140
- }
141
- if (file.dirname.endsWith('backend')) {
142
- return stream.pipe(jeditor(backendSettings))
143
- .pipe(jeditor((json) => cleanTsConfig(json)))
144
- .pipe(jeditor((json) => processJson(json)));
145
- }
146
- ;
147
- if (file.dirname.endsWith('masterPage')) {
148
- return stream.pipe(jeditor(masterSettings))
149
- .pipe(jeditor((json) => cleanTsConfig(json)))
150
- .pipe(jeditor((json) => processJson(json)))
151
- .pipe(replace('"../backend.d.ts",', '', replaceOptions))
152
- .pipe(replace('"../../../src/backend/\\*\\*/\\*.web.js",', '', replaceOptions));
153
- }
154
- ;
155
- return stream.pipe(jeditor(pageSettings))
156
- .pipe(jeditor((json) => cleanTsConfig(json)))
157
- .pipe(jeditor((json) => processJson(json)))
158
- .pipe(replace('"../backend.d.ts",', '', replaceOptions))
159
- .pipe(replace('"../../../src/backend/\\*\\*/\\*.web.js",', '', replaceOptions));
160
- }))
161
- .pipe(replace('masterPage.masterPage.js', 'masterPage.ts', replaceOptions))
162
- .pipe(replace('/src/', '/typescript/', replaceOptions))
163
- .pipe(replace('.js"', '.ts"', replaceOptions))
164
- .pipe(tap(function (file) {
165
- // console.debug(file.contents?.toString() ?? 'no content'); TODO: Uncomment when needed
166
- }))
167
- .pipe(gulp.dest((file) => {
168
- const filePath = file.dirname;
169
- const outputDir = path.dirname(filePath);
170
- return path.join(outputDir);
171
- }))
172
- .on('error', function (e) {
173
- console.log("💩" + red.underline.bold('Modification of WIX configs failed!'));
174
- console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
175
- this.emit('end');
176
- })
177
- .on('end', function () { console.log("🐶" + blue.underline(`Modification of ${yellow(count)} WIX configs succeeded!`)); });
178
- };
179
- }
180
- export function addTypes(options, done) {
181
- const { replaceOptions } = options;
182
- // Regex to match keywords at the beginning of a line, capturing any leading whitespace.
183
- // The 'm' flag is for multiline matching (^ matches start of line).
184
- // The 'g' flag is for global matching (replace all instances).
185
- const interfaceRegex = /^(\s*)interface\s/gm;
186
- const enumRegex = /^(\s*)enum\s/gm;
187
- const typeRegex = /^(\s*)type\s/gm;
188
- const exportTypes = gulp.src(['./.wix/types/wix-code-types/dist/types/common/*.d.ts', '!./.wix/types/wix-code-types/dist/types/common/$w.d.ts'])
189
- // The replacement string '$1export...' uses the captured whitespace to preserve indentation.
190
- .pipe(replace(interfaceRegex, 'export interface ', replaceOptions))
191
- .pipe(replace(enumRegex, 'export enum ', replaceOptions))
192
- .pipe(replace(typeRegex, 'export type ', replaceOptions))
193
- .pipe(gulp.dest('./.wix/types/wix-code-types/dist/types/common/'));
194
- const exportTypesBeta = gulp.src(['./.wix/types/wix-code-types/dist/types/beta/common/*.d.ts', '!./.wix/types/wix-code-types/dist/types/beta/common/$w.d.ts'])
195
- .pipe(replace(interfaceRegex, '$1export interface ', replaceOptions))
196
- .pipe(replace(enumRegex, 'export enum ', replaceOptions))
197
- .pipe(replace(typeRegex, 'export type ', replaceOptions))
198
- .pipe(gulp.dest('./.wix/types/wix-code-types/dist/types/beta/common/'));
199
- const processCommon = gulp.src(['./.wix/types/wix-code-types/dist/types/common/$w.d.ts'])
200
- .pipe(insert.prepend("import '@total-typescript/ts-reset';\n"))
201
- .pipe(gulp.dest('./.wix/types/wix-code-types/dist/types/common/'));
202
- return merge(processCommon, exportTypesBeta, exportTypes)
203
- .on('error', function (e) {
204
- console.log("💩" + red.underline.bold(' => Updating WIX failed!'));
205
- console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
206
- this.emit('end');
207
- done();
208
- })
209
- .on('end', function () {
210
- console.log("🐶" + blue.underline(' => Updating WIX succeeded!'));
211
- done();
212
- });
213
- }
214
- ;
215
- function makeHashable(obj) {
216
- if (Array.isArray(obj)) {
217
- return obj.map(makeHashable);
218
- }
219
- else if (obj && typeof obj === 'object') {
220
- const sortedKeys = Object.keys(obj).sort();
221
- const result = {};
222
- for (const key of sortedKeys) {
223
- result[key] = makeHashable(obj[key]);
224
- }
225
- return result;
226
- }
227
- else {
228
- return obj;
229
- }
230
- }
231
- function removeDuplicatesFromArray(arr) {
232
- const seen = new Set();
233
- const newArr = [];
234
- for (const item of arr) {
235
- const processedItem = processJson(item); // Recursively process the item
236
- const hashableItem = makeHashable(processedItem);
237
- const serializedItem = JSON.stringify(hashableItem);
238
- if (!seen.has(serializedItem)) {
239
- seen.add(serializedItem);
240
- newArr.push(processedItem);
241
- }
242
- }
243
- return newArr;
244
- }
245
- function processJson(obj) {
246
- if (Array.isArray(obj)) {
247
- // Process arrays and remove duplicate items
248
- const uniqueArray = removeDuplicatesFromArray(obj);
249
- return uniqueArray.length > 0 ? uniqueArray : undefined; // Remove empty arrays
250
- }
251
- else if (obj && typeof obj === 'object') {
252
- // Process objects, ensuring keys are unique
253
- const result = {};
254
- const seenKeys = new Set();
255
- for (const key in obj) {
256
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
257
- if (!seenKeys.has(key)) {
258
- const processedValue = processJson(obj[key]);
259
- if (processedValue !== undefined) { // Remove keys with undefined values
260
- seenKeys.add(key);
261
- result[key] = processedValue;
262
- }
263
- }
264
- }
265
- }
266
- // If all keys were empty or undefined, return undefined
267
- return Object.keys(result).length > 0 ? result : undefined;
268
- }
269
- else {
270
- // Return primitive values as-is
271
- return obj;
272
- }
273
- }
274
- function cleanTsConfig(json) {
275
- // const paths: Record<string, string[]> = {};
276
- if (json.compilerOptions?.paths) {
277
- for (const [key, value] of Object.entries(json.compilerOptions.paths)) {
278
- const uniquePaths = new Set(value);
279
- json.compilerOptions.paths[key] = Array.from(uniquePaths);
280
- // paths[key] = Array.from(uniquePaths);
281
- }
282
- // json.compilerOptions.paths = paths;
283
- }
284
- json.include = Array.from(new Set(json.include));
285
- json.exclude = Array.from(new Set(json.exclude));
286
- json.files = Array.from(new Set(json.files));
287
- return json;
288
- }
@@ -1,9 +0,0 @@
1
- import { TaskOptions } from '../Gulpfile.js';
2
- export declare function watchSCSS(): import("fs").FSWatcher;
3
- export declare function watchBackend(): import("fs").FSWatcher;
4
- export declare function watchPublic(): import("fs").FSWatcher;
5
- export declare function watchPages(): import("fs").FSWatcher;
6
- export declare function watchFiles(): import("fs").FSWatcher;
7
- export declare function watchTemplates(): import("fs").FSWatcher;
8
- export declare function watchTypes(): import("fs").FSWatcher;
9
- export declare function watchAll(options: TaskOptions): import("undertaker").TaskFunction;
@@ -1,58 +0,0 @@
1
- import gulp from 'gulp';
2
- import { green } from '../index.js';
3
- import { buildBackend } from './backend.js';
4
- import { buildPublic } from './public.js';
5
- import { buildPages } from './pages.js';
6
- import { copyFiles } from './copy.js';
7
- import { previewTemplates } from './templates.js';
8
- import { checkTs } from './checks.js';
9
- let taskOptions;
10
- export function watchSCSS() {
11
- return gulp.watch([
12
- '*/styles/**/*.scss'
13
- ], gulp.parallel('scss'));
14
- }
15
- export function watchBackend() {
16
- return gulp.watch([
17
- '*/backend/**/*.ts',
18
- '*/backend/**/*.tsx',
19
- '!*/backend/**/*.jsw.ts',
20
- '!src/**/**',
21
- ], gulp.parallel(checkTs(taskOptions), buildBackend(taskOptions)));
22
- }
23
- export function watchPublic() {
24
- return gulp.watch([
25
- '*/public/**/*.ts',
26
- '*/public/**/*.tsx',
27
- ], gulp.parallel(checkTs(taskOptions), buildPublic(taskOptions)));
28
- }
29
- export function watchPages() {
30
- return gulp.watch('typescript/pages/**/*.ts', gulp.parallel(checkTs(taskOptions), buildPages(taskOptions)));
31
- }
32
- export function watchFiles() {
33
- return gulp.watch([
34
- '*/backend/**/*',
35
- '*/public/**/*',
36
- '*/pages/**/*',
37
- '!*/**/*.ts',
38
- '!*/**/*.tsx',
39
- ], gulp.parallel(copyFiles(taskOptions)));
40
- }
41
- export function watchTemplates() {
42
- return gulp.watch([
43
- '*/backend/templates/**/*.tsx',
44
- '*/backend/templates/data/*.json',
45
- '!*/backend/templates/render.ts',
46
- ], gulp.parallel(previewTemplates(taskOptions), checkTs(taskOptions)));
47
- }
48
- export function watchTypes() {
49
- return gulp.watch([
50
- './.wix/types/**/*.d.ts',
51
- '!./.wix/types/wix-code-types'
52
- ], gulp.series('fix-wixtypes'));
53
- }
54
- export function watchAll(options) {
55
- taskOptions = options;
56
- console.log("🐕" + green.underline.bold(' => Adding watchers...'));
57
- return gulp.parallel(watchSCSS, watchBackend, watchPublic, watchPages, watchFiles, watchTemplates, watchTypes);
58
- }
@@ -1,8 +0,0 @@
1
- import { ModuleSettings, ProjectSettings } from './index.js';
2
- /**
3
- * Init Lucy project
4
- * @param {string} cwd Current working directory
5
- * @param {string} packageRoot Package root directory
6
- * @returns {void}
7
- */
8
- export declare function init(moduleSettings: ModuleSettings, projectSettings: ProjectSettings): Promise<void>;
@@ -1,167 +0,0 @@
1
- import chalk from 'chalk';
2
- import { existsSync, mkdirSync, promises as fsPromises } from 'fs';
3
- import fse from 'fs-extra';
4
- import { join } from 'path';
5
- import { simpleGit } from 'simple-git';
6
- import fs from 'fs/promises';
7
- import { spawnSync } from 'child_process';
8
- import path from 'path';
9
- import { blue, green, orange, red } from './index.js';
10
- /**
11
- * Init Lucy project
12
- * @param {string} cwd Current working directory
13
- * @param {string} packageRoot Package root directory
14
- * @returns {void}
15
- */
16
- export async function init(moduleSettings, projectSettings) {
17
- if (projectSettings.packageJSON && projectSettings.packageJSON.wixLucy?.initialized && !moduleSettings.args.includes('-f')) {
18
- console.log((`💩 ${red.underline.bold("=> This project is already initialized =>")} ${orange(moduleSettings.targetFolder)}`));
19
- return;
20
- }
21
- await copyFolder(join(moduleSettings.packageRoot, 'files'), moduleSettings.targetFolder);
22
- await editJson(moduleSettings.packageJsonPath, ['type', 'scripts', 'wixLucy'], ['module', moduleSettings.settings.scripts, moduleSettings.settings.lucySettings]);
23
- await stringReplace(join(moduleSettings.targetFolder, 'currents.config.js'), ['__ProjectName__'], [path.basename(moduleSettings.targetFolder)]);
24
- await installPackages(moduleSettings.settings.wixPackages, moduleSettings.settings.devPackages, moduleSettings.targetFolder);
25
- await editJson(join(moduleSettings.targetFolder, 'jsconfig.json'), ['compilerOptions', 'exclude'], [moduleSettings.settings.wixSettings.compilerOptions, moduleSettings.settings.wixSettings.exclude]);
26
- await editJson(join(moduleSettings.targetFolder, 'typedoc.json'), ['name'], [path.basename(moduleSettings.targetFolder)]);
27
- await gitInit(moduleSettings.targetFolder, projectSettings?.lucySettings?.modules ? projectSettings?.lucySettings?.modules : moduleSettings.settings.modules);
28
- console.log(chalk.greenBright.underline('🐶 => Initialization done!'));
29
- }
30
- /**
31
- * Copy files from source to target
32
- * @param {string} source Source folder
33
- * @param {string} target Target folder
34
- * @returns {Promise<void>}
35
- */
36
- async function copyFolder(source, target) {
37
- if (!existsSync(target)) {
38
- console.log((`💩 ${red.underline.bold("=> Target folder doesn't exist =>")} ${orange(target)}`));
39
- return;
40
- }
41
- try {
42
- const files = await fsPromises.readdir(source);
43
- for (const file of files) {
44
- const sourcePath = join(source, file);
45
- const targetPath = join(target, file);
46
- if (file === 'lucy.json' && existsSync(targetPath)) {
47
- continue;
48
- }
49
- const stats = await fsPromises.stat(sourcePath);
50
- if (stats.isDirectory()) {
51
- if (!existsSync(file)) {
52
- mkdirSync(file);
53
- }
54
- await fse.copySync(sourcePath, targetPath, { overwrite: true });
55
- }
56
- else {
57
- fse.copySync(sourcePath, targetPath, { overwrite: true });
58
- }
59
- }
60
- }
61
- catch (err) {
62
- console.log((`💩 ${red.underline.bold("=> There was an error while copying files =>")} ${orange(err)}`));
63
- }
64
- finally {
65
- console.log("🐕" + blue.underline.bold(' => Copy files completed!'));
66
- }
67
- }
68
- /**
69
- * Edit Json files
70
- * @param {string} filePath File path
71
- * @param {string[]} keys Keys to edit
72
- * @param {string[]} values Values to edit
73
- * @returns {void}
74
- */
75
- async function editJson(filePath, keys, values) {
76
- try {
77
- const data = await fs.readFile(filePath, 'utf8');
78
- let jsonData;
79
- try {
80
- jsonData = JSON.parse(data);
81
- }
82
- catch (parseError) {
83
- console.log((`💩 ${red.underline.bold("=> Error parsing JSON =>")} ${orange(parseError)}`));
84
- return;
85
- }
86
- for (const key of keys) {
87
- const index = keys.indexOf(key);
88
- const value = values[index];
89
- jsonData[key] = value;
90
- }
91
- const updatedJsonData = JSON.stringify(jsonData, null, 2);
92
- await fs.writeFile(filePath, updatedJsonData, 'utf8');
93
- }
94
- catch (err) {
95
- console.log((`💩 ${red.underline.bold("=> Error editing JSON Data =>")} ${orange(err)}`));
96
- }
97
- finally {
98
- console.log("🐕" + blue.underline(` => Updated file ${orange(filePath)}`));
99
- }
100
- }
101
- async function stringReplace(filePath, keys, values) {
102
- try {
103
- let modifiedContent = '';
104
- const data = await fs.readFile(filePath, 'utf8');
105
- for (const key of keys) {
106
- const index = keys.indexOf(key);
107
- const value = values[index];
108
- const regex = new RegExp(`${key}`, 'g');
109
- modifiedContent = data.replace(regex, `${value}`);
110
- }
111
- await fs.writeFile(filePath, modifiedContent, 'utf8');
112
- }
113
- catch (err) {
114
- console.log((`💩 ${red.underline.bold("=> During string replace =>")} ${orange(err)}`));
115
- }
116
- finally {
117
- console.log(blue.underline(`🐕 => Updated file ${orange(filePath)}`));
118
- }
119
- }
120
- async function installPackages(wixPackages, devPackages, cwd) {
121
- const wixPackageNames = Object.keys(wixPackages);
122
- const devPackageNames = Object.keys(devPackages);
123
- const devPackageVersions = Object.values(devPackages);
124
- const devPackageNamesAndVersions = devPackageNames.map((name, index) => `${name}@${devPackageVersions[index]}`);
125
- let success = true;
126
- wixPackageNames.forEach((name, index) => {
127
- console.log(`🐕 => Installing ${orange(name)}`);
128
- const wixInstall = `wix install ${name}`;
129
- const wixres = spawnSync(wixInstall, { shell: true, stdio: 'inherit' });
130
- if (wixres.error) {
131
- console.log((`💩 ${red.underline.bold("=> Failed to install package =>")} ${orange(wixres.error.message)}`));
132
- success = false;
133
- }
134
- else {
135
- console.log("🐕" + blue.underline(` => Package installed!`));
136
- }
137
- });
138
- const yarnAdd = `yarn add -D ${devPackageNamesAndVersions.join(' ')}`;
139
- const yarnRes = spawnSync(yarnAdd, { shell: true, stdio: 'inherit' });
140
- if (yarnRes.error) {
141
- success = false;
142
- console.log((`💩 ${red.underline.bold("=> Failed to install dev packages =>")} ${orange(yarnRes.error.message)}`));
143
- }
144
- if (success) {
145
- await fs.writeFile(join(cwd, 'wixpkgs.json'), JSON.stringify(wixPackages, null, 2), 'utf8');
146
- console.log("🐕" + blue.underline(` => All Packages installed!`));
147
- }
148
- else {
149
- console.log("🐕" + red.underline(` => Some packages failed to install!`));
150
- }
151
- }
152
- async function gitInit(cwd, modules) {
153
- const git = simpleGit({ baseDir: cwd });
154
- for (const [name, url] of Object.entries(modules)) {
155
- console.log(chalk.green.underline.bold(`Cloning ${name}`));
156
- try {
157
- await git.submoduleAdd(url, name);
158
- }
159
- catch (err) {
160
- console.log((`💩 ${red.underline.bold("=> Command failed =>")} ${orange(err)}`));
161
- }
162
- finally {
163
- console.log("🐕" + blue.underline(` => Cloned ${orange(name)}`));
164
- }
165
- }
166
- console.log("🐶" + green.underline(' => All Modules cloned!'));
167
- }
package/dist/install.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare function installPackages(wixPackages: Record<string, string>, devPackages: Record<string, string>, cwd: string): Promise<void>;
2
- export declare function gitInit(cwd: string, modules: Record<string, string>): Promise<void>;
package/dist/install.js DELETED
@@ -1,53 +0,0 @@
1
- import chalk from 'chalk';
2
- import { join } from 'path';
3
- import { simpleGit } from 'simple-git';
4
- import fs from 'fs/promises';
5
- import { spawnSync } from 'child_process';
6
- export async function installPackages(wixPackages, devPackages, cwd) {
7
- const wixPackageNames = Object.keys(wixPackages);
8
- const devPackageNames = Object.keys(devPackages);
9
- const devPackageVersions = Object.values(devPackages);
10
- const devPackageNamesAndVersions = devPackageNames.map((name, index) => `${name}@${devPackageVersions[index]}`);
11
- let success = true;
12
- wixPackageNames.forEach((name, index) => {
13
- console.log(`🐕 => Installing ${orange(name)}`);
14
- const wixInstall = `wix install ${name}`;
15
- const wixres = spawnSync(wixInstall, { shell: true, stdio: 'inherit' });
16
- if (wixres.error) {
17
- console.log((`💩 ${red.underline.bold("=> Failed to install package =>")} ${orange(wixres.error.message)}`));
18
- success = false;
19
- }
20
- else {
21
- console.log("🐕" + blue.underline(` => Package installed!`));
22
- }
23
- });
24
- const yarnAdd = `yarn add -D ${devPackageNamesAndVersions.join(' ')}`;
25
- const yarnRes = spawnSync(yarnAdd, { shell: true, stdio: 'inherit' });
26
- if (yarnRes.error) {
27
- success = false;
28
- console.log((`💩 ${red.underline.bold("=> Failed to install dev packages =>")} ${orange(yarnRes.error.message)}`));
29
- }
30
- if (success) {
31
- await fs.writeFile(join(cwd, 'wixpkgs.json'), JSON.stringify(wixPackages, null, 2), 'utf8');
32
- console.log("🐕" + blue.underline(` => All Packages installed!`));
33
- }
34
- else {
35
- console.log("🐕" + red.underline(` => Some packages failed to install!`));
36
- }
37
- }
38
- export async function gitInit(cwd, modules) {
39
- const git = simpleGit({ baseDir: cwd });
40
- for (const [name, url] of Object.entries(modules)) {
41
- console.log(chalk.green.underline.bold(`Cloning ${name}`));
42
- try {
43
- await git.submoduleAdd(url, name);
44
- }
45
- catch (err) {
46
- console.log((`💩 ${red.underline.bold("=> Command failed =>")} ${orange(err)}`));
47
- }
48
- finally {
49
- console.log("🐕" + blue.underline(` => Cloned ${orange(name)}`));
50
- }
51
- }
52
- console.log("🐶" + green.underline(' => All Modules cloned!'));
53
- }
@@ -1,67 +0,0 @@
1
- {
2
- "modules": {},
3
- "wixSettings": {
4
- "compilerOptions": {
5
- "composite": true,
6
- "noEmit": false,
7
- "lib": [],
8
- "jsx": "react-jsx"
9
- },
10
- "exclude": ["**/*.js"]
11
- },
12
- "initialized": false,
13
- "wixPackages": {},
14
- "devPackages": {
15
- "@eslint/js": "^9.30.1",
16
- "@styled/typescript-styled-plugin": "^1.0.1",
17
- "@total-typescript/ts-reset": "^0.6.1",
18
- "@types/node": "^24.0.10",
19
- "@types/nodemailer": "^6.4.17",
20
- "@types/react": "^19.1.8",
21
- "madge": "^8.0.0",
22
- "@typescript-eslint/eslint-plugin": "^8.35.1",
23
- "@typescript-eslint/parser": "^8.35.1",
24
- "@typescript-eslint/utils": "^8.35.1",
25
- "@vitest/coverage-v8": "^3.2.4",
26
- "@vitest/ui": "^3.2.4",
27
- "@wix/cli": "^1.1.101",
28
- "@wix/eslint-plugin-cli": "^1.0.2",
29
- "cypress": "^14.5.1",
30
- "cypress-cloud": "^1.13.1",
31
- "esbuild": "^0.25.5",
32
- "eslint": "^9.30.1",
33
- "eslint-plugin-exception-handling": "^1.5.4",
34
- "eslint-plugin-import": "^2.32.0",
35
- "eslint-plugin-jsdoc": "^51.3.3",
36
- "eslint-plugin-named-import-spacing": "^1.0.3",
37
- "eslint-plugin-promise": "^7.2.1",
38
- "eslint-plugin-simple-import-sort": "^12.1.1",
39
- "prettier": "^3.6.2",
40
- "sass": "^1.89.2",
41
- "ts-node": "^10.9.2",
42
- "tsx": "^4.20.3",
43
- "typedoc": "^0.28.7",
44
- "typedoc-github-theme": "^0.3.0",
45
- "typescript": "^5.8.3",
46
- "typescript-eslint": "^8.35.1",
47
- "typescript-eslint-language-service": "^5.0.5",
48
- "vite-tsconfig-paths": "^5.1.4",
49
- "vitest": "^3.2.4",
50
- "vitest-tsconfig-paths": "^3.4.1"
51
- },
52
- "scripts": {
53
- "postinstall": "wix sync-types",
54
- "wix:dev": "wix dev",
55
- "dev": "lucy-cli dev",
56
- "lint": "NODE_OPTIONS=\"--max-old-space-size=32768\" eslint .",
57
- "docs": "typedoc --tsconfig typescript/tsconfig.json --skipErrorChecking",
58
- "build": "lucy-cli build-prod",
59
- "fix-wix": "lucy-cli fix-wix",
60
- "tsc": "tsc -p ./typescript/tsconfig.json --noEmit",
61
- "test": "vitest --ui --coverage",
62
- "coverage": "vitest run --coverage",
63
- "cypress": "cypress open",
64
- "e2e": "cypress-cloud run --parallel --record",
65
- "graph": "madge --image graph.svg src"
66
- }
67
- }