lucy-cli 0.7.15 → 0.8.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.d.ts +1 -0
- package/dist/Gulpfile.js +14 -12
- package/dist/gulp/backend.d.ts +2 -5
- package/dist/gulp/backend.js +43 -82
- package/dist/gulp/checks.d.ts +2 -2
- package/dist/gulp/checks.js +21 -22
- package/dist/gulp/copy.d.ts +1 -2
- package/dist/gulp/copy.js +29 -34
- package/dist/gulp/helpers.d.ts +1 -0
- package/dist/gulp/helpers.js +7 -0
- package/dist/gulp/public.d.ts +1 -2
- package/dist/gulp/public.js +20 -33
- package/dist/gulp/styles.d.ts +1 -1
- package/dist/gulp/styles.js +19 -6
- package/dist/gulp/templates.d.ts +2 -2
- package/dist/gulp/templates.js +27 -30
- package/dist/gulp/test.d.ts +2 -2
- package/dist/gulp/test.js +24 -50
- package/dist/gulp/watchers.d.ts +0 -6
- package/dist/gulp/watchers.js +27 -61
- package/dist/helpers.d.ts +4 -0
- package/dist/helpers.js +19 -0
- package/dist/index.js +7 -1
- package/package.json +1 -1
- package/settings/master-settings.json +0 -1
- package/settings/page-settings.json +0 -1
- package/settings/public-settings.json +0 -1
- package/src/Gulpfile.ts +13 -17
- package/src/gulp/backend.ts +74 -107
- package/src/gulp/checks.ts +32 -28
- package/src/gulp/copy.ts +39 -40
- package/src/gulp/helpers.ts +9 -0
- package/src/gulp/public.ts +36 -47
- package/src/gulp/styles.ts +32 -13
- package/src/gulp/templates.ts +38 -39
- package/src/gulp/test.ts +55 -75
- package/src/gulp/watchers.ts +31 -101
- package/src/helpers.ts +23 -1
- package/src/index.ts +7 -1
package/src/gulp/watchers.ts
CHANGED
@@ -1,100 +1,55 @@
|
|
1
1
|
import gulp from 'gulp';
|
2
2
|
import { TaskOptions } from '../Gulpfile.js';
|
3
3
|
import { green } from '../index.js';
|
4
|
-
import { buildBackend, buildBackendJSW
|
5
|
-
import { buildPublic
|
4
|
+
import { buildBackend, buildBackendJSW } from './backend.js';
|
5
|
+
import { buildPublic } from './public.js';
|
6
6
|
import { buildPages } from './pages.js';
|
7
|
-
import { copyFiles
|
8
|
-
import { previewTemplates
|
9
|
-
import { checkPages, checkTs
|
10
|
-
import {
|
7
|
+
import { copyFiles } from './copy.js';
|
8
|
+
import { previewTemplates } from './templates.js';
|
9
|
+
import { checkPages, checkTs } from './checks.js';
|
10
|
+
import { test } from './test.js';
|
11
11
|
|
12
12
|
let taskOptions: TaskOptions;
|
13
13
|
|
14
14
|
export function watchSCSS() {
|
15
15
|
return gulp.watch([
|
16
|
-
'
|
17
|
-
|
16
|
+
'*/styles/**/*.scss'
|
17
|
+
],
|
18
18
|
gulp.parallel('scss')
|
19
19
|
);
|
20
20
|
}
|
21
21
|
|
22
22
|
export function watchBackend() {
|
23
23
|
return gulp.watch([
|
24
|
-
'
|
25
|
-
'
|
26
|
-
'
|
27
|
-
'
|
24
|
+
'*/backend/**/*.ts',
|
25
|
+
'*/backend/**/*.tsx',
|
26
|
+
'!*/backend/**/*.spec.ts',
|
27
|
+
'!*/backend/**/*.jsw.ts',
|
28
|
+
'!src/**/**',
|
28
29
|
], gulp.parallel(
|
29
|
-
test(),
|
30
|
-
checkTs(),
|
30
|
+
test(taskOptions),
|
31
|
+
checkTs(taskOptions),
|
31
32
|
buildBackend(taskOptions),
|
32
33
|
)
|
33
34
|
);
|
34
35
|
}
|
35
36
|
|
36
|
-
export function watchBackendLib() {
|
37
|
-
return gulp.watch([
|
38
|
-
'lib/backend/**/*.ts',
|
39
|
-
'lib/backend/**/*.tsx',
|
40
|
-
'!lib/backend/**/*.spec.ts',
|
41
|
-
'!lib/backend/**/*.jsw.ts',
|
42
|
-
], gulp.parallel(
|
43
|
-
testLib(),
|
44
|
-
checkTsLib(),
|
45
|
-
buildBackendLib(taskOptions)
|
46
|
-
)
|
47
|
-
);
|
48
|
-
}
|
49
|
-
|
50
|
-
export function watchJSW() {
|
51
|
-
return gulp.watch(['typescript/backend/**/*.jsw.ts'],
|
52
|
-
gulp.parallel(
|
53
|
-
test(),
|
54
|
-
checkTs(),
|
55
|
-
buildBackendJSW(taskOptions)
|
56
|
-
)
|
57
|
-
);
|
58
|
-
}
|
59
|
-
|
60
|
-
export function watchJSWLib() {
|
61
|
-
return gulp.watch(['lib/backend/**/*.jsw.ts'],
|
62
|
-
gulp.parallel(
|
63
|
-
testLib(),
|
64
|
-
checkTsLib(),
|
65
|
-
buildBackendJSWLib(taskOptions)
|
66
|
-
)
|
67
|
-
);
|
68
|
-
}
|
69
|
-
|
70
37
|
export function watchPublic() {
|
71
38
|
return gulp.watch([
|
72
|
-
'
|
73
|
-
'
|
39
|
+
'*/public/**/*.ts',
|
40
|
+
'*/public/**/*.tsx',
|
74
41
|
], gulp.parallel(
|
75
|
-
test(),
|
76
|
-
checkTs(),
|
42
|
+
test(taskOptions),
|
43
|
+
checkTs(taskOptions),
|
77
44
|
buildPublic(taskOptions),
|
78
45
|
)
|
79
46
|
);
|
80
47
|
}
|
81
48
|
|
82
|
-
export function watchPublicLib() {
|
83
|
-
return gulp.watch([
|
84
|
-
'lib/public/**/*.ts',
|
85
|
-
'lib/public/**/*.tsx',
|
86
|
-
], gulp.parallel(
|
87
|
-
testLib(),
|
88
|
-
checkTsLib(),
|
89
|
-
buildPublicLib(taskOptions),
|
90
|
-
)
|
91
|
-
);
|
92
|
-
}
|
93
|
-
|
94
49
|
export function watchPages() {
|
95
50
|
return gulp.watch('typescript/pages/**/*.ts',
|
96
51
|
gulp.parallel(
|
97
|
-
checkTs(),
|
52
|
+
checkTs(taskOptions),
|
98
53
|
buildPages(taskOptions),
|
99
54
|
)
|
100
55
|
);
|
@@ -102,42 +57,23 @@ export function watchPages() {
|
|
102
57
|
|
103
58
|
export function watchFiles() {
|
104
59
|
return gulp.watch([
|
105
|
-
'
|
106
|
-
'
|
107
|
-
'
|
108
|
-
'
|
60
|
+
'*/backend/**/*',
|
61
|
+
'*/public/**/*',
|
62
|
+
'*/pages/**/*',
|
63
|
+
'!*/**/*.ts',
|
64
|
+
'!*/**/*.tsx',
|
109
65
|
], gulp.parallel(copyFiles(taskOptions)));
|
110
66
|
}
|
111
67
|
|
112
|
-
export function watchFilesLib() {
|
113
|
-
return gulp.watch([
|
114
|
-
'lib/backend/**/*',
|
115
|
-
'lib/public/**/*',
|
116
|
-
'lib/pages/**/*',
|
117
|
-
'!lib/**/*.ts',
|
118
|
-
], gulp.parallel(copyFilesLib(taskOptions)));
|
119
|
-
}
|
120
|
-
|
121
68
|
export function watchTemplates() {
|
122
69
|
return gulp.watch([
|
123
|
-
'
|
124
|
-
'
|
125
|
-
'
|
126
|
-
], gulp.parallel(
|
127
|
-
previewTemplates(),
|
128
|
-
test()
|
129
|
-
)
|
130
|
-
);
|
131
|
-
}
|
132
|
-
|
133
|
-
export function watchTemplatesLib() {
|
134
|
-
return gulp.watch([
|
135
|
-
'lib/backend/templates/**/*.tsx',
|
136
|
-
'lib/backend/templates/data/*.json',
|
137
|
-
'!lib/backend/templates/render.ts',
|
70
|
+
'*/backend/templates/**/*.tsx',
|
71
|
+
'*/backend/templates/data/*.json',
|
72
|
+
'!*/backend/templates/render.ts',
|
138
73
|
], gulp.parallel(
|
139
|
-
|
140
|
-
|
74
|
+
previewTemplates(taskOptions),
|
75
|
+
test(taskOptions),
|
76
|
+
checkTs(taskOptions),
|
141
77
|
)
|
142
78
|
);
|
143
79
|
}
|
@@ -160,16 +96,10 @@ export function watchAll(options: TaskOptions) {
|
|
160
96
|
return gulp.parallel(
|
161
97
|
watchSCSS,
|
162
98
|
watchBackend,
|
163
|
-
watchBackendLib,
|
164
|
-
watchJSW,
|
165
|
-
watchJSWLib,
|
166
99
|
watchPublic,
|
167
|
-
watchPublicLib,
|
168
100
|
watchPages,
|
169
|
-
watchFilesLib,
|
170
101
|
watchFiles,
|
171
102
|
watchTemplates,
|
172
|
-
watchTemplatesLib,
|
173
103
|
watchTypes,
|
174
104
|
);
|
175
105
|
}
|
package/src/helpers.ts
CHANGED
@@ -7,6 +7,7 @@ import { spawnSync } from 'child_process';
|
|
7
7
|
import path from 'path';
|
8
8
|
import { fileURLToPath } from 'url';
|
9
9
|
import { ModuleSettings, ProjectSettings } from '.';
|
10
|
+
import { exec } from 'child_process';
|
10
11
|
|
11
12
|
import { blue, green, orange, red } from './index.js';
|
12
13
|
|
@@ -76,4 +77,25 @@ export async function runGulp(moduleSettings: ModuleSettings, projectSettings: P
|
|
76
77
|
|
77
78
|
// Check if 'dev' task exists
|
78
79
|
gulpfile.runTask(task, moduleSettings, projectSettings)
|
79
|
-
}
|
80
|
+
}
|
81
|
+
|
82
|
+
|
83
|
+
/**
|
84
|
+
* Clean up and run a command before exiting the process.
|
85
|
+
*/
|
86
|
+
export function handleExit() {
|
87
|
+
const cwd = process.cwd();
|
88
|
+
const command = `watchman watch-del '${cwd}'`;
|
89
|
+
|
90
|
+
console.log("🐕" + blue.underline(' => Cleaning up...'));
|
91
|
+
exec(command, (error, stdout, stderr) => {
|
92
|
+
if (error) {
|
93
|
+
console.error(`💩 Failed to run cleanup: ${error.message}`);
|
94
|
+
return;
|
95
|
+
}
|
96
|
+
if (stderr) {
|
97
|
+
console.error(`⚠️ Watchman stderr: ${stderr}`);
|
98
|
+
}
|
99
|
+
console.log(`✅ Watchman cleanup success: ${stdout}`);
|
100
|
+
});
|
101
|
+
}
|
package/src/index.ts
CHANGED
@@ -11,7 +11,7 @@ import fs from 'fs/promises';
|
|
11
11
|
|
12
12
|
import { init } from './init.js';
|
13
13
|
import { sync } from './sync.js';
|
14
|
-
import { runGulp, installPackages } from './helpers.js';
|
14
|
+
import { runGulp, installPackages, handleExit } from './helpers.js';
|
15
15
|
import { prepare } from './prepare.js';
|
16
16
|
|
17
17
|
export type LucySettings = {
|
@@ -70,6 +70,11 @@ const __filename = fileURLToPath(import.meta.url);
|
|
70
70
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
71
71
|
const __dirname = dirname(__filename);
|
72
72
|
|
73
|
+
process.on('SIGINT', () => {
|
74
|
+
console.log("🐕 Received Ctrl+C, cleaning up...");
|
75
|
+
handleExit();
|
76
|
+
process.exit(); // Exit the process explicitly
|
77
|
+
});
|
73
78
|
|
74
79
|
/**
|
75
80
|
* Main function
|
@@ -169,6 +174,7 @@ async function main(): Promise<void> {
|
|
169
174
|
|
170
175
|
if(moduleSettings.args.includes('-l')) moduleSettings.lockVersion = true;
|
171
176
|
|
177
|
+
console.log("🐕" + magenta.underline(' => Lucy CLI => RUNNING: ' + orange('Press Ctrl+C to stop.')));
|
172
178
|
// INFO: Run commands
|
173
179
|
if(moduleSettings.args.includes('init')){
|
174
180
|
if(projectSettings.lucySettings?.initialized && !moduleSettings.force) {
|