lucy-cli 0.7.15 β†’ 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. package/README.md +29 -1
  2. package/dist/Gulpfile.d.ts +1 -0
  3. package/dist/Gulpfile.js +14 -12
  4. package/dist/gulp/backend.d.ts +2 -5
  5. package/dist/gulp/backend.js +43 -82
  6. package/dist/gulp/checks.d.ts +2 -2
  7. package/dist/gulp/checks.js +21 -22
  8. package/dist/gulp/copy.d.ts +1 -2
  9. package/dist/gulp/copy.js +29 -34
  10. package/dist/gulp/helpers.d.ts +1 -0
  11. package/dist/gulp/helpers.js +7 -0
  12. package/dist/gulp/public.d.ts +1 -2
  13. package/dist/gulp/public.js +20 -33
  14. package/dist/gulp/styles.d.ts +1 -1
  15. package/dist/gulp/styles.js +19 -6
  16. package/dist/gulp/templates.d.ts +2 -2
  17. package/dist/gulp/templates.js +27 -30
  18. package/dist/gulp/test.d.ts +2 -2
  19. package/dist/gulp/test.js +24 -50
  20. package/dist/gulp/types.js +9 -18
  21. package/dist/gulp/watchers.d.ts +0 -6
  22. package/dist/gulp/watchers.js +27 -61
  23. package/dist/helpers.d.ts +4 -0
  24. package/dist/helpers.js +19 -0
  25. package/dist/index.js +7 -1
  26. package/dist/models.d.ts +37 -0
  27. package/dist/models.js +1 -0
  28. package/files/typescript/templates/render.ts +32 -0
  29. package/lucy.jpg +0 -0
  30. package/package.json +1 -1
  31. package/settings/master-settings.json +0 -1
  32. package/settings/page-settings.json +0 -1
  33. package/settings/public-settings.json +0 -1
  34. package/src/Gulpfile.ts +13 -17
  35. package/src/gulp/backend.ts +74 -107
  36. package/src/gulp/checks.ts +32 -28
  37. package/src/gulp/copy.ts +38 -40
  38. package/src/gulp/helpers.ts +9 -0
  39. package/src/gulp/public.ts +36 -47
  40. package/src/gulp/styles.ts +32 -13
  41. package/src/gulp/templates.ts +38 -39
  42. package/src/gulp/test.ts +55 -75
  43. package/src/gulp/types.ts +28 -41
  44. package/src/gulp/watchers.ts +31 -101
  45. package/src/helpers.ts +23 -1
  46. package/src/index.ts +7 -1
  47. package/src/models.ts +35 -0
package/README.md CHANGED
@@ -8,6 +8,13 @@ Lucy-CLI was developed out of a personal need to gain full TypeScript support fo
8
8
 
9
9
  Lucy, my loyal dog, accompanied me during long nights working on a major project where I developed this CLI. Her companionship and resilience inspired the name "Lucy-CLI."
10
10
 
11
+ ## CAUTION: Thing to keep in mind before using Lucy-CLI
12
+
13
+ This CLI is still in development and may have bugs. Please use it with caution.
14
+ Libraries are expected to have the same folder structure as the main typescript folder except for the pages folder.
15
+ (backend, public, styles)
16
+ The lucy CLI is opinionated and may not work with all projects.
17
+
11
18
  ## What It Does
12
19
 
13
20
  Lucy-CLI is designed to streamline the setup and management of TypeScript within Wix Velo projects, providing tools to enhance code quality and reduce development time. Here’s what it offers:
@@ -27,7 +34,28 @@ Lucy-CLI is designed to streamline the setup and management of TypeScript within
27
34
  5. **Configurable Setup**
28
35
  - After initialization, Lucy-CLI creates a `lucy-config.json` configuration file where you can modify settings, add dev packages, specify Wix packages, and configure git submodules.
29
36
 
30
- ---
37
+ 6. **Execute render functions**
38
+ - Lucy-CLI can execute render functions located in the backend template folder, allowing you to test render functions locally.
39
+
40
+ 7. **compile sccs files**
41
+ - Lucy-CLI can compile scss files to css files.
42
+ - It compiles styles/global.scss file to global.css.
43
+
44
+ 8. **Wix NPM Package Installation**
45
+ - Lucy-CLI can install Wix npm packages from the `lucy.json` file in the project directory.
46
+
47
+ 9. **Teting with Jest**
48
+ - Lucy-CLI can run tests with Jest.
49
+ - It runs tests located backend folder with the file name ending with `.spec.ts`.
50
+ - it creates a code coverage report in the coverage folder in the lib folders and typescript folders.
51
+
52
+ 10. **Linting with ESLint**
53
+ - Lucy-CLI can lint the code with ESLint.
54
+ - It uses the ESLint configuration in the `.eslintrc.cjs` file in the project directory.
55
+
56
+ 11. **Add git version during production build**
57
+ - Lucy-CLI can add the git version to the production build.
58
+ - It adds the git version to the `public/constant/env.ts` file in the public folder under the key gitTag.
31
59
 
32
60
  ## Commands & Options
33
61
 
@@ -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
  }