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/dist/init.js CHANGED
@@ -5,55 +5,27 @@ import { join } from 'path';
5
5
  import { simpleGit } from 'simple-git';
6
6
  import fs from 'fs/promises';
7
7
  import { spawnSync } from 'child_process';
8
- import settings from './settings.json' assert { type: 'json' };
9
8
  import path from 'path';
9
+ import { blue, green, orange, red } from './index.js';
10
10
  /**
11
11
  * Init Lucy project
12
12
  * @param {string} cwd Current working directory
13
13
  * @param {string} packageRoot Package root directory
14
14
  * @returns {void}
15
15
  */
16
- export async function init(cwd, packageRoot, args) {
17
- const sourceFolder = join(packageRoot, 'files');
18
- const targetFolder = cwd;
19
- let projectSettings;
20
- if (existsSync(join(targetFolder, 'lucy.json'))) {
21
- try {
22
- const lucyConfig = join(targetFolder, 'lucy.json');
23
- const data = await fs.readFile(lucyConfig, 'utf8');
24
- projectSettings = JSON.parse(data);
25
- }
26
- catch (parseError) {
27
- console.error(chalk.red.underline.bold('Error parsinc Lucy.json', parseError));
28
- }
29
- }
30
- else {
31
- const lucyConfig = {
32
- packages: settings.packages,
33
- modules: settings.modules
34
- };
35
- await fs.writeFile(join(targetFolder, 'lucy.json'), JSON.stringify(lucyConfig, null, 2), 'utf8');
36
- console.log(chalk.blueBright.underline.bold('Created Lucy config file!'));
37
- }
38
- const wixConfigPath = join(targetFolder, 'wix.config.json');
39
- const packageJSONraw = await fs.readFile(join(targetFolder, 'package.json'), 'utf8');
40
- const packageJSON = JSON.parse(packageJSONraw);
41
- if (packageJSON?.wixLucy?.intialized && !args.includes('-f')) {
42
- console.error(chalk.red.underline.bold(`This project is already initialized ${targetFolder}`));
43
- return;
44
- }
45
- if (!existsSync(wixConfigPath)) {
46
- console.error(chalk.red.underline.bold(`This is not a WIX project ${targetFolder}`));
16
+ export async function init(moduleSettings, projectSettings) {
17
+ if (projectSettings.packageJSON && projectSettings.packageJSON.wixLucy?.intialized && !moduleSettings.args.includes('-f')) {
18
+ console.log((`💩 ${red.underline.bold("=> This project is already initialized =>")} ${orange(moduleSettings.targetFolder)}`));
47
19
  return;
48
20
  }
49
- await copyFolder(sourceFolder, targetFolder);
50
- await editJson(join(targetFolder, 'package.json'), ['type', 'scripts', 'wixLucy'], ['module', settings.scripts, settings.lucySettings]);
51
- await stringReplace(join(targetFolder, 'currents.config.js'), ['__ProjectName__'], [path.basename(targetFolder)]);
52
- await installPackages(projectSettings?.packages ? projectSettings?.packages : settings.packages, targetFolder);
53
- await editJson(join(targetFolder, 'jsconfig.json'), ['compilerOptions', 'exclude'], [settings.wixSettings.compilerOptions, settings.wixSettings.exclude]);
54
- await editJson(join(targetFolder, 'typedoc.json'), ['name'], [path.basename(targetFolder)]);
55
- await gitInit(targetFolder, projectSettings?.modules ? projectSettings?.modules : settings.modules);
56
- console.log(chalk.blueBright.underline.bold('Done!'));
21
+ await copyFolder(join(moduleSettings.packageRoot, 'files'), moduleSettings.targetFolder);
22
+ await editJson(moduleSettings.packageJonPath, ['type', 'scripts', 'wixLucy'], ['module', moduleSettings.settings.scripts, moduleSettings.settings.lucySettings]);
23
+ await stringReplace(join(moduleSettings.targetFolder, 'currents.config.js'), ['__ProjectName__'], [path.basename(moduleSettings.targetFolder)]);
24
+ await installPackages(projectSettings?.packages ? projectSettings?.packages : moduleSettings.settings.packages, moduleSettings.targetFolder);
25
+ await editJson(join(moduleSettings.targetFolder, 'jsconfig.json'), ['compilerOptions', 'exclude'], [moduleSettings.settings.wixSettings.compilerOptions, moduleSettings.settings.wixSettings.exclude]);
26
+ await editJson(join(moduleSettings.targetFolder, 'typedoc.json'), ['name'], [path.basename(moduleSettings.targetFolder)]);
27
+ await gitInit(moduleSettings.targetFolder, projectSettings?.modules ? projectSettings?.modules : moduleSettings.settings.modules);
28
+ console.log(chalk.greenBright.underline('🐶 => Initialization done!'));
57
29
  }
58
30
  /**
59
31
  * Copy files from source to target
@@ -63,7 +35,7 @@ export async function init(cwd, packageRoot, args) {
63
35
  */
64
36
  async function copyFolder(source, target) {
65
37
  if (!existsSync(target)) {
66
- console.error(chalk.red.underline.bold(`Target folder doesn't exist: ${target}`));
38
+ console.log((`💩 ${red.underline.bold("=> Target folder doesn't exist =>")} ${orange(target)}`));
67
39
  return;
68
40
  }
69
41
  try {
@@ -87,10 +59,10 @@ async function copyFolder(source, target) {
87
59
  }
88
60
  }
89
61
  catch (err) {
90
- console.error(chalk.red.underline.bold(err));
62
+ console.log((`💩 ${red.underline.bold("=> There was an error while copying files =>")} ${orange(err)}`));
91
63
  }
92
64
  finally {
93
- console.log(chalk.blueBright.underline.bold('Copy files completed!'));
65
+ console.log("🐕" + blue.underline.bold(' => Copy files completed!'));
94
66
  }
95
67
  }
96
68
  /**
@@ -108,7 +80,7 @@ async function editJson(filePath, keys, values) {
108
80
  jsonData = JSON.parse(data);
109
81
  }
110
82
  catch (parseError) {
111
- console.error(chalk.red.underline.bold('Error parsing JSON:', parseError));
83
+ console.log((`💩 ${red.underline.bold("=> Error parsing JSON =>")} ${orange(parseError)}`));
112
84
  return;
113
85
  }
114
86
  for (const key of keys) {
@@ -120,10 +92,10 @@ async function editJson(filePath, keys, values) {
120
92
  await fs.writeFile(filePath, updatedJsonData, 'utf8');
121
93
  }
122
94
  catch (err) {
123
- console.log(chalk.red.underline.bold(err));
95
+ console.log((`💩 ${red.underline.bold("=> Error editing JSON Data =>")} ${orange(err)}`));
124
96
  }
125
97
  finally {
126
- console.log(chalk.blueBright.underline.bold(`File ${filePath} updated successfully!`));
98
+ console.log("🐕" + blue.underline(` => Updated file ${orange(filePath)}`));
127
99
  }
128
100
  }
129
101
  async function stringReplace(filePath, keys, values) {
@@ -139,23 +111,23 @@ async function stringReplace(filePath, keys, values) {
139
111
  await fs.writeFile(filePath, modifiedContent, 'utf8');
140
112
  }
141
113
  catch (err) {
142
- console.log(chalk.red.underline.bold(err));
114
+ console.log((`💩 ${red.underline.bold("=> Durring string replace =>")} ${orange(err)}`));
143
115
  }
144
116
  finally {
145
- console.log(chalk.blueBright.underline.bold(`File ${filePath} updated successfully!`));
117
+ console.log(blue.underline(`🐕 => Updated file ${orange(filePath)}`));
146
118
  }
147
119
  }
148
120
  async function installPackages(packages, cwd) {
149
121
  const packageNames = Object.keys(packages);
150
122
  const packageVersions = Object.values(packages);
151
123
  const packageNamesAndVersions = packageNames.map((name, index) => `${name}@${packageVersions[index]}`);
152
- const command = `yarn add ${packageNamesAndVersions.join(' ')}`;
124
+ const command = `yarn add -D ${packageNamesAndVersions.join(' ')}`;
153
125
  const result = spawnSync(command, { shell: true, stdio: 'inherit' });
154
126
  if (result.error) {
155
- console.error(chalk.red.underline.bold(`Command failed: ${result.error.message}`));
127
+ console.log((`💩 ${red.underline.bold("=> Failed to install packages =>")} ${orange(result.error.message)}`));
156
128
  }
157
129
  else {
158
- console.log(chalk.blueBright.underline.bold(`Command succeeded: ${result.stdout}`));
130
+ console.log("🐕" + blue.underline(` => Packeges installed!`));
159
131
  }
160
132
  }
161
133
  async function gitInit(cwd, modules) {
@@ -165,12 +137,12 @@ async function gitInit(cwd, modules) {
165
137
  try {
166
138
  await git.submoduleAdd(url, name);
167
139
  }
168
- catch (e) {
169
- console.error(chalk.red.underline.bold(`Command failed: ${e}`));
140
+ catch (err) {
141
+ console.log((`💩 ${red.underline.bold("=> Command failed =>")} ${orange(err)}`));
170
142
  }
171
143
  finally {
172
- console.log(chalk.blueBright.underline.bold(`Cloned ${name}`));
144
+ console.log("🐕" + blue.underline(` => Cloned ${orange(name)}`));
173
145
  }
174
146
  }
175
- console.log(chalk.blueBright.underline.bold(`All Modules cloned!`));
147
+ console.log("🐶" + green.underline(' => All Modules cloned!'));
176
148
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "modules": {
3
- "wix-lucy-lib": "git@github.com:Integral-Systems/wix-lucy-lib.git"
3
+ "lucy-lib": "git@github.com:Integral-Systems/lucy-lib.git"
4
4
  },
5
5
  "wixSettings": {
6
6
  "compilerOptions": {
@@ -24,8 +24,11 @@
24
24
  "@js-joda/locale": "4.8.10",
25
25
  "@js-joda/locale_de": "4.8.10",
26
26
  "@js-joda/locale_en": "4.8.10",
27
+ "@js-joda/locale_fr": "4.8.10",
28
+ "@js-joda/locale_it": "4.8.10",
27
29
  "@js-joda/timezone": "2.18.0",
28
30
  "@react-pdf/renderer": "2.0.17",
31
+ "velo-sync": "^0.0.9",
29
32
  "@total-typescript/ts-reset": "^0.4.2",
30
33
  "@types/i18n": "^0.13.6",
31
34
  "@types/jest": "^29.5.3",
package/dist/sync.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import { ModuleSettings, ProjectSettings } from ".";
2
+ export declare function sync(moduleSettings: ModuleSettings, projectSettings: ProjectSettings): void;
package/dist/sync.js ADDED
@@ -0,0 +1,5 @@
1
+ export function sync(moduleSettings, projectSettings) {
2
+ if (moduleSettings.args.includes('sync')) {
3
+ }
4
+ console.log('Hello sync');
5
+ }
package/files/lucy.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "modules": {
3
- "wix-lucy-lib": "git@github.com:Integral-Systems/wix-lucy-lib.git"
3
+ "lucy-lib": "git@github.com:Integral-Systems/lucy-lib.git"
4
4
  }
5
5
  }
@@ -1,10 +1,10 @@
1
1
  {
2
- "entryPoints": ["typescript/**/*.ts"],
2
+ "entryPoints": ["typescript/**/*.ts", "typescript/**/*.tsx"],
3
3
  "entryPointStrategy": "expand",
4
4
  "out": "docs",
5
5
  "plugin": ["typedoc-theme-hierarchy"],
6
6
  "theme": "hierarchy",
7
- "tsconfig": "./typescript/docs.tsconfig.json",
7
+ "tsconfig": "docs.tsconfig.json",
8
8
  "excludeExternals": true,
9
9
  "externalPattern":[
10
10
  "**/node_modules/**",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "lucy-cli",
4
- "version": "0.0.4",
4
+ "version": "0.5.0",
5
5
  "description": "Lucy Framwork for WIX Studio Editor",
6
6
  "main": ".dist/index.js",
7
7
  "scripts": {
@@ -25,6 +25,9 @@
25
25
  },
26
26
  "homepage": "https://github.com/Integral-Systems/wix-lucy-cli#readme",
27
27
  "bin": "./dist/index.js",
28
+ "publishConfig": {
29
+ "registry": "https://registry.npmjs.org"
30
+ },
28
31
  "dependencies": {
29
32
  "@wix/cli": "^1.0.83",
30
33
  "@wix/eslint-plugin-cli": "^1.0.1",
@@ -39,21 +42,24 @@
39
42
  "gulp-foreach": "^0.1.0",
40
43
  "gulp-if": "^3.0.0",
41
44
  "gulp-insert": "^0.5.0",
45
+ "gulp-jest": "^4.0.4",
42
46
  "gulp-json-editor": "^2.5.7",
43
47
  "gulp-rename": "^2.0.0",
44
48
  "gulp-sass": "^5.1.0",
45
49
  "gulp-shell": "^0.8.0",
46
50
  "gulp-string-replace": "^1.1.2",
47
51
  "gulp-tap": "^2.0.0",
52
+ "gulp-typedoc": "^3.0.2",
48
53
  "gulp-typescript": "^6.0.0-alpha.1",
49
54
  "gulp-wait": "^0.0.2",
50
- "jest": "^29.6.1",
55
+ "jest": "^29.7.0",
51
56
  "merge-stream": "^2.0.0",
52
57
  "prettier": "^3.0.3",
53
58
  "sass": "^1.65.1",
54
59
  "simple-git": "^3.20.0",
55
60
  "ts-jest": "^29.1.1",
56
- "typedoc": "^0.25.1",
61
+ "ts-node": "^10.9.1",
62
+ "typedoc": "^0.25.4",
57
63
  "typedoc-theme-hierarchy": "^4.0.0",
58
64
  "velo-sync": "^0.0.9"
59
65
  },
@@ -6,14 +6,24 @@
6
6
  "strict": true,
7
7
  "strictNullChecks": true,
8
8
  "paths": {
9
- "backend/*": ["../../../typescript/backend/*"],
9
+ "public/*": ["../../../lucy-lib/public/*"],
10
+ "backend/*": [
11
+ "../../../lucy-lib/backend/*",
12
+ "../../../lucy-lib/public/*"
13
+ ],
10
14
  "wix-types/*": ["../wix-code-types/dist/types/*"],
11
- "types/*": ["../../../typescript/types/*"]
15
+ "types/*": ["../../../typescript/types/*", "../../../lucy-lib/types/*"]
12
16
  }
13
17
  },
14
18
  "include": [
19
+ "../../../lucy-lib/public/**/*",
20
+ "../../../lucy-lib/backend/**/*.web.ts",
21
+ "../../../lucy-lib/backend/**/*",
15
22
  "../../../typescript/__mocks__/**/*",
23
+ "../../../lucy-lib/__mocks__/**/*",
16
24
  "../../../typescript/backend/**/*.json",
17
- "../../../typescript/backend/**/*"
25
+ "../../../lucy-lib/backend/**/*.json",
26
+ "../../../typescript/backend/**/*",
27
+ "../../../lucy-lib/backend/**/*"
18
28
  ]
19
29
  }
@@ -8,10 +8,17 @@
8
8
  "noUncheckedIndexedAccess": true,
9
9
  "lib": ["DOM"],
10
10
  "paths": {
11
- "backend/*": ["../../../typescript/backend/*"],
11
+ "public/*": ["../../../lucy-lib/public/*"],
12
+ "backend/*": [
13
+ "../../../typescript/backend/*",
14
+ "../../../lucy-lib/backend/*"
15
+ ],
12
16
  "wix-types/*": ["../wix-code-types/dist/types/*"],
13
- "types/*": ["../../../typescript/types/*"]
17
+ "types/*": ["../../../typescript/types/*", "../../../lucy-lib/types/*"]
14
18
  }
15
19
  },
