lucy-cli 1.2.5 → 2.0.0-alpha.10

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.
Files changed (175) hide show
  1. package/dist/args.d.ts +7 -0
  2. package/dist/args.js +23 -0
  3. package/dist/commands.d.ts +3 -0
  4. package/dist/commands.js +18 -0
  5. package/dist/config.d.ts +20 -0
  6. package/dist/config.js +39 -0
  7. package/dist/error.d.ts +17 -0
  8. package/dist/error.js +5 -0
  9. package/dist/helpers.d.ts +1 -32
  10. package/dist/helpers.js +6 -261
  11. package/dist/index.d.ts +2 -59
  12. package/dist/index.js +25 -282
  13. package/dist/init.d.ts +4 -8
  14. package/dist/init.js +269 -158
  15. package/dist/params.d.ts +7 -0
  16. package/dist/params.js +23 -0
  17. package/dist/policy.d.ts +3 -0
  18. package/dist/policy.js +5 -0
  19. package/dist/prepare.d.ts +0 -8
  20. package/dist/prepare.js +20 -19
  21. package/dist/runtime.d.ts +5 -0
  22. package/dist/runtime.js +11 -0
  23. package/dist/schemas/index.d.ts +2 -0
  24. package/dist/schemas/index.js +2 -0
  25. package/dist/schemas/types.js +1 -0
  26. package/dist/states.d.ts +10 -0
  27. package/dist/states.js +7 -0
  28. package/files/expo/.nvmrc +1 -0
  29. package/files/expo/.prettierignore +23 -0
  30. package/files/expo/.prettierrc.js +16 -0
  31. package/files/expo/.yarnrc +1 -0
  32. package/files/expo/.yarnrc.yml +3 -0
  33. package/files/expo/README.md +45 -0
  34. package/files/expo/assets/fonts/SpaceMono-Regular.ttf +0 -0
  35. package/files/expo/assets/images/adaptive-icon.png +0 -0
  36. package/files/expo/assets/images/favicon.png +0 -0
  37. package/files/expo/assets/images/icon.png +0 -0
  38. package/files/expo/assets/images/splash-icon.png +0 -0
  39. package/files/expo/babel.config.js +10 -0
  40. package/files/expo/constants/theme.ts +18 -0
  41. package/files/expo/eas.json +32 -0
  42. package/files/expo/eslint.config.mjs +181 -0
  43. package/files/expo/global.css +47 -0
  44. package/files/expo/hooks/useColorScheme.ts +17 -0
  45. package/files/expo/index.ts +11 -0
  46. package/files/expo/lib/data.ts +48 -0
  47. package/files/expo/lib/utils/index.ts +11 -0
  48. package/files/expo/lib/utils/polyfills.ts +29 -0
  49. package/files/expo/lib/wix/client.ts +12 -0
  50. package/files/expo/lib/wix/error.ts +3 -0
  51. package/files/expo/lib/wix/index.ts +2 -0
  52. package/files/expo/lucy.json +8 -0
  53. package/files/expo/metro.config.js +57 -0
  54. package/files/expo/nativewind-env.d.ts +1 -0
  55. package/files/expo/scripts/reset-project.ts +116 -0
  56. package/files/expo/tailwind.config.js +63 -0
  57. package/files/expo/tsconfig.json +46 -0
  58. package/files/expo/types/reset.d.ts +1 -0
  59. package/files/velo/typescript/public/scss/app.scss +0 -0
  60. package/files/velo/typescript/styles/.gitkeep +0 -0
  61. package/files/velo/typescript/styles/global.scss +0 -0
  62. package/package.json +16 -12
  63. package/src/args.ts +36 -0
  64. package/src/commands.ts +21 -0
  65. package/src/config.ts +61 -0
  66. package/src/error.ts +4 -0
  67. package/src/helpers.ts +7 -305
  68. package/src/index.ts +29 -369
  69. package/src/init.ts +386 -177
  70. package/src/policy.ts +6 -0
  71. package/src/prepare.ts +19 -19
  72. package/src/runtime.ts +20 -0
  73. package/src/schemas/index.ts +3 -0
  74. package/src/schemas/types.ts +0 -0
  75. package/src/states.ts +15 -0
  76. package/src copy/helpers.ts +307 -0
  77. package/src copy/index.ts +379 -0
  78. package/src copy/init.ts +183 -0
  79. package/src copy/models.ts +35 -0
  80. package/src copy/prepare.ts +24 -0
  81. package/src copy/schemas/index.ts +0 -0
  82. package/src copy/schemas/types.ts +0 -0
  83. package/src copy/settings.json +67 -0
  84. package/src copy/types.d.ts +8 -0
  85. package/dist/Gulpfile.d.ts +0 -34
  86. package/dist/Gulpfile.js +0 -115
  87. package/dist/cli.d.ts +0 -2
  88. package/dist/cli.js +0 -44
  89. package/dist/dev.d.ts +0 -2
  90. package/dist/dev.js +0 -14
  91. package/dist/gulp/backend copy.d.ts +0 -4
  92. package/dist/gulp/backend copy.js +0 -50
  93. package/dist/gulp/backend.d.ts +0 -3
  94. package/dist/gulp/backend.js +0 -91
  95. package/dist/gulp/checks.d.ts +0 -3
  96. package/dist/gulp/checks.js +0 -204
  97. package/dist/gulp/clean copy.d.ts +0 -2
  98. package/dist/gulp/clean copy.js +0 -19
  99. package/dist/gulp/clean.d.ts +0 -3
  100. package/dist/gulp/clean.js +0 -28
  101. package/dist/gulp/copy.d.ts +0 -2
  102. package/dist/gulp/copy.js +0 -33
  103. package/dist/gulp/docs.d.ts +0 -2
  104. package/dist/gulp/docs.js +0 -27
  105. package/dist/gulp/helpers.d.ts +0 -2
  106. package/dist/gulp/helpers.js +0 -24
  107. package/dist/gulp/pages copy.d.ts +0 -3
  108. package/dist/gulp/pages copy.js +0 -22
  109. package/dist/gulp/pages.d.ts +0 -2
  110. package/dist/gulp/pages.js +0 -36
  111. package/dist/gulp/pipeline.d.ts +0 -1
  112. package/dist/gulp/pipeline.js +0 -28
  113. package/dist/gulp/public.d.ts +0 -2
  114. package/dist/gulp/public.js +0 -49
  115. package/dist/gulp/styles.d.ts +0 -2
  116. package/dist/gulp/styles.js +0 -39
  117. package/dist/gulp/templates.d.ts +0 -2
  118. package/dist/gulp/templates.js +0 -32
  119. package/dist/gulp/test.d.ts +0 -2
  120. package/dist/gulp/test.js +0 -26
  121. package/dist/gulp/types.d.ts +0 -4
  122. package/dist/gulp/types.js +0 -288
  123. package/dist/gulp/watchers.d.ts +0 -9
  124. package/dist/gulp/watchers.js +0 -58
  125. package/dist/init copy.d.ts +0 -8
  126. package/dist/init copy.js +0 -167
  127. package/dist/install.d.ts +0 -2
  128. package/dist/install.js +0 -53
  129. package/dist/settings.json +0 -67
  130. package/dist/start_gulp.d.ts +0 -2
  131. package/dist/start_gulp.js +0 -14
  132. package/dist/sync.d.ts +0 -2
  133. package/dist/sync.js +0 -87
  134. /package/{files/.gitmodules → dist/schemas/types.d.ts} +0 -0
  135. /package/files/{typescript/__mocks__ → expo/components}/.gitkeep +0 -0
  136. /package/files/{typescript/pages → expo/components/ui}/.gitkeep +0 -0
  137. /package/files/{typescript/backend/data.ts → velo/.gitmodules} +0 -0
  138. /package/files/{.madgerc → velo/.madgerc} +0 -0
  139. /package/files/{.nvmrc → velo/.nvmrc} +0 -0
  140. /package/files/{.stylelintrc.js → velo/.stylelintrc.js} +0 -0
  141. /package/files/{.yarnrc.yml → velo/.yarnrc.yml} +0 -0
  142. /package/files/{currents.config.js → velo/currents.config.js} +0 -0
  143. /package/files/{cypress → velo/cypress}/e2e/base/base.cy.ts +0 -0
  144. /package/files/{cypress → velo/cypress}/fixtures/example.json +0 -0
  145. /package/files/{cypress → velo/cypress}/support/commands.ts +0 -0
  146. /package/files/{cypress → velo/cypress}/support/e2e.ts +0 -0
  147. /package/files/{cypress → velo/cypress}/tsconfig.json +0 -0
  148. /package/files/{cypress.config.mjs → velo/cypress.config.mjs} +0 -0
  149. /package/files/{eslint.config.mjs → velo/eslint.config.mjs} +0 -0
  150. /package/files/{local.tsconfig.json → velo/local.tsconfig.json} +0 -0
  151. /package/files/{typedoc.json → velo/typedoc.json} +0 -0
  152. /package/files/{typescript/public → velo/typescript/__mocks__}/.gitkeep +0 -0
  153. /package/files/{typescript/backend/events.ts → velo/typescript/backend/data.ts} +0 -0
  154. /package/files/{typescript/public/scss/app.scss → velo/typescript/backend/events.ts} +0 -0
  155. /package/files/{typescript → velo/typescript}/backend/http-functions.ts +0 -0
  156. /package/files/{typescript → velo/typescript}/backend/lib/http-functions/sync.ts +0 -0
  157. /package/files/{typescript → velo/typescript}/backend/permissions.json +0 -0
  158. /package/files/{typescript/styles → velo/typescript/pages}/.gitkeep +0 -0
  159. /package/files/{typescript/styles/global.scss → velo/typescript/public/.gitkeep} +0 -0
  160. /package/files/{typescript → velo/typescript}/tsconfig.json +0 -0
  161. /package/files/{vitest.config.ts → velo/vitest.config.ts} +0 -0
  162. /package/{src → src copy}/Gulpfile.ts +0 -0
  163. /package/{src → src copy}/gulp/backend.ts +0 -0
  164. /package/{src → src copy}/gulp/checks.ts +0 -0
  165. /package/{src → src copy}/gulp/clean.ts +0 -0
  166. /package/{src → src copy}/gulp/copy.ts +0 -0
  167. /package/{src → src copy}/gulp/helpers.ts +0 -0
  168. /package/{src → src copy}/gulp/pages.ts +0 -0
  169. /package/{src → src copy}/gulp/pipeline.ts +0 -0
  170. /package/{src → src copy}/gulp/public.ts +0 -0
  171. /package/{src → src copy}/gulp/styles.ts +0 -0
  172. /package/{src → src copy}/gulp/templates.ts +0 -0
  173. /package/{src → src copy}/gulp/types.ts +0 -0
  174. /package/{src → src copy}/gulp/watchers.ts +0 -0
  175. /package/{src → src copy}/sync.ts +0 -0
