lucy-cli 1.2.5 → 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 (171) hide show
  1. package/dist/args.d.ts +7 -0
  2. package/dist/args.js +23 -0
  3. package/dist/commands.d.ts +3 -0
  4. package/dist/commands.js +18 -0
  5. package/dist/config.d.ts +20 -0
  6. package/dist/config.js +39 -0
  7. package/dist/error.d.ts +17 -0
  8. package/dist/error.js +5 -0
  9. package/dist/helpers.d.ts +1 -32
  10. package/dist/helpers.js +6 -261
  11. package/dist/index.d.ts +2 -59
  12. package/dist/index.js +25 -282
  13. package/dist/init.d.ts +4 -8
  14. package/dist/init.js +245 -160
  15. package/dist/params.d.ts +7 -0
  16. package/dist/params.js +23 -0
  17. package/dist/policy.d.ts +3 -0
  18. package/dist/policy.js +5 -0
  19. package/dist/prepare.d.ts +0 -8
  20. package/dist/prepare.js +20 -19
  21. package/dist/runtime.d.ts +5 -0
  22. package/dist/runtime.js +11 -0
  23. package/dist/schemas/index.d.ts +2 -0
  24. package/dist/schemas/index.js +2 -0
  25. package/dist/schemas/types.js +1 -0
  26. package/dist/states.d.ts +10 -0
  27. package/dist/states.js +7 -0
  28. package/files/expo/.env +1 -0
  29. package/files/expo/.nvmrc +1 -0
  30. package/files/expo/.prettierignore +23 -0
  31. package/files/expo/.prettierrc.json +16 -0
  32. package/files/expo/.yarnrc +1 -0
  33. package/files/expo/.yarnrc.yml +3 -0
  34. package/files/expo/app/(tabs)/_layout.tsx +45 -0
  35. package/files/expo/app/_layout.tsx +45 -0
  36. package/files/expo/babel.config.js +9 -0
  37. package/files/expo/constants/Colors.ts +27 -0
  38. package/files/expo/constants/theme.ts +18 -0
  39. package/files/expo/eas.json +26 -0
  40. package/files/expo/eslint.config.js +185 -0
  41. package/files/expo/global.css +47 -0
  42. package/files/expo/hooks/useColorScheme.ts +11 -0
  43. package/files/expo/hooks/useColorScheme.web.ts +21 -0
  44. package/files/expo/hooks/useColorSchemeRN.ts +1 -0
  45. package/files/expo/hooks/useThemeColor.ts +21 -0
  46. package/files/expo/lib/data.ts +45 -0
  47. package/files/expo/lib/utils/index.ts +6 -0
  48. package/files/expo/lib/utils/polyfills.ts +29 -0
  49. package/files/expo/lib/wix/client.ts +14 -0
  50. package/files/expo/lib/wix/index.ts +1 -0
  51. package/files/expo/lucy.json +8 -0
  52. package/files/expo/readme.md +45 -0
  53. package/files/expo/tailwind.config.js +198 -0
  54. package/files/expo/tsconfig.json +40 -0
  55. package/files/expo/types/nativewind-env.d.ts +1 -0
  56. package/files/expo/types/reset.d.ts +1 -0
  57. package/files/velo/typescript/styles/global.scss +0 -0
  58. package/package.json +14 -11
  59. package/src/args.ts +36 -0
  60. package/src/commands.ts +21 -0
  61. package/src/config.ts +61 -0
  62. package/src/error.ts +4 -0
  63. package/src/helpers.ts +7 -305
  64. package/src/index.ts +29 -369
  65. package/src/init.ts +345 -177
  66. package/src/policy.ts +6 -0
  67. package/src/prepare.ts +19 -19
  68. package/src/runtime.ts +20 -0
  69. package/src/schemas/index.ts +3 -0
  70. package/src/schemas/types.ts +0 -0
  71. package/src/states.ts +15 -0
  72. package/src copy/helpers.ts +307 -0
  73. package/src copy/index.ts +379 -0
  74. package/src copy/init.ts +183 -0
  75. package/src copy/models.ts +35 -0
  76. package/src copy/prepare.ts +24 -0
  77. package/src copy/schemas/index.ts +0 -0
  78. package/src copy/schemas/types.ts +0 -0
  79. package/src copy/settings.json +67 -0
  80. package/src copy/types.d.ts +8 -0
  81. package/dist/Gulpfile.d.ts +0 -34
  82. package/dist/Gulpfile.js +0 -115
  83. package/dist/cli.d.ts +0 -2
  84. package/dist/cli.js +0 -44
  85. package/dist/dev.d.ts +0 -2
  86. package/dist/dev.js +0 -14
  87. package/dist/gulp/backend copy.d.ts +0 -4
  88. package/dist/gulp/backend copy.js +0 -50
  89. package/dist/gulp/backend.d.ts +0 -3
  90. package/dist/gulp/backend.js +0 -91
  91. package/dist/gulp/checks.d.ts +0 -3
  92. package/dist/gulp/checks.js +0 -204
  93. package/dist/gulp/clean copy.d.ts +0 -2
  94. package/dist/gulp/clean copy.js +0 -19
  95. package/dist/gulp/clean.d.ts +0 -3
  96. package/dist/gulp/clean.js +0 -28
  97. package/dist/gulp/copy.d.ts +0 -2
  98. package/dist/gulp/copy.js +0 -33
  99. package/dist/gulp/docs.d.ts +0 -2
  100. package/dist/gulp/docs.js +0 -27
  101. package/dist/gulp/helpers.d.ts +0 -2
  102. package/dist/gulp/helpers.js +0 -24
  103. package/dist/gulp/pages copy.d.ts +0 -3
  104. package/dist/gulp/pages copy.js +0 -22
  105. package/dist/gulp/pages.d.ts +0 -2
  106. package/dist/gulp/pages.js +0 -36
  107. package/dist/gulp/pipeline.d.ts +0 -1
  108. package/dist/gulp/pipeline.js +0 -28
  109. package/dist/gulp/public.d.ts +0 -2
  110. package/dist/gulp/public.js +0 -49
  111. package/dist/gulp/styles.d.ts +0 -2
  112. package/dist/gulp/styles.js +0 -39
  113. package/dist/gulp/templates.d.ts +0 -2
  114. package/dist/gulp/templates.js +0 -32
  115. package/dist/gulp/test.d.ts +0 -2
  116. package/dist/gulp/test.js +0 -26
  117. package/dist/gulp/types.d.ts +0 -4
  118. package/dist/gulp/types.js +0 -288
  119. package/dist/gulp/watchers.d.ts +0 -9
  120. package/dist/gulp/watchers.js +0 -58
  121. package/dist/init copy.d.ts +0 -8
  122. package/dist/init copy.js +0 -167
  123. package/dist/install.d.ts +0 -2
  124. package/dist/install.js +0 -53
  125. package/dist/settings.json +0 -67
  126. package/dist/start_gulp.d.ts +0 -2
  127. package/dist/start_gulp.js +0 -14
  128. package/dist/sync.d.ts +0 -2
  129. package/dist/sync.js +0 -87
  130. /package/{files/.gitmodules → dist/schemas/types.d.ts} +0 -0
  131. /package/files/{typescript/__mocks__/.gitkeep → velo/.gitmodules} +0 -0
  132. /package/files/{.madgerc → velo/.madgerc} +0 -0
  133. /package/files/{.nvmrc → velo/.nvmrc} +0 -0
  134. /package/files/{.stylelintrc.js → velo/.stylelintrc.js} +0 -0
  135. /package/files/{.yarnrc.yml → velo/.yarnrc.yml} +0 -0
  136. /package/files/{currents.config.js → velo/currents.config.js} +0 -0
  137. /package/files/{cypress → velo/cypress}/e2e/base/base.cy.ts +0 -0
  138. /package/files/{cypress → velo/cypress}/fixtures/example.json +0 -0
  139. /package/files/{cypress → velo/cypress}/support/commands.ts +0 -0
  140. /package/files/{cypress → velo/cypress}/support/e2e.ts +0 -0
  141. /package/files/{cypress → velo/cypress}/tsconfig.json +0 -0
  142. /package/files/{cypress.config.mjs → velo/cypress.config.mjs} +0 -0
  143. /package/files/{eslint.config.mjs → velo/eslint.config.mjs} +0 -0
  144. /package/files/{local.tsconfig.json → velo/local.tsconfig.json} +0 -0
  145. /package/files/{typedoc.json → velo/typedoc.json} +0 -0
  146. /package/files/{typescript/pages → velo/typescript/__mocks__}/.gitkeep +0 -0
  147. /package/files/{typescript → velo/typescript}/backend/data.ts +0 -0
  148. /package/files/{typescript → velo/typescript}/backend/events.ts +0 -0
  149. /package/files/{typescript → velo/typescript}/backend/http-functions.ts +0 -0
  150. /package/files/{typescript → velo/typescript}/backend/lib/http-functions/sync.ts +0 -0
  151. /package/files/{typescript → velo/typescript}/backend/permissions.json +0 -0
  152. /package/files/{typescript/public → velo/typescript/pages}/.gitkeep +0 -0
  153. /package/files/{typescript/styles → velo/typescript/public}/.gitkeep +0 -0
  154. /package/files/{typescript → velo/typescript}/public/scss/app.scss +0 -0
  155. /package/files/{typescript/styles/global.scss → velo/typescript/styles/.gitkeep} +0 -0
  156. /package/files/{typescript → velo/typescript}/tsconfig.json +0 -0
  157. /package/files/{vitest.config.ts → velo/vitest.config.ts} +0 -0
  158. /package/{src → src copy}/Gulpfile.ts +0 -0
  159. /package/{src → src copy}/gulp/backend.ts +0 -0
  160. /package/{src → src copy}/gulp/checks.ts +0 -0
  161. /package/{src → src copy}/gulp/clean.ts +0 -0
  162. /package/{src → src copy}/gulp/copy.ts +0 -0
  163. /package/{src → src copy}/gulp/helpers.ts +0 -0
  164. /package/{src → src copy}/gulp/pages.ts +0 -0
  165. /package/{src → src copy}/gulp/pipeline.ts +0 -0
  166. /package/{src → src copy}/gulp/public.ts +0 -0
  167. /package/{src → src copy}/gulp/styles.ts +0 -0
  168. /package/{src → src copy}/gulp/templates.ts +0 -0
  169. /package/{src → src copy}/gulp/types.ts +0 -0
  170. /package/{src → src copy}/gulp/watchers.ts +0 -0
  171. /package/{src → src copy}/sync.ts +0 -0
