lucy-cli 0.0.4 → 0.5.0

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 (63) hide show
  1. package/.yarnrc.yml +0 -2
  2. package/config.json +1 -0
  3. package/dist/Gulpfile.js +24 -115
  4. package/dist/dev.d.ts +2 -1
  5. package/dist/dev.js +2 -3
  6. package/dist/gulp/backend.d.ts +2 -0
  7. package/dist/gulp/backend.js +52 -8
  8. package/dist/gulp/checks.d.ts +3 -3
  9. package/dist/gulp/checks.js +37 -27
  10. package/dist/gulp/clean.d.ts +2 -0
  11. package/dist/gulp/clean.js +15 -3
  12. package/dist/gulp/copy.d.ts +1 -0
  13. package/dist/gulp/copy.js +24 -4
  14. package/dist/gulp/docs.d.ts +2 -0
  15. package/dist/gulp/docs.js +27 -0
  16. package/dist/gulp/pages.js +3 -3
  17. package/dist/gulp/pipeline.d.ts +1 -0
  18. package/dist/gulp/pipeline.js +27 -0
  19. package/dist/gulp/public.js +13 -7
  20. package/dist/gulp/styles.js +4 -4
  21. package/dist/gulp/templates.d.ts +1 -0
  22. package/dist/gulp/templates.js +21 -3
  23. package/dist/gulp/test.d.ts +2 -0
  24. package/dist/gulp/test.js +82 -0
  25. package/dist/gulp/types.js +7 -8
  26. package/dist/gulp/watchers.d.ts +17 -0
  27. package/dist/gulp/watchers.js +94 -0
  28. package/dist/index.d.ts +23 -1
  29. package/dist/index.js +46 -46
  30. package/dist/init.d.ts +2 -1
  31. package/dist/init.js +27 -55
  32. package/dist/settings.json +4 -1
  33. package/dist/sync.d.ts +2 -0
  34. package/dist/sync.js +5 -0
  35. package/files/lucy.json +1 -1
  36. package/files/typedoc.json +2 -2
  37. package/package.json +9 -3
  38. package/settings/backend-settings.json +13 -3
  39. package/settings/master-settings.json +10 -3
  40. package/settings/page-settings.json +11 -3
  41. package/settings/public-settings.json +13 -4
  42. package/src/Gulpfile.ts +75 -145
  43. package/src/dev.ts +4 -3
  44. package/src/gulp/backend.ts +57 -9
  45. package/src/gulp/checks.ts +36 -29
  46. package/src/gulp/clean.ts +17 -7
  47. package/src/gulp/copy.ts +27 -5
  48. package/src/gulp/pages.ts +4 -4
  49. package/src/gulp/pipeline.ts +30 -0
  50. package/src/gulp/public.ts +16 -8
  51. package/src/gulp/styles.ts +6 -5
  52. package/src/gulp/templates.ts +24 -5
  53. package/src/gulp/test.ts +82 -0
  54. package/src/gulp/types.ts +9 -12
  55. package/src/gulp/watchers.ts +175 -0
  56. package/src/index.ts +59 -68
  57. package/src/init.ts +28 -62
  58. package/src/settings.json +4 -1
  59. package/src/sync.ts +10 -0
  60. package/src/types.d.ts +2 -1
  61. package/.eslintrc.json +0 -3
  62. package/files/jest.config.ts +0 -28
  63. package/files/tsconfig.json +0 -51
package/.yarnrc.yml CHANGED
@@ -1,5 +1,3 @@
1
1
  nodeLinker: node-modules
2
2
 
3
3
  npmRegistryServer: "https://registry.npmjs.org/"
4
-
5
- yarnPath: .yarn/releases/yarn-3.7.0.cjs
package/config.json ADDED
@@ -0,0 +1 @@
1
+ {"siteUrl":"https://integralsd.editorx.io/development","secret":"SYv3Uv2OO8b6vEEk"}
package/dist/Gulpfile.js CHANGED
@@ -1,27 +1,26 @@
1
- import chalk from 'chalk';
2
1
  import gulp from 'gulp';
3
- import clean from 'gulp-clean';
4
2
  import gulpSass from 'gulp-sass';
5
3
  import shell from 'gulp-shell';
6
- import replace from 'gulp-string-replace';
7
4
  import * as os from 'os';
8
- import * as path from 'path';
9
5
  import * as dartSass from 'sass';
10
6
  import backendSettings from '../settings/backend-settings.json' assert { type: 'json' };