@@ -0,0 +1,67 @@
1
+ {
2
+ "modules": {},
3
+ "wixSettings": {
4
+ "compilerOptions": {
5
+ "composite": true,
6
+ "noEmit": false,
7
+ "lib": [],
8
+ "jsx": "react-jsx"
9
+ },
10
+ "exclude": ["**/*.js"]
11
+ },
12
+ "initialized": false,
13
+ "wixPackages": {},
14
+ "devPackages": {
15
+ "@eslint/js": "^9.30.1",
16
+ "@styled/typescript-styled-plugin": "^1.0.1",
17
+ "@total-typescript/ts-reset": "^0.6.1",
18
+ "@types/node": "^24.0.10",
19
+ "@types/nodemailer": "^6.4.17",
20
+ "@types/react": "^19.1.8",
21
+ "madge": "^8.0.0",
22
+ "@typescript-eslint/eslint-plugin": "^8.35.1",
23
+ "@typescript-eslint/parser": "^8.35.1",
24
+ "@typescript-eslint/utils": "^8.35.1",
25
+ "@vitest/coverage-v8": "^3.2.4",
26
+ "@vitest/ui": "^3.2.4",
27
+ "@wix/cli": "^1.1.101",
28
+ "@wix/eslint-plugin-cli": "^1.0.2",
29
+ "cypress": "^14.5.1",
30
+ "cypress-cloud": "^1.13.1",
31
+ "esbuild": "^0.25.5",
32
+ "eslint": "^9.30.1",
33
+ "eslint-plugin-exception-handling": "^1.5.4",
34
+ "eslint-plugin-import": "^2.32.0",
35
+ "eslint-plugin-jsdoc": "^51.3.3",
36
+ "eslint-plugin-named-import-spacing": "^1.0.3",
37
+ "eslint-plugin-promise": "^7.2.1",
38
+ "eslint-plugin-simple-import-sort": "^12.1.1",
39
+ "prettier": "^3.6.2",
40
+ "sass": "^1.89.2",
41
+ "ts-node": "^10.9.2",
42
+ "tsx": "^4.20.3",
43
+ "typedoc": "^0.28.7",
44
+ "typedoc-github-theme": "^0.3.0",
45
+ "typescript": "^5.8.3",
46
+ "typescript-eslint": "^8.35.1",
47
+ "typescript-eslint-language-service": "^5.0.5",
48
+ "vite-tsconfig-paths": "^5.1.4",
49
+ "vitest": "^3.2.4",
50
+ "vitest-tsconfig-paths": "^3.4.1"
51
+ },
52
+ "scripts": {
53
+ "postinstall": "wix sync-types",
54
+ "wix:dev": "wix dev",
55
+ "dev": "lucy-cli dev",
56
+ "lint": "NODE_OPTIONS=\"--max-old-space-size=32768\" eslint .",
57
+ "docs": "typedoc --tsconfig typescript/tsconfig.json --skipErrorChecking",
58
+ "build": "lucy-cli build-prod",
59
+ "fix-wix": "lucy-cli fix-wix",
60
+ "tsc": "tsc -p ./typescript/tsconfig.json --noEmit",
61
+ "test": "vitest --ui --coverage",
62
+ "coverage": "vitest run --coverage",
63
+ "cypress": "cypress open",
64
+ "e2e": "cypress-cloud run --parallel --record",
65
+ "graph": "madge --image graph.svg src"
66
+ }
67
+ }
@@ -0,0 +1,8 @@
1
+ declare module 'gulp-exec';
2
+ declare module 'gulp-clean';
3
+ declare module 'gulp-foreach';
4
+ declare module 'gulp-string-replace';
5
+ declare module 'gulp-wait';
6
+ declare module 'gulp-jest';
7
+ declare module 'gulp-flatmap';
8
+ declare module 'gulp-swc';
@@ -1,34 +0,0 @@
1
- import gulpSass from 'gulp-sass';
2
- import backendSettings from '../settings/backend-settings.json';
3
- import masterSettings from '../settings/master-settings.json';
4
- import pageSettings from '../settings/page-settings.json';
5
- import publicSettings from '../settings/public-settings.json';
6
- import { ModuleSettings, ProjectSettings } from './index.js';
7
- export type TaskOptions = {
8
- moduleSettings?: ModuleSettings;
9
- projectSettings?: ProjectSettings;
10
- enableIncrementalBuild: boolean;
11
- outputDir: string;
12
- sass: ReturnType<typeof gulpSass>;
13
- userHomeDir: string;
14
- replaceOptions: typeof replaceOptions;
15
- backendSettings: typeof backendSettings;
16
- masterSettings: typeof masterSettings;
17
- pageSettings: typeof pageSettings;
18
- publicSettings: typeof publicSettings;
19
- modulesSync: Record<string, string> | undefined;
20
- modulesSourcePaths: string[];
21
- cwd: string;
22
- isWatching?: boolean;
23
- };
24
- export interface File {
25
- path: string;
26
- dirname: string;
27
- }
28
- declare const replaceOptions: {
29
- logs: {
30
- enabled: boolean;
31
- };
32
- };
33
- export declare function runTask(task: string, moduleSettings: ModuleSettings, projectSettings: ProjectSettings): Promise<void>;
34
- export {};
package/dist/Gulpfile.js DELETED
@@ -1,115 +0,0 @@
1
- import gulp from 'gulp';
2
- import gulpSass from 'gulp-sass';
3
- import shell from 'gulp-shell';
4
- import * as os from 'os';
5
- import * as dartSass from 'sass';
6
- import backendSettings from '../settings/backend-settings.json' with { type: "json" };
7
- ;
8
- import masterSettings from '../settings/master-settings.json' with { type: "json" };
9
- ;
10
- import pageSettings from '../settings/page-settings.json' with { type: "json" };
11
- ;
12
- import publicSettings from '../settings/public-settings.json' with { type: "json" };
13
- ;
14
- import { buildPublic } from './gulp/public.js';
15
- import { buildBackend, buildBackendJSW } from './gulp/backend.js';
16
- import { checkPages, checkTs } from './gulp/checks.js';
17
- import { compileScss } from './gulp/styles.js';
18
- import { buildPages } from './gulp/pages.js';
19
- import { previewTemplates } from './gulp/templates.js';
20
- import { copyFiles } from './gulp/copy.js';
21
- import { cleanSrc, cleanWix } from './gulp/clean.js';
22
- import { addTypes, updateWixTypes } from './gulp/types.js';
23
- import { setProdConfig } from './gulp/pipeline.js';
24
- import { watchAll } from './gulp/watchers.js';
25
- import { blue, green, magenta, orange, red } from './index.js';
26
- import { getModulesSourcePaths, getModulesSync } from './gulp/helpers.js';
27
- const sass = gulpSass(dartSass);
28
- const outputDir = './src';
29
- const userHomeDir = os.homedir();
30
- const replaceOptions = {
31
- logs: {
32
- enabled: false
33
- }
34
- };
35
- const taskOptions = {
36
- enableIncrementalBuild: false,
37
- outputDir,
38
- sass,
39
- userHomeDir,
40
- pageSettings,
41
- publicSettings,
42
- backendSettings,
43
- masterSettings,
44
- replaceOptions,
45
- cwd: process.cwd(),
46
- modulesSync: getModulesSync(),
47
- modulesSourcePaths: getModulesSourcePaths(),
48
- };
49
- const watchTaskOptions = { ...taskOptions, isWatching: true };
50
- gulp.task('check-ts', gulp.parallel(checkTs(taskOptions)));
51
- gulp.task('scss', gulp.parallel(compileScss(taskOptions)));
52
- gulp.task('build-backend', gulp.parallel(buildBackend(taskOptions), buildBackendJSW(taskOptions)));
53
- gulp.task('build-public', gulp.parallel(buildPublic(taskOptions)));
54
- gulp.task('preview-templates', gulp.parallel(previewTemplates(taskOptions)));
55
- gulp.task('copy-files', gulp.parallel(copyFiles(taskOptions)));
56
- gulp.task('test', function () {
57
- return shell.task(['yarn test'], { ignoreErrors: true })().then(() => {
58
- console.log("šŸ•" + blue.underline.bold(' => Exited test task!'));
59
- }).catch(err => {
60
- console.log("šŸ’©" + red.underline.bold(' => Error in test task!'));
61
- });
62
- });
63
- gulp.task('test-ci', function () {
64
- return shell.task(['yarn test --run'], { ignoreErrors: true })().then(() => {
65
- console.log("šŸ•" + blue.underline.bold(' => Exited test task!'));
66
- }).catch(err => {
67
- console.log("šŸ’©" + red.underline.bold(' => Error in test task!'));
68
- });
69
- });
70
- gulp.task('sync-types', shell.task([
71
- 'yarn postinstall',
72
- ]));
73
- gulp.task('fix-wixtypes', gulp.parallel(updateWixTypes(taskOptions)));
74
- gulp.task('add-wix-types', function (done) {
75
- return addTypes(taskOptions, done);
76
- });
77
- gulp.task('set-production', gulp.parallel(setProdConfig()));
78
- gulp.task('start-wix', shell.task([
79
- 'yarn wix:dev',
80
- ]));
81
- gulp.task('gen-docs', shell.task([
82
- 'yarn docs',
83
- ]));
84
- gulp.task('fix-wix', gulp.series(cleanWix(), 'sync-types', 'fix-wixtypes', 'add-wix-types'));
85
- gulp.task('build', gulp.parallel('build-backend', 'build-public', 'preview-templates', buildPages(taskOptions), compileScss(taskOptions), 'copy-files'));
86
- gulp.task('build-pipeline', gulp.series(cleanSrc(taskOptions), 'set-production', 'check-ts', 'fix-wixtypes', 'add-wix-types', 'test-ci', 'build'));
87
- gulp.task('build-prod', gulp.series((done) => checkPages(true, false).then(() => done(), (err) => done(err)), cleanSrc(taskOptions), 'set-production', 'fix-wix', 'check-ts', 'test-ci', 'build-backend', 'build-public', buildPages(taskOptions), 'copy-files', compileScss(taskOptions)));
88
- gulp.task('start-dev-env', gulp.parallel(watchAll(watchTaskOptions), 'test', 'start-wix', 'check-ts', (done) => checkPages(false, taskOptions.moduleSettings?.force ?? false).then(() => done(), (err) => done(err))));
89
- gulp.task('dev', gulp.series(cleanSrc(taskOptions), 'fix-wix', 'build', 'start-dev-env'));
90
- async function gulpTaskRunner(task) {
91
- return new Promise(function (resolve, reject) {
92
- gulp.series(task, (done) => {
93
- resolve(true);
94
- done();
95
- })(function (err) {
96
- if (err) {
97
- console.log((`šŸ’© ${red.underline.bold("=> Error starting tasks =>")} ${orange(err)}`));
98
- reject(err);
99
- }
100
- });
101
- });
102
- }
103
- export async function runTask(task, moduleSettings, projectSettings) {
104
- taskOptions.cwd = moduleSettings.targetFolder;
105
- taskOptions.moduleSettings = moduleSettings;
106
- taskOptions.projectSettings = projectSettings;
107
- console.log("šŸ•" + magenta.underline(' => Starting Task => ' + orange(task)));
108
- try {
109
- await gulpTaskRunner(task);
110
- }
111
- catch (err) {
112
- console.log((`šŸ’© ${red.underline.bold("=> Error starting tasks =>")} ${orange(err)}`));
113
- }
114
- console.log("🐶" + green.underline.bold(' => Task completed: ' + task));
115
- }
package/dist/cli.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/dist/cli.js DELETED
@@ -1,44 +0,0 @@
1
- #!/usr/bin/env node
2
- import { helloWorld } from './index.js';
3
- const args = process.argv.slice(2);
4
- const cwd = process.cwd();
5
- /**
6
- *
7
- */
8
- function main() {
9
- console.log({ args, cwd });
10
- if (args.includes('help') || args.includes('-h')) {
11
- console.log('Help is on the way!');
12
- return;
13
- }
14
- if (args.includes('version') || args.includes('-v')) {
15
- console.log('1.0.0');
16
- return;
17
- }
18
- if (args.includes('init')) {
19
- helloWorld();
20
- return;
21
- }
22
- if (args.includes('sync')) {
23
- console.log('Hello serve');
24
- return;
25
- }
26
- }
27
- main();
28
- // const fs = require("fs"),
29
- // path = require("path")
30
- // /** Parse the command line */
31
- // var args = process.argv.slice(2);
32
- // // Validate input
33
- // if (args.length !== 2) {
34
- // console.log("Warning: Requires 2 arguments");
35
- // console.log("node index.js [path/source.html] [targetfile]");
36
- // process.exit();
37
- // }
38
- // const src = args[0];
39
- // const target = args[1];
40
- // const dirsrc = path.dirname(src);
41
- // if (!fs.existsSync(src)) {
42
- // console.log("Error: Source file doesn't exist. Given: ", src);
43
- // process.exit();
44
- // }
package/dist/dev.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { ModuleSettings, ProjectSettings } from '.';
2
- export declare function dev(moduleSettings: ModuleSettings, projectSettings: ProjectSettings): Promise<void>;
package/dist/dev.js DELETED
@@ -1,14 +0,0 @@
1
- // https://www.sergevandenoever.nl/run-gulp4-tasks-programatically-from-node/
2
- import path from 'path';
3
- import { fileURLToPath } from 'url';
4
- export async function dev(moduleSettings, projectSettings) {
5
- // Get the directory name of the current module
6
- const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = path.dirname(__filename);
8
- // Resolve the path to the Gulpfile
9
- const gulpfilePath = path.resolve(__dirname, 'Gulpfile.js');
10
- // Dynamically import the Gulpfile
11
- const gulpfile = await import(`file://${gulpfilePath}`);
12
- // Check if 'dev' task exists
13
- gulpfile.runTask('dev', moduleSettings, projectSettings);
14
- }
@@ -1,4 +0,0 @@
1
- /// <reference types="node" />
2
- import { TaksOptions } from '../Gulpfile';
3
- export declare function buildPublic(options: TaksOptions): () => NodeJS.ReadWriteStream;
4
- export declare function buildPublicLib(options: TaksOptions): () => NodeJS.ReadWriteStream;
@@ -1,50 +0,0 @@
1
- import chalk from 'chalk';
2
- import gulp from 'gulp';
3
- import { createGulpEsbuild } from 'gulp-esbuild';
4
- import * as path from 'path';
5
- export function buildPublic(options) {
6
- const { outputDir, enableIncrementalBuild } = options;
7
- const gulpEsbuild = createGulpEsbuild({
8
- incremental: enableIncrementalBuild,
9
- });
10
- return () => {
11
- return gulp.src([
12
- 'typescript/public/**/*.ts',
13
- 'typescript/public/**/*.tsx',
14
- ])
15
- .pipe(gulpEsbuild({
16
- bundle: false,
17
- }))
18
- .pipe(gulp.dest(path.join(outputDir, 'public')))
19
- .on('error', function () {
20
- console.log(chalk.red.underline.bold('Build of Public TS files failed!'));
21
- this.emit('end');
22
- })
23
- .on('end', function () {
24
- console.log(chalk.blueBright.underline('Build of Public TS files succeeded!'));
25
- });
26
- };
27
- }
28
- export function buildPublicLib(options) {
29
- const { outputDir, enableIncrementalBuild } = options;
30
- const gulpEsbuild = createGulpEsbuild({
31
- incremental: enableIncrementalBuild,
32
- });
33
- return () => {
34
- return gulp.src([
35
- 'wix-lucy-lib/src/public/**/*.ts',
36
- 'wix-lucy-lib/src/public/**/*.tsx'
37
- ])
38
- .pipe(gulpEsbuild({
39
- bundle: false,
40
- }))
41
- .pipe(gulp.dest(path.join(outputDir, 'public')))
42
- .on('error', function () {
43
- console.log(chalk.red.underline.bold('Build of Public (LIB) TS files failed!'));
44
- this.emit('end');
45
- })
46
- .on('end', function () {
47
- console.log(chalk.blueBright.underline('Build of Public (LIB) TS files succeeded!'));
48
- });
49
- };
50
- }
@@ -1,3 +0,0 @@
1
- import { TaskOptions } from '../Gulpfile';
2
- export declare function buildBackend(options: TaskOptions): import("undertaker").TaskFunction;
3
- export declare function buildBackendJSW(options: TaskOptions): import("undertaker").TaskFunction;
@@ -1,91 +0,0 @@
1
- import gulp from 'gulp';
2
- import rename from 'gulp-rename';
3
- import * as path from 'path';
4
- import { blue, orange, red } from '../index.js';
5
- import swc from 'gulp-swc';
6
- const swcOptions = {
7
- jsc: {
8
- target: 'es2020',
9
- parser: {
10
- syntax: "typescript",
11
- tsx: true,
12
- decorators: true,
13
- // preserveAllComments: true
14
- },
15
- preserveAllComments: false,
16
- minify: {
17
- compress: true // equivalent to {}
18
- }
19
- },
20
- };
21
- export function buildBackend(options) {
22
- const folders = ['typescript', ...options.modulesSourcePaths];
23
- const { outputDir } = options;
24
- // Create tasks for each folder
25
- const tasks = folders.map((folder) => {
26
- const taskName = `build_Backend-${folder}`; // Create a unique name for each task
27
- const task = () => gulp.src([
28
- `${folder}/backend/**/*.ts`,
29
- `${folder}/backend/**/*.tsx`,
30
- `!${folder}/backend/**/*.jsw.ts`,
31
- `!${folder}/backend/**/*.spec.ts`,
32
- ])
33
- .pipe(swc(swcOptions))
34
- .on('error', function (e) {
35
- console.log("šŸ’©" + red.underline.bold(` => Build of Backend files for ${orange(folder)} failed!`));
36
- console.log("šŸ’©" + red.underline.bold(` => Error: ${orange(e.message)}`));
37
- this.emit('end');
38
- })
39
- .pipe(gulp.dest(path.join(outputDir, 'backend')))
40
- .on('error', function (e) {
41
- console.log("šŸ’©" + red.underline.bold(` => Build of Backend files for ${orange(folder)} failed!`));
42
- console.log("šŸ’©" + red.underline.bold(` => Error: ${orange(e.message)}`));
43
- this.emit('end');
44
- })
45
- .on('end', function () {
46
- console.log("🐶" + blue.underline(` => Build of Backend files for ${orange(folder)} succeeded!`));
47
- });
48
- // Register the task with Gulp
49
- Object.defineProperty(task, 'name', { value: taskName }); // Set a unique name for debugging
50
- return task;
51
- });
52
- // Run all tasks in parallel
53
- return gulp.parallel(...tasks);
54
- }
55
- export function buildBackendJSW(options) {
56
- const folders = ['typescript', ...options.modulesSourcePaths];
57
- const swcOptions = {
58
- jsc: {
59
- target: 'es6',
60
- },
61
- };
62
- const { outputDir } = options;
63
- // Create tasks for each folder
64
- const tasks = folders.map((folder) => {
65
- const taskName = `build-${folder}`; // Create a unique name for each task
66
- const task = () => gulp.src([
67
- `${folder}/backend/**/*.jsw.ts`,
68
- ])
69
- .pipe(swc(swcOptions))
70
- .on('error', function (e) {
71
- console.log("šŸ’©" + red.underline.bold(` => Build of Public files for ${orange(folder)} failed!`));
72
- console.log("šŸ’©" + red.underline.bold(` => Error: ${orange(e.message)}`));
73
- this.emit('end');
74
- })
75
- .pipe(rename({ extname: '' }))
76
- .pipe(gulp.dest(path.join(outputDir, 'backend')))
77
- .on('error', function (e) {
78
- console.log("šŸ’©" + red.underline.bold(` => Build of JSW files for ${orange(folder)} failed!`));
79
- console.log("šŸ’©" + red.underline.bold(` => Error: ${orange(e.message)}`));
80
- this.emit('end');
81
- })
82
- .on('end', function () {
83
- console.log("🐶" + blue.underline(` => Build of JSW files for ${orange(folder)} succeeded!`));
84
- });
85
- // Register the task with Gulp
86
- Object.defineProperty(task, 'name', { value: taskName }); // Set a unique name for debugging
87
- return task;
88
- });
89
- // Run all tasks in parallel
90
- return gulp.parallel(...tasks);
91
- }
@@ -1,3 +0,0 @@
1
- import { TaskOptions } from '../Gulpfile.js';
2
- export declare function checkPages(fail: boolean, force: boolean): Promise<void>;
3
- export declare function checkTs(options: TaskOptions): import("undertaker").TaskFunction;
@@ -1,204 +0,0 @@
1
- import * as fs from 'fs';
2
- import glob from 'glob';
3
- import * as path from 'path';
4
- import gulp from 'gulp';
5
- import ts from 'gulp-typescript';
6
- import { blue, green, magenta, orange, red, yellow } from '../index.js';
7
- // /**
8
- // * Extracts a match from a file
9
- // * @param {string} filePath File path
10
- // * @param {string} pattern Pattern to match
11
- // */
12
- // function extractMatchFromFile(filePath: string, pattern: string) {
13
- // return new Promise((resolve, reject) => {
14
- // fs.readFile(filePath, 'utf8', (err, data) => {
15
- // if (err){
16
- // reject(err);
17
- // return;
18
- // }
19
- // const regex = new RegExp(pattern);
20
- // const match = regex.exec(data);
21
- // const capturedGroup = match ? match.groups?.page : null;
22
- // resolve(capturedGroup);
23
- // });
24
- // });
25
- // }
26
- // async function readFilesInFolder(folderPath: string, pattern: string | null, globPattern: string): Promise<Object[]> {
27
- // const files = await glob(path.join(folderPath, globPattern));
28
- // const filenameList: Object[] = [];
29
- // for (const file of files) {
30
- // if (pattern) {
31
- // const capturedGroup = await extractMatchFromFile(file, pattern);
32
- // if (capturedGroup) {
33
- // filenameList.push(capturedGroup);
34
- // }
35
- // } else {
36
- // filenameList.push(path.basename(file));
37
- // }
38
- // }
39
- // return filenameList;
40
- // }
41
- /**
42
- * Extracts a match from a file
43
- * @param {string} filePath File path
44
- * @param {string} pattern Pattern to match
45
- */
46
- function extractMatchFromFile(filePath, pattern) {
47
- return new Promise((resolve, reject) => {
48
- fs.readFile(filePath, 'utf8', (err, data) => {
49
- if (err) {
50
- reject(err);
51
- return;
52
- }
53
- const regex = new RegExp(pattern);
54
- const match = regex.exec(data);
55
- const capturedGroup = match ? match.groups?.page : null;
56
- resolve(capturedGroup);
57
- });
58
- });
59
- }
60
- /**
61
- * Reads files in a folder
62
- * @param {string} folderPath Folder path
63
- * @param {string} pattern Pattern to match
64
- * @param {string} globPattern Glob pattern
65
- */
66
- function readFilesInFolder(folderPath, pattern, globPattern) {
67
- return new Promise((resolve, reject) => {
68
- glob(path.join(folderPath, globPattern), (err, files) => {
69
- if (err) {
70
- reject(err);
71
- return;
72
- }
73
- const filenameList = [];
74
- /**
75
- * Traverse files
76
- * @param {number} index Index
77
- */
78
- function traverseFiles(index) {
79
- if (index === files.length) {
80
- resolve(filenameList);
81
- return;
82
- }
83
- const file = files[index];
84
- if (pattern) {
85
- if (!file)
86
- return;
87
- extractMatchFromFile(file, pattern)
88
- .then((capturedGroup) => {
89
- if (capturedGroup) {
90
- filenameList.push(capturedGroup);
91
- }
92
- traverseFiles(index + 1);
93
- })
94
- .catch(reject);
95
- }
96
- if (!pattern) {
97
- if (!file)
98
- return;
99
- filenameList.push(path.basename(file));
100
- traverseFiles(index + 1);
101
- }
102
- }
103
- traverseFiles(0);
104
- });
105
- });
106
- }
107
- export async function checkPages(fail, force) {
108
- console.log("šŸ•" + green.underline.bold(' => Checking pages...'));
109
- return new Promise(async (resolve, reject) => {
110
- try {
111
- const sourcePages = await readFilesInFolder('./.wix/types/', '\\/pages\\/(?<page>.*\\.ts)', '**/*.json');
112
- const tsPages = await readFilesInFolder('./typescript/pages', null, '**/*.ts');
113
- const sourcePagesSet = new Set(sourcePages);
114
- const tsPagesSet = new Set(tsPages);
115
- const missingInTs = Array.from(sourcePagesSet).filter((item) => !tsPages.includes(item));
116
- const obsoleteInTs = Array.from(tsPagesSet).filter((item) => !sourcePages.includes(item));
117
- if (missingInTs.length > 0) {
118
- if (!force) {
119
- console.log("šŸ’©" + red.underline.bold(' => Missing pages in ts folder: '), '\n', missingInTs);
120
- }
121
- if (force) {
122
- for (const page of missingInTs) {
123
- console.log("🐶" + magenta.underline.bold(' => Creating missing page: '), page);
124
- fs.writeFileSync(`./typescript/pages/${page}`, '');
125
- }
126
- }
127
- }
128
- if (obsoleteInTs.length > 0) {
129
- if (!force) {
130
- console.log("🦓" + yellow.underline.bold(' => Obsolete in ts folder'), '\n', obsoleteInTs);
131
- }
132
- if (force) {
133
- for (const page of obsoleteInTs) {
134
- console.log("🐶" + magenta.underline.bold(' => Deleting obsolete page: '), page);
135
- fs.rmSync(`./typescript/pages/${page}`);
136
- }
137
- }
138
- }
139
- if (missingInTs.length === 0 && obsoleteInTs.length === 0) {
140
- console.log("🐶" + blue.underline.bold(' => Pages are in-sync!'));
141
- }
142
- else if (fail) {
143
- process.exit(1);
144
- }
145
- ;
146
- }
147
- catch (error) {
148
- reject(error);
149
- }
150
- });
151
- }
152
- const customReporter = {
153
- error: (error, tsInstance) => {
154
- if (!error.diagnostic) {
155
- console.log(red(error.message));
156
- return;
157
- }
158
- const { fullFilename, startPosition } = error;
159
- const relativePath = path.relative(process.cwd(), fullFilename ?? '');
160
- const line = startPosition ? startPosition.line + 1 : 0;
161
- const col = startPosition ? startPosition.character + 1 : 0;
162
- const message = tsInstance.flattenDiagnosticMessageText(error.diagnostic.messageText, '\n');
163
- console.log(`${blue.underline(relativePath)}:${yellow(String(line))}:${yellow(String(col))}`);
164
- console.log(` ${red('error')} ${yellow(`TS${error.diagnostic.code}`)}: ${message}`);
165
- },
166
- finish: (results) => {
167
- const errorCount = results.transpileErrors + results.semanticErrors + results.declarationErrors;
168
- if (errorCount > 0) {
169
- console.log(`\nšŸ’„ ${red.bold(`Found ${errorCount} error${errorCount > 1 ? 's' : ''}.`)}`);
170
- }
171
- },
172
- };
173
- export function checkTs(options) {
174
- const folders = ['typescript', ...options.modulesSourcePaths];
175
- // Create tasks for each folder
176
- const tasks = folders.map((folder) => {
177
- const tsProject = ts.createProject(`./local.tsconfig.json`, { noEmit: true, declaration: false, skipDefaultLibCheck: true });
178
- const taskName = `test-${folder}`; // Create a unique name for each task
179
- const task = () => {
180
- let hasError = false;
181
- const stream = gulp.src([`${folder}/**/*.ts`, `!${folder}/types/**/*.ts`])
182
- .pipe(tsProject(customReporter))
183
- .on('error', () => {
184
- hasError = true;
185
- });
186
- if (options.isWatching) {
187
- stream.on('error', function () {
188
- this.emit('end');
189
- });
190
- }
191
- stream.on('end', () => {
192
- if (!hasError) {
193
- console.log("🐶" + blue.underline(` => Typescriptcheck for ${orange(folder)} succeeded!`));
194
- }
195
- });
196
- return stream;
197
- };
198
- // Register the task with Gulp
199
- Object.defineProperty(task, 'name', { value: taskName }); // Set a unique name for debugging
200
- return task;
201
- });
202
- // Run all tasks in parallel
203
- return gulp.parallel(...tasks);
204
- }
@@ -1,2 +0,0 @@
1
- import { TaksOptions } from '../Gulpfile';
2
- export declare function cleanWix(options: TaksOptions): () => any;