lucy-cli 0.8.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Gulpfile.js +6 -1
- package/dist/gulp/backend.js +34 -19
- package/dist/gulp/checks.js +2 -1
- package/dist/gulp/clean.js +5 -3
- package/dist/gulp/copy.js +2 -1
- package/dist/gulp/pages.d.ts +1 -1
- package/dist/gulp/pages.js +20 -11
- package/dist/gulp/pipeline.js +3 -2
- package/dist/gulp/public.js +19 -13
- package/dist/gulp/styles.js +7 -1
- package/dist/gulp/templates.js +2 -1
- package/dist/gulp/test.js +2 -1
- package/dist/gulp/types.js +3 -3
- package/dist/helpers.d.ts +6 -1
- package/dist/helpers.js +73 -7
- package/dist/index.js +48 -4
- package/dist/settings.json +31 -25
- package/files/eslint.config.mjs +141 -0
- package/files/typedoc.json +27 -17
- package/package.json +7 -5
- package/src/Gulpfile.ts +5 -1
- package/src/gulp/backend.ts +44 -32
- package/src/gulp/checks.ts +2 -1
- package/src/gulp/clean.ts +5 -3
- package/src/gulp/copy.ts +2 -1
- package/src/gulp/pages.ts +26 -16
- package/src/gulp/pipeline.ts +3 -2
- package/src/gulp/public.ts +21 -15
- package/src/gulp/styles.ts +7 -1
- package/src/gulp/templates.ts +2 -1
- package/src/gulp/test.ts +2 -1
- package/src/gulp/types.ts +3 -3
- package/src/helpers.ts +74 -10
- package/src/index.ts +54 -4
- package/src/settings.json +31 -25
- package/src/types.d.ts +2 -1
- package/files/.eslintrc.cjs +0 -108
package/dist/Gulpfile.js
CHANGED
@@ -87,6 +87,11 @@ export async function runTask(task, moduleSettings, projectSettings) {
|
|
87
87
|
taskOptions.moduleSettings = moduleSettings;
|
88
88
|
taskOptions.projectSettings = projectSettings;
|
89
89
|
console.log("🐕" + magenta.underline(' => Starting Task => ' + orange(task)));
|
90
|
-
|
90
|
+
try {
|
91
|
+
await gulpTaskRunner(task);
|
92
|
+
}
|
93
|
+
catch (err) {
|
94
|
+
console.log((`💩 ${red.underline.bold("=> Error starting tasks =>")} ${orange(err)}`));
|
95
|
+
}
|
91
96
|
console.log("🐶" + green.underline.bold(' => Task completed: ' + task));
|
92
97
|
}
|
package/dist/gulp/backend.js
CHANGED
@@ -1,8 +1,17 @@
|
|
1
1
|
import gulp from 'gulp';
|
2
|
-
import { createGulpEsbuild } from 'gulp-esbuild';
|
3
2
|
import rename from 'gulp-rename';
|
4
3
|
import * as path from 'path';
|
5
4
|
import { blue, orange, red } from '../index.js';
|
5
|
+
import swc from 'gulp-swc';
|
6
|
+
const swcOptions = {
|
7
|
+
jsc: {
|
8
|
+
target: 'es2020',
|
9
|
+
parser: {
|
10
|
+
syntax: "typescript",
|
11
|
+
tsx: true,
|
12
|
+
},
|
13
|
+
},
|
14
|
+
};
|
6
15
|
export function buildBackend(options) {
|
7
16
|
const folders = ['typescript'];
|
8
17
|
if (options.modulesSync) {
|
@@ -10,11 +19,7 @@ export function buildBackend(options) {
|
|
10
19
|
folders.push(module);
|
11
20
|
}
|
12
21
|
}
|
13
|
-
const { outputDir
|
14
|
-
const gulpEsbuild = createGulpEsbuild({
|
15
|
-
incremental: enableIncrementalBuild,
|
16
|
-
pipe: true,
|
17
|
-
});
|
22
|
+
const { outputDir } = options;
|
18
23
|
// Create tasks for each folder
|
19
24
|
const tasks = folders.map((folder) => {
|
20
25
|
const taskName = `build_Backend-${folder}`; // Create a unique name for each task
|
@@ -24,12 +29,17 @@ export function buildBackend(options) {
|
|
24
29
|
`!${folder}/backend/**/*.jsw.ts`,
|
25
30
|
`!${folder}/backend/**/*.spec.ts`,
|
26
31
|
])
|
27
|
-
.pipe(
|
28
|
-
|
29
|
-
|
32
|
+
.pipe(swc(swcOptions))
|
33
|
+
.pipe(swc(swcOptions))
|
34
|
+
.on('error', function (e) {
|
35
|
+
console.log("💩" + red.underline.bold(` => Build of Backend files for ${orange(folder)} failed!`));
|
36
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
37
|
+
this.emit('end');
|
38
|
+
})
|
30
39
|
.pipe(gulp.dest(path.join(outputDir, 'backend')))
|
31
|
-
.on('error', function () {
|
40
|
+
.on('error', function (e) {
|
32
41
|
console.log("💩" + red.underline.bold(` => Build of Backend files for ${orange(folder)} failed!`));
|
42
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
33
43
|
this.emit('end');
|
34
44
|
})
|
35
45
|
.on('end', function () {
|
@@ -49,24 +59,29 @@ export function buildBackendJSW(options) {
|
|
49
59
|
folders.push(module);
|
50
60
|
}
|
51
61
|
}
|
52
|
-
const
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
}
|
62
|
+
const swcOptions = {
|
63
|
+
jsc: {
|
64
|
+
target: 'es6',
|
65
|
+
},
|
66
|
+
};
|
67
|
+
const { outputDir } = options;
|
57
68
|
// Create tasks for each folder
|
58
69
|
const tasks = folders.map((folder) => {
|
59
70
|
const taskName = `build-${folder}`; // Create a unique name for each task
|
60
71
|
const task = () => gulp.src([
|
61
72
|
`${folder}/backend/**/*.jsw.ts`,
|
62
73
|
])
|
63
|
-
.pipe(
|
64
|
-
|
65
|
-
|
74
|
+
.pipe(swc(swcOptions))
|
75
|
+
.on('error', function (e) {
|
76
|
+
console.log("💩" + red.underline.bold(` => Build of Public files for ${orange(folder)} failed!`));
|
77
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
78
|
+
this.emit('end');
|
79
|
+
})
|
66
80
|
.pipe(rename({ extname: '' }))
|
67
81
|
.pipe(gulp.dest(path.join(outputDir, 'backend')))
|
68
|
-
.on('error', function () {
|
82
|
+
.on('error', function (e) {
|
69
83
|
console.log("💩" + red.underline.bold(` => Build of JSW files for ${orange(folder)} failed!`));
|
84
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
70
85
|
this.emit('end');
|
71
86
|
})
|
72
87
|
.on('end', function () {
|
package/dist/gulp/checks.js
CHANGED
@@ -128,8 +128,9 @@ export function checkTs(options) {
|
|
128
128
|
const taskName = `test-${folder}`; // Create a unique name for each task
|
129
129
|
const task = () => gulp.src([`${folder}/**/*.ts`, `!${folder}/types/**/*.ts`], { cwd: folder })
|
130
130
|
.pipe(tsProject(ts.reporter.fullReporter()))
|
131
|
-
.on('error', function () {
|
131
|
+
.on('error', function (e) {
|
132
132
|
console.log("💩" + red.underline.bold(` => Typescriptcheck for ${orange(folder)} failed!`));
|
133
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
133
134
|
this.emit('end');
|
134
135
|
})
|
135
136
|
.on('end', function () {
|
package/dist/gulp/clean.js
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
import gulp from 'gulp';
|
2
2
|
import clean from 'gulp-clean';
|
3
|
-
import { blue, red } from '../index.js';
|
3
|
+
import { blue, orange, red } from '../index.js';
|
4
4
|
export function cleanWix() {
|
5
5
|
return () => {
|
6
6
|
return gulp.src('./.wix', { read: false, allowEmpty: true })
|
7
7
|
.pipe(clean({ force: true }))
|
8
|
-
.on('error', function () {
|
8
|
+
.on('error', function (e) {
|
9
9
|
console.log("💩" + red.underline.bold(' => Cleaning of .wix failed!'));
|
10
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
10
11
|
this.emit('end');
|
11
12
|
})
|
12
13
|
.on('end', function () { console.log("🐶" + blue.underline(' => Cleaning of .wix succeeded!')); });
|
@@ -17,8 +18,9 @@ export function cleanSrc(options) {
|
|
17
18
|
return () => {
|
18
19
|
return gulp.src([`${outputDir}/pages`, `${outputDir}/public`, `${outputDir}/backend`], { read: false, allowEmpty: true })
|
19
20
|
.pipe(clean({ force: true }))
|
20
|
-
.on('error', function () {
|
21
|
+
.on('error', function (e) {
|
21
22
|
console.log("💩" + red.underline.bold('Cleaning of output files failed!'));
|
23
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
22
24
|
this.emit('end');
|
23
25
|
})
|
24
26
|
.on('end', function () { console.log("🐶" + blue.underline(' => Cleaning of .src succeeded!')); });
|
package/dist/gulp/copy.js
CHANGED
@@ -21,8 +21,9 @@ export function copyFiles(options) {
|
|
21
21
|
`!${folder}/styles/**`,
|
22
22
|
])
|
23
23
|
.pipe(gulp.dest(outputDir))
|
24
|
-
.on('error', function () {
|
24
|
+
.on('error', function (e) {
|
25
25
|
console.log("💩" + red.underline.bold(` => Copy of files for ${orange(folder)} failed!`));
|
26
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
26
27
|
this.emit('end');
|
27
28
|
})
|
28
29
|
.on('end', function () {
|
package/dist/gulp/pages.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
import { TaskOptions } from '../Gulpfile';
|
2
|
-
export declare function buildPages(options: TaskOptions): () =>
|
2
|
+
export declare function buildPages(options: TaskOptions): () => any;
|
package/dist/gulp/pages.js
CHANGED
@@ -1,21 +1,30 @@
|
|
1
1
|
import gulp from 'gulp';
|
2
|
-
import { createGulpEsbuild } from 'gulp-esbuild';
|
3
2
|
import * as path from 'path';
|
4
|
-
import { blue, red } from '../index.js';
|
3
|
+
import { blue, orange, red } from '../index.js';
|
4
|
+
import swc from 'gulp-swc';
|
5
|
+
const swcOptions = {
|
6
|
+
jsc: {
|
7
|
+
target: 'es2020',
|
8
|
+
parser: {
|
9
|
+
syntax: "typescript",
|
10
|
+
tsx: true,
|
11
|
+
},
|
12
|
+
},
|
13
|
+
};
|
5
14
|
export function buildPages(options) {
|
6
|
-
const { outputDir
|
7
|
-
const gulpEsbuild = createGulpEsbuild({
|
8
|
-
incremental: enableIncrementalBuild, // enables the esbuild's incremental build
|
9
|
-
pipe: true, // enables the esbuild's pipe mode
|
10
|
-
});
|
15
|
+
const { outputDir } = options;
|
11
16
|
return () => {
|
12
17
|
return gulp.src('typescript/pages/*.ts')
|
13
|
-
.pipe(
|
14
|
-
|
15
|
-
|
18
|
+
.pipe(swc(swcOptions))
|
19
|
+
.on('error', function (e) {
|
20
|
+
console.log("💩" + red.underline.bold(` => Build of Pages files failed!`));
|
21
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
22
|
+
this.emit('end');
|
23
|
+
})
|
16
24
|
.pipe(gulp.dest(path.join(outputDir, 'pages')))
|
17
|
-
.on('error', function () {
|
25
|
+
.on('error', function (e) {
|
18
26
|
console.log("💩" + red.underline.bold(' => Build of Pages TS files failed!'));
|
27
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
19
28
|
this.emit('end');
|
20
29
|
})
|
21
30
|
.on('end', function () { console.log("🐶" + blue.underline(' => Build of Pages TS files succeeded!')); });
|
package/dist/gulp/pipeline.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import gulp from 'gulp';
|
2
2
|
import * as path from 'path';
|
3
3
|
import replace from 'gulp-string-replace';
|
4
|
-
import { blue, red } from '../index.js';
|
4
|
+
import { blue, orange, red } from '../index.js';
|
5
5
|
export function setProdConfig() {
|
6
6
|
const tag = process.env.GIT_TAG || 'development';
|
7
7
|
const regexGit = /gitTag:\s*(.*),/g;
|
@@ -16,8 +16,9 @@ export function setProdConfig() {
|
|
16
16
|
const outputDir = path.dirname(filePath);
|
17
17
|
return path.join(`${outputDir}/constants`);
|
18
18
|
}))
|
19
|
-
.on('error', function () {
|
19
|
+
.on('error', function (e) {
|
20
20
|
console.log("💩" + red.underline.bold(' => Setting the git tag failed!'));
|
21
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
21
22
|
this.emit('end');
|
22
23
|
})
|
23
24
|
.on('end', function () {
|
package/dist/gulp/public.js
CHANGED
@@ -1,7 +1,16 @@
|
|
1
1
|
import gulp from 'gulp';
|
2
|
-
import { createGulpEsbuild } from 'gulp-esbuild';
|
3
2
|
import * as path from 'path';
|
4
3
|
import { blue, orange, red } from '../index.js';
|
4
|
+
import swc from 'gulp-swc';
|
5
|
+
const swcOptions = {
|
6
|
+
jsc: {
|
7
|
+
target: 'es2020',
|
8
|
+
parser: {
|
9
|
+
syntax: "typescript",
|
10
|
+
tsx: true,
|
11
|
+
},
|
12
|
+
},
|
13
|
+
};
|
5
14
|
export function buildPublic(options) {
|
6
15
|
const folders = ['typescript'];
|
7
16
|
if (options.modulesSync) {
|
@@ -9,11 +18,7 @@ export function buildPublic(options) {
|
|
9
18
|
folders.push(module);
|
10
19
|
}
|
11
20
|
}
|
12
|
-
const { outputDir
|
13
|
-
const gulpEsbuild = createGulpEsbuild({
|
14
|
-
incremental: enableIncrementalBuild,
|
15
|
-
pipe: true,
|
16
|
-
});
|
21
|
+
const { outputDir } = options;
|
17
22
|
// Create tasks for each folder
|
18
23
|
const tasks = folders.map((folder) => {
|
19
24
|
const taskName = `build_Public-${folder}`; // Create a unique name for each task
|
@@ -21,15 +26,16 @@ export function buildPublic(options) {
|
|
21
26
|
`${folder}/public/**/*.ts`,
|
22
27
|
`${folder}/public/**/*.tsx`,
|
23
28
|
])
|
24
|
-
.pipe(
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
})
|
29
|
+
.pipe(swc(swcOptions))
|
30
|
+
.on('error', function (e) {
|
31
|
+
console.log("💩" + red.underline.bold(` => Build of Public files for ${orange(folder)} failed!`));
|
32
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
33
|
+
this.emit('end');
|
34
|
+
})
|
30
35
|
.pipe(gulp.dest(path.join(outputDir, 'public')))
|
31
|
-
.on('error', function () {
|
36
|
+
.on('error', function (e) {
|
32
37
|
console.log("💩" + red.underline.bold(` => Build of Public files for ${orange(folder)} failed!`));
|
38
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
33
39
|
this.emit('end');
|
34
40
|
})
|
35
41
|
.on('end', function () {
|
package/dist/gulp/styles.js
CHANGED
@@ -13,9 +13,15 @@ export function compileScss(options) {
|
|
13
13
|
const taskName = `compile_sass-${folder}`; // Create a unique name for each task
|
14
14
|
const task = () => gulp.src(['typescript/styles/global.scss'])
|
15
15
|
.pipe(sass().on('error', sass.logError))
|
16
|
+
.on('error', function (e) {
|
17
|
+
console.log("💩" + red.underline.bold(` => Build of SCSS files for ${orange(folder)} failed!`));
|
18
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
19
|
+
this.emit('end');
|
20
|
+
})
|
16
21
|
.pipe(gulp.dest(`${outputDir}/styles`))
|
17
|
-
.on('error', function () {
|
22
|
+
.on('error', function (e) {
|
18
23
|
console.log("💩" + red.underline.bold(` => Compiling of scss files for ${orange(folder)} failed!`));
|
24
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
19
25
|
this.emit('end');
|
20
26
|
})
|
21
27
|
.on('end', function () {
|
package/dist/gulp/templates.js
CHANGED
@@ -20,8 +20,9 @@ export function previewTemplates(options) {
|
|
20
20
|
`!${folder}/backend/templates/render.ts`,
|
21
21
|
])
|
22
22
|
.pipe(exec((file) => `npx ts-node-esm -T ${file.path}`, taskOpt))
|
23
|
-
.on('error', function () {
|
23
|
+
.on('error', function (e) {
|
24
24
|
console.log("💩" + red.underline.bold(` => Render of Template for ${orange(folder)} failed!`));
|
25
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
25
26
|
this.emit('end');
|
26
27
|
})
|
27
28
|
.on('end', function () {
|
package/dist/gulp/test.js
CHANGED
@@ -40,8 +40,9 @@ export function test(options) {
|
|
40
40
|
'public/(.*)': '<rootDir>/public/$1'
|
41
41
|
}
|
42
42
|
}))
|
43
|
-
.on('error', function () {
|
43
|
+
.on('error', function (e) {
|
44
44
|
console.log("💩" + red.underline.bold(` => Tests for ${orange(folder)} failed!`));
|
45
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
45
46
|
this.emit('end');
|
46
47
|
})
|
47
48
|
.on('end', function () {
|
package/dist/gulp/types.js
CHANGED
@@ -5,7 +5,7 @@ import flatmap from 'gulp-flatmap';
|
|
5
5
|
import jeditor from 'gulp-json-editor';
|
6
6
|
import merge from 'merge-stream';
|
7
7
|
import * as insert from 'gulp-insert';
|
8
|
-
import { blue, red, yellow } from '../index.js';
|
8
|
+
import { blue, orange, red, yellow } from '../index.js';
|
9
9
|
import tap from 'gulp-tap';
|
10
10
|
export function updateWixTypes(options) {
|
11
11
|
return () => {
|
@@ -141,7 +141,7 @@ export function updateWixTypes(options) {
|
|
141
141
|
}))
|
142
142
|
.on('error', function (e) {
|
143
143
|
console.log("💩" + red.underline.bold('Modification of WIX configs failed!'));
|
144
|
-
console.
|
144
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
145
145
|
this.emit('end');
|
146
146
|
})
|
147
147
|
.on('end', function () { console.log("🐶" + blue.underline(`Modification of ${yellow(count)} WIX configs succeeded!`)); });
|
@@ -168,8 +168,8 @@ export function addTypes(options, done) {
|
|
168
168
|
.pipe(gulp.dest('./.wix/types/wix-code-types/dist/types/common/'));
|
169
169
|
return merge(processPages, processCommon, exportTypesBeta, exportTypes)
|
170
170
|
.on('error', function (e) {
|
171
|
-
console.error(e);
|
172
171
|
console.log("💩" + red.underline.bold(' => Updating WIX failed!'));
|
172
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
173
173
|
this.emit('end');
|
174
174
|
done();
|
175
175
|
})
|
package/dist/helpers.d.ts
CHANGED
@@ -5,4 +5,9 @@ export declare function runGulp(moduleSettings: ModuleSettings, projectSettings:
|
|
5
5
|
/**
|
6
6
|
* Clean up and run a command before exiting the process.
|
7
7
|
*/
|
8
|
-
export declare function
|
8
|
+
export declare function cleanupWatchers(): void;
|
9
|
+
/**
|
10
|
+
* Kill all processes matching a specific substring in their command, with a fallback for Windows.
|
11
|
+
* @param {string} processPattern - The substring to match (e.g., "wix:dev" or "@wix/cli/bin/wix.cjs").
|
12
|
+
*/
|
13
|
+
export declare function killAllProcesses(processPattern: string): void;
|
package/dist/helpers.js
CHANGED
@@ -5,7 +5,8 @@ import { spawnSync } from 'child_process';
|
|
5
5
|
import path from 'path';
|
6
6
|
import { fileURLToPath } from 'url';
|
7
7
|
import { exec } from 'child_process';
|
8
|
-
import
|
8
|
+
import os from 'os';
|
9
|
+
import { blue, green, orange, red, yellow, magenta } from './index.js';
|
9
10
|
export async function installPackages(wixPackages, devPackages, cwd, locked) {
|
10
11
|
if (locked)
|
11
12
|
console.log("🐕" + blue.underline(` => Installing & version locked packages!`));
|
@@ -71,18 +72,83 @@ export async function runGulp(moduleSettings, projectSettings, task) {
|
|
71
72
|
/**
|
72
73
|
* Clean up and run a command before exiting the process.
|
73
74
|
*/
|
74
|
-
export function
|
75
|
+
export function cleanupWatchers() {
|
76
|
+
console.log(`🧹 ${magenta.underline('Cleaning up Watchman watchers...')}`);
|
75
77
|
const cwd = process.cwd();
|
76
|
-
const command = `watchman watch-del
|
77
|
-
console.log("🐕" + blue.underline(' => Cleaning up...'));
|
78
|
+
const command = `watchman watch-del "${cwd}"`; // Adjust for Windows paths
|
78
79
|
exec(command, (error, stdout, stderr) => {
|
79
80
|
if (error) {
|
80
|
-
console.error(`💩 Failed to run cleanup: ${error.message}`);
|
81
|
+
console.error(`💩 ${red.underline('Failed to run cleanup:')} ${orange(error.message)}`);
|
81
82
|
return;
|
82
83
|
}
|
83
84
|
if (stderr) {
|
84
|
-
console.error(`⚠️
|
85
|
+
console.error(`⚠️ ${yellow.underline('Watchman stderr:')} ${stderr}`);
|
85
86
|
}
|
86
|
-
console.log(`✅ Watchman cleanup success: ${stdout}`);
|
87
|
+
console.log(`✅ ${green.underline('Watchman cleanup success:')} ${stdout}`);
|
88
|
+
});
|
89
|
+
}
|
90
|
+
/**
|
91
|
+
* Kill all processes matching a specific substring in their command, with a fallback for Windows.
|
92
|
+
* @param {string} processPattern - The substring to match (e.g., "wix:dev" or "@wix/cli/bin/wix.cjs").
|
93
|
+
*/
|
94
|
+
export function killAllProcesses(processPattern) {
|
95
|
+
const isWindows = os.platform() === 'win32';
|
96
|
+
const command = isWindows
|
97
|
+
? `tasklist /FI "IMAGENAME eq node.exe" /FO CSV | findstr "${processPattern}"` // Adjust for Node.js processes
|
98
|
+
: `ps -eo pid,command | grep "${processPattern}" | grep -v grep`;
|
99
|
+
exec(command, (error, stdout, stderr) => {
|
100
|
+
if (error) {
|
101
|
+
console.error(`💩 ${red.underline('Failed to find processes:')} ${orange(error.message)}`);
|
102
|
+
return;
|
103
|
+
}
|
104
|
+
if (stderr) {
|
105
|
+
console.error(`⚠️ ${yellow.underline('Error output:')} ${stderr}`);
|
106
|
+
}
|
107
|
+
if (!stdout.trim()) {
|
108
|
+
console.log(`ℹ️ ${blue.underline(`No processes found matching pattern:`)} ${orange(processPattern)}`);
|
109
|
+
return;
|
110
|
+
}
|
111
|
+
console.log(`📝 ${magenta.underline('Found matching processes:')}\n${stdout}`);
|
112
|
+
const lines = stdout.trim().split('\n');
|
113
|
+
const pids = isWindows
|
114
|
+
? lines.map(line => line.match(/"(\d+)"/)?.[1]) // Extract PID from Windows tasklist output
|
115
|
+
: lines.map(line => line.trim().split(/\s+/)[0]).filter(pid => !isNaN(Number(pid)));
|
116
|
+
pids.forEach(pid => {
|
117
|
+
if (!pid)
|
118
|
+
return;
|
119
|
+
try {
|
120
|
+
const killCommand = isWindows
|
121
|
+
? `taskkill /PID ${pid} /T /F` // Forcefully terminate the process on Windows
|
122
|
+
: `kill -SIGTERM ${pid}`;
|
123
|
+
exec(killCommand, (killError) => {
|
124
|
+
if (killError) {
|
125
|
+
console.error(`⚠️ ${yellow.underline('Failed to kill process with PID')} ${orange(pid)}: ${red(killError.message)}`);
|
126
|
+
}
|
127
|
+
else {
|
128
|
+
console.log(`✅ ${green.underline('Killed process with PID:')} ${orange(pid)}`);
|
129
|
+
}
|
130
|
+
});
|
131
|
+
// Schedule SIGKILL fallback for non-Windows platforms
|
132
|
+
if (!isWindows) {
|
133
|
+
setTimeout(() => {
|
134
|
+
try {
|
135
|
+
process.kill(parseInt(pid, 10), 'SIGKILL');
|
136
|
+
console.log(`🔪 ${red.underline('Sent SIGKILL to process with PID:')} ${orange(pid)} (fallback).`);
|
137
|
+
}
|
138
|
+
catch (killError) {
|
139
|
+
if (killError.code === 'ESRCH') {
|
140
|
+
console.log(`✅ ${green.underline('Process with PID')} ${orange(pid)} ${green.underline('already terminated.')}`);
|
141
|
+
}
|
142
|
+
else {
|
143
|
+
console.error(`⚠️ ${yellow.underline('Failed to send SIGKILL to process with PID')} ${orange(pid)}: ${red(killError.message)}`);
|
144
|
+
}
|
145
|
+
}
|
146
|
+
}, 10000);
|
147
|
+
}
|
148
|
+
}
|
149
|
+
catch (err) {
|
150
|
+
console.error(`⚠️ ${yellow.underline('Failed to kill process with PID')} ${orange(pid)}: ${red(err.message)}`);
|
151
|
+
}
|
152
|
+
});
|
87
153
|
});
|
88
154
|
}
|
package/dist/index.js
CHANGED
@@ -9,8 +9,9 @@ import { join } from 'path';
|
|
9
9
|
import fs from 'fs/promises';
|
10
10
|
import { init } from './init.js';
|
11
11
|
import { sync } from './sync.js';
|
12
|
-
import { runGulp, installPackages,
|
12
|
+
import { runGulp, installPackages, killAllProcesses, cleanupWatchers } from './helpers.js';
|
13
13
|
import { prepare } from './prepare.js';
|
14
|
+
import { spawnSync } from 'child_process';
|
14
15
|
export const orange = chalk.hex('#FFA500');
|
15
16
|
export const blue = chalk.blueBright;
|
16
17
|
export const green = chalk.greenBright;
|
@@ -21,10 +22,45 @@ export const magenta = chalk.magentaBright;
|
|
21
22
|
const __filename = fileURLToPath(import.meta.url);
|
22
23
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
23
24
|
const __dirname = dirname(__filename);
|
25
|
+
// const cwd = process.cwd();
|
26
|
+
// const command = `watchman watch-del '${cwd}'`;
|
27
|
+
// killAllProcesses('@wix/cli/bin/wix.cjs'); // Matches processes running the Wix CLI
|
28
|
+
// killAllProcesses('wix:dev');
|
29
|
+
process.on('exit', (code) => {
|
30
|
+
killAllProcesses('@wix/cli/bin/wix.cjs'); // Matches processes running the Wix CLI
|
31
|
+
killAllProcesses('wix:dev');
|
32
|
+
cleanupWatchers();
|
33
|
+
console.log(`🚪 ${magenta.underline('Process exiting with code:')} ${orange(code)}`);
|
34
|
+
});
|
24
35
|
process.on('SIGINT', () => {
|
25
|
-
console.log(
|
26
|
-
|
27
|
-
|
36
|
+
console.log(`🐕 ${green.underline('Received Ctrl+C (SIGINT), cleaning up...')}`);
|
37
|
+
killAllProcesses('@wix/cli/bin/wix.cjs'); // Matches processes running the Wix CLI
|
38
|
+
killAllProcesses('wix:dev');
|
39
|
+
cleanupWatchers();
|
40
|
+
process.exit(); // Exit explicitly after handling
|
41
|
+
});
|
42
|
+
process.on('SIGTERM', () => {
|
43
|
+
console.log(`🛑 ${red.underline('Received termination signal (SIGTERM), cleaning up...')}`);
|
44
|
+
killAllProcesses('@wix/cli/bin/wix.cjs'); // Matches processes running the Wix CLI
|
45
|
+
killAllProcesses('wix:dev');
|
46
|
+
cleanupWatchers();
|
47
|
+
process.exit(); // Exit explicitly after handling
|
48
|
+
});
|
49
|
+
process.on('uncaughtException', (error) => {
|
50
|
+
console.error(`💥 ${red.underline('Uncaught Exception:')}`, error);
|
51
|
+
killAllProcesses('@wix/cli/bin/wix.cjs'); // Matches processes running the Wix CLI
|
52
|
+
killAllProcesses('wix:dev');
|
53
|
+
cleanupWatchers();
|
54
|
+
process.exit(1); // Exit with an error code
|
55
|
+
});
|
56
|
+
process.on('unhandledRejection', (reason, promise) => {
|
57
|
+
console.error(`🚨 ${yellow.underline('Unhandled Rejection at:')} ${orange(promise)}`);
|
58
|
+
console.error(`🚨 ${red.underline('Reason:')} ${reason}`);
|
59
|
+
cleanupWatchers();
|
60
|
+
killAllProcesses('@wix/cli/bin/wix.cjs'); // Matches processes running the Wix CLI
|
61
|
+
killAllProcesses('wix:dev');
|
62
|
+
cleanupWatchers();
|
63
|
+
process.exit(1); // Exit with an error code
|
28
64
|
});
|
29
65
|
/**
|
30
66
|
* Main function
|
@@ -59,6 +95,7 @@ async function main() {
|
|
59
95
|
console.log("🦮 " + magenta.bold('sync') + " : Synchronizes the database (not Implemented)");
|
60
96
|
console.log("🦮 " + magenta.bold('install') + " : Installs all Wix npm packages listed in the 'lucy.json' file in the project directory.");
|
61
97
|
console.log("🦮 " + magenta.bold('fix') + " : Runs a fix command to resolve common issues in development or production settings.");
|
98
|
+
console.log("🦮 " + magenta.bold('docs') + " : Generates documentation for the project.");
|
62
99
|
console.log("\nOptions:");
|
63
100
|
console.log("🦮 " + magenta.bold('-h, help') + " : Displays this help message.");
|
64
101
|
console.log("🦮 " + magenta.bold('-v, version') + " : Displays the current version of Lucy CLI as defined in the project’s package.json.");
|
@@ -131,6 +168,13 @@ async function main() {
|
|
131
168
|
init(moduleSettings, projectSettings);
|
132
169
|
return;
|
133
170
|
}
|
171
|
+
if (moduleSettings.args.includes('docs')) {
|
172
|
+
const res = spawnSync('yarn docs', { shell: true, stdio: 'inherit' });
|
173
|
+
if (res.error) {
|
174
|
+
return console.log((`💩 ${red.underline.bold("=> Failed to install dev packages =>")} ${orange(res.error.message)}`));
|
175
|
+
}
|
176
|
+
return console.log("🐕" + blue.underline(` => Docs generated!`));
|
177
|
+
}
|
134
178
|
if (moduleSettings.args.includes('prepare')) {
|
135
179
|
await prepare(moduleSettings, projectSettings);
|
136
180
|
return;
|
package/dist/settings.json
CHANGED
@@ -12,33 +12,39 @@
|
|
12
12
|
"initialized": false,
|
13
13
|
"wixPackages": {},
|
14
14
|
"devPackages": {
|
15
|
-
"@
|
15
|
+
"@eslint/js": "^9.15.0",
|
16
16
|
"@styled/typescript-styled-plugin": "^1.0.1",
|
17
|
-
"@total-typescript/ts-reset": "0.6.1",
|
18
|
-
"@types/jest": "^29.5.
|
19
|
-
"@types/node": "22.9.
|
20
|
-
"@types/
|
21
|
-
"@
|
22
|
-
"@typescript-eslint/
|
23
|
-
"@
|
24
|
-
"
|
25
|
-
"
|
26
|
-
"
|
27
|
-
"
|
28
|
-
"
|
29
|
-
"
|
17
|
+
"@total-typescript/ts-reset": "^0.6.1",
|
18
|
+
"@types/jest": "^29.5.14",
|
19
|
+
"@types/node": "^22.9.1",
|
20
|
+
"@types/nodemailer": "^6.4.17",
|
21
|
+
"@types/react": "^18.3.12",
|
22
|
+
"@typescript-eslint/eslint-plugin": "^8.15.0",
|
23
|
+
"@typescript-eslint/parser": "^8.15.0",
|
24
|
+
"@typescript-eslint/utils": "^8.15.0",
|
25
|
+
"@wix/cli": "^1.1.52",
|
26
|
+
"@wix/eslint-plugin-cli": "^1.0.2",
|
27
|
+
"cypress": "^13.16.0",
|
28
|
+
"cypress-cloud": "^1.11.0",
|
29
|
+
"esbuild": "^0.24.0",
|
30
|
+
"eslint": "^9.15.0",
|
31
|
+
"eslint-plugin-import": "^2.31.0",
|
32
|
+
"eslint-plugin-jsdoc": "^50.5.0",
|
30
33
|
"eslint-plugin-named-import-spacing": "^1.0.3",
|
31
|
-
"eslint-plugin-
|
32
|
-
"
|
33
|
-
"
|
34
|
-
"
|
35
|
-
"sass": "^1.
|
36
|
-
"ts-jest": "^29.
|
37
|
-
"ts-node": "^10.9.
|
38
|
-
"tsx": "4.19.2",
|
39
|
-
"typedoc": "0.26.11",
|
40
|
-
"typedoc-
|
41
|
-
"
|
34
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
35
|
+
"jest": "^29.7.0",
|
36
|
+
"prettier": "^3.3.3",
|
37
|
+
"react": "^18.3.1",
|
38
|
+
"sass": "^1.81.0",
|
39
|
+
"ts-jest": "^29.2.5",
|
40
|
+
"ts-node": "^10.9.2",
|
41
|
+
"tsx": "^4.19.2",
|
42
|
+
"typedoc": "^0.26.11",
|
43
|
+
"typedoc-plugin-merge-modules": "^6.0.3",
|
44
|
+
"typedoc-plugin-zod": "^1.3.0",
|
45
|
+
"typedoc-theme-hierarchy": "^5.0.3",
|
46
|
+
"typescript": "5.6.3",
|
47
|
+
"typescript-eslint": "^8.15.0",
|
42
48
|
"typescript-eslint-language-service": "^5.0.5"
|
43
49
|
},
|
44
50
|
"scripts": {
|