lucy-cli 2.0.0-beta.13 → 2.0.0-beta.14

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 (172) hide show
  1. package/package.json +7 -2
  2. package/.cursorignore +0 -4
  3. package/.eslintrc.cjs +0 -96
  4. package/.github/funding.yml +0 -2
  5. package/.nvmrc +0 -1
  6. package/.stylelintrc.js +0 -8
  7. package/.wix/debug.log +0 -10
  8. package/.yarnrc.yml +0 -2
  9. package/files/sync-data/data/test.csv +0 -17
  10. package/files/sync-data/files/lucy.jpg +0 -0
  11. package/files/sync-data/schema/test.json +0 -11
  12. package/lucy.jpg +0 -0
  13. package/mitarbeiter-login.html +0 -188
  14. package/old/Gulpfile.d.ts +0 -34
  15. package/old/Gulpfile.js +0 -116
  16. package/old/Gulpfile.js.map +0 -1
  17. package/old/Gulpfile.ts +0 -231
  18. package/old/gulp/backend.d.ts +0 -3
  19. package/old/gulp/backend.js +0 -92
  20. package/old/gulp/backend.js.map +0 -1
  21. package/old/gulp/backend.ts +0 -109
  22. package/old/gulp/checks.d.ts +0 -3
  23. package/old/gulp/checks.js +0 -205
  24. package/old/gulp/checks.js.map +0 -1
  25. package/old/gulp/checks.ts +0 -228
  26. package/old/gulp/clean.d.ts +0 -3
  27. package/old/gulp/clean.js +0 -29
  28. package/old/gulp/clean.js.map +0 -1
  29. package/old/gulp/clean.ts +0 -33
  30. package/old/gulp/copy.d.ts +0 -2
  31. package/old/gulp/copy.js +0 -34
  32. package/old/gulp/copy.js.map +0 -1
  33. package/old/gulp/copy.ts +0 -42
  34. package/old/gulp/helpers.d.ts +0 -2
  35. package/old/gulp/helpers.js +0 -25
  36. package/old/gulp/helpers.js.map +0 -1
  37. package/old/gulp/helpers.ts +0 -26
  38. package/old/gulp/pages.d.ts +0 -2
  39. package/old/gulp/pages.js +0 -37
  40. package/old/gulp/pages.js.map +0 -1
  41. package/old/gulp/pages.ts +0 -40
  42. package/old/gulp/pipeline.d.ts +0 -1
  43. package/old/gulp/pipeline.js +0 -29
  44. package/old/gulp/pipeline.js.map +0 -1
  45. package/old/gulp/pipeline.ts +0 -31
  46. package/old/gulp/public.d.ts +0 -2
  47. package/old/gulp/public.js +0 -50
  48. package/old/gulp/public.js.map +0 -1
  49. package/old/gulp/public.ts +0 -59
  50. package/old/gulp/styles.d.ts +0 -2
  51. package/old/gulp/styles.js +0 -40
  52. package/old/gulp/styles.js.map +0 -1
  53. package/old/gulp/styles.ts +0 -46
  54. package/old/gulp/templates.d.ts +0 -2
  55. package/old/gulp/templates.js +0 -33
  56. package/old/gulp/templates.js.map +0 -1
  57. package/old/gulp/templates.ts +0 -39
  58. package/old/gulp/types.d.ts +0 -4
  59. package/old/gulp/types.js +0 -289
  60. package/old/gulp/types.js.map +0 -1
  61. package/old/gulp/types.ts +0 -311
  62. package/old/gulp/watchers.d.ts +0 -9
  63. package/old/gulp/watchers.js +0 -59
  64. package/old/gulp/watchers.js.map +0 -1
  65. package/old/gulp/watchers.ts +0 -105
  66. package/old/helpers.d.ts +0 -32
  67. package/old/helpers.js +0 -267
  68. package/old/helpers.js.map +0 -1
  69. package/old/helpers.ts +0 -307
  70. package/old/index.d.ts +0 -59
  71. package/old/index.js +0 -288
  72. package/old/index.js.map +0 -1
  73. package/old/index.ts +0 -379
  74. package/old/init.d.ts +0 -8
  75. package/old/init.js +0 -165
  76. package/old/init.js.map +0 -1
  77. package/old/init.ts +0 -183
  78. package/old/models.d.ts +0 -37
  79. package/old/models.js +0 -2
  80. package/old/models.js.map +0 -1
  81. package/old/models.ts +0 -35
  82. package/old/prepare.d.ts +0 -8
  83. package/old/prepare.js +0 -20
  84. package/old/prepare.js.map +0 -1
  85. package/old/prepare.ts +0 -24
  86. package/old/schemas/index.d.ts +0 -0
  87. package/old/schemas/index.js +0 -2
  88. package/old/schemas/index.js.map +0 -1
  89. package/old/schemas/index.ts +0 -0
  90. package/old/schemas/types.d.ts +0 -0
  91. package/old/schemas/types.js +0 -2
  92. package/old/schemas/types.js.map +0 -1
  93. package/old/schemas/types.ts +0 -0
  94. package/old/settings.json +0 -67
  95. package/old/sync.d.ts +0 -2
  96. package/old/sync.js +0 -88
  97. package/old/sync.js.map +0 -1
  98. package/old/sync.ts +0 -97
  99. package/old/types.d.ts +0 -8
  100. package/pnpm-workspace.yaml +0 -6
  101. package/settings/backend-settings.json +0 -19
  102. package/settings/master-settings.json +0 -20
  103. package/settings/page-settings.json +0 -21
  104. package/settings/public-settings.json +0 -22
  105. package/src/args.ts +0 -121
  106. package/src/commands/checks.ts +0 -51
  107. package/src/commands/cleanup.ts +0 -11
  108. package/src/commands/copy.ts +0 -29
  109. package/src/commands/edit.ts +0 -81
  110. package/src/commands/exec.ts +0 -73
  111. package/src/commands/git.ts +0 -152
  112. package/src/commands/home.ts +0 -20
  113. package/src/commands/install.ts +0 -269
  114. package/src/commands/read.ts +0 -45
  115. package/src/commands/write.ts +0 -45
  116. package/src/commands.ts +0 -21
  117. package/src/config.ts +0 -142
  118. package/src/error.ts +0 -3
  119. package/src/helpers.ts +0 -93
  120. package/src/index.ts +0 -113
  121. package/src/init/blocks.ts +0 -85
  122. package/src/init/cargo.ts +0 -25
  123. package/src/init/expo.ts +0 -69
  124. package/src/init/gitModules.ts +0 -15
  125. package/src/init/index.ts +0 -86
  126. package/src/init/monorepo.ts +0 -72
  127. package/src/init/prepareVelo.ts +0 -19
  128. package/src/init/tauri.ts +0 -42
  129. package/src/init/templates.ts +0 -98
  130. package/src/init/velo.ts +0 -66
  131. package/src/policy.ts +0 -6
  132. package/src/prepare.ts +0 -24
  133. package/src/runtime.ts +0 -21
  134. package/src/schemas/gulp.ts +0 -31
  135. package/src/schemas/index.ts +0 -17
  136. package/src/schemas/lucy.ts +0 -43
  137. package/src/schemas/tsconfig.ts +0 -35
  138. package/src/schemas/types.ts +0 -40
  139. package/src/settings.json +0 -67
  140. package/src/states.ts +0 -15
  141. package/src/tasks/Gulpfile.ts +0 -207
  142. package/src/tasks/gulp/backend.ts +0 -113
  143. package/src/tasks/gulp/checks.ts +0 -219
  144. package/src/tasks/gulp/clean.ts +0 -38
  145. package/src/tasks/gulp/copy.ts +0 -38
  146. package/src/tasks/gulp/helpers.ts +0 -18
  147. package/src/tasks/gulp/pages.ts +0 -43
  148. package/src/tasks/gulp/pipeline.ts +0 -31
  149. package/src/tasks/gulp/public.ts +0 -61
  150. package/src/tasks/gulp/styles.ts +0 -47
  151. package/src/tasks/gulp/templates.ts +0 -53
  152. package/src/tasks/gulp/types.ts +0 -310
  153. package/src/tasks/gulp/watchers.ts +0 -97
  154. package/src/tasks/index.ts +0 -24
  155. package/src/tasks/syncSettings.ts +0 -21
  156. package/src/types.d.ts +0 -8
  157. package/src/utils/index.ts +0 -0
  158. package/src/utils/logger.ts +0 -40
  159. package/src/wix-sdk/check.ts +0 -24
  160. package/src/wix-sdk/client.ts +0 -18
  161. package/src/wix-sdk/index.ts +0 -17
  162. package/src/wix-sdk/init.ts +0 -54
  163. package/src/wix-sdk/run.ts +0 -56
  164. package/src/wix-sync/client.ts +0 -6
  165. package/src/wix-sync/export.ts +0 -19
  166. package/src/wix-sync/import.ts +0 -27
  167. package/src/wix-sync/index.ts +0 -36
  168. package/src/wix-sync/init.ts +0 -77
  169. package/src/wix-sync/is-alive.ts +0 -25
  170. package/src/wix-sync/migrate.ts +0 -23
  171. package/src/wix-sync/sync.ts +0 -27
  172. package/tsconfig.json +0 -34
