lucy-cli 0.7.14 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,6 +16,7 @@ export type TaskOptions = {
16
16
  masterSettings: typeof masterSettings;
17
17
  pageSettings: typeof pageSettings;
18
18
  publicSettings: typeof publicSettings;
19
+ modulesSync: Record<string, string> | undefined;
19
20
  cwd: string;
20
21
  };
21
22
  export interface File {
package/dist/Gulpfile.js CHANGED
@@ -7,19 +7,20 @@ import backendSettings from '../settings/backend-settings.json' assert { type: '
7
7
  import masterSettings from '../settings/master-settings.json' assert { type: 'json' };
8
8
  import pageSettings from '../settings/page-settings.json' assert { type: 'json' };
9
9
  import publicSettings from '../settings/public-settings.json' assert { type: 'json' };
10
- import { buildPublic, buildPublicLib } from './gulp/public.js';
11
- import { buildBackend, buildBackendJSW, buildBackendJSWLib, buildBackendLib } from './gulp/backend.js';
12
- import { checkPages, checkTs, checkTsLib } from './gulp/checks.js';
10
+ import { buildPublic } from './gulp/public.js';
11
+ import { buildBackend, buildBackendJSW } from './gulp/backend.js';
12
+ import { checkPages, checkTs } from './gulp/checks.js';
13
13
  import { compileScss } from './gulp/styles.js';
14
14
  import { buildPages } from './gulp/pages.js';
15
- import { previewTemplates, previewTemplatesLib } from './gulp/templates.js';
16
- import { copyFiles, copyFilesLib } from './gulp/copy.js';
15
+ import { previewTemplates } from './gulp/templates.js';
16
+ import { copyFiles } from './gulp/copy.js';
17
17
  import { cleanSrc, cleanWix } from './gulp/clean.js';
18
18
  import { addTypes, updateWixTypes } from './gulp/types.js';
19
19
  import { setProdConfig } from './gulp/pipeline.js';
20
20
  import { watchAll } from './gulp/watchers.js';
21
21
  import { green, magenta, orange, red } from './index.js';
22
- import { testLib, test } from './gulp/test.js';
22
+ import { test } from './gulp/test.js';
23
+ import { getModulesSync } from './gulp/helpers.js';
23
24
  const sass = gulpSass(dartSass);
24
25
  const outputDir = './src';
25
26
  const userHomeDir = os.homedir();
@@ -39,14 +40,15 @@ const taskOptions = {
39
40
  masterSettings,
40
41
  replaceOptions,
41
42
  cwd: process.cwd(),
43
+ modulesSync: getModulesSync(),
42
44
  };
43
- gulp.task('check-ts', gulp.parallel(checkTs(), checkTsLib()));
45
+ gulp.task('check-ts', gulp.parallel(checkTs(taskOptions)));
44
46
  gulp.task('scss', gulp.parallel(compileScss(taskOptions)));
45
- gulp.task('build-backend', gulp.parallel(buildBackend(taskOptions), buildBackendLib(taskOptions), buildBackendJSW(taskOptions), buildBackendJSWLib(taskOptions)));
46
- gulp.task('build-public', gulp.parallel(buildPublic(taskOptions), buildPublicLib(taskOptions)));
47
- gulp.task('preview-templates', gulp.parallel(previewTemplates(), previewTemplatesLib()));
48
- gulp.task('copy-files', gulp.parallel(copyFiles(taskOptions), copyFilesLib(taskOptions)));
49
- gulp.task('test', gulp.parallel(test(), testLib()));
47
+ gulp.task('build-backend', gulp.parallel(buildBackend(taskOptions), buildBackendJSW(taskOptions)));
48
+ gulp.task('build-public', gulp.parallel(buildPublic(taskOptions)));
49
+ gulp.task('preview-templates', gulp.parallel(previewTemplates(taskOptions)));
50
+ gulp.task('copy-files', gulp.parallel(copyFiles(taskOptions)));
51
+ gulp.task('test', gulp.parallel(test(taskOptions)));
50
52
  gulp.task('sync-types', shell.task([
51
53
  'yarn postinstall',
52
54
  ]));
@@ -1,6 +1,3 @@
1
1
  import { TaskOptions } from '../Gulpfile';
2
- export declare function buildBackend(options: TaskOptions): () => NodeJS.ReadWriteStream;
3
- export declare function buildBackendLib(options: TaskOptions): () => NodeJS.ReadWriteStream;
4
- export declare function buildBackendJSW(options: TaskOptions): () => NodeJS.ReadWriteStream;
5
- export declare function buildBackendJSWLib(options: TaskOptions): () => NodeJS.ReadWriteStream;
6
- export declare function buildBackendHTTP(options: TaskOptions): () => NodeJS.ReadWriteStream;
2
+ export declare function buildBackend(options: TaskOptions): import("undertaker").TaskFunction;
3
+ export declare function buildBackendJSW(options: TaskOptions): import("undertaker").TaskFunction;
@@ -2,117 +2,78 @@ import gulp from 'gulp';
2
2
  import { createGulpEsbuild } from 'gulp-esbuild';
3
3
  import rename from 'gulp-rename';
4
4
  import * as path from 'path';
5
- import { blue, red } from '../index.js';
6
- import ts from 'gulp-typescript';
7
- import tsConf from '../../files/typescript/tsconfig.json' assert { type: 'json' };
8
- const tsOptions = tsConf.compilerOptions;
5
+ import { blue, orange, red } from '../index.js';
9
6
  export function buildBackend(options) {
7
+ const folders = ['typescript'];
8
+ if (options.modulesSync) {
9
+ for (const module of Object.keys(options.modulesSync)) {
10
+ folders.push(module);
11
+ }
12
+ }
10
13
  const { outputDir, enableIncrementalBuild } = options;
11
14
  const gulpEsbuild = createGulpEsbuild({
12
15
  incremental: enableIncrementalBuild,
13
16
  });
14
- return () => {
15
- return gulp.src([
16
- 'typescript/backend/**/*.ts',
17
- 'typescript/backend/**/*.tsx',
18
- '!typescript/backend/**/*.jsw.ts',
19
- '!typescript/backend/**/*.spec.ts',
20
- '!typescript/backend/http-functions.ts',
17
+ // Create tasks for each folder
18
+ const tasks = folders.map((folder) => {
19
+ const taskName = `build_Backend-${folder}`; // Create a unique name for each task
20
+ const task = () => gulp.src([
21
+ `${folder}/backend/**/*.ts`,
22
+ `${folder}/backend/**/*.tsx`,
23
+ `!${folder}/backend/**/*.jsw.ts`,
24
+ `!${folder}/backend/**/*.spec.ts`,
21
25
  ])
22
26
  .pipe(gulpEsbuild({
23
27
  bundle: false,
24
28
  }))
25
29
  .pipe(gulp.dest(path.join(outputDir, 'backend')))
26
30
  .on('error', function () {
27
- console.log("💩" + red.underline.bold(' => Build of Backend TS files failed!'));
31
+ console.log("💩" + red.underline.bold(` => Build of Backend files for ${orange(folder)} failed!`));
28
32
  this.emit('end');
29
33
  })
30
34
  .on('end', function () {
31
- console.log("🐶" + blue.underline(' => Build of Backend TS files succeeded!'));
35
+ console.log("🐶" + blue.underline(` => Build of Backend files for ${orange(folder)} succeeded!`));
32
36
  });
33
- };
34
- }
35
- export function buildBackendLib(options) {
36
- const { outputDir, enableIncrementalBuild } = options;
37
- const gulpEsbuild = createGulpEsbuild({
38
- incremental: enableIncrementalBuild,
37
+ // Register the task with Gulp
38
+ Object.defineProperty(task, 'name', { value: taskName }); // Set a unique name for debugging
39
+ return task;
39
40
  });
40
- return () => {
41
- return gulp.src([
42
- 'lib/backend/**/*.ts',
43
- 'lib/backend/**/*.tsx',
44
- '!lib/backend/**/*.jsw.ts',
45
- '!lib/backend/**/*.spec.ts',
46
- '!lib/backend/http-functions.ts',
47
- ])
48
- .pipe(gulpEsbuild({
49
- bundle: false,
50
- }))
51
- .pipe(gulp.dest(path.join(outputDir, 'backend')))
52
- .on('error', function () {
53
- console.log("💩" + red.underline.bold(' => Build of Backend TS (LIB) files failed!'));
54
- this.emit('end');
55
- })
56
- .on('end', function () {
57
- console.log("🐶" + blue.underline(' => Build of Backend TS (LIB) files succeeded!'));
58
- });
59
- };
41
+ // Run all tasks in parallel
42
+ return gulp.parallel(...tasks);
60
43
  }
61
44
  export function buildBackendJSW(options) {
45
+ const folders = ['typescript'];
46
+ if (options.modulesSync) {
47
+ for (const module of Object.keys(options.modulesSync)) {
48
+ folders.push(module);
49
+ }
50
+ }
62
51
  const { outputDir, enableIncrementalBuild } = options;
63
52
  const gulpEsbuild = createGulpEsbuild({
64
53
  incremental: enableIncrementalBuild,
65
54
  });
66
- return () => {
67
- return gulp.src(['typescript/backend/**/*.jsw.ts'])
55
+ // Create tasks for each folder
56
+ const tasks = folders.map((folder) => {
57
+ const taskName = `build-${folder}`; // Create a unique name for each task
58
+ const task = () => gulp.src([
59
+ `${folder}/backend/**/*.jsw.ts`,
60
+ ])
68
61
  .pipe(gulpEsbuild({
69
62
  bundle: false,
70
63
  }))
71
64
  .pipe(rename({ extname: '' }))
72
65
  .pipe(gulp.dest(path.join(outputDir, 'backend')))
73
66
  .on('error', function () {
74
- console.log("💩" + red.underline.bold(' => Build of JSW files failed!'));
67
+ console.log("💩" + red.underline.bold(` => Build of JSW files for ${orange(folder)} failed!`));
75
68
  this.emit('end');
76
69
  })
77
- .on('end', function () { console.log("🐶" + blue.underline(' => Build of (JSW) files succeeded!')); });
78
- };
79
- }
80
- export function buildBackendJSWLib(options) {
81
- const { outputDir, enableIncrementalBuild } = options;
82
- const gulpEsbuild = createGulpEsbuild({
83
- incremental: enableIncrementalBuild,
70
+ .on('end', function () {
71
+ console.log("🐶" + blue.underline(` => Build of JSW files for ${orange(folder)} succeeded!`));
72
+ });
73
+ // Register the task with Gulp
74
+ Object.defineProperty(task, 'name', { value: taskName }); // Set a unique name for debugging
75
+ return task;
84
76
  });
85
- return () => {
86
- return gulp.src(['lib/backend/**/*.jsw.ts'])
87
- .pipe(gulpEsbuild({
88
- bundle: false,
89
- }))
90
- .pipe(rename({ extname: '' }))
91
- .pipe(gulp.dest(path.join(outputDir, 'backend')))
92
- .on('error', function () {
93
- console.log("💩" + red.underline.bold(' => Build of JSW (LIB) files failed!'));
94
- this.emit('end');
95
- })
96
- .on('end', function () { console.log("🐶" + blue.underline(' => Build of JSW (LIB) files succeeded!')); });
97
- };
98
- }
99
- export function buildBackendHTTP(options) {
100
- const { outputDir, enableIncrementalBuild } = options;
101
- delete tsOptions.outFile;
102
- delete tsOptions.outDir;
103
- delete tsOptions.rootDir;
104
- // tsOptions.resolveJsonModule = false;
105
- tsOptions.module = 'amd';
106
- tsOptions.outFile = 'http-functions.js';
107
- console.log({ tsOptions });
108
- return () => {
109
- return gulp.src(['lib/backend/http-functions.ts', 'typescript/backend/http-functions.ts'])
110
- .pipe(ts(tsOptions))
111
- .pipe(gulp.dest(path.join(outputDir, 'backend')))
112
- .on('error', function () {
113
- console.log("💩" + red.underline.bold(' => Build of HTTP (LIB) files failed!'));
114
- this.emit('end');
115
- })
116
- .on('end', function () { console.log("🐶" + blue.underline(' => Build of HTTP (LIB) files succeeded!')); });
117
- };
77
+ // Run all tasks in parallel
78
+ return gulp.parallel(...tasks);
118
79
  }
@@ -1,3 +1,3 @@
1
+ import { TaskOptions } from '../Gulpfile.js';
1
2
  export declare function checkPages(fail: boolean, force: boolean): Promise<void>;
2
- export declare function checkTs(): () => import("gulp-typescript/release/project.js").ICompileStream;
3
- export declare function checkTsLib(): () => import("gulp-typescript/release/project.js").ICompileStream;
3
+ export declare function checkTs(options: TaskOptions): import("undertaker").TaskFunction;
@@ -3,7 +3,7 @@ import glob from 'glob';
3
3
  import * as path from 'path';
4
4
  import gulp from 'gulp';
5
5
  import ts from 'gulp-typescript';
6
- import { blue, green, magenta, red, yellow } from '../index.js';
6
+ import { blue, green, magenta, orange, red, yellow } from '../index.js';
7
7
  /**
8
8
  * Extracts a match from a file
9
9
  * @param {string} filePath File path
@@ -115,31 +115,30 @@ export async function checkPages(fail, force) {
115
115
  }
116
116
  });
117
117
  }
118
- export function checkTs() {
119
- const tsProject = ts.createProject('./lib/tsconfig.json', { noEmit: true });
120
- return () => {
121
- return gulp.src(['lib/typescript/**/*.ts', '!lib/typescript/types/**/*.ts'], { cwd: 'typescript' })
122
- .pipe(tsProject(ts.reporter.fullReporter()))
123
- .on('error', function () {
124
- console.log("💩" + red.underline.bold(' => Typescript error!'));
125
- this.emit('end');
126
- })
127
- .on('end', function () {
128
- console.log("🐶" + blue.underline(' => Typescriptcheck succeeded!'));
129
- });
130
- };
131
- }
132
- export function checkTsLib() {
133
- const tsProject = ts.createProject('./lib/tsconfig.json', { noEmit: true });
134
- return () => {
135
- return gulp.src(['lib/typescript/**/*.ts', '!lib/typescript/types/**/*.ts'], { cwd: 'typescript' })
118
+ export function checkTs(options) {
119
+ const folders = ['typescript'];
120
+ if (options.modulesSync) {
121
+ for (const module of Object.keys(options.modulesSync)) {
122
+ folders.push(module);
123
+ }
124
+ }
125
+ // Create tasks for each folder
126
+ const tasks = folders.map((folder) => {
127
+ const tsProject = ts.createProject(`./${folder}/tsconfig.json`, { noEmit: true });
128
+ const taskName = `test-${folder}`; // Create a unique name for each task
129
+ const task = () => gulp.src([`${folder}/**/*.ts`, `!${folder}/types/**/*.ts`], { cwd: folder })
136
130
  .pipe(tsProject(ts.reporter.fullReporter()))
137
131
  .on('error', function () {
138
- console.log("💩" + red.underline.bold(' => Typescript (LIB) error!'));
132
+ console.log("💩" + red.underline.bold(` => Typescriptcheck for ${orange(folder)} failed!`));
139
133
  this.emit('end');
140
134
  })
141
135
  .on('end', function () {
142
- console.log("🐶" + blue.underline(' => Typescript check (LIB) succeeded!'));
136
+ console.log("🐶" + blue.underline(` => Typescriptcheck for ${orange(folder)} succeeded!`));
143
137
  });
144
- };
138
+ // Register the task with Gulp
139
+ Object.defineProperty(task, 'name', { value: taskName }); // Set a unique name for debugging
140
+ return task;
141
+ });
142
+ // Run all tasks in parallel
143
+ return gulp.parallel(...tasks);
145
144
  }
@@ -1,3 +1,2 @@
1
1
  import { TaskOptions } from '../Gulpfile';
2
- export declare function copyFiles(options: TaskOptions): () => NodeJS.ReadWriteStream;
3
- export declare function copyFilesLib(options: TaskOptions): () => NodeJS.ReadWriteStream;
2
+ export declare function copyFiles(options: TaskOptions): import("undertaker").TaskFunction;
package/dist/gulp/copy.js CHANGED
@@ -1,42 +1,37 @@
1
1
  import gulp from 'gulp';
2
- import { blue, red } from '../index.js';
2
+ import { blue, orange, red } from '../index.js';
3
3
  export function copyFiles(options) {
4
- const { outputDir } = options;
5
- return () => {
6
- return gulp.src([
7
- 'typescript/**/*',
8
- '!typescript/*tsconfig.json',
9
- '!typescript/**/*.ts',
10
- '!typescript/**/*.tsx',
11
- '!typescript/types/**/**',
12
- '!typescript/__mocks__/**/**',
13
- '!typescript/styles/**',
4
+ const folders = ['typescript'];
5
+ if (options.modulesSync) {
6
+ for (const module of Object.keys(options.modulesSync)) {
7
+ folders.push(module);
8
+ }
9
+ }
10
+ // Create tasks for each folder
11
+ const tasks = folders.map((folder) => {
12
+ const { outputDir } = options;
13
+ const taskName = `copy-${folder}`; // Create a unique name for each task
14
+ const task = () => gulp.src([
15
+ `${folder}/**/*`,
16
+ `!${folder}/*tsconfig.json`,
17
+ `!${folder}/**/*.ts`,
18
+ `!${folder}/**/*.tsx`,
19
+ `!${folder}/types/**/**`,
20
+ `!${folder}/__mocks__/**/**`,
21
+ `!${folder}/styles/**`,
14
22
  ])
15
23
  .pipe(gulp.dest(outputDir))
16
24
  .on('error', function () {
17
- console.log("💩" + red.underline.bold(' => Copy of files failed!'));
25
+ console.log("💩" + red.underline.bold(` => Copy of files for ${orange(folder)} failed!`));
18
26
  this.emit('end');
19
27
  })
20
- .on('end', function () { console.log("🐶" + blue.underline(' => Copy of files succeeded!')); });
21
- };
22
- }
23
- export function copyFilesLib(options) {
24
- const { outputDir } = options;
25
- return () => {
26
- return gulp.src([
27
- 'typescript/**/*',
28
- '!typescript/*tsconfig.json',
29
- '!typescript/**/*.ts',
30
- '!typescript/**/*.tsx',
31
- '!typescript/types/**/**',
32
- '!typescript/__mocks__/**/**',
33
- '!typescript/styles/**',
34
- ])
35
- .pipe(gulp.dest(outputDir))
36
- .on('error', function () {
37
- console.log("💩" + red.underline.bold(' => Copy of files (LIB) failed!'));
38
- this.emit('end');
39
- })
40
- .on('end', function () { console.log("🐶" + blue.underline(' => Copy of files (LIB) succeeded!')); });
41
- };
28
+ .on('end', function () {
29
+ console.log("🐶" + blue.underline(` => Copy of files for ${orange(folder)} succeeded!`));
30
+ });
31
+ // Register the task with Gulp
32
+ Object.defineProperty(task, 'name', { value: taskName }); // Set a unique name for debugging
33
+ return task;
34
+ });
35
+ // Run all tasks in parallel
36
+ return gulp.parallel(...tasks);
42
37
  }
@@ -0,0 +1 @@
1
+ export declare function getModulesSync(): Record<string, string> | undefined;
@@ -0,0 +1,7 @@
1
+ import * as path from 'path';
2
+ import * as fs from 'fs';
3
+ export function getModulesSync() {
4
+ const absolutePath = path.resolve('./lucy.json');
5
+ const fileContent = fs.readFileSync(absolutePath, 'utf8');
6
+ return JSON.parse(fileContent).modules;
7
+ }
@@ -1,3 +1,2 @@
1
1
  import { TaskOptions } from '../Gulpfile';
2
- export declare function buildPublic(options: TaskOptions): () => NodeJS.ReadWriteStream;
3
- export declare function buildPublicLib(options: TaskOptions): () => NodeJS.ReadWriteStream;
2
+ export declare function buildPublic(options: TaskOptions): import("undertaker").TaskFunction;
@@ -1,16 +1,24 @@
1
1
  import gulp from 'gulp';
2
2
  import { createGulpEsbuild } from 'gulp-esbuild';
3
3
  import * as path from 'path';
4
- import { blue, red } from '../index.js';
4
+ import { blue, orange, red } from '../index.js';
5
5
  export function buildPublic(options) {
6
+ const folders = ['typescript'];
7
+ if (options.modulesSync) {
8
+ for (const module of Object.keys(options.modulesSync)) {
9
+ folders.push(module);
10
+ }
11
+ }
6
12
  const { outputDir, enableIncrementalBuild } = options;
7
13
  const gulpEsbuild = createGulpEsbuild({
8
14
  incremental: enableIncrementalBuild,
9
15
  });
10
- return () => {
11
- return gulp.src([
12
- 'typescript/public/**/*.ts',
13
- 'typescript/public/**/*.tsx',
16
+ // Create tasks for each folder
17
+ const tasks = folders.map((folder) => {
18
+ const taskName = `build_Public-${folder}`; // Create a unique name for each task
19
+ const task = () => gulp.src([
20
+ `${folder}/public/**/*.ts`,
21
+ `${folder}/public/**/*.tsx`,
14
22
  ])
15
23
  .pipe(gulpEsbuild({
16
24
  bundle: false,
@@ -20,37 +28,16 @@ export function buildPublic(options) {
20
28
  }))
21
29
  .pipe(gulp.dest(path.join(outputDir, 'public')))
22
30
  .on('error', function () {
23
- console.log("💩" + red.underline.bold(' => Build of Public TS files failed!'));
31
+ console.log("💩" + red.underline.bold(` => Build of Public files for ${orange(folder)} failed!`));
24
32
  this.emit('end');
25
33
  })
26
34
  .on('end', function () {
27
- console.log("🐶" + blue.underline(' => Build of Public TS files succeeded!'));
35
+ console.log("🐶" + blue.underline(` => Build of Public files for ${orange(folder)} succeeded!`));
28
36
  });
29
- };
30
- }
31
- export function buildPublicLib(options) {
32
- const { outputDir, enableIncrementalBuild } = options;
33
- const gulpEsbuild = createGulpEsbuild({
34
- incremental: enableIncrementalBuild,
37
+ // Register the task with Gulp
38
+ Object.defineProperty(task, 'name', { value: taskName }); // Set a unique name for debugging
39
+ return task;
35
40
  });
36
- return () => {
37
- return gulp.src([
38
- 'lib/public/**/*.ts',
39
- 'lib/public/**/*.tsx'
40
- ])
41
- .pipe(gulpEsbuild({
42
- bundle: false,
43
- loader: {
44
- '.tsx': 'tsx',
45
- },
46
- }))
47
- .pipe(gulp.dest(path.join(outputDir, 'public')))
48
- .on('error', function () {
49
- console.log("💩" + red.underline.bold(' => Build of Public (LIB) TS files failed!'));
50
- this.emit('end');
51
- })
52
- .on('end', function () {
53
- console.log("🐶" + blue.underline(' => Build of Public (LIB) TS files succeeded!'));
54
- });
55
- };
41
+ // Run all tasks in parallel
42
+ return gulp.parallel(...tasks);
56
43
  }
@@ -1,2 +1,2 @@
1
1
  import { TaskOptions } from '../Gulpfile';
2
- export declare function compileScss(options: TaskOptions): () => NodeJS.ReadWriteStream;
2
+ export declare function compileScss(options: TaskOptions): import("undertaker").TaskFunction;
@@ -1,17 +1,30 @@
1
1
  import gulp from 'gulp';
2
- import { blue, red } from '../index.js';
2
+ import { blue, orange, red } from '../index.js';
3
3
  export function compileScss(options) {
4
+ const folders = ['typescript'];
5
+ // if (options.modulesSync){
6
+ // for (const module of Object.keys(options.modulesSync)) {
7
+ // folders.push(module);
8
+ // }
9
+ // }
4
10
  const { sass, outputDir } = options;
5
- return () => {
6
- return gulp.src(['typescript/styles/global.scss'])
11
+ // Create tasks for each folder
12
+ const tasks = folders.map((folder) => {
13
+ const taskName = `compile_sass-${folder}`; // Create a unique name for each task
14
+ const task = () => gulp.src(['typescript/styles/global.scss'])
7
15
  .pipe(sass().on('error', sass.logError))
8
16
  .pipe(gulp.dest(`${outputDir}/styles`))
9
17
  .on('error', function () {
10
- console.log("💩" + red.underline.bold(' => Compiling of scss files failed!'));
18
+ console.log("💩" + red.underline.bold(` => Compiling of scss files for ${orange(folder)} failed!`));
11
19
  this.emit('end');
12
20
  })
13
21
  .on('end', function () {
14
- console.log("🐶" + blue.underline(' => Compiling of scss files succeeded!'));
22
+ console.log("🐶" + blue.underline(` => Compiling of scss files for ${orange(folder)} succeeded!`));
15
23
  });
16
- };
24
+ // Register the task with Gulp
25
+ Object.defineProperty(task, 'name', { value: taskName }); // Set a unique name for debugging
26
+ return task;
27
+ });
28
+ // Run all tasks in parallel
29
+ return gulp.parallel(...tasks);
17
30
  }
@@ -1,2 +1,2 @@
1
- export declare function previewTemplates(): () => any;
2
- export declare function previewTemplatesLib(): () => any;
1
+ import { TaskOptions } from '../Gulpfile';
2
+ export declare function previewTemplates(options: TaskOptions): import("undertaker").TaskFunction;
@@ -1,39 +1,36 @@
1
1
  import gulp from 'gulp';
2
2
  import exec from 'gulp-exec';
3
- import { blue, red } from '../index.js';
4
- export function previewTemplates() {
5
- const options = {
3
+ import { blue, orange, red } from '../index.js';
4
+ export function previewTemplates(options) {
5
+ const folders = ['typescript'];
6
+ if (options.modulesSync) {
7
+ for (const module of Object.keys(options.modulesSync)) {
8
+ folders.push(module);
9
+ }
10
+ }
11
+ const taskOpt = {
6
12
  continueOnError: true,
7
13
  };
8
- return () => {
9
- return gulp.src([
10
- 'typescript/backend/templates/**/*.tsx',
11
- 'typescript/backend/templates/data/*.json',
12
- '!typescript/backend/templates/render.ts',
14
+ // Create tasks for each folder
15
+ const tasks = folders.map((folder) => {
16
+ const taskName = `render_templates-${folder}`; // Create a unique name for each task
17
+ const task = () => gulp.src([
18
+ `${folder}/backend/templates/**/*.tsx`,
19
+ `${folder}/backend/templates/data/*.json`,
20
+ `!${folder}/backend/templates/render.ts`,
13
21
  ])
14
- .pipe(exec((file) => `npx ts-node-esm -T ${file.path}`, options))
22
+ .pipe(exec((file) => `npx ts-node-esm -T ${file.path}`, taskOpt))
15
23
  .on('error', function () {
16
- console.log("💩" + red.underline.bold(' => Render of Template failed!'));
24
+ console.log("💩" + red.underline.bold(` => Render of Template for ${orange(folder)} failed!`));
17
25
  this.emit('end');
18
26
  })
19
- .on('end', function () { console.log("🐶" + blue.underline(' => Render of Template succeeded!')); });
20
- };
21
- }
22
- export function previewTemplatesLib() {
23
- const options = {
24
- continueOnError: true,
25
- };
26
- return () => {
27
- return gulp.src([
28
- 'lib/backend/templates/**/*.tsx',
29
- 'lib/backend/templates/data/*.json',
30
- '!lib/backend/templates/render.ts',
31
- ])
32
- .pipe(exec((file) => `npx ts-node-esm -T ${file.path}`, options))
33
- .on('error', function () {
34
- console.log("💩" + red.underline.bold(' => Render of Template (LIB) failed!'));
35
- this.emit('end');
36
- })
37
- .on('end', function () { console.log("🐶" + blue.underline(' => Render of Template (LIB) succeeded!')); });
38
- };
27
+ .on('end', function () {
28
+ console.log("🐶" + blue.underline(` => Render of Template for ${orange(folder)} succeeded!`));
29
+ });
30
+ // Register the task with Gulp
31
+ Object.defineProperty(task, 'name', { value: taskName }); // Set a unique name for debugging
32
+ return task;
33
+ });
34
+ // Run all tasks in parallel
35
+ return gulp.parallel(...tasks);
39
36
  }
@@ -1,2 +1,2 @@
1
- export declare function test(): () => any;
2
- export declare function testLib(): () => any;
1
+ import { TaskOptions } from '../Gulpfile.js';
2
+ export declare function test(options: TaskOptions): import("undertaker").TaskFunction;