lucy-cli 1.2.4 → 1.2.5

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 CHANGED
@@ -58,9 +58,10 @@ Lucy-CLI is designed to streamline the setup and management of TypeScript within
58
58
  ``` json
59
59
  "modules": {
60
60
  "<repoName>": {
61
- "url": "String",
62
- "branch": "String",
63
- "path": "String" // Optional, specifies the path where the submodule should be cloned
61
+ "url": "String",
62
+ "branch": "String",
63
+ "path": "String", // Optional, specifies the path where the submodule should be cloned
64
+ "noCompile": true // Optional, if true, the module will not be compiled
64
65
  }
65
66
  }
66
67
  ```
@@ -17,6 +17,7 @@ export type TaskOptions = {
17
17
  pageSettings: typeof pageSettings;
18
18
  publicSettings: typeof publicSettings;
19
19
  modulesSync: Record<string, string> | undefined;
20
+ modulesSourcePaths: string[];
20
21
  cwd: string;
21
22
  isWatching?: boolean;
22
23
  };
package/dist/Gulpfile.js CHANGED
@@ -23,7 +23,7 @@ import { addTypes, updateWixTypes } from './gulp/types.js';
23
23
  import { setProdConfig } from './gulp/pipeline.js';
24
24
  import { watchAll } from './gulp/watchers.js';
25
25
  import { blue, green, magenta, orange, red } from './index.js';
26
- import { getModulesSync } from './gulp/helpers.js';
26
+ import { getModulesSourcePaths, getModulesSync } from './gulp/helpers.js';
27
27
  const sass = gulpSass(dartSass);
28
28
  const outputDir = './src';
29
29
  const userHomeDir = os.homedir();
@@ -44,6 +44,7 @@ const taskOptions = {
44
44
  replaceOptions,
45
45
  cwd: process.cwd(),
46
46
  modulesSync: getModulesSync(),
47
+ modulesSourcePaths: getModulesSourcePaths(),
47
48
  };
48
49
  const watchTaskOptions = { ...taskOptions, isWatching: true };
49
50
  gulp.task('check-ts', gulp.parallel(checkTs(taskOptions)));
@@ -19,12 +19,7 @@ const swcOptions = {
19
19
  },
20
20
  };