16
- "include": ["../../../typescript/backend/**/*"]
20
+ "include": [
21
+ "../../../typescript/backend/**/*",
22
+ "../../../lucy-lib/backend/**/*"
23
+ ]
17
24
  }
@@ -9,10 +9,18 @@
9
9
  "noUncheckedIndexedAccess": true,
10
10
  "lib": ["DOM"],
11
11
  "paths": {
12
- "backend/*": ["../../../typescript/backend/*"],
12
+ "public/*": ["../../../lucy-lib/public/*"],
13
+ "backend/*": [
14
+ "../../../typescript/backend/*",
15
+ "../../../lucy-lib/backend/*"
16
+ ],
13
17
  "wix-types/*": ["../wix-code-types/dist/types/*"],
14
- "types/*": ["../../../typescript/types/*"]
18
+ "types/*": ["../../../typescript/types/*", "../../../lucy-lib/types/*"]
15
19
  }
16
20
  },
17
- "include": ["../../../typescript/backend/**/*"]
21
+ "include": [
22
+ "../../../lucy-lib/public/*",
23
+ "../../../typescript/backend/**/*",
24
+ "../../../lucy-lib/backend/**/*"
25
+ ]
18
26
  }
@@ -8,14 +8,23 @@
8
8
  "strictNullChecks": true,
9
9
  "lib": ["DOM"],
10
10
  "paths": {
11
- "backend/*": ["../../../typescript/backend/*"],
12
- "public/*": ["../../../typescript/public/*"],
13
- "types/*": ["../../../typescript/types/*"],
11
+ "backend/*": [
12
+ "../../../typescript/backend/*",
13
+ "../../../lucy-lib/backend/*"
14
+ ],
15
+ "public/*": [
16
+ "../../../typescript/public/*",
17
+ "../../../lucy-lib/public/*"
18
+ ],
19
+ "types/*": ["../../../typescript/types/*", "../../../lucy-lib/types/*"],
14
20
  "wix-types/*": ["../wix-code-types/dist/types/*"]
15
21
  }
16
22
  },
17
23
  "include": [
24
+ "../../../lucy-lib/public/**/*",
18
25
  "../../../typescript/__mocks__/**/*",
19
- "../../../typescript/backend/**/*"
26
+ "../../../lucy-lib/__mocks__/**/*",
27
+ "../../../typescript/backend/**/*",
28
+ "../../../lucy-lib/backend/**/*"
20
29
  ]
21
30
  }