11
7
  import masterSettings from '../settings/master-settings.json' assert { type: 'json' };
12
8
  import pageSettings from '../settings/page-settings.json' assert { type: 'json' };
13
9
  import publicSettings from '../settings/public-settings.json' assert { type: 'json' };
14
10
  import { buildPublic, buildPublicLib } from './gulp/public.js';
15
- import { buildBackend, buildBackendJSW } from './gulp/backend.js';
11
+ import { buildBackend, buildBackendJSW, buildBackendJSWLib, buildBackendLib } from './gulp/backend.js';
16
12
  import { checkPages, checkTs, checkTsLib } from './gulp/checks.js';
17
13
  import { compileScss } from './gulp/styles.js';
18
14
  import { buildPages } from './gulp/pages.js';
19
- import { previewTemplates } from './gulp/templates.js';
20
- import { copyFiles } from './gulp/copy.js';
21
- import { cleanWix } from './gulp/clean.js';
15
+ import { previewTemplates, previewTemplatesLib } from './gulp/templates.js';
16
+ import { copyFiles, copyFilesLib } from './gulp/copy.js';
17
+ import { cleanSrc, cleanWix } from './gulp/clean.js';
22
18
  import { addTypes, updateWixTypes } from './gulp/types.js';
19
+ import { setProdConfig } from './gulp/pipeline.js';
20
+ import { watchAll } from './gulp/watchers.js';
21
+ import { green, magenta, orange, red } from './index.js';
22
+ import { testLib, test } from './gulp/test.js';
23
23
  const sass = gulpSass(dartSass);
24
- let enableIncrementalBuild = false;
25
24
  const outputDir = './src';
26
25
  const userHomeDir = os.homedir();
27
26
  const replaceOpions = {
@@ -30,7 +29,7 @@ const replaceOpions = {
30
29
  }
31
30
  };
32
31
  const taskOptions = {
33
- enableIncrementalBuild,
32
+ enableIncrementalBuild: false,
34
33
  outputDir,
35
34
  sass,
36
35
  userHomeDir,
@@ -41,128 +40,40 @@ const taskOptions = {
41
40
  replaceOpions,
42
41
  cwd: process.cwd(),
43
42
  };
44
- gulp.task('check-pages', gulp.parallel(checkPages));
45
43
  gulp.task('check-ts', gulp.parallel(checkTs(), checkTsLib()));
46
44
  gulp.task('scss', gulp.parallel(compileScss(taskOptions)));
47
- gulp.task('build-jsw', gulp.parallel(buildBackendJSW(taskOptions)));
48
- gulp.task('build-backend', gulp.parallel(buildBackend(taskOptions)));
45
+ gulp.task('build-backend', gulp.parallel(buildBackend(taskOptions), buildBackendLib(taskOptions), buildBackendJSW(taskOptions), buildBackendJSWLib(taskOptions)));
49
46
  gulp.task('build-public', gulp.parallel(buildPublic(taskOptions), buildPublicLib(taskOptions)));
50
- gulp.task('build-pages', gulp.parallel(buildPages(taskOptions)));
51
- gulp.task('preview-templates', gulp.parallel(previewTemplates()));
52
- gulp.task('copy-files', gulp.parallel(copyFiles(taskOptions)));
53
- gulp.task('clean-wix', gulp.parallel(cleanWix()));
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()));
54
50
  gulp.task('sync-types', shell.task([
55
- // 'yarn postinstall',
51
+ 'yarn postinstall',
56
52
  ]));
57
53
  gulp.task('fix-wixtypes', gulp.parallel(updateWixTypes(taskOptions)));
58
54
  gulp.task('add-wix-types', function (done) {
59
55
  return addTypes(taskOptions, done);
60
56
  });
