lucy-cli 0.9.4 → 0.9.6
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 +4 -2
- package/dist/Gulpfile.js +12 -5
- package/dist/gulp/templates.js +1 -1
- package/dist/gulp/test.d.ts +1 -1
- package/dist/gulp/test.js +17 -90
- package/dist/gulp/watchers.js +8 -4
- package/dist/settings.json +6 -8
- package/files/local.tsconfig.json +53 -0
- package/files/typedoc.json +9 -10
- package/files/vitest.config.ts +57 -0
- package/package.json +3 -3
- package/src/Gulpfile.ts +13 -7
- package/src/gulp/templates.ts +1 -1
- package/src/gulp/watchers.ts +7 -6
- package/src/settings.json +6 -8
- package/src/gulp/test.ts +0 -106
package/README.md
CHANGED
@@ -44,10 +44,12 @@ Lucy-CLI is designed to streamline the setup and management of TypeScript within
|
|
44
44
|
8. **Wix NPM Package Installation**
|
45
45
|
- Lucy-CLI can install Wix npm packages from the `lucy.json` file in the project directory.
|
46
46
|
|
47
|
-
9. **Teting with
|
48
|
-
- Lucy-CLI can run tests with
|
47
|
+
9. **Teting with Vitest**
|
48
|
+
- Lucy-CLI can run tests with Vitest.
|
49
49
|
- It runs tests located backend folder with the file name ending with `.spec.ts`.
|
50
50
|
- it creates a code coverage report in the coverage folder in the lib folders and typescript folders.
|
51
|
+
- Vitest is looking for mokes in typescript folder and lib folder.
|
52
|
+
- You can add additional mock folders in vitest.config.ts file.
|
51
53
|
|
52
54
|
10. **Linting with ESLint**
|
53
55
|
- Lucy-CLI can lint the code with ESLint.
|
package/dist/Gulpfile.js
CHANGED
@@ -18,8 +18,7 @@ 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
|
-
import { green, magenta, orange, red } from './index.js';
|
22
|
-
import { test } from './gulp/test.js';
|
21
|
+
import { blue, green, magenta, orange, red } from './index.js';
|
23
22
|
import { getModulesSync } from './gulp/helpers.js';
|
24
23
|
const sass = gulpSass(dartSass);
|
25
24
|
const outputDir = './src';
|
@@ -48,7 +47,13 @@ gulp.task('build-backend', gulp.parallel(buildBackend(taskOptions), buildBackend
|
|
48
47
|
gulp.task('build-public', gulp.parallel(buildPublic(taskOptions)));
|
49
48
|
gulp.task('preview-templates', gulp.parallel(previewTemplates(taskOptions)));
|
50
49
|
gulp.task('copy-files', gulp.parallel(copyFiles(taskOptions)));
|
51
|
-
gulp.task('test',
|
50
|
+
gulp.task('test', function () {
|
51
|
+
return shell.task(['yarn test'], { ignoreErrors: true })().then(() => {
|
52
|
+
console.log("🐕" + blue.underline.bold(' => Exited test task!'));
|
53
|
+
}).catch(err => {
|
54
|
+
console.log("💩" + red.underline.bold(' => Error in test task!'));
|
55
|
+
});
|
56
|
+
});
|
52
57
|
gulp.task('sync-types', shell.task([
|
53
58
|
'yarn postinstall',
|
54
59
|
]));
|
@@ -58,14 +63,16 @@ gulp.task('add-wix-types', function (done) {
|
|
58
63
|
});
|
59
64
|
gulp.task('set-production', gulp.parallel(setProdConfig()));
|
60
65
|
gulp.task('start-wix', shell.task([
|
61
|
-
'yarn wix:dev',
|
66
|
+
'sleep 3; yarn wix:dev',
|
62
67
|
]));
|
63
68
|
gulp.task('gen-docs', shell.task([
|
64
69
|
'yarn docs',
|
65
70
|
]));
|
66
71
|
gulp.task('fix-wix', gulp.series(cleanWix(), 'sync-types', 'fix-wixtypes', 'add-wix-types'));
|
67
72
|
gulp.task('build', gulp.parallel('build-backend', 'build-public', 'preview-templates', buildPages(taskOptions), compileScss(taskOptions), 'copy-files'));
|
68
|
-
gulp.task('build-pipeline', gulp.series(cleanSrc(taskOptions), 'set-production', 'fix-wixtypes', 'add-wix-types',
|
73
|
+
gulp.task('build-pipeline', gulp.series(cleanSrc(taskOptions), 'set-production', 'fix-wixtypes', 'add-wix-types',
|
74
|
+
// 'test',
|
75
|
+
'build'));
|
69
76
|
gulp.task('build-prod', gulp.series((done) => checkPages(true, false).then(() => done(), (err) => done(err)), cleanSrc(taskOptions), 'set-production', 'fix-wix', 'build-backend', 'build-public', buildPages(taskOptions), 'copy-files', compileScss(taskOptions), 'gen-docs'));
|
70
77
|
gulp.task('start-dev-env', gulp.parallel(watchAll(taskOptions), 'test', 'start-wix', (done) => checkPages(false, taskOptions.moduleSettings?.force ?? false).then(() => done(), (err) => done(err))));
|
71
78
|
gulp.task('dev', gulp.series(cleanSrc(taskOptions), 'fix-wix', 'build', 'start-dev-env'));
|
package/dist/gulp/templates.js
CHANGED
@@ -19,7 +19,7 @@ export function previewTemplates(options) {
|
|
19
19
|
`${folder}/backend/templates/data/*.json`,
|
20
20
|
`!${folder}/backend/templates/render.ts`,
|
21
21
|
])
|
22
|
-
.pipe(exec((file) => `npx tsx --tsconfig
|
22
|
+
.pipe(exec((file) => `npx tsx --tsconfig ./local.tsconfig.json ${file.path}`, taskOpt))
|
23
23
|
.on('error', function (e) {
|
24
24
|
console.log("💩" + red.underline.bold(` => Render of Template for ${orange(folder)} failed!`));
|
25
25
|
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
package/dist/gulp/test.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
import { TaskOptions } from '../Gulpfile.js';
|
2
|
-
export declare function
|
2
|
+
export declare function buildPages(options: TaskOptions): () => any;
|
package/dist/gulp/test.js
CHANGED
@@ -2,98 +2,25 @@ import gulp from 'gulp';
|
|
2
2
|
import { blue, orange, red } from '../index.js';
|
3
3
|
import gulpJest from 'gulp-jest';
|
4
4
|
const jest = gulpJest.default;
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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`,
|
17
|
-
])
|
18
|
-
.pipe(jest({
|
19
|
-
verbose: true,
|
20
|
-
extensionsToTreatAsEsm: ['.ts'],
|
21
|
-
transform: {
|
22
|
-
'^.+\\.tsx?$': [
|
23
|
-
'ts-jest',
|
24
|
-
{
|
25
|
-
tsconfig: `./${folder}/tsconfig.json`,
|
26
|
-
usESM: true,
|
27
|
-
},
|
28
|
-
],
|
29
|
-
},
|
30
|
-
preset: 'ts-jest',
|
31
|
-
setupFilesAfterEnv: [],
|
32
|
-
testEnvironment: 'node',
|
33
|
-
collectCoverage: true,
|
34
|
-
coverageDirectory: './coverage',
|
35
|
-
coverageReporters: ['clover', 'json', 'lcov', 'text'],
|
36
|
-
rootDir: `./${folder}`,
|
37
|
-
roots: [...folders.map(folder => `../${folder}`)],
|
38
|
-
testMatch: ['**/*.spec.ts'],
|
39
|
-
passWithNoTests: true,
|
40
|
-
moduleNameMapper: {
|
41
|
-
'public/(.*)': [...folders.map(folder => `../${folder}/$1`)],
|
42
|
-
'backend/(.*)': [...folders.map(folder => `../${folder}/$1`)],
|
43
|
-
}
|
44
|
-
}))
|
5
|
+
const taskOpt = {
|
6
|
+
continueOnError: true,
|
7
|
+
};
|
8
|
+
export function buildPages(options) {
|
9
|
+
const { outputDir } = options;
|
10
|
+
return () => {
|
11
|
+
return gulp.src('typescript/pages/*.ts')
|
12
|
+
.pipe(swc(swcOptions))
|
45
13
|
.on('error', function (e) {
|
46
|
-
console.log("💩" + red.underline.bold(` =>
|
14
|
+
console.log("💩" + red.underline.bold(` => Build of Pages files failed!`));
|
47
15
|
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
48
16
|
this.emit('end');
|
49
17
|
})
|
50
|
-
.
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
return gulp.parallel(...tasks);
|
59
|
-
// return () => {
|
60
|
-
// return gulp.src([
|
61
|
-
// ...folders.map(folder => `${folder}/backend/**/*.spec.ts`)
|
62
|
-
// ])
|
63
|
-
// .pipe(jest({
|
64
|
-
// verbose: true,
|
65
|
-
// extensionsToTreatAsEsm: ['.ts'],
|
66
|
-
// transform: {
|
67
|
-
// '^.+\\.tsx?$': [
|
68
|
-
// 'ts-jest',
|
69
|
-
// {
|
70
|
-
// tsconfig: `./typescript/tsconfig.json`,
|
71
|
-
// usESM: true,
|
72
|
-
// },
|
73
|
-
// ],
|
74
|
-
// },
|
75
|
-
// preset: 'ts-jest',
|
76
|
-
// setupFilesAfterEnv: [],
|
77
|
-
// testEnvironment: 'node',
|
78
|
-
// collectCoverage: true,
|
79
|
-
// coverageDirectory: './coverage',
|
80
|
-
// coverageReporters: ['clover', 'json', 'lcov', 'text'],
|
81
|
-
// rootDir: `./typescript`,
|
82
|
-
// roots: [`.`],
|
83
|
-
// testMatch: ['**/*.spec.ts'],
|
84
|
-
// passWithNoTests: true,
|
85
|
-
// moduleNameMapper: {
|
86
|
-
// 'public/(.*)': [...folders.map(folder => `${folder}/$1`)],
|
87
|
-
// 'backend/(.*)': [...folders.map(folder => `${folder}/$1`)],
|
88
|
-
// }
|
89
|
-
// }))
|
90
|
-
// .on('error', function (e: Error) {
|
91
|
-
// console.log("💩" + red.underline.bold(` => Tests for failed!`));
|
92
|
-
// console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
93
|
-
// this.emit('end');
|
94
|
-
// })
|
95
|
-
// .on('end', function () {
|
96
|
-
// console.log("🐶" + blue.underline(` => Tests succeeded!`));
|
97
|
-
// });
|
98
|
-
// }
|
18
|
+
.pipe(gulp.dest(path.join(outputDir, 'pages')))
|
19
|
+
.on('error', function (e) {
|
20
|
+
console.log("💩" + red.underline.bold(' => Build of Pages TS files failed!'));
|
21
|
+
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
22
|
+
this.emit('end');
|
23
|
+
})
|
24
|
+
.on('end', function () { console.log("🐶" + blue.underline(' => Build of Pages TS files succeeded!')); });
|
25
|
+
};
|
99
26
|
}
|
package/dist/gulp/watchers.js
CHANGED
@@ -6,7 +6,7 @@ import { buildPages } from './pages.js';
|
|
6
6
|
import { copyFiles } from './copy.js';
|
7
7
|
import { previewTemplates } from './templates.js';
|
8
8
|
import { checkTs } from './checks.js';
|
9
|
-
import
|
9
|
+
import shell from 'gulp-shell';
|
10
10
|
let taskOptions;
|
11
11
|
export function watchSCSS() {
|
12
12
|
return gulp.watch([
|
@@ -19,13 +19,17 @@ export function watchBackend() {
|
|
19
19
|
'*/backend/**/*.tsx',
|
20
20
|
'!*/backend/**/*.jsw.ts',
|
21
21
|
'!src/**/**',
|
22
|
-
], gulp.parallel(
|
22
|
+
], gulp.parallel(checkTs(taskOptions), buildBackend(taskOptions), shell.task([
|
23
|
+
'yarn docs',
|
24
|
+
])));
|
23
25
|
}
|
24
26
|
export function watchPublic() {
|
25
27
|
return gulp.watch([
|
26
28
|
'*/public/**/*.ts',
|
27
29
|
'*/public/**/*.tsx',
|
28
|
-
], gulp.parallel(
|
30
|
+
], gulp.parallel(checkTs(taskOptions), buildPublic(taskOptions), shell.task([
|
31
|
+
'yarn docs',
|
32
|
+
])));
|
29
33
|
}
|
30
34
|
export function watchPages() {
|
31
35
|
return gulp.watch('typescript/pages/**/*.ts', gulp.parallel(checkTs(taskOptions), buildPages(taskOptions)));
|
@@ -44,7 +48,7 @@ export function watchTemplates() {
|
|
44
48
|
'*/backend/templates/**/*.tsx',
|
45
49
|
'*/backend/templates/data/*.json',
|
46
50
|
'!*/backend/templates/render.ts',
|
47
|
-
], gulp.parallel(previewTemplates(taskOptions),
|
51
|
+
], gulp.parallel(previewTemplates(taskOptions), checkTs(taskOptions)));
|
48
52
|
}
|
49
53
|
export function watchTypes() {
|
50
54
|
return gulp.watch([
|
package/dist/settings.json
CHANGED
@@ -35,20 +35,18 @@
|
|
35
35
|
"eslint-plugin-named-import-spacing": "^1.0.3",
|
36
36
|
"eslint-plugin-promise": "^7.2.1",
|
37
37
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
38
|
-
"jest": "^29.7.0",
|
39
38
|
"prettier": "^3.3.3",
|
40
39
|
"react": "^18.3.1",
|
41
40
|
"sass": "^1.81.0",
|
42
|
-
"ts-jest": "^29.2.5",
|
43
41
|
"ts-node": "^10.9.2",
|
44
42
|
"tsx": "^4.19.2",
|
45
43
|
"typedoc": "0.27.1",
|
46
|
-
"typedoc-plugin-merge-modules": "^6.0.3",
|
47
|
-
"typedoc-plugin-zod": "^1.3.0",
|
48
|
-
"typedoc-theme-hierarchy": "^5.0.3",
|
49
44
|
"typescript": "5.6.3",
|
50
45
|
"typescript-eslint": "^8.15.0",
|
51
|
-
"typescript-eslint-language-service": "^5.0.5"
|
46
|
+
"typescript-eslint-language-service": "^5.0.5",
|
47
|
+
"vitest": "^2.1.8",
|
48
|
+
"vitest-tsconfig-paths": "^3.4.1",
|
49
|
+
"vite-tsconfig-paths": "^5.1.4"
|
52
50
|
},
|
53
51
|
"scripts": {
|
54
52
|
"postinstall": "wix sync-types",
|
@@ -59,8 +57,8 @@
|
|
59
57
|
"build": "lucy-cli build-prod",
|
60
58
|
"fix-wix": "lucy-cli fix-wix",
|
61
59
|
"tsc": "tsc -p ./typescript/tsconfig.json --noEmit",
|
62
|
-
"test": "
|
63
|
-
"
|
60
|
+
"test": "vitest --ui --coverage",
|
61
|
+
"coverage": "vitest run --coverage",
|
64
62
|
"cypress": "cypress open",
|
65
63
|
"e2e": "cypress-cloud run --parallel --record"
|
66
64
|
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
{
|
2
|
+
"typeAcquisition": {
|
3
|
+
"enable": true
|
4
|
+
},
|
5
|
+
"compilerOptions": {
|
6
|
+
"outDir": "../src",
|
7
|
+
"rootDir": ".",
|
8
|
+
"target": "ES2020",
|
9
|
+
"module": "ES2020",
|
10
|
+
"moduleResolution": "Node",
|
11
|
+
"preserveConstEnums": true,
|
12
|
+
"allowSyntheticDefaultImports": true,
|
13
|
+
"skipLibCheck": false,
|
14
|
+
"allowJs": true,
|
15
|
+
"declaration": true,
|
16
|
+
"jsx": "react",
|
17
|
+
"strict": true,
|
18
|
+
"alwaysStrict": false,
|
19
|
+
"noImplicitAny": true,
|
20
|
+
"noImplicitReturns": true,
|
21
|
+
"noImplicitThis": true,
|
22
|
+
"strictNullChecks": true,
|
23
|
+
"exactOptionalPropertyTypes": true,
|
24
|
+
"strictBindCallApply": true,
|
25
|
+
"strictFunctionTypes": true,
|
26
|
+
"strictPropertyInitialization": true,
|
27
|
+
"resolveJsonModule": true,
|
28
|
+
"plugins": [
|
29
|
+
{
|
30
|
+
"name": "@styled/typescript-styled-plugin"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"name": "typescript-eslint-language-service"
|
34
|
+
}
|
35
|
+
],
|
36
|
+
"paths": {
|
37
|
+
"public/*": ["./lib/public/*", "./typescript/public/*"],
|
38
|
+
"backend/*": ["./lib/backend/*", "./typescript/backend/*"],
|
39
|
+
"pages/*": ["./pages/*"],
|
40
|
+
"types/*": ["./types/*"]
|
41
|
+
},
|
42
|
+
"typeRoots": ["./types", "../node_modules/@types"]
|
43
|
+
},
|
44
|
+
"exclude": [
|
45
|
+
"../node_modules",
|
46
|
+
"../.wix",
|
47
|
+
"node_modules",
|
48
|
+
"./wix",
|
49
|
+
"./**/*.test.ts",
|
50
|
+
"../src/**/*"
|
51
|
+
],
|
52
|
+
"include": ["!*.d.ts", "public/**/*.tsx", "**/*.ts"]
|
53
|
+
}
|
package/files/typedoc.json
CHANGED
@@ -7,23 +7,22 @@
|
|
7
7
|
"entryPointStrategy": "expand",
|
8
8
|
"out": "docs",
|
9
9
|
"plugin": [
|
10
|
-
"typedoc-theme
|
11
|
-
"typedoc-plugin-zod",
|
12
|
-
"typedoc-plugin-merge-modules"
|
10
|
+
"typedoc-github-theme",
|
13
11
|
],
|
14
|
-
"
|
15
|
-
"tsconfig": "docs.tsconfig.json",
|
12
|
+
"tsconfig": "local.tsconfig.json",
|
16
13
|
"excludeExternals": true,
|
17
14
|
"externalPattern": [
|
18
15
|
"**/node_modules/**",
|
19
16
|
"**/.wix/**",
|
20
|
-
".wix/**"
|
17
|
+
".wix/**",
|
21
18
|
],
|
22
19
|
"exclude": [
|
23
20
|
"./.wix/**/*",
|
24
|
-
".wix/**/*"
|
21
|
+
".wix/**/*",
|
22
|
+
"cypress/**",
|
23
|
+
"**/__mocks__/**",
|
25
24
|
],
|
26
|
-
"name": "
|
27
|
-
"mergeModulesRenameDefaults":
|
28
|
-
"mergeModulesMergeMode": "project",
|
25
|
+
"name": "wix-integraleakademie",
|
26
|
+
// "mergeModulesRenameDefaults": false, // NEW option of TypeDoc added by this plugin
|
27
|
+
// "mergeModulesMergeMode": "project", // NEW option of TypeDoc added by this plugin
|
29
28
|
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
2
|
+
import path from 'node:path';
|
3
|
+
|
4
|
+
import fs from 'fs';
|
5
|
+
import tsconfigPaths from 'vite-tsconfig-paths';
|
6
|
+
import { defineConfig } from 'vitest/config';
|
7
|
+
|
8
|
+
export default defineConfig({
|
9
|
+
plugins: [
|
10
|
+
tsconfigPaths({
|
11
|
+
projects: ['./local.tsconfig.json'],
|
12
|
+
}),
|
13
|
+
{
|
14
|
+
name: 'multi-folder-wix-resolution',
|
15
|
+
enforce: 'pre',
|
16
|
+
resolveId(source) {
|
17
|
+
|
18
|
+
if (source.startsWith('wix')){
|
19
|
+
const baseName = source.replace(/^wix/, '');
|
20
|
+
const candidates = [
|
21
|
+
path.resolve(__dirname, './lib/__mocks__/wix' + baseName),
|
22
|
+
path.resolve(__dirname, './typescript/__mocks__/wix' + baseName),
|
23
|
+
];
|
24
|
+
|
25
|
+
for (const candidate of candidates){
|
26
|
+
if (fs.existsSync(candidate + '.ts') || fs.existsSync(candidate + '/index.ts')){
|
27
|
+
return candidate;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
return null;
|
33
|
+
},
|
34
|
+
},
|
35
|
+
],
|
36
|
+
test: {
|
37
|
+
coverage: {
|
38
|
+
provider: 'v8',
|
39
|
+
reporter: ['text', 'json', 'html'],
|
40
|
+
reportsDirectory: './coverage',
|
41
|
+
exclude: ['**/node_modules/**', 'src/**', '.wix/**', '**/models/**', '**/__mocks__/**', 'docs/**', 'cypress/**', '**/pages/**'],
|
42
|
+
},
|
43
|
+
alias: {}
|
44
|
+
},
|
45
|
+
// resolve: {
|
46
|
+
// alias: [
|
47
|
+
// {
|
48
|
+
// find: /^wix(.*)$/,
|
49
|
+
// replacement: path.resolve(__dirname, './lib/__mocks__/wix$1'),
|
50
|
+
// },
|
51
|
+
// {
|
52
|
+
// find: /^wix(.*)$/,
|
53
|
+
// replacement: path.resolve(__dirname, './typescript/__mocks__/wix$1'),
|
54
|
+
// },
|
55
|
+
// ],
|
56
|
+
// },
|
57
|
+
});
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"type": "module",
|
3
3
|
"name": "lucy-cli",
|
4
|
-
"version": "0.9.
|
4
|
+
"version": "0.9.6",
|
5
5
|
"description": "Lucy Framework for WIX Studio Editor",
|
6
6
|
"main": ".dist/index.js",
|
7
7
|
"scripts": {
|
@@ -68,8 +68,8 @@
|
|
68
68
|
"ts-node": "^10.9.1",
|
69
69
|
"typedoc": "0.26.11",
|
70
70
|
"typedoc-theme-hierarchy": "5.0.3",
|
71
|
-
"
|
72
|
-
"
|
71
|
+
"typescript": "^5.6.3",
|
72
|
+
"velo-sync": "^0.0.9"
|
73
73
|
},
|
74
74
|
"devDependencies": {
|
75
75
|
"@types/fs-extra": "^11.0.4",
|
package/src/Gulpfile.ts
CHANGED
@@ -20,8 +20,7 @@ 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
|
-
import { ModuleSettings, ProjectSettings, green, magenta, orange, red } from './index.js';
|
24
|
-
import { test } from './gulp/test.js';
|
23
|
+
import { ModuleSettings, ProjectSettings, blue, green, magenta, orange, red } from './index.js';
|
25
24
|
import { getModulesSync } from './gulp/helpers.js';
|
26
25
|
|
27
26
|
const sass = gulpSass(dartSass);
|
@@ -95,9 +94,16 @@ gulp.task('copy-files', gulp.parallel(
|
|
95
94
|
copyFiles(taskOptions),
|
96
95
|
));
|
97
96
|
|
98
|
-
gulp.task('test',
|
99
|
-
|
100
|
-
|
97
|
+
gulp.task('test', function () {
|
98
|
+
return shell.task(
|
99
|
+
['yarn test'],
|
100
|
+
{ ignoreErrors: true }
|
101
|
+
)().then(() => {
|
102
|
+
console.log("🐕" + blue.underline.bold(' => Exited test task!'));
|
103
|
+
}).catch(err => {
|
104
|
+
console.log("💩" + red.underline.bold(' => Error in test task!'));
|
105
|
+
});
|
106
|
+
});
|
101
107
|
|
102
108
|
gulp.task('sync-types', shell.task([
|
103
109
|
'yarn postinstall',
|
@@ -116,7 +122,7 @@ gulp.task('set-production', gulp.parallel(
|
|
116
122
|
));
|
117
123
|
|
118
124
|
gulp.task('start-wix', shell.task([
|
119
|
-
'yarn wix:dev',
|
125
|
+
'sleep 3; yarn wix:dev',
|
120
126
|
]));
|
121
127
|
|
122
128
|
gulp.task('gen-docs', shell.task([
|
@@ -145,7 +151,7 @@ gulp.task('build-pipeline', gulp.series(
|
|
145
151
|
'set-production',
|
146
152
|
'fix-wixtypes',
|
147
153
|
'add-wix-types',
|
148
|
-
'test',
|
154
|
+
// 'test',
|
149
155
|
'build',
|
150
156
|
));
|
151
157
|
|
package/src/gulp/templates.ts
CHANGED
@@ -24,7 +24,7 @@ export function previewTemplates(options: TaskOptions) {
|
|
24
24
|
`${folder}/backend/templates/data/*.json`,
|
25
25
|
`!${folder}/backend/templates/render.ts`,
|
26
26
|
])
|
27
|
-
.pipe(exec((file: File) => `npx tsx --tsconfig
|
27
|
+
.pipe(exec((file: File) => `npx tsx --tsconfig ./local.tsconfig.json ${file.path}`, taskOpt))
|
28
28
|
.on('error', function (e: Error) {
|
29
29
|
console.log("💩" + red.underline.bold(` => Render of Template for ${orange(folder)} failed!`));
|
30
30
|
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
package/src/gulp/watchers.ts
CHANGED
@@ -7,7 +7,7 @@ import { buildPages } from './pages.js';
|
|
7
7
|
import { copyFiles } from './copy.js';
|
8
8
|
import { previewTemplates } from './templates.js';
|
9
9
|
import { checkPages, checkTs } from './checks.js';
|
10
|
-
import
|
10
|
+
import shell from 'gulp-shell';
|
11
11
|
|
12
12
|
let taskOptions: TaskOptions;
|
13
13
|
|
@@ -26,10 +26,11 @@ export function watchBackend() {
|
|
26
26
|
'!*/backend/**/*.jsw.ts',
|
27
27
|
'!src/**/**',
|
28
28
|
], gulp.parallel(
|
29
|
-
test(taskOptions),
|
30
29
|
checkTs(taskOptions),
|
31
30
|
buildBackend(taskOptions),
|
32
|
-
|
31
|
+
shell.task([
|
32
|
+
'yarn docs',
|
33
|
+
]))
|
33
34
|
);
|
34
35
|
}
|
35
36
|
|
@@ -38,10 +39,11 @@ export function watchPublic() {
|
|
38
39
|
'*/public/**/*.ts',
|
39
40
|
'*/public/**/*.tsx',
|
40
41
|
], gulp.parallel(
|
41
|
-
test(taskOptions),
|
42
42
|
checkTs(taskOptions),
|
43
43
|
buildPublic(taskOptions),
|
44
|
-
|
44
|
+
shell.task([
|
45
|
+
'yarn docs',
|
46
|
+
]))
|
45
47
|
);
|
46
48
|
}
|
47
49
|
|
@@ -71,7 +73,6 @@ export function watchTemplates() {
|
|
71
73
|
'!*/backend/templates/render.ts',
|
72
74
|
], gulp.parallel(
|
73
75
|
previewTemplates(taskOptions),
|
74
|
-
test(taskOptions),
|
75
76
|
checkTs(taskOptions),
|
76
77
|
)
|
77
78
|
);
|
package/src/settings.json
CHANGED
@@ -35,20 +35,18 @@
|
|
35
35
|
"eslint-plugin-named-import-spacing": "^1.0.3",
|
36
36
|
"eslint-plugin-promise": "^7.2.1",
|
37
37
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
38
|
-
"jest": "^29.7.0",
|
39
38
|
"prettier": "^3.3.3",
|
40
39
|
"react": "^18.3.1",
|
41
40
|
"sass": "^1.81.0",
|
42
|
-
"ts-jest": "^29.2.5",
|
43
41
|
"ts-node": "^10.9.2",
|
44
42
|
"tsx": "^4.19.2",
|
45
43
|
"typedoc": "0.27.1",
|
46
|
-
"typedoc-plugin-merge-modules": "^6.0.3",
|
47
|
-
"typedoc-plugin-zod": "^1.3.0",
|
48
|
-
"typedoc-theme-hierarchy": "^5.0.3",
|
49
44
|
"typescript": "5.6.3",
|
50
45
|
"typescript-eslint": "^8.15.0",
|
51
|
-
"typescript-eslint-language-service": "^5.0.5"
|
46
|
+
"typescript-eslint-language-service": "^5.0.5",
|
47
|
+
"vitest": "^2.1.8",
|
48
|
+
"vitest-tsconfig-paths": "^3.4.1",
|
49
|
+
"vite-tsconfig-paths": "^5.1.4"
|
52
50
|
},
|
53
51
|
"scripts": {
|
54
52
|
"postinstall": "wix sync-types",
|
@@ -59,8 +57,8 @@
|
|
59
57
|
"build": "lucy-cli build-prod",
|
60
58
|
"fix-wix": "lucy-cli fix-wix",
|
61
59
|
"tsc": "tsc -p ./typescript/tsconfig.json --noEmit",
|
62
|
-
"test": "
|
63
|
-
"
|
60
|
+
"test": "vitest --ui --coverage",
|
61
|
+
"coverage": "vitest run --coverage",
|
64
62
|
"cypress": "cypress open",
|
65
63
|
"e2e": "cypress-cloud run --parallel --record"
|
66
64
|
}
|
package/src/gulp/test.ts
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
import gulp from 'gulp';
|
2
|
-
import { blue, orange, red } from '../index.js';
|
3
|
-
import gulpJest from 'gulp-jest';
|
4
|
-
import { TaskOptions } from '../Gulpfile.js';
|
5
|
-
const jest = gulpJest.default;
|
6
|
-
|
7
|
-
export function test(options: TaskOptions) {
|
8
|
-
const folders = ['typescript'];
|
9
|
-
if (options.modulesSync){
|
10
|
-
for (const module of Object.keys(options.modulesSync)) {
|
11
|
-
folders.push(module);
|
12
|
-
}
|
13
|
-
}
|
14
|
-
|
15
|
-
// Create tasks for each folder
|
16
|
-
const tasks = folders.map((folder) => {
|
17
|
-
const taskName = `tests-${folder}`; // Create a unique name for each task
|
18
|
-
const task = () =>
|
19
|
-
gulp.src([
|
20
|
-
`${folder}/backend/**/*.spec.ts`,
|
21
|
-
])
|
22
|
-
.pipe(jest({
|
23
|
-
verbose: true,
|
24
|
-
extensionsToTreatAsEsm: ['.ts'],
|
25
|
-
transform: {
|
26
|
-
'^.+\\.tsx?$': [
|
27
|
-
'ts-jest',
|
28
|
-
{
|
29
|
-
tsconfig: `./${folder}/tsconfig.json`,
|
30
|
-
usESM: true,
|
31
|
-
},
|
32
|
-
],
|
33
|
-
},
|
34
|
-
preset: 'ts-jest',
|
35
|
-
setupFilesAfterEnv: [],
|
36
|
-
testEnvironment: 'node',
|
37
|
-
collectCoverage: true,
|
38
|
-
coverageDirectory: './coverage',
|
39
|
-
coverageReporters: ['clover', 'json', 'lcov', 'text'],
|
40
|
-
rootDir: `./${folder}`,
|
41
|
-
roots: [...folders.map(folder => `../${folder}`)],
|
42
|
-
testMatch: ['**/*.spec.ts'],
|
43
|
-
passWithNoTests: true,
|
44
|
-
moduleNameMapper: {
|
45
|
-
'public/(.*)': [...folders.map(folder => `../${folder}/$1`)],
|
46
|
-
'backend/(.*)': [...folders.map(folder => `../${folder}/$1`)],
|
47
|
-
}
|
48
|
-
}))
|
49
|
-
.on('error', function (e: Error) {
|
50
|
-
console.log("💩" + red.underline.bold(` => Tests for ${orange(folder)} failed!`));
|
51
|
-
console.log("💩" + red.underline.bold(` => Error: ${orange(e.message)}`));
|
52
|
-
this.emit('end');
|
53
|
-
})
|
54
|
-
.on('end', function () {
|
55
|
-
console.log("🐶" + blue.underline(` => Tests for ${orange(folder)} succeeded!`));
|
56
|
-
});
|
57
|
-
|
58
|
-
// Register the task with Gulp
|
59
|
-
Object.defineProperty(task, 'name', { value: taskName }); // Set a unique name for debugging
|
60
|
-
return task;
|
61
|
-
});
|
62
|
-
|
63
|
-
// Run all tasks in parallel
|
64
|
-
return gulp.parallel(...tasks);
|
65
|
-
|
66
|
-
// return () => {
|
67
|
-
// return gulp.src([
|
68
|
-
// ...folders.map(folder => `${folder}/backend/**/*.spec.ts`)
|
69
|
-
// ])
|
70
|
-
// .pipe(jest({
|
71
|
-
// verbose: true,
|
72
|
-
// extensionsToTreatAsEsm: ['.ts'],
|
73
|
-
// transform: {
|
74
|
-
// '^.+\\.tsx?$': [
|
75
|
-
// 'ts-jest',
|
76
|
-
// {
|
77
|
-
// tsconfig: `./typescript/tsconfig.json`,
|
78
|
-
// usESM: true,
|
79
|
-
// },
|
80
|
-
// ],
|
81
|
-
// },
|
82
|
-
// preset: 'ts-jest',
|
83
|
-
// setupFilesAfterEnv: [],
|
84
|
-
// testEnvironment: 'node',
|
85
|
-
// collectCoverage: true,
|
86
|
-
// coverageDirectory: './coverage',
|
87
|
-
// coverageReporters: ['clover', 'json', 'lcov', 'text'],
|
88
|
-
// rootDir: `./typescript`,
|
89
|
-
// roots: [`.`],
|
90
|
-
// testMatch: ['**/*.spec.ts'],
|
91
|
-
// passWithNoTests: true,
|
92
|
-
// moduleNameMapper: {
|
93
|
-
// 'public/(.*)': [...folders.map(folder => `${folder}/$1`)],
|
94
|
-
// 'backend/(.*)': [...folders.map(folder => `${folder}/$1`)],
|
95
|
-
// }
|
96
|
-
// }))
|
97
|
-
// .on('error', function (e: Error) {
|
98
|
-
// console.log("💩" + red.underline.bold(` => Tests for 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(` => Tests succeeded!`));
|
104
|
-
// });
|
105
|
-
// }
|
106
|
-
}
|