lucy-cli 0.7.15 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- 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/dist/gulp/test.js
CHANGED
@@ -1,11 +1,19 @@
|
|
1
1
|
import gulp from 'gulp';
|
2
|
-
import { blue, red } from '../index.js';
|
2
|
+
import { blue, orange, red } from '../index.js';
|
3
3
|
import gulpJest from 'gulp-jest';
|
4
4
|
const jest = gulpJest.default;
|
5
|
-
export function test() {
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
export function test(options) {
|
6
|
+
const folders = ['typescript'];
|
7
|
+
if (options.modulesSync) {
|
8
|
+
for (const module of Object.keys(options.modulesSync)) {
|
9
|
+
folders.push(module);
|
10
|
+
}
|
11
|
+
}
|
12
|
+
// Create tasks for each folder
|
13
|
+
const tasks = folders.map((folder) => {
|
14
|
+
const taskName = `tests-${folder}`; // Create a unique name for each task
|
15
|
+
const task = () => gulp.src([
|
16
|
+
`${folder}/backend/**/*.spec.ts`,
|
9
17
|
])
|
10
18
|
.pipe(jest({
|
11
19
|
verbose: true,
|
@@ -14,7 +22,7 @@ export function test() {
|
|
14
22
|
'^.+\\.tsx?$': [
|
15
23
|
'ts-jest',
|
16
24
|
{
|
17
|
-
tsconfig:
|
25
|
+
tsconfig: `./${folder}/tsconfig.json`,
|
18
26
|
usESM: true,
|
19
27
|
},
|
20
28
|
],
|
@@ -23,60 +31,26 @@ export function test() {
|
|
23
31
|
setupFilesAfterEnv: [],
|
24
32
|
testEnvironment: 'node',
|
25
33
|
collectCoverage: true,
|
26
|
-
coverageDirectory: '../coverage',
|
27
|
-
coverageReporters: ['clover', 'json', 'lcov', 'text'],
|
28
|
-
rootDir: './typescript',
|
29
|
-
testMatch: ['**/*.spec.ts'],
|
30
|
-
passWithNoTests: true,
|
31
|
-
moduleNameMapper: {
|
32
|
-
'public/(.*)': '<rootDir>/public/$1'
|
33
|
-
}
|
34
|
-
}))
|
35
|
-
.on('error', function () {
|
36
|
-
console.log("💩" + red.underline.bold(' => Tests failed!'));
|
37
|
-
this.emit('end');
|
38
|
-
})
|
39
|
-
.on('end', function () {
|
40
|
-
console.log("🐶" + blue.underline(' => Test succeeded!'));
|
41
|
-
});
|
42
|
-
};
|
43
|
-
}
|
44
|
-
export function testLib() {
|
45
|
-
return () => {
|
46
|
-
return gulp.src([
|
47
|
-
'lib/backend/**/*.spec.ts',
|
48
|
-
])
|
49
|
-
.pipe(jest({
|
50
|
-
verbose: true,
|
51
|
-
extensionsToTreatAsEsm: ['.ts'],
|
52
|
-
transform: {
|
53
|
-
'^.+\\.tsx?$': [
|
54
|
-
'ts-jest',
|
55
|
-
{
|
56
|
-
tsconfig: './lib/tsconfig.json',
|
57
|
-
usESM: true,
|
58
|
-
},
|
59
|
-
],
|
60
|
-
},
|
61
|
-
preset: 'ts-jest',
|
62
|
-
setupFilesAfterEnv: [],
|
63
|
-
testEnvironment: 'node',
|
64
|
-
collectCoverage: true,
|
65
|
-
passWithNoTests: true,
|
66
34
|
coverageDirectory: './coverage',
|
67
35
|
coverageReporters: ['clover', 'json', 'lcov', 'text'],
|
68
|
-
rootDir:
|
36
|
+
rootDir: `./${folder}`,
|
69
37
|
testMatch: ['**/*.spec.ts'],
|
38
|
+
passWithNoTests: true,
|
70
39
|
moduleNameMapper: {
|
71
40
|
'public/(.*)': '<rootDir>/public/$1'
|
72
41
|
}
|
73
42
|
}))
|
74
43
|
.on('error', function () {
|
75
|
-
console.log("💩" + red.underline.bold(
|
44
|
+
console.log("💩" + red.underline.bold(` => Tests for ${orange(folder)} failed!`));
|
76
45
|
this.emit('end');
|
77
46
|
})
|
78
47
|
.on('end', function () {
|
79
|
-
console.log("🐶" + blue.underline(
|
48
|
+
console.log("🐶" + blue.underline(` => Tests for ${orange(folder)} succeeded!`));
|
80
49
|
});
|
81
|
-
|
50
|
+
// Register the task with Gulp
|
51
|
+
Object.defineProperty(task, 'name', { value: taskName }); // Set a unique name for debugging
|
52
|
+
return task;
|
53
|
+
});
|
54
|
+
// Run all tasks in parallel
|
55
|
+
return gulp.parallel(...tasks);
|
82
56
|
}
|
package/dist/gulp/watchers.d.ts
CHANGED
@@ -1,15 +1,9 @@
|
|
1
1
|
import { TaskOptions } from '../Gulpfile.js';
|
2
2
|
export declare function watchSCSS(): import("fs").FSWatcher;
|
3
3
|
export declare function watchBackend(): import("fs").FSWatcher;
|
4
|
-
export declare function watchBackendLib(): import("fs").FSWatcher;
|
5
|
-
export declare function watchJSW(): import("fs").FSWatcher;
|
6
|
-
export declare function watchJSWLib(): import("fs").FSWatcher;
|
7
4
|
export declare function watchPublic(): import("fs").FSWatcher;
|
8
|
-
export declare function watchPublicLib(): import("fs").FSWatcher;
|
9
5
|
export declare function watchPages(): import("fs").FSWatcher;
|
10
6
|
export declare function watchFiles(): import("fs").FSWatcher;
|
11
|
-
export declare function watchFilesLib(): import("fs").FSWatcher;
|
12
7
|
export declare function watchTemplates(): import("fs").FSWatcher;
|
13
|
-
export declare function watchTemplatesLib(): import("fs").FSWatcher;
|
14
8
|
export declare function watchTypes(): import("fs").FSWatcher;
|
15
9
|
export declare function watchAll(options: TaskOptions): import("undertaker").TaskFunction;
|
package/dist/gulp/watchers.js
CHANGED
@@ -1,85 +1,51 @@
|
|
1
1
|
import gulp from 'gulp';
|
2
2
|
import { green } from '../index.js';
|
3
|
-
import { buildBackend
|
4
|
-
import { buildPublic
|
3
|
+
import { buildBackend } from './backend.js';
|
4
|
+
import { buildPublic } from './public.js';
|
5
5
|
import { buildPages } from './pages.js';
|
6
|
-
import { copyFiles
|
7
|
-
import { previewTemplates
|
8
|
-
import { checkTs
|
9
|
-
import {
|
6
|
+
import { copyFiles } from './copy.js';
|
7
|
+
import { previewTemplates } from './templates.js';
|
8
|
+
import { checkTs } from './checks.js';
|
9
|
+
import { test } from './test.js';
|
10
10
|
let taskOptions;
|
11
11
|
export function watchSCSS() {
|
12
12
|
return gulp.watch([
|
13
|
-
'
|
14
|
-
'lib/styles/**/*.scss'
|
13
|
+
'*/styles/**/*.scss'
|
15
14
|
], gulp.parallel('scss'));
|
16
15
|
}
|
17
16
|
export function watchBackend() {
|
18
17
|
return gulp.watch([
|
19
|
-
'
|
20
|
-
'
|
21
|
-
'
|
22
|
-
'
|
23
|
-
|
24
|
-
|
25
|
-
export function watchBackendLib() {
|
26
|
-
return gulp.watch([
|
27
|
-
'lib/backend/**/*.ts',
|
28
|
-
'lib/backend/**/*.tsx',
|
29
|
-
'!lib/backend/**/*.spec.ts',
|
30
|
-
'!lib/backend/**/*.jsw.ts',
|
31
|
-
], gulp.parallel(testLib(), checkTsLib(), buildBackendLib(taskOptions)));
|
32
|
-
}
|
33
|
-
export function watchJSW() {
|
34
|
-
return gulp.watch(['typescript/backend/**/*.jsw.ts'], gulp.parallel(test(), checkTs(), buildBackendJSW(taskOptions)));
|
35
|
-
}
|
36
|
-
export function watchJSWLib() {
|
37
|
-
return gulp.watch(['lib/backend/**/*.jsw.ts'], gulp.parallel(testLib(), checkTsLib(), buildBackendJSWLib(taskOptions)));
|
18
|
+
'*/backend/**/*.ts',
|
19
|
+
'*/backend/**/*.tsx',
|
20
|
+
'!*/backend/**/*.spec.ts',
|
21
|
+
'!*/backend/**/*.jsw.ts',
|
22
|
+
'!src/**/**',
|
23
|
+
], gulp.parallel(test(taskOptions), checkTs(taskOptions), buildBackend(taskOptions)));
|
38
24
|
}
|
39
25
|
export function watchPublic() {
|
40
26
|
return gulp.watch([
|
41
|
-
'
|
42
|
-
'
|
43
|
-
], gulp.parallel(test(), checkTs(), buildPublic(taskOptions)));
|
44
|
-
}
|
45
|
-
export function watchPublicLib() {
|
46
|
-
return gulp.watch([
|
47
|
-
'lib/public/**/*.ts',
|
48
|
-
'lib/public/**/*.tsx',
|
49
|
-
], gulp.parallel(testLib(), checkTsLib(), buildPublicLib(taskOptions)));
|
27
|
+
'*/public/**/*.ts',
|
28
|
+
'*/public/**/*.tsx',
|
29
|
+
], gulp.parallel(test(taskOptions), checkTs(taskOptions), buildPublic(taskOptions)));
|
50
30
|
}
|
51
31
|
export function watchPages() {
|
52
|
-
return gulp.watch('typescript/pages/**/*.ts', gulp.parallel(checkTs(), buildPages(taskOptions)));
|
32
|
+
return gulp.watch('typescript/pages/**/*.ts', gulp.parallel(checkTs(taskOptions), buildPages(taskOptions)));
|
53
33
|
}
|
54
34
|
export function watchFiles() {
|
55
35
|
return gulp.watch([
|
56
|
-
'
|
57
|
-
'
|
58
|
-
'
|
59
|
-
'
|
36
|
+
'*/backend/**/*',
|
37
|
+
'*/public/**/*',
|
38
|
+
'*/pages/**/*',
|
39
|
+
'!*/**/*.ts',
|
40
|
+
'!*/**/*.tsx',
|
60
41
|
], gulp.parallel(copyFiles(taskOptions)));
|
61
42
|
}
|
62
|
-
export function watchFilesLib() {
|
63
|
-
return gulp.watch([
|
64
|
-
'lib/backend/**/*',
|
65
|
-
'lib/public/**/*',
|
66
|
-
'lib/pages/**/*',
|
67
|
-
'!lib/**/*.ts',
|
68
|
-
], gulp.parallel(copyFilesLib(taskOptions)));
|
69
|
-
}
|
70
43
|
export function watchTemplates() {
|
71
44
|
return gulp.watch([
|
72
|
-
'
|
73
|
-
'
|
74
|
-
'
|
75
|
-
], gulp.parallel(previewTemplates(), test()));
|
76
|
-
}
|
77
|
-
export function watchTemplatesLib() {
|
78
|
-
return gulp.watch([
|
79
|
-
'lib/backend/templates/**/*.tsx',
|
80
|
-
'lib/backend/templates/data/*.json',
|
81
|
-
'!lib/backend/templates/render.ts',
|
82
|
-
], gulp.parallel(previewTemplatesLib(), testLib()));
|
45
|
+
'*/backend/templates/**/*.tsx',
|
46
|
+
'*/backend/templates/data/*.json',
|
47
|
+
'!*/backend/templates/render.ts',
|
48
|
+
], gulp.parallel(previewTemplates(taskOptions), test(taskOptions), checkTs(taskOptions)));
|
83
49
|
}
|
84
50
|
export function watchTypes() {
|
85
51
|
return gulp.watch([
|
@@ -90,5 +56,5 @@ export function watchTypes() {
|
|
90
56
|
export function watchAll(options) {
|
91
57
|
taskOptions = options;
|
92
58
|
console.log("🐕" + green.underline.bold(' => Adding watchers...'));
|
93
|
-
return gulp.parallel(watchSCSS, watchBackend,
|
59
|
+
return gulp.parallel(watchSCSS, watchBackend, watchPublic, watchPages, watchFiles, watchTemplates, watchTypes);
|
94
60
|
}
|
package/dist/helpers.d.ts
CHANGED
@@ -2,3 +2,7 @@ import { ModuleSettings, ProjectSettings } from '.';
|
|
2
2
|
export declare function installPackages(wixPackages: Record<string, string>, devPackages: Record<string, string>, cwd: string, locked: boolean): Promise<void>;
|
3
3
|
export declare function gitInit(cwd: string, modules: Record<string, string>): Promise<void>;
|
4
4
|
export declare function runGulp(moduleSettings: ModuleSettings, projectSettings: ProjectSettings, task: string): Promise<void>;
|
5
|
+
/**
|
6
|
+
* Clean up and run a command before exiting the process.
|
7
|
+
*/
|
8
|
+
export declare function handleExit(): void;
|
package/dist/helpers.js
CHANGED
@@ -4,6 +4,7 @@ import { spawnSync } from 'child_process';
|
|
4
4
|
// https://www.sergevandenoever.nl/run-gulp4-tasks-programatically-from-node/
|
5
5
|
import path from 'path';
|
6
6
|
import { fileURLToPath } from 'url';
|
7
|
+
import { exec } from 'child_process';
|
7
8
|
import { blue, green, orange, red } from './index.js';
|
8
9
|
export async function installPackages(wixPackages, devPackages, cwd, locked) {
|
9
10
|
if (locked)
|
@@ -67,3 +68,21 @@ export async function runGulp(moduleSettings, projectSettings, task) {
|
|
67
68
|
// Check if 'dev' task exists
|
68
69
|
gulpfile.runTask(task, moduleSettings, projectSettings);
|
69
70
|
}
|
71
|
+
/**
|
72
|
+
* Clean up and run a command before exiting the process.
|
73
|
+
*/
|
74
|
+
export function handleExit() {
|
75
|
+
const cwd = process.cwd();
|
76
|
+
const command = `watchman watch-del '${cwd}'`;
|
77
|
+
console.log("🐕" + blue.underline(' => Cleaning up...'));
|
78
|
+
exec(command, (error, stdout, stderr) => {
|
79
|
+
if (error) {
|
80
|
+
console.error(`💩 Failed to run cleanup: ${error.message}`);
|
81
|
+
return;
|
82
|
+
}
|
83
|
+
if (stderr) {
|
84
|
+
console.error(`⚠️ Watchman stderr: ${stderr}`);
|
85
|
+
}
|
86
|
+
console.log(`✅ Watchman cleanup success: ${stdout}`);
|
87
|
+
});
|
88
|
+
}
|
package/dist/index.js
CHANGED
@@ -9,7 +9,7 @@ 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 } from './helpers.js';
|
12
|
+
import { runGulp, installPackages, handleExit } from './helpers.js';
|
13
13
|
import { prepare } from './prepare.js';
|
14
14
|
export const orange = chalk.hex('#FFA500');
|
15
15
|
export const blue = chalk.blueBright;
|
@@ -21,6 +21,11 @@ export const magenta = chalk.magentaBright;
|
|
21
21
|
const __filename = fileURLToPath(import.meta.url);
|
22
22
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
23
23
|
const __dirname = dirname(__filename);
|
24
|
+
process.on('SIGINT', () => {
|
25
|
+
console.log("🐕 Received Ctrl+C, cleaning up...");
|
26
|
+
handleExit();
|
27
|
+
process.exit(); // Exit the process explicitly
|
28
|
+
});
|
24
29
|
/**
|
25
30
|
* Main function
|
26
31
|
* @returns {Promise<void>}
|
@@ -114,6 +119,7 @@ async function main() {
|
|
114
119
|
}
|
115
120
|
if (moduleSettings.args.includes('-l'))
|
116
121
|
moduleSettings.lockVersion = true;
|
122
|
+
console.log("🐕" + magenta.underline(' => Lucy CLI => RUNNING: ' + orange('Press Ctrl+C to stop.')));
|
117
123
|
// INFO: Run commands
|
118
124
|
if (moduleSettings.args.includes('init')) {
|
119
125
|
if (projectSettings.lucySettings?.initialized && !moduleSettings.force) {
|
package/package.json
CHANGED
package/src/Gulpfile.ts
CHANGED
@@ -9,19 +9,20 @@ import masterSettings from '../settings/master-settings.json' assert { type: 'js
|
|
9
9
|
import pageSettings from '../settings/page-settings.json' assert { type: 'json' };
|
10
10
|
import publicSettings from '../settings/public-settings.json' assert { type: 'json' };
|
11
11
|
|
12
|
-
import { buildPublic
|
13
|
-
import { buildBackend,
|
14
|
-
import { checkPages, checkTs
|
12
|
+
import { buildPublic } from './gulp/public.js';
|
13
|
+
import { buildBackend, buildBackendJSW } from './gulp/backend.js';
|
14
|
+
import { checkPages, checkTs } from './gulp/checks.js';
|
15
15
|
import { compileScss } from './gulp/styles.js';
|
16
16
|
import { buildPages } from './gulp/pages.js';
|
17
|
-
import { previewTemplates
|
18
|
-
import { copyFiles
|
17
|
+
import { previewTemplates } from './gulp/templates.js';
|
18
|
+
import { copyFiles } from './gulp/copy.js';
|
19
19
|
import { cleanSrc, cleanWix } from './gulp/clean.js';
|
20
20
|
import { addTypes, updateWixTypes } from './gulp/types.js';
|
21
21
|
import { setProdConfig } from './gulp/pipeline.js';
|
22
22
|
import { watchAll } from './gulp/watchers.js';
|
23
23
|
import { ModuleSettings, ProjectSettings, green, magenta, orange, red } from './index.js';
|
24
|
-
import {
|
24
|
+
import { test } from './gulp/test.js';
|
25
|
+
import { getModulesSync } from './gulp/helpers.js';
|
25
26
|
|
26
27
|
const sass = gulpSass(dartSass);
|
27
28
|
|
@@ -37,6 +38,7 @@ export type TaskOptions = {
|
|
37
38
|
masterSettings: typeof masterSettings,
|
38
39
|
pageSettings: typeof pageSettings,
|
39
40
|
publicSettings: typeof publicSettings,
|
41
|
+
modulesSync: Record<string, string> | undefined;
|
40
42
|
cwd: string;
|
41
43
|
}
|
42
44
|
|
@@ -64,11 +66,11 @@ const taskOptions: TaskOptions = {
|
|
64
66
|
masterSettings,
|
65
67
|
replaceOptions,
|
66
68
|
cwd: process.cwd(),
|
69
|
+
modulesSync: getModulesSync(),
|
67
70
|
}
|
68
71
|
|
69
72
|
gulp.task('check-ts', gulp.parallel(
|
70
|
-
checkTs(),
|
71
|
-
checkTsLib(),
|
73
|
+
checkTs(taskOptions),
|
72
74
|
));
|
73
75
|
|
74
76
|
gulp.task('scss', gulp.parallel(
|
@@ -77,30 +79,24 @@ gulp.task('scss', gulp.parallel(
|
|
77
79
|
|
78
80
|
gulp.task('build-backend', gulp.parallel(
|
79
81
|
buildBackend(taskOptions),
|
80
|
-
buildBackendLib(taskOptions),
|
81
82
|
buildBackendJSW(taskOptions),
|
82
|
-
buildBackendJSWLib(taskOptions),
|
83
83
|
// buildBackendHTTP(taskOptions),
|
84
84
|
));
|
85
85
|
|
86
86
|
gulp.task('build-public', gulp.parallel(
|
87
87
|
buildPublic(taskOptions),
|
88
|
-
buildPublicLib(taskOptions),
|
89
88
|
));
|
90
89
|
|
91
90
|
gulp.task('preview-templates', gulp.parallel(
|
92
|
-
previewTemplates(),
|
93
|
-
previewTemplatesLib()
|
91
|
+
previewTemplates(taskOptions),
|
94
92
|
));
|
95
93
|
|
96
94
|
gulp.task('copy-files', gulp.parallel(
|
97
95
|
copyFiles(taskOptions),
|
98
|
-
copyFilesLib(taskOptions)
|
99
96
|
));
|
100
97
|
|
101
98
|
gulp.task('test', gulp.parallel(
|
102
|
-
test(),
|
103
|
-
testLib(),
|
99
|
+
test(taskOptions),
|
104
100
|
));
|
105
101
|
|
106
102
|
gulp.task('sync-types', shell.task([
|
@@ -196,7 +192,7 @@ async function gulpTaskRunner(task: string) {
|
|
196
192
|
}
|
197
193
|
|
198
194
|
export async function runTask(task: string, moduleSettings: ModuleSettings, projectSettings: ProjectSettings) {
|
199
|
-
taskOptions.cwd =
|
195
|
+
taskOptions.cwd = moduleSettings.targetFolder;
|
200
196
|
taskOptions.moduleSettings = moduleSettings;
|
201
197
|
taskOptions.projectSettings = projectSettings;
|
202
198
|
console.log("🐕" + magenta.underline(' => Starting Task => ' + orange(task)));
|
package/src/gulp/backend.ts
CHANGED
@@ -3,130 +3,97 @@ import { createGulpEsbuild } from 'gulp-esbuild';
|
|
3
3
|
import rename from 'gulp-rename';
|
4
4
|
import * as path from 'path';
|
5
5
|
import { TaskOptions } from '../Gulpfile';
|
6
|
-
import { blue, red } from '../index.js';
|
7
|
-
import ts from 'gulp-typescript';
|
8
|
-
import merge from 'merge2';
|
9
|
-
import esbuild from 'gulp-esbuild';
|
10
|
-
import concat from 'gulp-concat';
|
11
|
-
import tsConf from '../../files/typescript/tsconfig.json' assert { type: 'json' };
|
12
|
-
|
13
|
-
|
14
|
-
type TsSettings = ts.Settings;
|
15
|
-
const tsOptions:TsSettings = tsConf.compilerOptions;
|
6
|
+
import { blue, orange, red } from '../index.js';
|
16
7
|
|
17
8
|
export function buildBackend(options: TaskOptions) {
|
18
|
-
const
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
return () => {
|
24
|
-
return gulp.src([
|
25
|
-
'typescript/backend/**/*.ts',
|
26
|
-
'typescript/backend/**/*.tsx',
|
27
|
-
'!typescript/backend/**/*.jsw.ts',
|
28
|
-
'!typescript/backend/**/*.spec.ts',
|
29
|
-
'!typescript/backend/http-functions.ts',
|
30
|
-
])
|
31
|
-
.pipe(gulpEsbuild({
|
32
|
-
bundle: false,
|
33
|
-
}))
|
34
|
-
.pipe(gulp.dest(path.join(outputDir, 'backend')))
|
35
|
-
.on('error', function () {
|
36
|
-
console.log("💩" + red.underline.bold(' => Build of Backend TS files failed!'));
|
37
|
-
this.emit('end');
|
38
|
-
})
|
39
|
-
.on('end', function() { console.log("🐶" + blue.underline(' => Build of Backend TS files succeeded!'));
|
9
|
+
const folders = ['typescript'];
|
10
|
+
if (options.modulesSync){
|
11
|
+
for (const module of Object.keys(options.modulesSync)) {
|
12
|
+
folders.push(module);
|
40
13
|
}
|
41
|
-
|
42
|
-
}
|
14
|
+
}
|
43
15
|
|
44
|
-
export function buildBackendLib(options: TaskOptions) {
|
45
16
|
const { outputDir, enableIncrementalBuild } = options;
|
46
17
|
const gulpEsbuild = createGulpEsbuild({
|
47
18
|
incremental: enableIncrementalBuild,
|
48
19
|
});
|
49
|
-
|
50
|
-
return () => {
|
51
|
-
return gulp.src([
|
52
|
-
'lib/backend/**/*.ts',
|
53
|
-
'lib/backend/**/*.tsx',
|
54
|
-
'!lib/backend/**/*.jsw.ts',
|
55
|
-
'!lib/backend/**/*.spec.ts',
|
56
|
-
'!lib/backend/http-functions.ts',
|
57
|
-
])
|
58
|
-
.pipe(gulpEsbuild({
|
59
|
-
bundle: false,
|
60
|
-
}))
|
61
|
-
.pipe(gulp.dest(path.join(outputDir, 'backend')))
|
62
|
-
.on('error', function () {
|
63
|
-
console.log("💩" + red.underline.bold(' => Build of Backend TS (LIB) files failed!'));
|
64
|
-
this.emit('end');
|
65
|
-
})
|
66
|
-
.on('end', function() { console.log("🐶" + blue.underline(' => Build of Backend TS (LIB) files succeeded!'));
|
67
|
-
}
|
68
|
-
)}
|
69
|
-
}
|
70
20
|
|
71
|
-
|
72
|
-
const
|
73
|
-
|
74
|
-
|
21
|
+
// Create tasks for each folder
|
22
|
+
const tasks = folders.map((folder) => {
|
23
|
+
const taskName = `build_Backend-${folder}`; // Create a unique name for each task
|
24
|
+
|
25
|
+
const task = () =>
|
26
|
+
gulp.src([
|
27
|
+
`${folder}/backend/**/*.ts`,
|
28
|
+
`${folder}/backend/**/*.tsx`,
|
29
|
+
`!${folder}/backend/**/*.jsw.ts`,
|
30
|
+
`!${folder}/backend/**/*.spec.ts`,
|
31
|
+
])
|
32
|
+
.pipe(
|
33
|
+
gulpEsbuild({
|
34
|
+
bundle: false,
|
35
|
+
})
|
36
|
+
)
|
37
|
+
.pipe(gulp.dest(path.join(outputDir, 'backend')))
|
38
|
+
.on('error', function () {
|
39
|
+
console.log("💩" + red.underline.bold(` => Build of Backend files for ${orange(folder)} failed!`));
|
40
|
+
this.emit('end');
|
41
|
+
})
|
42
|
+
.on('end', function () {
|
43
|
+
console.log("🐶" + blue.underline(` => Build of Backend files for ${orange(folder)} succeeded!`));
|
44
|
+
});
|
45
|
+
|
46
|
+
// Register the task with Gulp
|
47
|
+
Object.defineProperty(task, 'name', { value: taskName }); // Set a unique name for debugging
|
48
|
+
return task;
|
75
49
|
});
|
76
50
|
|
77
|
-
|
78
|
-
|
79
|
-
.pipe(gulpEsbuild({
|
80
|
-
bundle: false,
|
81
|
-
}))
|
82
|
-
.pipe(rename({ extname: '' }))
|
83
|
-
.pipe(gulp.dest(path.join(outputDir, 'backend')))
|
84
|
-
.on('error', function () {
|
85
|
-
console.log("💩" + red.underline.bold(' => Build of JSW files failed!'));
|
86
|
-
this.emit('end');
|
87
|
-
})
|
88
|
-
.on('end', function() { console.log("🐶" + blue.underline(' => Build of (JSW) files succeeded!'))})
|
89
|
-
}
|
51
|
+
// Run all tasks in parallel
|
52
|
+
return gulp.parallel(...tasks);
|
90
53
|
}
|
91
54
|
|
92
|
-
|
55
|
+
|
56
|
+
export function buildBackendJSW(options: TaskOptions) {
|
57
|
+
const folders = ['typescript'];
|
58
|
+
if (options.modulesSync){
|
59
|
+
for (const module of Object.keys(options.modulesSync)) {
|
60
|
+
folders.push(module);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
93
64
|
const { outputDir, enableIncrementalBuild } = options;
|
94
65
|
const gulpEsbuild = createGulpEsbuild({
|
95
66
|
incremental: enableIncrementalBuild,
|
96
67
|
});
|
97
68
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
bundle: false,
|
102
|
-
}))
|
103
|
-
.pipe(rename({ extname: '' }))
|
104
|
-
.pipe(gulp.dest(path.join(outputDir, 'backend')))
|
105
|
-
.on('error', function () {
|
106
|
-
console.log("💩" + red.underline.bold(' => Build of JSW (LIB) files failed!'));
|
107
|
-
this.emit('end');
|
108
|
-
})
|
109
|
-
.on('end', function() { console.log("🐶" + blue.underline(' => Build of JSW (LIB) files succeeded!'))})
|
110
|
-
}
|
111
|
-
}
|
69
|
+
// Create tasks for each folder
|
70
|
+
const tasks = folders.map((folder) => {
|
71
|
+
const taskName = `build-${folder}`; // Create a unique name for each task
|
112
72
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
73
|
+
const task = () =>
|
74
|
+
gulp.src([
|
75
|
+
`${folder}/backend/**/*.jsw.ts`,
|
76
|
+
])
|
77
|
+
.pipe(
|
78
|
+
gulpEsbuild({
|
79
|
+
bundle: false,
|
80
|
+
})
|
81
|
+
)
|
82
|
+
.pipe(rename({ extname: '' }))
|
83
|
+
.pipe(gulp.dest(path.join(outputDir, 'backend')))
|
84
|
+
.on('error', function () {
|
85
|
+
console.log("💩" + red.underline.bold(` => Build of JSW files for ${orange(folder)} failed!`));
|
86
|
+
this.emit('end');
|
87
|
+
})
|
88
|
+
.on('end', function () {
|
89
|
+
console.log("🐶" + blue.underline(` => Build of JSW files for ${orange(folder)} succeeded!`));
|
90
|
+
});
|
91
|
+
|
92
|
+
// Register the task with Gulp
|
93
|
+
Object.defineProperty(task, 'name', { value: taskName }); // Set a unique name for debugging
|
94
|
+
return task;
|
95
|
+
});
|
96
|
+
|
97
|
+
// Run all tasks in parallel
|
98
|
+
return gulp.parallel(...tasks);
|
132
99
|
}
|