61
- gulp.task('clean-src', async () => {
62
- return gulp.src([`${outputDir}/pages`, `${outputDir}/public`, `${outputDir}/backend`], { read: false, allowEmpty: true })
63
- .pipe(clean({ force: true }))
64
- .on('error', function () {
65
- console.log(chalk.red.underline.bold('Cleaning of output files failed!'));
66
- this.emit('end');
67
- })
68
- .on('end', function () { console.log(chalk.blueBright.underline('Cleaning of output files succeeded!')); });
69
- });
70
- gulp.task('set-production', function () {
71
- const droneTag = process.env.DRONE_TAG || 'development';
72
- const regexGit = /gitTag:\s*(.*),/g;
73
- const regexDev = /devMode:\s*(.*),/g;
74
- return gulp
75
- .src(['./typescript/public/constants/config.ts'])
76
- .pipe(replace(regexGit, `gitTag: '${droneTag}',`))
77
- .pipe(replace(regexDev, `devMode: false,`))
78
- .pipe(gulp.dest((file) => {
79
- const filePath = file.dirname;
80
- const outputDir = path.dirname(filePath);
81
- return path.join(`${outputDir}/constants`);
82
- }))
83
- .on('error', function () {
84
- console.log(chalk.red.underline.bold('Setting the git tag failed!'));
85
- this.emit('end');
86
- })
87
- .on('end', function () { console.log(chalk.blueBright.underline('Setting the git tag succeeded!')); });
88
- });
57
+ gulp.task('set-production', gulp.parallel(setProdConfig()));
89
58
  gulp.task('start-wix', shell.task([
90
59
  'yarn wix:dev',
91
60
  ]));
92
- gulp.task('test-watch', shell.task([
93
- 'sleep 10; yarn test --watch',
94
- ]));
95
- gulp.task('test', shell.task([
96
- 'sleep 2; yarn test',
97
- ]));
98
61
  gulp.task('gen-docs', shell.task([
99
62
  'yarn docs',
100
63
  ]));