package/old/helpers.js DELETED
@@ -1,267 +0,0 @@
1
- import chalk from 'chalk';
2
- import { simpleGit } from 'simple-git';
3
- import { spawnSync, exec } from 'child_process';
4
- // https://www.sergevandenoever.nl/run-gulp4-tasks-programatically-from-node/
5
- import path, { join } from 'path';
6
- import { fileURLToPath } from 'url';
7
- import os from 'os';
8
- import fs, { mkdirSync } from 'fs';
9
- import fse from 'fs-extra';
10
- import { writeFile } from 'fs/promises';
11
- import { blue, green, orange, red, yellow, magenta } from './index.js';
12
- export async function installPackages(wixPackages, devPackages, cwd, locked) {
13
- if (locked)
14
- console.log("🐕" + blue.underline(` => Installing & version locked packages!`));
15
- const wixPackageNames = Object.keys(wixPackages);
16
- const wixPackageVersions = Object.values(wixPackages);
17
- const wixPackageNamesAndVersions = wixPackageNames.map((name, index) => `${name}@${wixPackageVersions[index]}`);
18
- const devPackageNames = Object.keys(devPackages);
19
- const devPackageVersions = Object.values(devPackages);
20
- const devPackageNamesAndVersions = devPackageNames.map((name, index) => `${name}@${devPackageVersions[index]}`);
21
- let success = true;
22
- // Dev packages are installed all at once with yarn.
23
- if (devPackageNames.length > 0) {
24
- console.log(`🐕 => Installing dev packages with yarn...`);
25
- const packagesToInstall = locked ? devPackageNamesAndVersions.join(' ') : devPackageNames.join(' ');
26
- const yarnAdd = `yarn add -D ${packagesToInstall}`;
27
- const yarnRes = spawnSync(yarnAdd, { shell: true, stdio: 'inherit' });
28
- if (yarnRes.error) {
29
- success = false;
30
- console.log((`💩 ${red.underline.bold("=> Failed to install dev packages =>")} ${orange(yarnRes.error.message)}`));
31
- }
32
- else {
33
- console.log("🐕" + blue.underline(` => Dev packages installed!`));
34
- }
35
- }
36
- // Packages are installed all at once with yarn.
37
- if (wixPackageNames.length > 0) {
38
- console.log(`🐕 => Installing packages with yarn...`);
39
- const packagesToInstall = locked ? wixPackageNamesAndVersions.join(' ') : wixPackageNames.join(' ');
40
- const yarnAdd = `yarn add ${packagesToInstall}`;
41
- const yarnRes = spawnSync(yarnAdd, { shell: true, stdio: 'inherit' });
42
- if (yarnRes.error) {
43
- success = false;
44
- console.log((`💩 ${red.underline.bold("=> Failed to install packages =>")} ${orange(yarnRes.error.message)}`));
45
- }
46
- else {
47
- console.log("🐕" + blue.underline(` => Packages installed!`));
48
- }
49
- }
50
- // Wix packages are installed one by one.
51
- if (wixPackageNames.length > 0) {
52
- wixPackageNames.forEach((name, index) => {
53
- console.log(`🐕 => Installing wix package ${orange(name)}`);
54
- const wixInstall = locked ? `wix install ${wixPackageNamesAndVersions[index]}` : `wix install ${name}`;
55
- const wixres = spawnSync(wixInstall, { shell: true, stdio: 'inherit' });
56
- if (wixres.error) {
57
- console.log((`💩 ${red.underline.bold("=> Failed to install wix package =>")} ${orange(wixres.error.message)}`));
58
- success = false;
59
- }
60
- else {
61
- console.log("🐕" + blue.underline(` => Wix package ${orange(name)} installed!`));
62
- }
63
- });
64
- }
65
- if (success) {
66
- console.log("🐕" + blue.underline(` => All Packages installed!`));
67
- }
68
- else {
69
- console.log("🐕" + red.underline(` => Some packages failed to install!`));
70
- }
71
- }
72
- async function isSubmoduleRegistered(git, submoduleName) {
73
- try {
74
- const urlConfig = await git.getConfig(`submodule.${submoduleName}.url`);
75
- return !!urlConfig.value;
76
- }
77
- catch (e) {
78
- // simple-git throws an error if the config key doesn't exist
79
- return false;
80
- }
81
- }
82
- export async function gitInit(cwd, modules, force) {
83
- const git = simpleGit({ baseDir: cwd });
84
- if (!(await git.checkIsRepo())) {
85
- console.log(chalk.yellow('Project is not a git repository. Initializing...'));
86
- await git.init();
87
- }
88
- if (!modules) {
89
- console.log(chalk.yellow('No submodules defined in settings, skipping.'));
90
- return;
91
- }
92
- const dotGitmodulesPath = path.join(cwd, '.gitmodules');
93
- for (const [name, repo] of Object.entries(modules)) {
94
- console.log(chalk.green.underline.bold(`Processing submodule ${name}`));
95
- const clonePath = repo.path || name;
96
- try {
97
- const isRegistered = await isSubmoduleRegistered(git, clonePath);
98
- // Check that .gitmodules exists AND contains the entry for this specific submodule.
99
- const isConfiguredInFile = fs.existsSync(dotGitmodulesPath) &&
100
- fs.readFileSync(dotGitmodulesPath, 'utf-8').includes(`[submodule "${clonePath}"]`);
101
- // Add/repair if not configured in .gitmodules, or if forced by the user.
102
- if (!isConfiguredInFile || force) {
103
- console.log(`🐕 ${blue.underline(`Adding/updating submodule ${name} at ${clonePath}...`)}`);
104
- // If git already has a config entry, we must use --force to repair it.
105
- const submoduleArgs = ['add', ...(force || isRegistered ? ['--force'] : []), repo.url, clonePath];
106
- await git.subModule(submoduleArgs);
107
- }
108
- else {
109
- console.log(`🐕 ${blue.underline(`Submodule ${name} at ${clonePath} already registered. Skipping add.`)}`);
110
- }
111
- await git.submoduleUpdate(['--init', '--recursive', clonePath]);
112
- await simpleGit({ baseDir: path.join(cwd, clonePath) }).checkout(repo.branch);
113
- }
114
- catch (err) {
115
- console.log((`💩 ${red.underline.bold(`=> Command failed for submodule ${name} =>`)} ${orange(err)}`));
116
- }
117
- }
118
- console.log("🐶" + green.underline(' => All modules processed!'));
119
- }
120
- export async function runGulp(moduleSettings, projectSettings, task) {
121
- // Get the directory name of the current module
122
- const __filename = fileURLToPath(import.meta.url);
123
- const __dirname = path.dirname(__filename);
124
- // Resolve the path to the Gulpfile
125
- const gulpfilePath = path.resolve(__dirname, 'Gulpfile.js');
126
- // Dynamically import the Gulpfile
127
- const gulpfile = await import(`file://${gulpfilePath}`);
128
- // Check if 'dev' task exists
129
- gulpfile.runTask(task, moduleSettings, projectSettings);
130
- }
131
- /**
132
- * Clean up and run a command before exiting the process.
133
- */
134
- export function cleanupWatchers() {
135
- console.log(`🧹 ${magenta.underline('Cleaning up Watchman watchers...')}`);
136
- const cwd = process.cwd();
137
- const command = `watchman watch-del "${cwd}"`; // Adjust for Windows paths
138
- exec(command, (error, stdout, stderr) => {
139
- if (error) {
140
- console.error(`💩 ${red.underline('Failed to run cleanup:')} ${orange(error.message)}`);
141
- return;
142
- }
143
- if (stderr) {
144
- console.error(`⚠️ ${yellow.underline('Watchman stderr:')} ${stderr}`);
145
- }
146
- console.log(`✅ ${green.underline('Watchman cleanup success:')} ${stdout}`);
147
- });
148
- }
149
- /**
150
- * Kill all processes matching a specific substring in their command, with a fallback for Windows.
151
- * @param {string} processPattern - The substring to match (e.g., "wix:dev" or "@wix/cli/bin/wix.cjs").
152
- */
153
- export function killAllProcesses(processPattern) {
154
- const isWindows = os.platform() === 'win32';
155
- const command = isWindows
156
- ? `tasklist /FI "IMAGENAME eq node.exe" /FO CSV | findstr "${processPattern}"` // Adjust for Node.js processes
157
- : `ps -eo pid,command | grep "${processPattern}" | grep -v grep`;
158
- exec(command, (error, stdout, stderr) => {
159
- if (error) {
160
- console.error(`💩 ${red.underline('Failed to find processes:')} ${orange(error.message)}`);
161
- return;
162
- }
163
- if (stderr) {
164
- console.error(`⚠️ ${yellow.underline('Error output:')} ${stderr}`);
165
- }
166
- if (!stdout.trim()) {
167
- console.log(`ℹ️ ${blue.underline(`No processes found matching pattern:`)} ${orange(processPattern)}`);
168
- return;
169
- }
170
- console.log(`📝 ${magenta.underline('Found matching processes:')}\n${stdout}`);
171
- const lines = stdout.trim().split('\n');
172
- const pids = isWindows
173
- ? lines.map(line => line.match(/"(\d+)"/)?.[1]) // Extract PID from Windows tasklist output
174
- : lines.map(line => line.trim().split(/\s+/)[0]).filter(pid => !isNaN(Number(pid)));
175
- pids.forEach(pid => {
176
- if (!pid)
177
- return;
178
- try {
179
- const killCommand = isWindows
180
- ? `taskkill /PID ${pid} /T /F` // Forcefully terminate the process on Windows
181
- : `kill -SIGTERM ${pid}`;
182
- exec(killCommand, (killError) => {
183
- if (killError) {
184
- console.error(`⚠️ ${yellow.underline('Failed to kill process with PID')} ${orange(pid)}: ${red(killError.message)}`);
185
- }
186
- else {
187
- console.log(`✅ ${green.underline('Killed process with PID:')} ${orange(pid)}`);
188
- }
189
- });
190
- // Schedule SIGKILL fallback for non-Windows platforms
191
- if (!isWindows) {
192
- setTimeout(() => {
193
- try {
194
- process.kill(parseInt(pid, 10), 'SIGKILL');
195
- console.log(`🔪 ${red.underline('Sent SIGKILL to process with PID:')} ${orange(pid)} (fallback).`);
196
- }
197
- catch (killError) {
198
- if (killError.code === 'ESRCH') {
199
- console.log(`✅ ${green.underline('Process with PID')} ${orange(pid)} ${green.underline('already terminated.')}`);
200
- }
201
- else {
202
- console.error(`⚠️ ${yellow.underline('Failed to send SIGKILL to process with PID')} ${orange(pid)}: ${red(killError.message)}`);
203
- }
204
- }
205
- }, 10000);
206
- }
207
- }
208
- catch (err) {
209
- console.error(`⚠️ ${yellow.underline('Failed to kill process with PID')} ${orange(pid)}: ${red(err.message)}`);
210
- }
211
- });
212
- });
213
- }
214
- export async function saveConfig(config, file) {
215
- await fs.promises.writeFile(file, JSON.stringify(config));
216
- }
217
- export async function readConfig(file) {
218
- let content = await fs.promises.readFile(file, 'utf-8');
219
- return JSON.parse(content);
220
- }
221
- export async function createTemplateFolder(moduleSettings) {
222
- const templatesPath = join(os.homedir(), '.lucy-cli');
223
- try {
224
- mkdirSync(templatesPath);
225
- const defaultTemplatePath = join(templatesPath, 'default');
226
- mkdirSync(defaultTemplatePath);
227
- const sourceFilesPath = join(moduleSettings.packageRoot, 'files');
228
- const defaultTemplateFilesPath = join(defaultTemplatePath, 'files');
229
- await fse.copy(sourceFilesPath, defaultTemplateFilesPath);
230
- const defaultTemplateSettingsPath = join(defaultTemplatePath, 'settings.json');
231
- await writeFile(defaultTemplateSettingsPath, JSON.stringify(moduleSettings.settings, null, 2));
232
- console.log(green('✅ Default template created successfully!'));
233
- }
234
- catch (e) {
235
- console.log((`💩 ${red.underline.bold("=> Error creating default template =>")} ${orange(e)}`));
236
- return;
237
- }
238
- }
239
- /**
240
- * Updates a lucy.json file with dependencies from a package.json file.
241
- * It replaces 'wixPackages' with 'dependencies' and 'devPackages' with 'devDependencies'.
242
- * @param {string} packageJsonPath - Path to the package.json file.
243
- * @param {string} lucyConfigPath - Path to the lucy.json file.
244
- */
245
- export async function updateLucyConfigFromPackageJson(packageJsonPath, lucyConfigPath) {
246
- try {
247
- console.log(`🐕 Reading package definitions from ${orange(packageJsonPath)}...`);
248
- const pkgJsonContent = await fs.promises.readFile(packageJsonPath, 'utf-8');
249
- const packageJson = JSON.parse(pkgJsonContent);
250
- console.log(`🐕 Reading Lucy configuration from ${orange(lucyConfigPath)}...`);
251
- const lucyConfigContent = await fs.promises.readFile(lucyConfigPath, 'utf-8');
252
- const lucyConfig = JSON.parse(lucyConfigContent);
253
- const { dependencies = {}, devDependencies = {} } = packageJson;
254
- // Note: `wixPackages` are installed using `wix install`. If your `dependencies`
255
- // contain packages that are not Wix packages, `lucy-cli install` might fail.
256
- lucyConfig.wixPackages = dependencies;
257
- lucyConfig.devPackages = devDependencies;
258
- console.log(`🐕 Writing updated configuration to ${orange(lucyConfigPath)}...`);
259
- await fs.promises.writeFile(lucyConfigPath, JSON.stringify(lucyConfig, null, 2));
260
- console.log(green.underline('✅ Lucy configuration updated successfully!'));
261
- }
262
- catch (error) {
263
- console.error(`💩 ${red.underline.bold('=> Error updating lucy.json from package.json:')} ${orange(error.message)}`);
264
- throw error; // re-throw to allow caller to handle
265
- }
266
- }
267
- //# sourceMappingURL=helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAa,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAChD,6EAA6E;AAC7E,OAAO,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEvE,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,WAAmC,EAAE,WAAmC,EAAG,GAAW,EAAE,MAAe;IAC5I,IAAI,MAAM;QAAE,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,2CAA2C,CAAC,CAAC,CAAC;IAE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W,GAAgB,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAE5D,OAAO,CAAC,GAAG,CAAC,sCAAsC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC/E,MAAM,iBAAiB,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAC9E,MAAM,UAAU,GAAiB,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAE/D,MAAM,EAAE,YAAY,GAAG,EAAE,EAAE,eAAe,GAAG,EAAE,EAAE,GAAG,WAAW,CAAC;QAEhE,gFAAgF;QAChF,6EAA6E;QAC7E,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC;QACtC,UAAU,CAAC,WAAW,GAAG,eAAe,CAAC;QAEzC,OAAO,CAAC,GAAG,CAAC,uCAAuC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAChF,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAEjF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,4CAA4C,CAAC,CAAC,CAAC;IAE/E,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QAClB,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,gDAAgD,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACrH,MAAM,KAAK,CAAC,CAAC,qCAAqC;IACtD,CAAC;AACL,CAAC"}
package/old/helpers.ts DELETED
@@ -1,307 +0,0 @@
1
- import chalk from 'chalk';
2
- import { simpleGit, SimpleGit } from 'simple-git';
3
- import { spawnSync, exec } from 'child_process';
4
- // https://www.sergevandenoever.nl/run-gulp4-tasks-programatically-from-node/
5
- import path, { join } from 'path';
6
- import { fileURLToPath } from 'url';
7
- import { LucySettings, ModuleSettings, ProjectSettings } from './index.js';
8
- import os from 'os';
9
- import fs, { mkdirSync } from 'fs';
10
- import fse from 'fs-extra';
11
- import { writeFile } from 'fs/promises';
12
-
13
- import { blue, green, orange, red, yellow, magenta } from './index.js';
14
-
15
- export async function installPackages(wixPackages: Record<string, string>, devPackages: Record<string, string>, cwd: string, locked: boolean ) {
16
- if (locked) console.log("🐕" + blue.underline(` => Installing & version locked packages!`));
17
-
18
- const wixPackageNames = Object.keys(wixPackages);
19
- const wixPackageVersions = Object.values(wixPackages);
20
- const wixPackageNamesAndVersions = wixPackageNames.map((name, index) => `${name}@${wixPackageVersions[index]}`);
21
-
22
- const devPackageNames = Object.keys(devPackages);
23
- const devPackageVersions = Object.values(devPackages);
24
- const devPackageNamesAndVersions = devPackageNames.map((name, index) => `${name}@${devPackageVersions[index]}`);
25
-
26
- let success = true;
27
-
28
- // Dev packages are installed all at once with yarn.
29
- if (devPackageNames.length > 0) {
30
- console.log(`🐕 => Installing dev packages with yarn...`);
31
- const packagesToInstall = locked ? devPackageNamesAndVersions.join(' ') : devPackageNames.join(' ');
32
- const yarnAdd = `yarn add -D ${packagesToInstall}`;
33
- const yarnRes = spawnSync(yarnAdd, { shell: true, stdio: 'inherit' });
34
- if (yarnRes.error) {
35
- success = false;
36
- console.log((`💩 ${red.underline.bold("=> Failed to install dev packages =>")} ${orange(yarnRes.error.message)}`));
37
- } else {
38
- console.log("🐕" + blue.underline(` => Dev packages installed!`));
39
- }
40
- }
41
-
42
- // Packages are installed all at once with yarn.
43
- if (wixPackageNames.length > 0) {
44
- console.log(`🐕 => Installing packages with yarn...`);
45
- const packagesToInstall = locked ? wixPackageNamesAndVersions.join(' ') : wixPackageNames.join(' ');
46
- const yarnAdd = `yarn add ${packagesToInstall}`;
47
- const yarnRes = spawnSync(yarnAdd, { shell: true, stdio: 'inherit' });
48
- if (yarnRes.error) {
49
- success = false;
50
- console.log((`💩 ${red.underline.bold("=> Failed to install packages =>")} ${orange(yarnRes.error.message)}`));
51
- } else {
52
- console.log("🐕" + blue.underline(` => Packages installed!`));
53
- }
54
- }
55
-
56
- // Wix packages are installed one by one.
57
- if (wixPackageNames.length > 0) {
58
- wixPackageNames.forEach((name, index) => {
59
- console.log(`🐕 => Installing wix package ${orange(name)}`);
60
- const wixInstall = locked ? `wix install ${wixPackageNamesAndVersions[index]}`: `wix install ${name}`;
61
- const wixres = spawnSync(wixInstall, { shell: true, stdio: 'inherit' });
62
- if (wixres.error) {
63
- console.log((`💩 ${red.underline.bold("=> Failed to install wix package =>")} ${orange(wixres.error.message)}`));
64
- success = false;
65
- } else {
66
- console.log("🐕" + blue.underline(` => Wix package ${orange(name)} installed!`));
67
- }
68
- });
69
- }
70
-
71
- if(success) {
72
- console.log("🐕" + blue.underline(` => All Packages installed!`));
73
- } else {
74
- console.log("🐕" + red.underline(` => Some packages failed to install!`));
75
- }
76
- }
77
-
78
- async function isSubmoduleRegistered(git: SimpleGit, submoduleName: string): Promise<boolean> {
79
- try {
80
- const urlConfig = await git.getConfig(`submodule.${submoduleName}.url`);
81
- return !!urlConfig.value;
82
- } catch (e) {
83
- // simple-git throws an error if the config key doesn't exist
84
- return false;
85
- }
86
- }
87
-
88
- export async function gitInit(cwd: string, modules: LucySettings['modules'] | undefined, force: boolean) {
89
- const git = simpleGit({ baseDir: cwd });
90
-
91
- if (!(await git.checkIsRepo())) {
92
- console.log(chalk.yellow('Project is not a git repository. Initializing...'));
93
- await git.init();
94
- }
95
-
96
- if (!modules) {
97
- console.log(chalk.yellow('No submodules defined in settings, skipping.'));
98
- return;
99
- }
100
-
101
- const dotGitmodulesPath = path.join(cwd, '.gitmodules');
102
-
103
- for (const [name, repo] of Object.entries(modules)) {
104
- console.log(chalk.green.underline.bold(`Processing submodule ${name}`));
105
- const clonePath = repo.path || name;
106
-
107
- try {
108
- const isRegistered = await isSubmoduleRegistered(git, clonePath);
109
- // Check that .gitmodules exists AND contains the entry for this specific submodule.
110
- const isConfiguredInFile = fs.existsSync(dotGitmodulesPath) &&
111
- fs.readFileSync(dotGitmodulesPath, 'utf-8').includes(`[submodule "${clonePath}"]`);
112
-
113
- // Add/repair if not configured in .gitmodules, or if forced by the user.
114
- if (!isConfiguredInFile || force) {
115
- console.log(`🐕 ${blue.underline(`Adding/updating submodule ${name} at ${clonePath}...`)}`);
116
- // If git already has a config entry, we must use --force to repair it.
117
- const submoduleArgs = ['add', ...(force || isRegistered ? ['--force'] : []), repo.url, clonePath];
118
- await git.subModule(submoduleArgs);
119
- } else {
120
- console.log(`🐕 ${blue.underline(`Submodule ${name} at ${clonePath} already registered. Skipping add.`)}`);
121
- }
122
-
123
- await git.submoduleUpdate(['--init', '--recursive', clonePath]);
124
- await simpleGit({ baseDir: path.join(cwd, clonePath) }).checkout(repo.branch);
125
- } catch (err) {
126
- console.log((`💩 ${red.underline.bold(`=> Command failed for submodule ${name} =>`)} ${orange(err)}`));
127
- }
128
- }
129
- console.log("🐶" + green.underline(' => All modules processed!'));
130
- }
131
-
132
-
133
- export async function runGulp(moduleSettings: ModuleSettings, projectSettings: ProjectSettings, task: string) {
134
- // Get the directory name of the current module
135
- const __filename = fileURLToPath(import.meta.url);
136
- const __dirname = path.dirname(__filename);
137
-
138
- // Resolve the path to the Gulpfile
139
- const gulpfilePath = path.resolve(__dirname, 'Gulpfile.js');
140
-
141
- // Dynamically import the Gulpfile
142
- const gulpfile = await import(`file://${gulpfilePath}`);
143
-
144
- // Check if 'dev' task exists
145
- gulpfile.runTask(task, moduleSettings, projectSettings)
146
- }
147
-
148
-
149
- /**
150
- * Clean up and run a command before exiting the process.
151
- */
152
- export function cleanupWatchers() {
153
- console.log(`🧹 ${magenta.underline('Cleaning up Watchman watchers...')}`);
154
- const cwd = process.cwd();
155
- const command = `watchman watch-del "${cwd}"`; // Adjust for Windows paths
156
- exec(command, (error, stdout, stderr) => {
157
- if (error) {
158
- console.error(`💩 ${red.underline('Failed to run cleanup:')} ${orange(error.message)}`);
159
- return;
160
- }
161
- if (stderr) {
162
- console.error(`⚠️ ${yellow.underline('Watchman stderr:')} ${stderr}`);
163
- }
164
- console.log(`✅ ${green.underline('Watchman cleanup success:')} ${stdout}`);
165
- });
166
- }
167
-
168
- /**
169
- * Kill all processes matching a specific substring in their command, with a fallback for Windows.
170
- * @param {string} processPattern - The substring to match (e.g., "wix:dev" or "@wix/cli/bin/wix.cjs").
171
- */
172
- export function killAllProcesses(processPattern: string) {
173
- const isWindows = os.platform() === 'win32';
174
- const command = isWindows
175
- ? `tasklist /FI "IMAGENAME eq node.exe" /FO CSV | findstr "${processPattern}"` // Adjust for Node.js processes
176
- : `ps -eo pid,command | grep "${processPattern}" | grep -v grep`;
177
-
178
- exec(command, (error, stdout, stderr) => {
179
- if (error) {
180
- console.error(`💩 ${red.underline('Failed to find processes:')} ${orange(error.message)}`);
181
- return;
182
- }
183
- if (stderr) {
184
- console.error(`⚠️ ${yellow.underline('Error output:')} ${stderr}`);
185
- }
186
- if (!stdout.trim()) {
187
- console.log(`ℹ️ ${blue.underline(`No processes found matching pattern:`)} ${orange(processPattern)}`);
188
- return;
189
- }
190
-
191
- console.log(`📝 ${magenta.underline('Found matching processes:')}\n${stdout}`);
192
- const lines = stdout.trim().split('\n');
193
- const pids = isWindows
194
- ? lines.map(line => line.match(/"(\d+)"/)?.[1]) // Extract PID from Windows tasklist output
195
- : lines.map(line => line.trim().split(/\s+/)[0]).filter(pid => !isNaN(Number(pid)));
196
-
197
- pids.forEach(pid => {
198
- if (!pid) return;
199
- try {
200
- const killCommand = isWindows
201
- ? `taskkill /PID ${pid} /T /F` // Forcefully terminate the process on Windows
202
- : `kill -SIGTERM ${pid}`;
203
-
204
- exec(killCommand, (killError) => {
205
- if (killError) {
206
- console.error(`⚠️ ${yellow.underline('Failed to kill process with PID')} ${orange(pid)}: ${red(killError.message)}`);
207
- } else {
208
- console.log(`✅ ${green.underline('Killed process with PID:')} ${orange(pid)}`);
209
- }
210
- });
211
-
212
- // Schedule SIGKILL fallback for non-Windows platforms
213
- if (!isWindows) {
214
- setTimeout(() => {
215
- try {
216
- process.kill(parseInt(pid, 10), 'SIGKILL');
217
- console.log(`🔪 ${red.underline('Sent SIGKILL to process with PID:')} ${orange(pid)} (fallback).`);
218
- } catch (killError: any) {
219
- if (killError.code === 'ESRCH') {
220
- console.log(`✅ ${green.underline('Process with PID')} ${orange(pid)} ${green.underline('already terminated.')}`);
221
- } else {
222
- console.error(`⚠️ ${yellow.underline('Failed to send SIGKILL to process with PID')} ${orange(pid)}: ${red(killError.message)}`);
223
- }
224
- }
225
- }, 10000);
226
- }
227
- } catch (err: any) {
228
- console.error(`⚠️ ${yellow.underline('Failed to kill process with PID')} ${orange(pid)}: ${red(err.message)}`);
229
- }
230
- });
231
- });
232
- }
233
-
234
- export interface VeloSyncConfig {
235
- siteUrl: string;
236
- secret: string;
237
- }
238
- export async function saveConfig(config:VeloSyncConfig, file: string) {
239
- await fs.promises.writeFile(file, JSON.stringify(config));
240
- }
241
- export async function readConfig(file: string): Promise<VeloSyncConfig> {
242
- let content = await fs.promises.readFile(file, 'utf-8');
243
- return JSON.parse(content);
244
- }
245
-
246
- export async function createTemplateFolder(moduleSettings: ModuleSettings) {
247
- const templatesPath = join(os.homedir(), '.lucy-cli');
248
-
249
- try {
250
- mkdirSync(templatesPath);
251
-
252
- const defaultTemplatePath = join(templatesPath, 'default');
253
- mkdirSync(defaultTemplatePath);
254
-
255
- const sourceFilesPath = join(moduleSettings.packageRoot, 'files');
256
- const defaultTemplateFilesPath = join(defaultTemplatePath, 'files');
257
- await fse.copy(sourceFilesPath, defaultTemplateFilesPath);
258
-
259
- const defaultTemplateSettingsPath = join(defaultTemplatePath, 'settings.json');
260
- await writeFile(defaultTemplateSettingsPath, JSON.stringify(moduleSettings.settings, null, 2));
261
-
262
- console.log(green('✅ Default template created successfully!'));
263
- } catch (e) {
264
- console.log((`💩 ${red.underline.bold("=> Error creating default template =>")} ${orange(e)}`));
265
- return;
266
- }
267
- }
268
-
269
- export type PackageJson = {
270
- dependencies?: Record<string, string>;
271
- devDependencies?: Record<string, string>;
272
- [key: string]: any;
273
- }
274
-
275
- /**
276
- * Updates a lucy.json file with dependencies from a package.json file.
277
- * It replaces 'wixPackages' with 'dependencies' and 'devPackages' with 'devDependencies'.
278
- * @param {string} packageJsonPath - Path to the package.json file.
279
- * @param {string} lucyConfigPath - Path to the lucy.json file.
280
- */
281
- export async function updateLucyConfigFromPackageJson(packageJsonPath: string, lucyConfigPath: string): Promise<void> {
282
- try {
283
- console.log(`🐕 Reading package definitions from ${orange(packageJsonPath)}...`);
284
- const pkgJsonContent = await fs.promises.readFile(packageJsonPath, 'utf-8');
285
- const packageJson: PackageJson = JSON.parse(pkgJsonContent);
286
-
287
- console.log(`🐕 Reading Lucy configuration from ${orange(lucyConfigPath)}...`);
288
- const lucyConfigContent = await fs.promises.readFile(lucyConfigPath, 'utf-8');
289
- const lucyConfig: LucySettings = JSON.parse(lucyConfigContent);
290
-
291
- const { dependencies = {}, devDependencies = {} } = packageJson;
292
-
293
- // Note: `wixPackages` are installed using `wix install`. If your `dependencies`
294
- // contain packages that are not Wix packages, `lucy-cli install` might fail.
295
- lucyConfig.wixPackages = dependencies;
296
- lucyConfig.devPackages = devDependencies;
297
-
298
- console.log(`🐕 Writing updated configuration to ${orange(lucyConfigPath)}...`);
299
- await fs.promises.writeFile(lucyConfigPath, JSON.stringify(lucyConfig, null, 2));
300
-
301
- console.log(green.underline('✅ Lucy configuration updated successfully!'));
302
-
303
- } catch (error: any) {
304
- console.error(`💩 ${red.underline.bold('=> Error updating lucy.json from package.json:')} ${orange(error.message)}`);
305
- throw error; // re-throw to allow caller to handle
306
- }
307
- }
package/old/index.d.ts DELETED
@@ -1,59 +0,0 @@
1
- #!/usr/bin/env node --no-warnings
2
- export type ModulesSettings = {
3
- packageRoot: string;
4
- targetFolder: string;
5
- args: string[];
6
- settings: LucySettings;
7
- };
8
- export type LucySettings = {
9
- modules: {
10
- [libName: string]: {
11
- url: string;
12
- branch: string;
13
- path?: string;
14
- noCompile?: boolean;
15
- };
16
- };
17
- wixSettings: {
18
- compilerOptions: {
19
- composite: boolean;
20
- noEmit: boolean;
21
- lib: string[];
22
- jsx: string;
23
- };
24
- exclude: string[];
25
- };
26
- initialized: boolean;
27
- wixPackages: {
28
- [packageName: string]: string;
29
- };
30
- devPackages: {
31
- [packageName: string]: string;
32
- };
33
- scripts: {
34
- [commandName: string]: string;
35
- };
36
- };
37
- export type ModuleSettings = {
38
- packageRoot: string;
39
- targetFolder: string;
40
- args: string[];
41
- wixConfigPath: string;
42
- lucyConfigPath: string;
43
- packageJsonPath: string;
44
- settings: LucySettings;
45
- lockVersion: boolean;
46
- force: boolean;
47
- veloConfigName: string;
48
- };
49
- export type ProjectSettings = {
50
- modules?: Record<string, string>;
51
- lucySettings?: LucySettings;
52
- packageJSON?: Record<string, any>;
53
- };
54
- export declare const orange: import("chalk").ChalkInstance;
55
- export declare const blue: import("chalk").ChalkInstance;
56
- export declare const green: import("chalk").ChalkInstance;
57
- export declare const red: import("chalk").ChalkInstance;
58
- export declare const yellow: import("chalk").ChalkInstance;
59
- export declare const magenta: import("chalk").ChalkInstance;