lucy-cli 0.8.3 → 0.9.1
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/README.md +11 -0
- package/dist/Gulpfile.js +6 -1
- package/dist/gulp/backend.js +34 -19
- package/dist/gulp/checks.js +3 -2
- 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 +67 -5
- package/dist/settings.json +3 -1
- package/files/cypress/e2e/base/base.cy.ts +14 -0
- package/files/cypress/fixtures/example.json +5 -0
- package/files/cypress/support/commands.ts +37 -0
- package/files/cypress/support/e2e.ts +24 -0
- package/files/cypress/tsconfig.json +9 -0
- package/files/cypress.config.ts +14 -2
- package/package.json +9 -7
- package/src/Gulpfile.ts +5 -1
- package/src/gulp/backend.ts +44 -32
- package/src/gulp/checks.ts +4 -2
- 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 +76 -5
- package/src/settings.json +3 -1
- package/src/types.d.ts +2 -1
@@ -0,0 +1,37 @@
|
|
1
|
+
/// <reference types="cypress" />
|
2
|
+
// ***********************************************
|
3
|
+
// This example commands.ts shows you how to
|
4
|
+
// create various custom commands and overwrite
|
5
|
+
// existing commands.
|
6
|
+
//
|
7
|
+
// For more comprehensive examples of custom
|
8
|
+
// commands please read more here:
|
9
|
+
// https://on.cypress.io/custom-commands
|
10
|
+
// ***********************************************
|
11
|
+
//
|
12
|
+
//
|
13
|
+
// -- This is a parent command --
|
14
|
+
// Cypress.Commands.add('login', (email, password) => { ... })
|
15
|
+
//
|
16
|
+
//
|
17
|
+
// -- This is a child command --
|
18
|
+
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
|
19
|
+
//
|
20
|
+
//
|
21
|
+
// -- This is a dual command --
|
22
|
+
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
|
23
|
+
//
|
24
|
+
//
|
25
|
+
// -- This will overwrite an existing command --
|
26
|
+
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
27
|
+
//
|
28
|
+
// declare global {
|
29
|
+
// namespace Cypress {
|
30
|
+
// interface Chainable {
|
31
|
+
// login(email: string, password: string): Chainable<void>
|
32
|
+
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
|
33
|
+
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
|
34
|
+
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
|
35
|
+
// }
|
36
|
+
// }
|
37
|
+
// }
|
@@ -0,0 +1,24 @@
|
|
1
|
+
// ***********************************************************
|
2
|
+
// This example support/e2e.ts is processed and
|
3
|
+
// loaded automatically before your test files.
|
4
|
+
//
|
5
|
+
// This is a great place to put global configuration and
|
6
|
+
// behavior that modifies Cypress.
|
7
|
+
//
|
8
|
+
// You can change the location of this file or turn off
|
9
|
+
// automatically serving support files with the
|
10
|
+
// 'supportFile' configuration option.
|
11
|
+
//
|
12
|
+
// You can read more here:
|
13
|
+
// https://on.cypress.io/configuration
|
14
|
+
// ***********************************************************
|
15
|
+
|
16
|
+
// Import commands.js using ES2015 syntax:
|
17
|
+
import './commands';
|
18
|
+
|
19
|
+
// before(() => {
|
20
|
+
// // Set the base URL for your application
|
21
|
+
// cy.visit('https://www.zikade.ch');
|
22
|
+
// });
|
23
|
+
// Alternatively you can use CommonJS syntax:
|
24
|
+
// require('./commands')
|
package/files/cypress.config.ts
CHANGED
@@ -1,10 +1,22 @@
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
2
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
3
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
4
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
1
5
|
// cypress.config.js
|
2
|
-
|
3
|
-
|
6
|
+
const { defineConfig } = require('cypress');
|
7
|
+
const { cloudPlugin } = require('cypress-cloud/plugin');
|
4
8
|
|
5
9
|
module.exports = defineConfig({
|
6
10
|
videoCompression: 15,
|
11
|
+
chromeWebSecurity: true,
|
12
|
+
pageLoadTimeout: 120000,
|
13
|
+
defaultCommandTimeout: 10000,
|
14
|
+
retries: {
|
15
|
+
runMode: 0,
|
16
|
+
openMode: 0,
|
17
|
+
},
|
7
18
|
e2e: {
|
19
|
+
baseUrl: 'https://www.somehost.com/',
|
8
20
|
setupNodeEvents(on, config) {
|
9
21
|
return cloudPlugin(on, config);
|
10
22
|
},
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"type": "module",
|
3
3
|
"name": "lucy-cli",
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.9.1",
|
5
5
|
"description": "Lucy Framework for WIX Studio Editor",
|
6
6
|
"main": ".dist/index.js",
|
7
7
|
"scripts": {
|
@@ -32,6 +32,7 @@
|
|
32
32
|
"registry": "https://registry.npmjs.org"
|
33
33
|
},
|
34
34
|
"dependencies": {
|
35
|
+
"@swc/core": "^1.9.3",
|
35
36
|
"@wix/cli": "^1.0.83",
|
36
37
|
"@wix/eslint-plugin-cli": "^1.0.1",
|
37
38
|
"chalk": "^5.3.0",
|
@@ -41,20 +42,21 @@
|
|
41
42
|
"gulp-clean": "^0.4.0",
|
42
43
|
"gulp-cli": "3.0.0",
|
43
44
|
"gulp-concat": "^2.6.1",
|
44
|
-
"gulp-esbuild": "0.12.1",
|
45
45
|
"gulp-exec": "^5.0.0",
|
46
46
|
"gulp-flatmap": "^1.0.2",
|
47
47
|
"gulp-if": "^3.0.0",
|
48
48
|
"gulp-insert": "^0.5.0",
|
49
49
|
"gulp-jest": "^4.0.4",
|
50
50
|
"gulp-json-editor": "2.6.0",
|
51
|
+
"gulp-plumber": "^1.2.1",
|
51
52
|
"gulp-rename": "^2.0.0",
|
52
53
|
"gulp-sass": "^5.1.0",
|
53
54
|
"gulp-shell": "^0.8.0",
|
54
55
|
"gulp-string-replace": "^1.1.2",
|
56
|
+
"gulp-swc": "^2.2.0",
|
55
57
|
"gulp-tap": "^2.0.0",
|
56
58
|
"gulp-typedoc": "^3.0.2",
|
57
|
-
"gulp-typescript": "
|
59
|
+
"gulp-typescript": "5.0.1",
|
58
60
|
"gulp-wait": "^0.0.2",
|
59
61
|
"jest": "^29.7.0",
|
60
62
|
"merge-stream": "^2.0.0",
|
@@ -66,7 +68,8 @@
|
|
66
68
|
"ts-node": "^10.9.1",
|
67
69
|
"typedoc": "0.26.11",
|
68
70
|
"typedoc-theme-hierarchy": "5.0.3",
|
69
|
-
"velo-sync": "^0.0.9"
|
71
|
+
"velo-sync": "^0.0.9",
|
72
|
+
"typescript": "^5.6.3"
|
70
73
|
},
|
71
74
|
"devDependencies": {
|
72
75
|
"@types/fs-extra": "^11.0.4",
|
@@ -75,6 +78,7 @@
|
|
75
78
|
"@types/gulp-concat": "^0.0.37",
|
76
79
|
"@types/gulp-insert": "^0.5.13",
|
77
80
|
"@types/gulp-json-editor": "^2.2.36",
|
81
|
+
"@types/gulp-plumber": "^0.0.37",
|
78
82
|
"@types/gulp-rename": "^2.0.6",
|
79
83
|
"@types/gulp-sass": "^5.0.4",
|
80
84
|
"@types/gulp-tap": "^1.0.5",
|
@@ -84,13 +88,11 @@
|
|
84
88
|
"@typescript-eslint/eslint-plugin": "8.14.0",
|
85
89
|
"@typescript-eslint/parser": "8.14.0",
|
86
90
|
"@typescript-eslint/utils": "8.14.0",
|
87
|
-
"esbuild": "0.24.0",
|
88
91
|
"eslint": "9.14.0",
|
89
92
|
"eslint-plugin-import": "^2.27.5",
|
90
93
|
"eslint-plugin-jsdoc": "50.5.0",
|
91
94
|
"eslint-plugin-named-import-spacing": "^1.0.3",
|
92
95
|
"eslint-plugin-simple-import-sort": "12.1.1",
|
93
|
-
"ts-node": "^10.9.1"
|
94
|
-
"typescript": "^5.1.6"
|
96
|
+
"ts-node": "^10.9.1"
|
95
97
|
}
|
96
98
|
}
|
package/src/Gulpfile.ts
CHANGED
@@ -133,7 +133,7 @@ gulp.task('fix-wix', gulp.series(
|
|
133
133
|
gulp.task('build', gulp.parallel(
|
134
134
|
'build-backend',
|
135
135
|
'build-public',
|
136
|
-
buildPages(taskOptions),
|
136
|
+
buildPages(taskOptions),
|
137
137
|
compileScss(taskOptions),
|
138
138
|
'copy-files'
|
139
139
|
)
|
@@ -196,6 +196,10 @@ export async function runTask(task: string, moduleSettings: ModuleSettings, proj
|
|
196
196
|
taskOptions.moduleSettings = moduleSettings;
|
197
197
|
taskOptions.projectSettings = projectSettings;
|
198
198
|
console.log("🐕" + magenta.underline(' => Starting Task => ' + orange(task)));
|
199
|
+
try {
|
199
200
|
await gulpTaskRunner(task);
|
201
|
+
} catch (err) {
|
202
|
+
console.log((`💩 ${red.underline.bold("=> Error starting tasks =>")} ${orange(err)}`));
|
203
|
+
}
|
200
204
|
console.log("🐶" + green.underline.bold(' => Task completed: ' + task));
|
201
205
|
}
|
package/src/gulp/backend.ts
CHANGED
@@ -1,9 +1,20 @@
|
|
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 { TaskOptions } from '../Gulpfile';
|
6
5
|
import { blue, orange, red } from '../index.js';
|
6
|
+
import swc from 'gulp-swc';
|
7
|
+
import { cond } from 'cypress/types/lodash';
|
8
|
+
|
9
|
+
const swcOptions = {
|
10
|
+
jsc: {
|
11
|
+
target: 'es2020',
|
12
|
+
parser: {
|
13
|
+
syntax: "typescript",
|
14
|
+
tsx: true,
|
15
|
+
},
|
16
|
+
},
|
17
|
+
};
|
7
18
|
|
8
19
|
export function buildBackend(options: TaskOptions) {
|
9
20
|
const folders = ['typescript'];
|
@@ -13,11 +24,7 @@ export function buildBackend(options: TaskOptions) {
|
|
13
24
|
}
|
14
25
|
}
|
15
26
|
|
16
|
-
const { outputDir
|
17
|
-
const gulpEsbuild = createGulpEsbuild({
|
18
|
-
incremental: enableIncrementalBuild,
|
19
|
-
pipe: true,
|
20
|
-
});
|
27
|
+
const { outputDir } = options;
|
21
28
|
|
22
29
|
// Create tasks for each folder
|
23
30
|
const tasks = folders.map((folder) => {
|
@@ -30,14 +37,17 @@ export function buildBackend(options: TaskOptions) {
|
|
30
37
|
`!${folder}/backend/**/*.jsw.ts`,
|
31
38
|
`!${folder}/backend/**/*.spec.ts`,
|
32
39
|
])
|
33
|
-
.pipe(
|
34
|
-
|
35
|
-
|
36
|
-
})
|
37
|
-
|
40
|
+
.pipe(swc(swcOptions))
|
41
|
+
.pipe(swc(swcOptions))
|
42
|
+
.on('error', function (e: Error) {
|
43
|
+
console.log("💩" + red.underline.bold(` => Build of Backend files for ${orange(folder)} failed!`));
|
44
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
45
|
+
this.emit('end');
|
46
|
+
})
|
38
47
|
.pipe(gulp.dest(path.join(outputDir, 'backend')))
|
39
|
-
.on('error', function () {
|
48
|
+
.on('error', function (e: Error) {
|
40
49
|
console.log("💩" + red.underline.bold(` => Build of Backend files for ${orange(folder)} failed!`));
|
50
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
41
51
|
this.emit('end');
|
42
52
|
})
|
43
53
|
.on('end', function () {
|
@@ -61,12 +71,12 @@ export function buildBackendJSW(options: TaskOptions) {
|
|
61
71
|
folders.push(module);
|
62
72
|
}
|
63
73
|
}
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
}
|
74
|
+
const swcOptions = {
|
75
|
+
jsc: {
|
76
|
+
target: 'es6',
|
77
|
+
},
|
78
|
+
};
|
79
|
+
const { outputDir } = options;
|
70
80
|
|
71
81
|
// Create tasks for each folder
|
72
82
|
const tasks = folders.map((folder) => {
|
@@ -76,20 +86,22 @@ export function buildBackendJSW(options: TaskOptions) {
|
|
76
86
|
gulp.src([
|
77
87
|
`${folder}/backend/**/*.jsw.ts`,
|
78
88
|
])
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
)
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
})
|
90
|
-
.
|
91
|
-
|
92
|
-
|
89
|
+
.pipe(swc(swcOptions))
|
90
|
+
.on('error', function (e: Error) {
|
91
|
+
console.log("💩" + red.underline.bold(` => Build of Public files for ${orange(folder)} failed!`));
|
92
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
93
|
+
this.emit('end');
|
94
|
+
})
|
95
|
+
.pipe(rename({ extname: '' }))
|
96
|
+
.pipe(gulp.dest(path.join(outputDir, 'backend')))
|
97
|
+
.on('error', function (e: Error) {
|
98
|
+
console.log("💩" + red.underline.bold(` => Build of JSW files for ${orange(folder)} failed!`));
|
99
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
100
|
+
this.emit('end');
|
101
|
+
})
|
102
|
+
.on('end', function () {
|
103
|
+
console.log("🐶" + blue.underline(` => Build of JSW files for ${orange(folder)} succeeded!`));
|
104
|
+
});
|
93
105
|
|
94
106
|
// Register the task with Gulp
|
95
107
|
Object.defineProperty(task, 'name', { value: taskName }); // Set a unique name for debugging
|
package/src/gulp/checks.ts
CHANGED
@@ -135,11 +135,13 @@ export function checkTs(options: TaskOptions) {
|
|
135
135
|
|
136
136
|
const task = () =>
|
137
137
|
gulp.src([`${folder}/**/*.ts`, `!${folder}/types/**/*.ts`], { cwd: folder })
|
138
|
-
.pipe(tsProject(ts.reporter.fullReporter()))
|
139
|
-
.on('error', function () {
|
138
|
+
.pipe(tsProject(ts.reporter.fullReporter(true)))
|
139
|
+
.on('error', function (e: Error) {
|
140
140
|
console.log("💩" + red.underline.bold(` => Typescriptcheck for ${orange(folder)} failed!`));
|
141
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
141
142
|
this.emit('end');
|
142
143
|
})
|
144
|
+
|
143
145
|
.on('end', function () {
|
144
146
|
console.log("🐶" + blue.underline(` => Typescriptcheck for ${orange(folder)} succeeded!`));
|
145
147
|
});
|
package/src/gulp/clean.ts
CHANGED
@@ -2,14 +2,15 @@ import chalk from 'chalk';
|
|
2
2
|
import gulp from 'gulp';
|
3
3
|
import { TaskOptions } from '../Gulpfile';
|
4
4
|
import clean from 'gulp-clean';
|
5
|
-
import { blue, red } from '../index.js';
|
5
|
+
import { blue, orange, red } from '../index.js';
|
6
6
|
|
7
7
|
export function cleanWix() {
|
8
8
|
return () => {
|
9
9
|
return gulp.src('./.wix', { read: false, allowEmpty: true })
|
10
10
|
.pipe(clean({ force: true }))
|
11
|
-
.on('error', function () {
|
11
|
+
.on('error', function (e: Error) {
|
12
12
|
console.log("💩" + red.underline.bold(' => Cleaning of .wix failed!'));
|
13
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
13
14
|
this.emit('end');
|
14
15
|
})
|
15
16
|
.on('end', function() { console.log("🐶" + blue.underline(' => Cleaning of .wix succeeded!')); });
|
@@ -22,8 +23,9 @@ export function cleanSrc(options: TaskOptions) {
|
|
22
23
|
return () => {
|
23
24
|
return gulp.src([`${outputDir}/pages`, `${outputDir}/public`, `${outputDir}/backend`], { read: false, allowEmpty: true })
|
24
25
|
.pipe(clean({ force: true }))
|
25
|
-
.on('error', function () {
|
26
|
+
.on('error', function (e: Error) {
|
26
27
|
console.log("💩" + red.underline.bold('Cleaning of output files failed!'));
|
28
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
27
29
|
this.emit('end');
|
28
30
|
})
|
29
31
|
.on('end', function() { console.log("🐶" + blue.underline(' => Cleaning of .src succeeded!')); });
|
package/src/gulp/copy.ts
CHANGED
@@ -28,8 +28,9 @@ export function copyFiles(options: TaskOptions) {
|
|
28
28
|
`!${folder}/styles/**`,
|
29
29
|
])
|
30
30
|
.pipe(gulp.dest(outputDir))
|
31
|
-
.on('error', function () {
|
31
|
+
.on('error', function (e: Error) {
|
32
32
|
console.log("💩" + red.underline.bold(` => Copy of files for ${orange(folder)} failed!`));
|
33
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
33
34
|
this.emit('end');
|
34
35
|
})
|
35
36
|
.on('end', function () {
|
package/src/gulp/pages.ts
CHANGED
@@ -1,26 +1,36 @@
|
|
1
1
|
import gulp from 'gulp';
|
2
2
|
import { TaskOptions } from '../Gulpfile';
|
3
|
-
import { createGulpEsbuild } from 'gulp-esbuild';
|
4
3
|
import * as path from 'path';
|
5
|
-
import { blue, red } from '../index.js';
|
4
|
+
import { blue, orange, red } from '../index.js';
|
5
|
+
import swc from 'gulp-swc';
|
6
|
+
|
7
|
+
const swcOptions = {
|
8
|
+
jsc: {
|
9
|
+
target: 'es2020',
|
10
|
+
parser: {
|
11
|
+
syntax: "typescript",
|
12
|
+
tsx: true,
|
13
|
+
},
|
14
|
+
},
|
15
|
+
};
|
6
16
|
|
7
17
|
export function buildPages(options: TaskOptions) {
|
8
|
-
const { outputDir
|
9
|
-
const gulpEsbuild = createGulpEsbuild({
|
10
|
-
incremental: enableIncrementalBuild, // enables the esbuild's incremental build
|
11
|
-
pipe: true, // enables the esbuild's pipe mode
|
12
|
-
});
|
18
|
+
const { outputDir} = options;
|
13
19
|
|
14
20
|
return () => {
|
15
21
|
return gulp.src('typescript/pages/*.ts')
|
16
|
-
.pipe(
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
.pipe(swc(swcOptions))
|
23
|
+
.on('error', function (e: Error) {
|
24
|
+
console.log("💩" + red.underline.bold(` => Build of Pages files failed!`));
|
25
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
26
|
+
this.emit('end');
|
27
|
+
})
|
28
|
+
.pipe(gulp.dest(path.join(outputDir, 'pages')))
|
29
|
+
.on('error', function (e: Error) {
|
30
|
+
console.log("💩" + red.underline.bold(' => Build of Pages TS files failed!'));
|
31
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
32
|
+
this.emit('end');
|
33
|
+
})
|
34
|
+
.on('end', function() { console.log("🐶" + blue.underline(' => Build of Pages TS files succeeded!')); });
|
25
35
|
};
|
26
36
|
}
|
package/src/gulp/pipeline.ts
CHANGED
@@ -2,7 +2,7 @@ import gulp from 'gulp';
|
|
2
2
|
import * as path from 'path';
|
3
3
|
import { File } from '../Gulpfile';
|
4
4
|
import replace from 'gulp-string-replace';
|
5
|
-
import { blue, red } from '../index.js';
|
5
|
+
import { blue, orange, red } from '../index.js';
|
6
6
|
|
7
7
|
export function setProdConfig() {
|
8
8
|
const tag = process.env.GIT_TAG || 'development';
|
@@ -20,8 +20,9 @@ export function setProdConfig() {
|
|
20
20
|
|
21
21
|
return path.join(`${outputDir}/constants`);
|
22
22
|
}))
|
23
|
-
.on('error', function () {
|
23
|
+
.on('error', function (e: Error) {
|
24
24
|
console.log("💩" + red.underline.bold(' => Setting the git tag failed!'));
|
25
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
25
26
|
this.emit('end');
|
26
27
|
})
|
27
28
|
.on('end', function() { console.log("🐶" + blue.underline(' => Setting the git tag succeeded!'));
|
package/src/gulp/public.ts
CHANGED
@@ -1,9 +1,18 @@
|
|
1
1
|
import gulp from 'gulp';
|
2
|
-
import { createGulpEsbuild } from 'gulp-esbuild';
|
3
|
-
|
4
2
|
import * as path from 'path';
|
5
3
|
import { TaskOptions } from '../Gulpfile';
|
6
4
|
import { blue, orange, red } from '../index.js';
|
5
|
+
import swc from 'gulp-swc';
|
6
|
+
|
7
|
+
const swcOptions = {
|
8
|
+
jsc: {
|
9
|
+
target: 'es2020',
|
10
|
+
parser: {
|
11
|
+
syntax: "typescript",
|
12
|
+
tsx: true,
|
13
|
+
},
|
14
|
+
},
|
15
|
+
};
|
7
16
|
|
8
17
|
export function buildPublic(options: TaskOptions) {
|
9
18
|
const folders = ['typescript'];
|
@@ -13,11 +22,7 @@ export function buildPublic(options: TaskOptions) {
|
|
13
22
|
}
|
14
23
|
}
|
15
24
|
|
16
|
-
const { outputDir
|
17
|
-
const gulpEsbuild = createGulpEsbuild({
|
18
|
-
incremental: enableIncrementalBuild,
|
19
|
-
pipe: true,
|
20
|
-
});
|
25
|
+
const { outputDir } = options;
|
21
26
|
|
22
27
|
// Create tasks for each folder
|
23
28
|
const tasks = folders.map((folder) => {
|
@@ -28,15 +33,16 @@ export function buildPublic(options: TaskOptions) {
|
|
28
33
|
`${folder}/public/**/*.ts`,
|
29
34
|
`${folder}/public/**/*.tsx`,
|
30
35
|
])
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
.on('error', function () {
|
36
|
+
.pipe(swc(swcOptions))
|
37
|
+
.on('error', function (e: Error) {
|
38
|
+
console.log("💩" + red.underline.bold(` => Build of Public files for ${orange(folder)} failed!`));
|
39
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
40
|
+
this.emit('end');
|
41
|
+
})
|
42
|
+
.pipe(gulp.dest(path.join(outputDir, 'public')))
|
43
|
+
.on('error', function (e: Error) {
|
39
44
|
console.log("💩" + red.underline.bold(` => Build of Public files for ${orange(folder)} failed!`));
|
45
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
40
46
|
this.emit('end');
|
41
47
|
})
|
42
48
|
.on('end', function () {
|
package/src/gulp/styles.ts
CHANGED
@@ -21,9 +21,15 @@ export function compileScss(options: TaskOptions) {
|
|
21
21
|
const task = () =>
|
22
22
|
gulp.src(['typescript/styles/global.scss'])
|
23
23
|
.pipe(sass().on('error', sass.logError))
|
24
|
+
.on('error', function (e: Error) {
|
25
|
+
console.log("💩" + red.underline.bold(` => Build of SCSS files for ${orange(folder)} failed!`));
|
26
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
27
|
+
this.emit('end');
|
28
|
+
})
|
24
29
|
.pipe(gulp.dest(`${outputDir}/styles`))
|
25
|
-
.on('error', function () {
|
30
|
+
.on('error', function (e: Error) {
|
26
31
|
console.log("💩" + red.underline.bold(` => Compiling of scss files for ${orange(folder)} failed!`));
|
32
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
27
33
|
this.emit('end');
|
28
34
|
})
|
29
35
|
.on('end', function () {
|
package/src/gulp/templates.ts
CHANGED
@@ -25,8 +25,9 @@ export function previewTemplates(options: TaskOptions) {
|
|
25
25
|
`!${folder}/backend/templates/render.ts`,
|
26
26
|
])
|
27
27
|
.pipe(exec((file: File) => `npx ts-node-esm -T ${file.path}`, taskOpt))
|
28
|
-
.on('error', function () {
|
28
|
+
.on('error', function (e: Error) {
|
29
29
|
console.log("💩" + red.underline.bold(` => Render of Template for ${orange(folder)} failed!`));
|
30
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
30
31
|
this.emit('end');
|
31
32
|
})
|
32
33
|
.on('end', function () {
|
package/src/gulp/test.ts
CHANGED
@@ -44,8 +44,9 @@ export function test(options: TaskOptions) {
|
|
44
44
|
'public/(.*)': '<rootDir>/public/$1'
|
45
45
|
}
|
46
46
|
}))
|
47
|
-
.on('error', function () {
|
47
|
+
.on('error', function (e: Error) {
|
48
48
|
console.log("💩" + red.underline.bold(` => Tests for ${orange(folder)} failed!`));
|
49
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
49
50
|
this.emit('end');
|
50
51
|
})
|
51
52
|
.on('end', function () {
|
package/src/gulp/types.ts
CHANGED
@@ -7,7 +7,7 @@ import flatmap from 'gulp-flatmap';
|
|
7
7
|
import jeditor from 'gulp-json-editor';
|
8
8
|
import merge from 'merge-stream';
|
9
9
|
import * as insert from 'gulp-insert';
|
10
|
-
import { blue, red, yellow } from '../index.js';
|
10
|
+
import { blue, orange, red, yellow } from '../index.js';
|
11
11
|
import tap from 'gulp-tap';
|
12
12
|
import { TSConfig } from '../models';
|
13
13
|
|
@@ -150,7 +150,7 @@ export function updateWixTypes(options: TaskOptions) {
|
|
150
150
|
}))
|
151
151
|
.on('error', function (e: Error) {
|
152
152
|
console.log("💩" + red.underline.bold('Modification of WIX configs failed!'));
|
153
|
-
console.
|
153
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
154
154
|
this.emit('end');
|
155
155
|
})
|
156
156
|
.on('end', function() { console.log("🐶" + blue.underline(`Modification of ${yellow(count)} WIX configs succeeded!`)); });
|
@@ -187,8 +187,8 @@ export function addTypes(options: TaskOptions, done: gulp.TaskFunctionCallback):
|
|
187
187
|
exportTypes,
|
188
188
|
)
|
189
189
|
.on('error', function(e: Error) {
|
190
|
-
console.error(e);
|
191
190
|
console.log("💩" + red.underline.bold(' => Updating WIX failed!'));
|
191
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
192
192
|
this.emit('end');
|
193
193
|
done();
|
194
194
|
})
|