101
- gulp.task('watch-scss', () => {
102
- gulp.watch(['typescript/public/scss/**/*.scss'], gulp.series('scss'));
103
- });
104
- gulp.task('watch-jsw', () => {
105
- enableIncrementalBuild = true;
106
- gulp.watch(['typescript/backend/**/frontend.*.ts', 'wix-lucy-lib/backend/**/frontend.*.ts'], gulp.series('check-ts', 'build-jsw', 'test'));
107
- });
108
- gulp.task('watch-backend', () => {
109
- enableIncrementalBuild = true;
110
- gulp.watch([
111
- 'typescript/backend/**/*.ts',
112
- 'typescript/backend/**/*.tsx',
113
- '!typescript/backend/**/*.spec.ts',
114
- ], gulp.series('check-ts', 'build-backend', 'test'));
115
- });
116
- gulp.task('watch-public', () => {
117
- enableIncrementalBuild = true;
118
- gulp.watch([
119
- 'typescript/public/**/*.ts',
120
- 'typescript/public/**/*.tsx',
121
- 'wix-lucy-lib/src/public/**/*.ts',
122
- 'wix-lucy-lib/src/public/**/*.tsx'
123
- ], gulp.series('check-ts', 'build-public', 'test'));
124
- });
125
- gulp.task('watch-templates', () => {
126
- gulp.watch([
127
- 'typescript/backend/templates/**/*.tsx',
128
- 'typescript/backend/templates/data/*.json',
129
- '!typescript/backend/templates/render.ts',
130
- ], gulp.series('preview-templates'));
131
- });
132
- gulp.task('watch-pages', () => {
133
- enableIncrementalBuild = true;
134
- gulp.watch('typescript/pages/**/*.ts', gulp.series('check-ts', 'build-pages', 'test'));
135
- });
136
- gulp.task('watch-files', () => {
137
- enableIncrementalBuild = true;
138
- gulp.watch([
139
- 'typescript/backend/**/*',
140
- 'typescript/public/**/*',
141
- 'typescript/pages/**/*',
142
- '!typescript/**/*.ts',
143
- ], gulp.series('copy-files'));
144
- });
145
- gulp.task('watch-types', () => {
146
- enableIncrementalBuild = true;
147
- gulp.watch(['./.wix/types/**/*.d.ts', '!./.wix/types/wix-code-types'], gulp.series('fix-wixtypes'));
148
- });
149
- gulp.task('fix-wix', gulp.series('clean-wix', 'sync-types', 'fix-wixtypes', 'add-wix-types'));
150
- gulp.task('clean', gulp.series('clean-src'));
151
- gulp.task('watch', gulp.parallel('watch-types', 'watch-jsw', 'watch-backend', 'watch-public', 'watch-pages', 'watch-files', 'watch-scss', 'watch-templates'));
152
- gulp.task('build-prod', gulp.series('clean', 'set-production', 'fix-wix', 'check-pages', 'build-jsw', 'build-backend', 'build-public', 'build-pages', 'copy-files', 'scss', 'gen-docs'));
153
- gulp.task('build', gulp.series('clean', 'fix-wix', 'check-ts', 'build-jsw', 'build-backend', 'build-public', 'build-pages', 'scss', 'copy-files'));
154
- gulp.task('fix-for-test', gulp.series('fix-wixtypes', 'add-wix-types'));
155
- gulp.task('build-pipeline', gulp.series('clean', 'set-production', 'build-jsw', 'build-backend', 'build-public', 'build-pages', 'copy-files', 'scss', 'gen-docs'));
156
- gulp.task('start-dev-env', gulp.parallel('watch', 'check-pages'));
157
- gulp.task('dev', gulp.series('build', 'start-dev-env', 'test-watch'));
158
- gulp.task('default', gulp.series('dev'));
64
+ gulp.task('fix-wix', gulp.series(cleanWix(), 'sync-types', 'fix-wixtypes', 'add-wix-types'));
65
+ gulp.task('build', gulp.parallel('build-backend', 'build-public', buildPages(taskOptions), compileScss(taskOptions), 'copy-files'));
66
+ gulp.task('build-pipeline', gulp.series(cleanSrc(taskOptions), 'set-production', 'fix-wixtypes', 'add-wix-types', 'test', 'build'));
67
+ gulp.task('build-prod', gulp.series((done) => checkPages(true).then(() => done(), (err) => done(err)), cleanSrc(taskOptions), 'set-production', 'fix-wix', 'build-backend', 'build-public', buildPages(taskOptions), 'copy-files', compileScss(taskOptions), 'gen-docs'));
68
+ gulp.task('start-dev-env', gulp.parallel(watchAll(taskOptions), 'test', 'start-wix', (done) => checkPages(false).then(() => done(), (err) => done(err))));
69
+ gulp.task('dev', gulp.series(cleanSrc(taskOptions), 'fix-wix', 'build', 'start-dev-env'));
159
70
  async function gulpTaskRunner(task) {
160
71
  return new Promise(function (resolve, reject) {
161
72
  gulp.series(task, (done) => {
162
73
  resolve(true);
163
74
  done();
164
75
  })(function (err) {
165
- console.log('gulpTaskRunner', err);
76
+ console.log((`💩 ${red.underline.bold("=> Error starting tasks =>")} ${orange(err)}`));
166
77
  if (err) {
167
78
  reject(err);
168
79
  }
@@ -170,10 +81,8 @@ async function gulpTaskRunner(task) {
170
81
  });
171
82
  }
172
83
  export async function runTask(task, cwd) {
173
- console.log('runTask', { task, cwd });
174
84
  taskOptions.cwd = cwd;
175
- console.log('runTask', { task, cwd });
176
- console.log('start');
85
+ console.log("🐕" + magenta.underline(' => Starting Task => ' + orange(task)));
177
86
  await gulpTaskRunner(task);
178
- console.log('end');
87
+ console.log("🐶" + green.underline.bold(' => Task completed: ' + task));
179
88
  }
package/dist/dev.d.ts CHANGED
@@ -1 +1,2 @@
1
- export declare function dev(cwd: string, arg: string[]): Promise<void>;
1
+ import { ModuleSettings, ProjectSettings } from '.';
2
+ export declare function dev(moduleSettings: ModuleSettings, projectSettings: ProjectSettings): Promise<void>;
package/dist/dev.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import path from 'path';
2
2
  import { fileURLToPath } from 'url';
3
- export async function dev(cwd, arg) {
4
- console.log('dev', { cwd, arg });
3
+ export async function dev(moduleSettings, projectSettings) {
5
4
  // Get the directory name of the current module
6
5
  const __filename = fileURLToPath(import.meta.url);
7
6
  const __dirname = path.dirname(__filename);
@@ -10,5 +9,5 @@ export async function dev(cwd, arg) {
10
9
  // Dynamically import the Gulpfile
11
10
  const gulpfile = await import(`file://${gulpfilePath}`);
12
11
  // Check if 'dev' task exists
13
- gulpfile.runTask('dev', cwd);
12
+ gulpfile.runTask('dev', moduleSettings.targetFolder);
14
13
  }
@@ -1,4 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { TaskOptions } from '../Gulpfile';
3
3
  export declare function buildBackend(options: TaskOptions): () => NodeJS.ReadWriteStream;
4
+ export declare function buildBackendLib(options: TaskOptions): () => NodeJS.ReadWriteStream;
4
5
  export declare function buildBackendJSW(options: TaskOptions): () => NodeJS.ReadWriteStream;
6
+ export declare function buildBackendJSWLib(options: TaskOptions): () => NodeJS.ReadWriteStream;
@@ -1,8 +1,8 @@
1
- import chalk from 'chalk';
2
1
  import gulp from 'gulp';
3
2
  import { createGulpEsbuild } from 'gulp-esbuild';
4
3
  import rename from 'gulp-rename';
5
4
  import * as path from 'path';
5
+ import { blue, red } from '../index.js';
6
6
  export function buildBackend(options) {
7
7
  const { outputDir, enableIncrementalBuild } = options;
8
8
  const gulpEsbuild = createGulpEsbuild({
@@ -12,7 +12,7 @@ export function buildBackend(options) {
12
12
  return gulp.src([
13
13
  'typescript/backend/**/*.ts',
14
14
  'typescript/backend/**/*.tsx',
15
- '!typescript/backend/**/frontend.*.ts',
15
+ '!typescript/backend/**/*.jsw.ts',
16
16
  '!typescript/backend/**/*.spec.ts',
17
17
  ])
18
18
  .pipe(gulpEsbuild({
@@ -20,11 +20,36 @@ export function buildBackend(options) {
20
20
  }))
21
21
  .pipe(gulp.dest(path.join(outputDir, 'backend')))
22
22
  .on('error', function () {
23
- console.log(chalk.red.underline.bold('Build of Backend TS files failed!'));
23
+ console.log("💩" + red.underline.bold(' => Build of Backend TS files failed!'));
24
24
  this.emit('end');
25
25
  })
26
26
  .on('end', function () {
27
- console.log(chalk.blueBright.underline('Build of Backend TS files succeeded!'));
27
+ console.log("🐶" + blue.underline(' => Build of Backend TS files succeeded!'));
28
+ });
29
+ };
30
+ }
31
+ export function buildBackendLib(options) {
32
+ const { outputDir, enableIncrementalBuild } = options;
33
+ const gulpEsbuild = createGulpEsbuild({
34
+ incremental: enableIncrementalBuild,
35
+ });
36
+ return () => {
37
+ return gulp.src([
38
+ 'lucy-lib/backend/**/*.ts',
39
+ 'lucy-lib/backend/**/*.tsx',
40
+ '!lucy-lib/backend/**/*.jsw.ts',
41
+ '!lucy-lib/backend/**/*.spec.ts',
42
+ ])
43
+ .pipe(gulpEsbuild({
44
+ bundle: false,
45
+ }))
46
+ .pipe(gulp.dest(path.join(outputDir, 'backend')))
47
+ .on('error', function () {
48
+ console.log("💩" + red.underline.bold(' => Build of Backend TS (LIB) files failed!'));
49
+ this.emit('end');
50
+ })
51
+ .on('end', function () {
52
+ console.log("🐶" + blue.underline(' => Build of Backend TS (LIB) files succeeded!'));
28
53
  });
29
54
  };
30
55
  }
@@ -34,16 +59,35 @@ export function buildBackendJSW(options) {
34
59
  incremental: enableIncrementalBuild,
35
60
  });
36
61
  return () => {
37
- return gulp.src(['typescript/backend/**/*.jsw.ts', 'wix-lucy-lib/backend/**/*.jsw.ts'])
62
+ return gulp.src(['typescript/backend/**/*.jsw.ts'])
63
+ .pipe(gulpEsbuild({
64
+ bundle: false,
65
+ }))
66
+ .pipe(rename({ extname: '' }))
67
+ .pipe(gulp.dest(path.join(outputDir, 'backend')))
68
+ .on('error', function () {
69
+ console.log("💩" + red.underline.bold(' => Build of JSW files failed!'));
70
+ this.emit('end');
71
+ })
72
+ .on('end', function () { console.log("🐶" + blue.underline(' => Build of (JSW) files succeeded!')); });
73
+ };
74
+ }
75
+ export function buildBackendJSWLib(options) {
76
+ const { outputDir, enableIncrementalBuild } = options;
77
+ const gulpEsbuild = createGulpEsbuild({
78
+ incremental: enableIncrementalBuild,
79
+ });
80
+ return () => {
81
+ return gulp.src(['lucy-lib/backend/**/*.jsw.ts'])
38
82
  .pipe(gulpEsbuild({
39
83
  bundle: false,
40
84
  }))
41
- .pipe(rename({ extname: '.jsw' }))
85
+ .pipe(rename({ extname: '' }))
42
86
  .pipe(gulp.dest(path.join(outputDir, 'backend')))
43
87
  .on('error', function () {
44
- console.log(chalk.red.underline.bold('Build of JSW files failed!'));
88
+ console.log("💩" + red.underline.bold(' => Build of JSW (LIB) files failed!'));
45
89
  this.emit('end');
46
90
  })
47
- .on('end', function () { console.log(chalk.blueBright.underline('Build of JSW files succeeded!')); });
91
+ .on('end', function () { console.log("🐶" + blue.underline(' => Build of JSW (LIB) files succeeded!')); });
48
92
  };
49
93
  }
@@ -1,3 +1,3 @@
1
- export declare function checkPages(): Promise<void>;
2
- export declare function checkTs(): () => import("gulp-typescript/release/project").ICompileStream;
3
- export declare function checkTsLib(): () => import("gulp-typescript/release/project").ICompileStream;
1
+ export declare function checkPages(fail: 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;
@@ -1,9 +1,9 @@
1
- import chalk from 'chalk';
2
1
  import * as fs from 'fs';
3
2
  import glob from 'glob';
4
3
  import * as path from 'path';
5
4
  import gulp from 'gulp';
6
5
  import ts from 'gulp-typescript';
6
+ import { blue, green, red, yellow } from '../index.js';
7
7
  /**
8
8
  * Extracts a match from a file
9
9
  * @param {string} filePath File path
@@ -70,50 +70,60 @@ function readFilesInFolder(folderPath, pattern, globPattern) {
70
70
  });
71
71
  });
72
72
  }
73
- export async function checkPages() {
74
- console.log(chalk.blueBright.underline.bold('Checking pages...'));
75
- const sourcePages = await readFilesInFolder('./.wix/types/', '\\/pages\\/(?<page>.*\\.ts)', '**/*.json');
76
- const tsPages = await readFilesInFolder('./typescript/pages', null, '**/*.ts');
77
- const sourcePagesSet = new Set(sourcePages);
78
- const tsPagesSet = new Set(tsPages);
79
- const missingInTs = Array.from(sourcePagesSet).filter((item) => !tsPages.includes(item));
80
- const obsoleteInTs = Array.from(tsPagesSet).filter((item) => !sourcePages.includes(item));
81
- if (missingInTs.length > 0) {
82
- console.log(chalk.yellow.underline.bold('Missing in ts folder: '), '\n', missingInTs);
83
- throw new Error('Missing in ts folder');
84
- }
85
- if (obsoleteInTs.length > 0) {
86
- console.log(chalk.yellow.underline.bold('Obsolete in ts folder'), '\n', obsoleteInTs);
87
- throw new Error('Obsolete in ts folder');
88
- }
89
- if (missingInTs.length === 0 || obsoleteInTs.length === 0)
90
- console.log(chalk.blueBright.underline.bold('Files are insync!'));
73
+ export async function checkPages(fail) {
74
+ console.log("🐕" + green.underline.bold(' => Checking pages...'));
75
+ return new Promise(async (resolve, reject) => {
76
+ try {
77
+ const sourcePages = await readFilesInFolder('./.wix/types/', '\\/pages\\/(?<page>.*\\.ts)', '**/*.json');
78
+ const tsPages = await readFilesInFolder('./typescript/pages', null, '**/*.ts');
79
+ const sourcePagesSet = new Set(sourcePages);
80
+ const tsPagesSet = new Set(tsPages);
81
+ const missingInTs = Array.from(sourcePagesSet).filter((item) => !tsPages.includes(item));
82
+ const obsoleteInTs = Array.from(tsPagesSet).filter((item) => !sourcePages.includes(item));
83
+ if (missingInTs.length > 0) {
84
+ console.log("🦴" + yellow.underline.bold(' => Missing in ts folder: '), '\n', missingInTs);
85
+ }
86
+ if (obsoleteInTs.length > 0) {
87
+ console.log("🦴" + yellow.underline.bold(' => Obsolete in ts folder'), '\n', obsoleteInTs);
88
+ }
89
+ if (missingInTs.length === 0 || obsoleteInTs.length === 0) {
90
+ console.log("🐶" + blue.underline.bold(' => Pages are insync!'));
91
+ }
92
+ else if (fail) {
93
+ process.exit(1);
94
+ }
95
+ ;
96
+ }
97
+ catch (error) {
98
+ reject(error);
99
+ }
100
+ });
91
101
  }
92
102
  export function checkTs() {
93
- const tsProject = ts.createProject('./wix-lucy-lib/tsconfig.json', { noEmit: true });
103
+ const tsProject = ts.createProject('./lucy-lib/tsconfig.json', { noEmit: true });
94
104
  return () => {
95
- return gulp.src(['wix-lucy-lib/typescript/**/*.ts', '!wix-lucy-lib/typescript/types/**/*.ts'], { cwd: 'typescript' })
105
+ return gulp.src(['lucy-lib/typescript/**/*.ts', '!lucy-lib/typescript/types/**/*.ts'], { cwd: 'typescript' })
96
106
  .pipe(tsProject(ts.reporter.fullReporter()))
97
107
  .on('error', function () {
98
- console.log(chalk.red.underline.bold('Typescript (LIB) error!'));
108
+ console.log("💩" + red.underline.bold(' => Typescript error!'));
99
109
  this.emit('end');
100
110
  })
101
111
  .on('end', function () {
102
- console.log(chalk.blueBright.underline('Typescript check succeeded!'));
112
+ console.log("🐶" + blue.underline(' => Typescriptcheck succeeded!'));
103
113
  });
104
114
  };
105
115
  }
106
116
  export function checkTsLib() {
107
- const tsProject = ts.createProject('./wix-lucy-lib/tsconfig.json', { noEmit: true });
117
+ const tsProject = ts.createProject('./lucy-lib/tsconfig.json', { noEmit: true });
108
118
  return () => {
109
- return gulp.src(['wix-lucy-lib/typescript/**/*.ts', '!wix-lucy-lib/typescript/types/**/*.ts'], { cwd: 'typescript' })
119
+ return gulp.src(['lucy-lib/typescript/**/*.ts', '!lucy-lib/typescript/types/**/*.ts'], { cwd: 'typescript' })
110
120
  .pipe(tsProject(ts.reporter.fullReporter()))
111
121
  .on('error', function () {
112
- console.log(chalk.red.underline.bold('Typescript (LIB) error!'));
122
+ console.log("💩" + red.underline.bold(' => Typescript (LIB) error!'));
113
123
  this.emit('end');
114
124
  })
115
125
  .on('end', function () {
116
- console.log(chalk.blueBright.underline('Typescript check (LIB) succeeded!'));
126
+ console.log("🐶" + blue.underline(' => Typescript check (LIB) succeeded!'));
117
127
  });
118
128
  };
119
129
  }
@@ -1 +1,3 @@
1
+ import { TaskOptions } from '../Gulpfile';
1
2
  export declare function cleanWix(): () => any;
3
+ export declare function cleanSrc(options: TaskOptions): () => any;
@@ -1,14 +1,26 @@
1
- import chalk from 'chalk';
2
1
  import gulp from 'gulp';
3
2
  import clean from 'gulp-clean';
3
+ import { blue, red } from '../index.js';
4
4
  export function cleanWix() {
5
5
  return () => {
6
6
  return gulp.src('./.wix', { read: false, allowEmpty: true })
7
7
  .pipe(clean({ force: true }))
8
8
  .on('error', function () {
9
- console.log(chalk.red.underline.bold('Cleaning of .wix failed!'));
9
+ console.log("💩" + red.underline.bold(' => Cleaning of .wix failed!'));
10
10
  this.emit('end');
11
11
  })
12
- .on('end', function () { console.log(chalk.blueBright.underline('Cleaning of .wix succeeded!')); });
12
+ .on('end', function () { console.log("🐶" + blue.underline(' => Cleaning of .wix succeeded!')); });
13
+ };
14
+ }
15
+ export function cleanSrc(options) {
16
+ const { outputDir } = options;
17
+ return () => {
18
+ return gulp.src([`${outputDir}/pages`, `${outputDir}/public`, `${outputDir}/backend`], { read: false, allowEmpty: true })
19
+ .pipe(clean({ force: true }))
20
+ .on('error', function () {
21
+ console.log("💩" + red.underline.bold('Cleaning of output files failed!'));
22
+ this.emit('end');
23
+ })
24
+ .on('end', function () { console.log("🐶" + blue.underline(' => Cleaning of .src succeeded!')); });
13
25
  };
14
26
  }
@@ -1,3 +1,4 @@
1
1
  /// <reference types="node" />
2
2
  import { TaskOptions } from '../Gulpfile';
3
3
  export declare function copyFiles(options: TaskOptions): () => NodeJS.ReadWriteStream;
4
+ export declare function copyFilesLib(options: TaskOptions): () => NodeJS.ReadWriteStream;
package/dist/gulp/copy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import gulp from 'gulp';
2
- import chalk from 'chalk';
2
+ import { blue, red } from '../index.js';
3
3
  export function copyFiles(options) {
4
4
  const { outputDir } = options;
5
5
  return () => {
@@ -10,13 +10,33 @@ export function copyFiles(options) {
10
10
  '!typescript/**/*.tsx',
11
11
  '!typescript/types/**/**',
12
12
  '!typescript/__mocks__/**/**',
13
- '!typescript/public/scss/**',
13
+ '!typescript/styles/**',
14
14
  ])
15
15
  .pipe(gulp.dest(outputDir))
16
16
  .on('error', function () {
17
- console.log(chalk.red.underline.bold('Copy of files failed!'));
17
+ console.log("💩" + red.underline.bold(' => Copy of files failed!'));
18
18
  this.emit('end');
19
19
  })
20
- .on('end', function () { console.log(chalk.blueBright.underline('Copy of files succeeded!')); });
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!')); });
21
41
  };
22
42
  }
@@ -0,0 +1,2 @@
1
+ /// <reference types="node" />
2
+ export declare function generateDocs(): NodeJS.ReadWriteStream;
@@ -0,0 +1,27 @@
1
+ import gulp from 'gulp';
2
+ import { blue, red } from '../index.js';
3
+ import typedoc from 'gulp-typedoc';
4
+ export function generateDocs() {
5
+ // path.basename(options.cwd)
6
+ return gulp.src([
7
+ 'typescript/backend/**/*.ts',
8
+ 'typescript/backend/**/*.tsx',
9
+ '!typescript/backend/**/*.jsw.ts',
10
+ '!typescript/backend/**/*.spec.ts',
11
+ ])
12
+ .pipe(typedoc({
13
+ out: "docs",
14
+ plugins: [
15
+ "typedoc-theme-hierarchy"
16
+ ],
17
+ theme: "hierarchy",
18
+ name: "wix-development"
19
+ }))
20
+ .on('error', function () {
21
+ console.log("💩" + red.underline.bold(' => Build of Backend TS files failed!'));
22
+ this.emit('end');
23
+ })
24
+ .on('end', function () {
25
+ console.log("🐶" + blue.underline(' => Build of Backend TS files succeeded!'));
26
+ });
27
+ }
@@ -1,7 +1,7 @@
1
1
  import gulp from 'gulp';
2
- import chalk from 'chalk';
3
2
  import { createGulpEsbuild } from 'gulp-esbuild';
4
3
  import * as path from 'path';
4
+ import { blue, red } from '../index.js';
5
5
  export function buildPages(options) {
6
6
  const { outputDir, enableIncrementalBuild } = options;
7
7
  const gulpEsbuild = createGulpEsbuild({
@@ -14,9 +14,9 @@ export function buildPages(options) {
14
14
  }))
15
15
  .pipe(gulp.dest(path.join(outputDir, 'pages')))
16
16
  .on('error', function () {
17
- console.log(chalk.red.underline.bold('Build of Pages TS files failed!'));
17
+ console.log("💩" + red.underline.bold(' => Build of Pages TS files failed!'));
18
18
  this.emit('end');
19
19
  })
20
- .on('end', function () { console.log(chalk.blueBright.underline('Build of Pages TS files succeeded!')); });
20
+ .on('end', function () { console.log("🐶" + blue.underline(' => Build of Pages TS files succeeded!')); });
21
21
  };
22
22
  }
@@ -0,0 +1 @@
1
+ export declare function setProdConfig(): () => any;
@@ -0,0 +1,27 @@
1
+ import gulp from 'gulp';
2
+ import * as path from 'path';
3
+ import replace from 'gulp-string-replace';
4
+ import { blue, red } from '../index.js';
5
+ export function setProdConfig() {
6
+ const droneTag = process.env.DRONE_TAG || 'development';
7
+ const regexGit = /gitTag:\s*(.*),/g;
8
+ const regexDev = /devMode:\s*(.*),/g;
9
+ return () => {
10
+ return gulp
11
+ .src(['./typescript/public/constants/config.ts'])
12
+ .pipe(replace(regexGit, `gitTag: '${droneTag}',`))
13
+ .pipe(replace(regexDev, `devMode: false,`))
14
+ .pipe(gulp.dest((file) => {
15
+ const filePath = file.dirname;
16
+ const outputDir = path.dirname(filePath);
17
+ return path.join(`${outputDir}/constants`);
18
+ }))
19
+ .on('error', function () {
20
+ console.log("💩" + red.underline.bold(' => Setting the git tag failed!'));
21
+ this.emit('end');
22
+ })
23
+ .on('end', function () {
24
+ console.log("🐶" + blue.underline(' => Setting the git tag succeeded!'));
25
+ });
26
+ };
27
+ }