21
21
  export function buildBackend(options) {
22
- const folders = ['typescript'];
23
- if (options.modulesSync) {
24
- for (const module of Object.keys(options.modulesSync)) {
25
- folders.push(module);
26
- }
27
- }
22
+ const folders = ['typescript', ...options.modulesSourcePaths];
28
23
  const { outputDir } = options;
29
24
  // Create tasks for each folder
30
25
  const tasks = folders.map((folder) => {
@@ -58,12 +53,7 @@ export function buildBackend(options) {
58
53
  return gulp.parallel(...tasks);
59
54
  }
60
55
  export function buildBackendJSW(options) {
61
- const folders = ['typescript'];
62
- if (options.modulesSync) {
63
- for (const module of Object.keys(options.modulesSync)) {
64
- folders.push(module);
65
- }
66
- }
56
+ const folders = ['typescript', ...options.modulesSourcePaths];
67
57
  const swcOptions = {
68
58
  jsc: {
69
59
  target: 'es6',
@@ -171,12 +171,7 @@ const customReporter = {
171
171
  },
172
172
  };
173
173
  export function checkTs(options) {
174
- const folders = ['typescript'];
175
- if (options.modulesSync) {
176
- for (const module of Object.keys(options.modulesSync)) {
177
- folders.push(module);
178
- }
179
- }
174
+ const folders = ['typescript', ...options.modulesSourcePaths];
180
175
  // Create tasks for each folder
181
176
  const tasks = folders.map((folder) => {
182
177
  const tsProject = ts.createProject(`./local.tsconfig.json`, { noEmit: true, declaration: false, skipDefaultLibCheck: true });
package/dist/gulp/copy.js CHANGED
@@ -1,12 +1,7 @@
1
1
  import gulp from 'gulp';
2
2
  import { blue, orange, red } from '../index.js';
3
3
  export function copyFiles(options) {
4
- const folders = ['typescript'];
5
- if (options.modulesSync) {
6
- for (const module of Object.keys(options.modulesSync)) {
7
- folders.push(module);
8
- }
9
- }
4
+ const folders = ['typescript', ...options.modulesSourcePaths];
10
5
  // Create tasks for each folder
11
6
  const tasks = folders.map((folder) => {
12
7
  const { outputDir } = options;
@@ -1 +1,2 @@
1
1
  export declare function getModulesSync(): Record<string, string> | undefined;
2
+ export declare function getModulesSourcePaths(): string[];
@@ -5,3 +5,20 @@ export function getModulesSync() {
5
5
  const fileContent = fs.readFileSync(absolutePath, 'utf8');
6
6
  return JSON.parse(fileContent).modules;
7
7
  }
8
+ export function getModulesSourcePaths() {
9
+ const absolutePath = path.resolve('./lucy.json');
10
+ const fileContent = fs.readFileSync(absolutePath, 'utf8');
11
+ const data = JSON.parse(fileContent).modules;
12
+ const paths = [];
13
+ for (const module of Object.keys(data)) {
14
+ if (!data[module].noCompile) {
15
+ if (data[module].path) {
16
+ paths.push(data[module].path);
17
+ }
18
+ else {
19
+ paths.push(module);
20
+ }
21
+ }
22
+ }
23
+ return paths;
24
+ }
@@ -16,12 +16,7 @@ const swcOptions = {
16
16
  },
17
17
  };
18
18
  export function buildPublic(options) {
19
- const folders = ['typescript'];
20
- if (options.modulesSync) {
21
- for (const module of Object.keys(options.modulesSync)) {
22
- folders.push(module);
23
- }
24
- }
19
+ const folders = ['typescript', ...options.modulesSourcePaths];
25
20
  const { outputDir } = options;
26
21
  // Create tasks for each folder
27
22
  const tasks = folders.map((folder) => {
@@ -2,13 +2,8 @@ import gulp from 'gulp';
2
2
  import { blue, orange, red } from '../index.js';
3
3
  export function compileScss(options) {
4
4
  const folders = ['typescript'];
5
- // if (options.modulesSync){
6
- // for (const module of Object.keys(options.modulesSync)) {
7
- // folders.push(module);
8
- // }
9
- // }
10
5
  const { sass, outputDir } = options;
11
- const buildWixScss = () => gulp.src(['typescript/styles/global.scss'])
6
+ const buildWixScss = () => gulp.src(['typescript/styles/global.scss'], { allowEmpty: true })
12
7
  .pipe(sass().on('error', sass.logError))
13
8
  .on('error', function (e) {
14
9
  console.log("💩" + red.underline.bold(` => Build of SCSS files for ${orange('global.scs')} failed!`));
@@ -24,7 +19,7 @@ export function compileScss(options) {
24
19
  .on('end', function () {
25
20
  console.log("🐶" + blue.underline(` => Compiling of scss files for ${orange('global.scs')} succeeded!`));
26
21
  });
27
- const buildScss = () => gulp.src(['typescript/public/scss/app.scss'])
22
+ const buildScss = () => gulp.src(['typescript/public/scss/app.scss'], { allowEmpty: true })
28
23
  .pipe(sass().on('error', sass.logError))
29
24
  .on('error', function (e) {
30
25
  console.log("💩" + red.underline.bold(` => Build of SCSS files for ${orange('app.scss')} failed!`));
@@ -2,12 +2,7 @@ import gulp from 'gulp';
2
2
  import exec from 'gulp-exec';
3
3
  import { blue, orange, red } from '../index.js';
4
4
  export function previewTemplates(options) {
5
- const folders = ['typescript'];
6
- if (options.modulesSync) {
7
- for (const module of Object.keys(options.modulesSync)) {
8
- folders.push(module);
9
- }
10
- }
5
+ const folders = ['typescript', ...options.modulesSourcePaths];
11
6
  const taskOpt = {
12
7
  continueOnError: true,
13
8
  };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,17 @@
1
1
  #!/usr/bin/env node --no-warnings
2
+ export type ModulesSettings = {
3
+ packageRoot: string;
4
+ targetFolder: string;
5
+ args: string[];
6
+ settings: LucySettings;
7
+ };
2
8
  export type LucySettings = {
3
9
  modules: {
4
10
  [libName: string]: {
5
11
  url: string;
6
12
  branch: string;
7
13
  path?: string;
14
+ noCompile?: boolean;
8
15
  };
9
16
  };
10
17
  wixSettings: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "lucy-cli",
4
- "version": "1.2.4",
4
+ "version": "1.2.5",
5
5
  "description": "Lucy Framework for WIX Studio Editor",
6
6
  "main": ".dist/index.js",
7
7
  "scripts": {
package/src/Gulpfile.ts CHANGED
@@ -21,7 +21,7 @@ import { addTypes, updateWixTypes } from './gulp/types.js';
21
21
  import { setProdConfig } from './gulp/pipeline.js';
22
22
  import { watchAll } from './gulp/watchers.js';
23
23
  import { ModuleSettings, ProjectSettings, blue, green, magenta, orange, red } from './index.js';
24
- import { getModulesSync } from './gulp/helpers.js';
24
+ import { getModulesSourcePaths, getModulesSync } from './gulp/helpers.js';
25
25
 
26
26
  const sass = gulpSass(dartSass);
27
27
 
@@ -38,6 +38,7 @@ export type TaskOptions = {
38
38
  pageSettings: typeof pageSettings,
39
39
  publicSettings: typeof publicSettings,
40
40
  modulesSync: Record<string, string> | undefined;
41
+ modulesSourcePaths: string[];
41
42
  cwd: string;
42
43
  isWatching?: boolean;
43
44
  }
@@ -67,6 +68,7 @@ const taskOptions: TaskOptions = {
67
68
  replaceOptions,
68
69
  cwd: process.cwd(),
69
70
  modulesSync: getModulesSync(),
71
+ modulesSourcePaths: getModulesSourcePaths(),
70
72
  }
71
73
 
72
74
  const watchTaskOptions: TaskOptions = { ...taskOptions, isWatching: true };
@@ -23,12 +23,7 @@ const swcOptions = {
23
23
  };
24
24
 
25
25
  export function buildBackend(options: TaskOptions) {
26
- const folders = ['typescript'];
27
- if (options.modulesSync){
28
- for (const module of Object.keys(options.modulesSync)) {
29
- folders.push(module);
30
- }
31
- }
26
+ const folders = ['typescript', ...options.modulesSourcePaths];
32
27
 
33
28
  const { outputDir } = options;
34
29
 
@@ -70,12 +65,8 @@ export function buildBackend(options: TaskOptions) {
70
65
 
71
66
 
72
67
  export function buildBackendJSW(options: TaskOptions) {
73
- const folders = ['typescript'];
74
- if (options.modulesSync){
75
- for (const module of Object.keys(options.modulesSync)) {
76
- folders.push(module);
77
- }
78
- }
68
+ const folders = ['typescript', ...options.modulesSourcePaths];
69
+
79
70
  const swcOptions = {
80
71
  jsc: {
81
72
  target: 'es6',
@@ -186,12 +186,8 @@ const customReporter: ts.reporter.Reporter = {
186
186
  };
187
187
 
188
188
  export function checkTs(options: TaskOptions) {
189
- const folders = ['typescript'];
190
- if (options.modulesSync){
191
- for (const module of Object.keys(options.modulesSync)) {
192
- folders.push(module);
193
- }
194
- }
189
+ const folders = ['typescript', ...options.modulesSourcePaths];
190
+
195
191
 
196
192
  // Create tasks for each folder
197
193
  const tasks = folders.map((folder) => {
package/src/gulp/copy.ts CHANGED
@@ -4,12 +4,7 @@ import { TaskOptions } from '../Gulpfile';
4
4
  import { blue, orange, red } from '../index.js';
5
5
 
6
6
  export function copyFiles(options: TaskOptions) {
7
- const folders = ['typescript'];
8
- if (options.modulesSync){
9
- for (const module of Object.keys(options.modulesSync)) {
10
- folders.push(module);
11
- }
12
- }
7
+ const folders = ['typescript', ...options.modulesSourcePaths];
13
8
 
14
9
  // Create tasks for each folder
15
10
  const tasks = folders.map((folder) => {
@@ -6,4 +6,21 @@ export function getModulesSync(): Record<string, string> | undefined {
6
6
  const absolutePath = path.resolve('./lucy.json');
7
7
  const fileContent = fs.readFileSync(absolutePath, 'utf8') as any;
8
8
  return JSON.parse(fileContent).modules;
9
+ }
10
+
11
+ export function getModulesSourcePaths(): string[] {
12
+ const absolutePath = path.resolve('./lucy.json');
13
+ const fileContent = fs.readFileSync(absolutePath, 'utf8') as any;
14
+ const data = JSON.parse(fileContent).modules;
15
+ const paths: string[] = [];
16
+ for (const module of Object.keys(data)) {
17
+ if (!data[module].noCompile) {
18
+ if (data[module].path) {
19
+ paths.push(data[module].path);
20
+ } else {
21
+ paths.push(module);
22
+ }
23
+ }
24
+ }
25
+ return paths;
9
26
  }
@@ -19,12 +19,7 @@ const swcOptions = {
19
19
  };
20
20
 
21
21
  export function buildPublic(options: TaskOptions) {
22
- const folders = ['typescript'];
23
- if (options.modulesSync){
24
- for (const module of Object.keys(options.modulesSync)) {
25
- folders.push(module);
26
- }
27
- }
22
+ const folders = ['typescript', ...options.modulesSourcePaths];
28
23
 
29
24
  const { outputDir } = options;
30
25
 
@@ -5,15 +5,10 @@ import { blue, orange, red } from '../index.js';
5
5
 
6
6
  export function compileScss(options: TaskOptions) {
7
7
  const folders = ['typescript'];
8
- // if (options.modulesSync){
9
- // for (const module of Object.keys(options.modulesSync)) {
10
- // folders.push(module);
11
- // }
12
- // }
13
8
 
14
9
  const { sass, outputDir} = options;
15
10
 
16
- const buildWixScss = () => gulp.src(['typescript/styles/global.scss'])
11
+ const buildWixScss = () => gulp.src(['typescript/styles/global.scss'], { allowEmpty: true })
17
12
  .pipe(sass().on('error', sass.logError))
18
13
  .on('error', function (e: Error) {
19
14
  console.log("💩" + red.underline.bold(` => Build of SCSS files for ${orange('global.scs')} failed!`));
@@ -30,7 +25,7 @@ export function compileScss(options: TaskOptions) {
30
25
  console.log("🐶" + blue.underline(` => Compiling of scss files for ${orange('global.scs')} succeeded!`));
31
26
  });
32
27
 
33
- const buildScss = () => gulp.src(['typescript/public/scss/app.scss'])
28
+ const buildScss = () => gulp.src(['typescript/public/scss/app.scss'], { allowEmpty: true })
34
29
  .pipe(sass().on('error', sass.logError))
35
30
  .on('error', function (e: Error) {
36
31
  console.log("💩" + red.underline.bold(` => Build of SCSS files for ${orange('app.scss')} failed!`));
@@ -4,12 +4,7 @@ import exec from 'gulp-exec';
4
4
  import { blue, orange, red } from '../index.js';
5
5
 
6
6
  export function previewTemplates(options: TaskOptions) {
7
- const folders = ['typescript'];
8
- if (options.modulesSync){
9
- for (const module of Object.keys(options.modulesSync)) {
10
- folders.push(module);
11
- }
12
- }
7
+ const folders = ['typescript', ...options.modulesSourcePaths];
13
8
 
14
9
  const taskOpt = {
15
10
  continueOnError: true,
package/src/index.ts CHANGED
@@ -16,12 +16,19 @@ import { prepare } from './prepare.js';
16
16
  import { spawn, spawnSync } from 'child_process';
17
17
  import os from 'os';
18
18
 
19
+ export type ModulesSettings = {
20
+ packageRoot: string;
21
+ targetFolder: string;
22
+ args: string[];
23
+ settings: LucySettings;
24
+ }
19
25
  export type LucySettings = {
20
26
  modules: {
21
27
  [libName: string]: {
22
28
  url: string;
23
29
  branch: string;
24
30
  path?: string;
31
+ noCompile?: boolean;
25
32
  };
26
33
  };
27
34
  wixSettings: {