package/dist/index.js CHANGED
@@ -1,284 +1,27 @@
1
- #!/usr/bin/env node --no-warnings
2
- import { dirname } from 'path';
3
- import { fileURLToPath } from 'url';
4
- import { existsSync } from 'fs';
5
- import chalk from 'chalk';
6
- import settings from './settings.json' with { type: "json" };
7
- ;
8
- import projectPackageJSON from '../package.json' with { type: "json" };
9
- ;
10
- import { join } from 'path';
11
- import fs from 'fs/promises';
12
- import { init } from './init.js';
13
- import { sync } from './sync.js';
14
- import { runGulp, installPackages, killAllProcesses, cleanupWatchers, createTemplateFolder, updateLucyConfigFromPackageJson } from './helpers.js';
15
- import { prepare } from './prepare.js';
16
- import { spawn, spawnSync } from 'child_process';
17
- import os from 'os';
18
- export const orange = chalk.hex('#FFA500');
19
- export const blue = chalk.blueBright;
20
- export const green = chalk.greenBright;
21
- export const red = chalk.redBright;
22
- export const yellow = chalk.yellow;
23
- export const magenta = chalk.magentaBright;
24
- // eslint-disable-next-line @typescript-eslint/naming-convention
25
- const __filename = fileURLToPath(import.meta.url);
26
- // eslint-disable-next-line @typescript-eslint/naming-convention
27
- const __dirname = dirname(__filename);
28
- // const cwd = process.cwd();
29
- // const command = `watchman watch-del '${cwd}'`;
30
- // killAllProcesses('@wix/cli/bin/wix.cjs'); // Matches processes running the Wix CLI
31
- // killAllProcesses('wix:dev');
32
- process.on('exit', (code) => {
33
- killAllProcesses('@wix/cli/bin/wix.cjs'); // Matches processes running the Wix CLI
34
- killAllProcesses('wix:dev');
35
- cleanupWatchers();
36
- console.log(`🚪 ${magenta.underline('Process exiting with code:')} ${orange(code)}`);
37
- });
38
- process.on('SIGINT', () => {
39
- console.log(`🐕 ${green.underline('Received Ctrl+C (SIGINT), cleaning up...')}`);
40
- killAllProcesses('@wix/cli/bin/wix.cjs'); // Matches processes running the Wix CLI
41
- killAllProcesses('wix:dev');
42
- cleanupWatchers();
43
- process.exit(); // Exit explicitly after handling
44
- });
45
- process.on('SIGTERM', () => {
46
- console.log(`🛑 ${red.underline('Received termination signal (SIGTERM), cleaning up...')}`);
47
- killAllProcesses('@wix/cli/bin/wix.cjs'); // Matches processes running the Wix CLI
48
- killAllProcesses('wix:dev');
49
- cleanupWatchers();
50
- process.exit(); // Exit explicitly after handling
51
- });
52
- process.on('uncaughtException', (error) => {
53
- console.error(`💥 ${red.underline('Uncaught Exception:')}`, error);
54
- killAllProcesses('@wix/cli/bin/wix.cjs'); // Matches processes running the Wix CLI
55
- killAllProcesses('wix:dev');
56
- cleanupWatchers();
57
- process.exit(1); // Exit with an error code
58
- });
59
- process.on('unhandledRejection', (reason, promise) => {
60
- console.error(`🚨 ${yellow.underline('Unhandled Rejection at:')} ${orange(promise)}`);
61
- console.error(`🚨 ${red.underline('Reason:')} ${reason}`);
62
- cleanupWatchers();
63
- killAllProcesses('@wix/cli/bin/wix.cjs'); // Matches processes running the Wix CLI
64
- killAllProcesses('wix:dev');
65
- cleanupWatchers();
66
- process.exit(1); // Exit with an error code
67
- });
68
- /**
69
- * Main function
70
- * @returns {Promise<void>}
71
- */
1
+ #!/usr/bin/env node
2
+ import { Effect, pipe } from "effect";
3
+ import { build_runtime } from "./runtime.js";
4
+ import { get_args } from "./args.js";
5
+ import 'dotenv/config';
6
+ import { Config } from "./config.js";
7
+ import { init } from "./init.js";
8
+ const lucyCLI = pipe(Effect.gen(function* (_) {
9
+ const config = yield* Config;
10
+ config.config.action.type;
11
+ if (config.config.action.type === undefined) {
12
+ return yield* Effect.fail("No Params Provided");
13
+ }
14
+ if (config.config.action.action === 'init') {
15
+ return yield* init();
16
+ }
17
+ }));
72
18
  async function main() {
73
- // INFO: Module settings
74
- const moduleSettings = {
75
- packageRoot: dirname(__dirname),
76
- targetFolder: process.cwd(),
77
- args: process.argv.slice(2),
78
- settings,
79
- wixConfigPath: join(process.cwd(), 'wix.config.json'),
80
- lucyConfigPath: join(process.cwd(), 'lucy.json'),
81
- packageJsonPath: join(process.cwd(), 'package.json'),
82
- force: false,
83
- lockVersion: false,
84
- veloConfigName: 'config.json'
85
- };
86
- let projectSettings = {};
87
- if (moduleSettings.args.includes('version') || moduleSettings.args.includes('-v')) {
88
- console.log("🐾" + blue.bold(` => ${projectPackageJSON.version}`));
89
- return;
90
- }
91
- if (moduleSettings.args.includes('templates')) {
92
- const templatesPath = join(os.homedir(), '.lucy-cli');
93
- if (!existsSync(templatesPath)) {
94
- console.log((`💩 ${red.underline.bold("=> Lucy templates folder not found at =>")} ${orange(templatesPath)}`));
95
- console.log(chalk.yellow('🐕 Creating templates folder with default template...'));
96
- await createTemplateFolder(moduleSettings);
97
- }
98
- console.log(`🐕 ${blue.underline('Opening templates folder at:')} ${orange(templatesPath)}`);
99
- let command;
100
- switch (process.platform) {
101
- case 'darwin':
102
- command = 'open';
103
- break;
104
- case 'win32':
105
- command = 'start';
106
- break;
107
- default:
108
- command = 'xdg-open';
109
- break;
110
- }
111
- const child = spawn(command, [templatesPath], { detached: true, stdio: 'ignore' });
112
- child.on('error', (err) => {
113
- console.error(`💩 ${red.underline.bold('Failed to open folder:')} ${orange(err.message)}`);
114
- });
115
- child.unref();
116
- return;
117
- }
118
- // Run velo sync
119
- if (moduleSettings.args.includes('velo-sync')) {
120
- await sync(moduleSettings, projectSettings);
121
- return;
122
- }
123
- if (moduleSettings.args.includes('help') || moduleSettings.args.includes('-h')) {
124
- console.log("🦮 " + green.underline.bold(' => Lucy CLI Help'));
125
- console.log("Usage: lucy-cli <command> [options]");
126
- console.log("\nCommands:");
127
- console.log("🦮 " + magenta.bold('init') + " : Initializes caontaining a WIX project to enable full TS support");
128
- console.log("🦮 " + magenta.bold('dev') + " : Starts the development environment. This includes setting up any required services for local development.");
129
- console.log("🦮 " + magenta.bold('build-prod') + " : Builds the project in production mode, optimizing files for deployment.");
130
- console.log("🦮 " + magenta.bold('prepare') + " : Prepares the project by installing packages & initializing git modules, configured in lucy.json");
131
- console.log("🦮 " + magenta.bold('velo-sync') + " : Synchronizes wix collections(velo-sync -h for help)");
132
- console.log("🦮 " + magenta.bold('install') + " : Installs all Wix npm packages listed in the 'lucy.json' file in the project directory.");
133
- console.log("🦮 " + magenta.bold('fix') + " : Runs a fix command to resolve common issues in development or production settings.");
134
- console.log("🦮 " + magenta.bold('docs') + " : Generates documentation for the project.");
135
- console.log("🦮 " + magenta.bold('cypress') + " : Starts the cypress test runner.");
136
- console.log("🦮 " + magenta.bold('templates') + " : Opens the Lucy CLI templates folder.");
137
- console.log("🦮 " + magenta.bold('sync-pkgs') + " : Syncs dependencies from package.json to lucy.json.");
138
- console.log("🦮 " + magenta.bold('e2e') + " : Starts the cypress test runner in CI mode. first argument is the key second is the build id <e2e <somekey <someID>");
139
- console.log("\nOptions:");
140
- console.log("🦮 " + magenta.bold('-h, help') + " : Displays this help message.");
141
- console.log("🦮 " + magenta.bold('-v, version') + " : Displays the current version of Lucy CLI as defined in the project’s package.json.");
142
- console.log("🦮 " + magenta.bold('-f, force') + " : Forces specific commands to execute even if they may lead to potential issues.");
143
- console.log(" Used for functions like deleting obsolete pages or initializing missing components.");
144
- console.log("🦮 " + magenta.bold('-l') + " : Locks package versions to those specified in the configuration file lucy.json");
145
- console.log("\nExamples:");
146
- console.log("🦮 " + magenta.bold('lucy-cli init') + " : Initializes a new Wix project.");
147
- console.log("🦮 " + magenta.bold('lucy-cli dev') + " : Starts the development environment.");
148
- console.log("🦮 " + magenta.bold('lucy-cli sync') + " : Synchronizes database and settings.");
149
- console.log("🦮 " + magenta.bold('lucy-cli install') + " : Installs all Wix npm packages from 'lucy.json'.");
150
- console.log("🦮 " + magenta.bold('lucy-cli dev -f') + " : Starts the dev environment with forced settings.");
151
- console.log("🦮 " + magenta.bold('lucy-cli install -l') + " : Installs Wix npm packages, respecting locked versions specified in the configuration.");
152
- return;
153
- }
154
- if (!existsSync(moduleSettings.wixConfigPath)) {
155
- console.log((`💩 ${red.underline.bold("=> This is not a WIX project =>")} ${orange(moduleSettings.targetFolder)}`));
156
- return;
157
- }
158
- //INFO: Collect project settings
159
- if (moduleSettings.args.includes('-f'))
160
- moduleSettings.force = true;
161
- if (moduleSettings.args.includes('-l'))
162
- moduleSettings.lockVersion = true;
163
- if (existsSync(moduleSettings.packageJsonPath)) {
164
- const packageJSONraw = await fs.readFile(join(moduleSettings.packageJsonPath), 'utf8');
165
- try {
166
- projectSettings.packageJSON = JSON.parse(packageJSONraw);
167
- if (moduleSettings.force) {
168
- console.log("❗️" + red.underline(' => Forcing'));
169
- moduleSettings.force = true;
170
- }
171
- }
172
- catch (parseError) {
173
- console.log((`💩 ${red.underline.bold("=> Error parsing package.json =>")} ${orange(parseError)}`));
174
- return;
175
- }
176
- }
177
- if (existsSync(moduleSettings.lucyConfigPath)) {
178
- try {
179
- const data = await fs.readFile(moduleSettings.lucyConfigPath, 'utf8');
180
- projectSettings.lucySettings = JSON.parse(data);
181
- }
182
- catch (parseError) {
183
- console.log((`💩 ${red.underline.bold("=> Error parsing Lucy.json =>")} ${orange(parseError)}`));
184
- }
185
- }
186
- else {
187
- if (!moduleSettings.args.includes('init')) {
188
- return console.log(yellow.underline.bold('🐶 => Project not Initialized! Please initialize using "lucy-cli init"'));
189
- }
190
- ;
191
- }
192
- if (!projectSettings.lucySettings?.initialized) {
193
- if (!moduleSettings.args.includes('init')) {
194
- return console.log(yellow.underline.bold('🐶 => Project not Initialized! Please initialize using "lucy-cli init"'));
195
- }
196
- }
197
- if (moduleSettings.args.includes('-l'))
198
- moduleSettings.lockVersion = true;
199
- console.log("🐕" + magenta.underline(' => Lucy CLI => RUNNING: ' + orange('Press Ctrl+C to stop.')));
200
- // INFO: Run commands
201
- if (moduleSettings.args.includes('init')) {
202
- if (projectSettings.lucySettings?.initialized && !moduleSettings.force) {
203
- console.log((`💩 ${red.underline.bold("=> This project is already initialized =>")} ${orange(moduleSettings.targetFolder)}`));
204
- console.log("🐕" + magenta.underline(' => Use -f to force initialization'));
205
- return;
206
- }
207
- console.log("🐕" + magenta.underline(' => Initializing project'));
208
- init(moduleSettings, projectSettings);
209
- return;
210
- }
211
- if (moduleSettings.args.includes('docs')) {
212
- const res = spawnSync('yarn docs', { shell: true, stdio: 'inherit' });
213
- if (res.error) {
214
- return console.log((`💩 ${red.underline.bold("=> Failed to Docs generated => ")} ${orange(res.error.message)}`));
215
- }
216
- return console.log("🐕" + blue.underline(` => Docs generated!`));
217
- }
218
- if (moduleSettings.args.includes('cypress')) {
219
- const res = spawnSync('yarn cypress', { shell: true, stdio: 'inherit' });
220
- if (res.error) {
221
- return console.log((`💩 ${red.underline.bold("=> Failed to start cypress => ")} ${orange(res.error.message)}`));
222
- }
223
- return console.log("🐕" + blue.underline(` => Started Cypress`));
224
- }
225
- if (moduleSettings.args.includes('e2e')) {
226
- // Extract arguments
227
- const e2eIndex = moduleSettings.args.indexOf('e2e');
228
- const key = moduleSettings.args[e2eIndex + 1];
229
- const buildId = moduleSettings.args[e2eIndex + 2];
230
- // Validate that both arguments are provided
231
- if (!key && !buildId) {
232
- console.log(`💩 ${red.underline.bold("=> Missing required arguments:")} ${orange("key")} and ${orange("build ID")}`);
233
- process.exit(1);
234
- }
235
- // Run Cypress with the provided arguments
236
- const res = spawnSync(`yarn e2e --key ${key} --ci-build-id ${buildId}`, { shell: true, stdio: 'inherit' });
237
- if (res.error) {
238
- console.log(`💩 ${red.underline.bold("=> Failed to start Cypress =>")} ${orange(res.error.message)}`);
239
- process.exit(1);
240
- }
241
- return console.log("🐕 " + blue.underline(`=> Started Cypress successfully`));
242
- }
243
- if (moduleSettings.args.includes('prepare')) {
244
- await prepare(moduleSettings, projectSettings);
245
- return;
246
- }
247
- if (moduleSettings.args.includes('install')) {
248
- if (!projectSettings.lucySettings?.initialized) {
249
- console.log((`💩 ${red.underline.bold("=> This project is not initialized =>")} ${orange(moduleSettings.targetFolder)}`));
250
- console.log("🐕" + magenta.underline(' => Use init to initialize'));
251
- return;
252
- }
253
- await installPackages(projectSettings.lucySettings.wixPackages, projectSettings.lucySettings.devPackages, moduleSettings.targetFolder, moduleSettings.lockVersion);
254
- return;
255
- }
256
- if (moduleSettings.args.includes('dev')) {
257
- runGulp(moduleSettings, projectSettings, 'dev');
258
- return;
259
- }
260
- if (moduleSettings.args.includes('build-prod')) {
261
- runGulp(moduleSettings, projectSettings, 'build-prod');
262
- return;
263
- }
264
- if (moduleSettings.args.includes('fix')) {
265
- runGulp(moduleSettings, projectSettings, 'fix-wix');
266
- return;
267
- }
268
- if (moduleSettings.args.includes('sync-pkgs')) {
269
- console.log("🐕" + magenta.underline(' => Syncing package.json with lucy.json'));
270
- if (!existsSync(moduleSettings.packageJsonPath)) {
271
- console.log((`💩 ${red.underline.bold("=> package.json not found at =>")} ${orange(moduleSettings.packageJsonPath)}`));
272
- return;
273
- }
274
- if (!existsSync(moduleSettings.lucyConfigPath)) {
275
- console.log((`💩 ${red.underline.bold("=> lucy.json not found at =>")} ${orange(moduleSettings.lucyConfigPath)}`));
276
- return;
277
- }
278
- await updateLucyConfigFromPackageJson(moduleSettings.packageJsonPath, moduleSettings.lucyConfigPath);
279
- return;
280
- }
281
- console.log("🐕" + blue.underline.bold(' => Running dev'));
282
- runGulp(moduleSettings, projectSettings, 'dev');
19
+ const args = await get_args();
20
+ const runtime = build_runtime(args);
21
+ // The runtime will handle logging failures. This will catch unhandled defects.
22
+ await runtime.runPromise(lucyCLI);
283
23
  }
284
- main();
24
+ main().catch((error) => {
25
+ console.error("An unexpected application error occurred:", error);
26
+ process.exit(1);
27
+ });
package/dist/init.d.ts CHANGED
@@ -1,8 +1,4 @@
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
+ import { Effect } from "effect/index";
2
+ import { Config } from "./config.js";
3
+ import { Terminal, FileSystem, Path } from "@effect/platform";
4
+ export declare const init: () => Effect.Effect<void, string | import("@effect/platform/Error").PlatformError, Config | Terminal.Terminal | FileSystem.FileSystem | Path.Path | import("@effect/platform/CommandExecutor").CommandExecutor>;