lucy-cli 0.10.0 → 0.10.1

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
@@ -30,32 +30,42 @@ Lucy-CLI is designed to streamline the setup and management of TypeScript within
30
30
 
31
31
  4. **Git Submodule Support**
32
32
  - Includes support for git submodules, providing full type support within submodules and enabling the use of libraries and types across projects.
33
-
34
- 5. **Configurable Setup**
33
+ - To add a submodule, include the following in the `lucy.json` file:
34
+
35
+ ``` json
36
+ "modules": {
37
+ "<repoName>": {
38
+ "url": "String",
39
+ "branch": "String"
40
+ }
41
+ }
42
+ ```
43
+
44
+ 1. **Configurable Setup**
35
45
  - After initialization, Lucy-CLI creates a `lucy-config.json` configuration file where you can modify settings, add dev packages, specify Wix packages, and configure git submodules.
36
46
 
37
- 6. **Execute render functions**
47
+ 2. **Execute render functions**
38
48
  - Lucy-CLI can execute render functions located in the backend template folder, allowing you to test render functions locally.
39
49
 
40
- 7. **compile sccs files**
50
+ 3. **compile sccs files**
41
51
  - Lucy-CLI can compile scss files to css files.
42
52
  - It compiles styles/global.scss file to global.css.
43
53
 
44
- 8. **Wix NPM Package Installation**
54
+ 4. **Wix NPM Package Installation**
45
55
  - Lucy-CLI can install Wix npm packages from the `lucy.json` file in the project directory.
46
56
 
47
- 9. **Teting with Vitest**
57
+ 5. **Teting with Vitest**
48
58
  - Lucy-CLI can run tests with Vitest.
49
59
  - It runs tests located backend folder with the file name ending with `.spec.ts`.
50
60
  - it creates a code coverage report in the coverage folder in the lib folders and typescript folders.
51
61
  - Vitest is looking for mokes in typescript folder and lib folder.
52
62
  - You can add additional mock folders in vitest.config.ts file.
53
63
 
54
- 10. **Linting with ESLint**
64
+ 6. **Linting with ESLint**
55
65
  - Lucy-CLI can lint the code with ESLint.
56
66
  - It uses the ESLint configuration in the `.eslintrc.cjs` file in the project directory.
57
67
 
58
- 11. **Add git version during production build**
68
+ 7. **Add git version during production build**
59
69
  - Lucy-CLI can add the git version to the production build.
60
70
  - It adds the git version to the `public/constant/env.ts` file in the public folder under the key gitTag.
61
71
 
package/dist/helpers.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { ModuleSettings, ProjectSettings } from '.';
1
+ import { LucySettings, ModuleSettings, ProjectSettings } from '.';
2
2
  export declare function installPackages(wixPackages: Record<string, string>, devPackages: Record<string, string>, cwd: string, locked: boolean): Promise<void>;
3
- export declare function gitInit(cwd: string, modules: Record<string, string>): Promise<void>;
3
+ export declare function gitInit(cwd: string, modules: LucySettings['modules']): Promise<void>;
4
4
  export declare function runGulp(moduleSettings: ModuleSettings, projectSettings: ProjectSettings, task: string): Promise<void>;
5
5
  /**
6
6
  * Clean up and run a command before exiting the process.
package/dist/helpers.js CHANGED
@@ -6,6 +6,7 @@ import path from 'path';
6
6
  import { fileURLToPath } from 'url';
7
7
  import { exec } from 'child_process';
8
8
  import os from 'os';
9
+ import fs from 'fs';
9
10
  import { blue, green, orange, red, yellow, magenta } from './index.js';
10
11
  export async function installPackages(wixPackages, devPackages, cwd, locked) {
11
12
  if (locked)
@@ -43,11 +44,19 @@ export async function installPackages(wixPackages, devPackages, cwd, locked) {
43
44
  }
44
45
  }
45
46
  export async function gitInit(cwd, modules) {
46
- const git = simpleGit({ baseDir: cwd });
47
- for (const [name, url] of Object.entries(modules)) {
47
+ for (const [name, repo] of Object.entries(modules)) {
48
48
  console.log(chalk.green.underline.bold(`Cloning ${name}`));
49
+ const git = simpleGit({ baseDir: cwd });
49
50
  try {
50
- await git.submoduleAdd(url, name);
51
+ const repoPath = path.resolve(cwd, name);
52
+ if (!fs.existsSync(repoPath)) {
53
+ await git.submoduleAdd(repo.url, name);
54
+ }
55
+ if (fs.existsSync(repoPath)) {
56
+ console.log(`🐕 ${blue.underline(' => Module already cloned!')}`);
57
+ }
58
+ const localGit = simpleGit({ baseDir: `${cwd}/${name}` });
59
+ await localGit.checkout(repo.branch);
51
60
  }
52
61
  catch (err) {
53
62
  console.log((`💩 ${red.underline.bold("=> Command failed =>")} ${orange(err)}`));
package/dist/index.d.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  #!/usr/bin/env node --no-warnings
2
2
  export type LucySettings = {
3
3
  modules: {
4
- [llibName: string]: string;
4
+ [llibName: string]: {
5
+ url: string;
6
+ branch: string;
7
+ };
5
8
  };
6
9
  wixSettings: {
7
10
  compilerOptions: {
@@ -17,7 +17,10 @@
17
17
  "@total-typescript/ts-reset": "^0.6.1",
18
18
  "@types/node": "^22.9.1",
19
19
  "@types/nodemailer": "^6.4.17",
20
+ "typedoc-github-theme": "^0.2.0",
20
21
  "@types/react": "^19.0.0",
22
+ "@vitest/ui": "^2.1.8",
23
+ "@vitest/coverage-v8": "^2.1.8",
21
24
  "@typescript-eslint/eslint-plugin": "^8.15.0",
22
25
  "@typescript-eslint/parser": "^8.15.0",
23
26
  "@typescript-eslint/utils": "^8.15.0",
@@ -1,4 +1,3 @@
1
- /** @type { import('typedoc').TypeDocOptionMap & import('typedoc-plugin-merge-modules').Config } */
2
1
  {
3
2
  "entryPoints": [
4
3
  "*/**/*.ts",
@@ -7,22 +6,20 @@
7
6
  "entryPointStrategy": "expand",
8
7
  "out": "docs",
9
8
  "plugin": [
10
- "typedoc-github-theme",
9
+ "typedoc-github-theme"
11
10
  ],
12
11
  "tsconfig": "local.tsconfig.json",
13
12
  "excludeExternals": true,
14
13
  "externalPattern": [
15
14
  "**/node_modules/**",
16
15
  "**/.wix/**",
17
- ".wix/**",
16
+ ".wix/**"
18
17
  ],
19
18
  "exclude": [
20
19
  "./.wix/**/*",
21
20
  ".wix/**/*",
22
21
  "cypress/**",
23
- "**/__mocks__/**",
22
+ "**/__mocks__/**"
24
23
  ],
25
- "name": "wix-integraleakademie",
26
- // "mergeModulesRenameDefaults": false, // NEW option of TypeDoc added by this plugin
27
- // "mergeModulesMergeMode": "project", // NEW option of TypeDoc added by this plugin
24
+ "name": "Wix-lucy"
28
25
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "lucy-cli",
4
- "version": "0.10.0",
4
+ "version": "0.10.1",
5
5
  "description": "Lucy Framework for WIX Studio Editor",
6
6
  "main": ".dist/index.js",
7
7
  "scripts": {
package/src/helpers.ts CHANGED
@@ -4,11 +4,13 @@ import { spawnSync } from 'child_process';
4
4
  // https://www.sergevandenoever.nl/run-gulp4-tasks-programatically-from-node/
5
5
  import path from 'path';
6
6
  import { fileURLToPath } from 'url';
7
- import { ModuleSettings, ProjectSettings } from '.';
7
+ import { LucySettings, ModuleSettings, ProjectSettings } from '.';
8
8
  import { exec } from 'child_process';
9
9
  import os from 'os';
10
+ import fs from 'fs';
10
11
 
11
12
  import { blue, green, orange, red, yellow, magenta } from './index.js';
13
+ import { fsync } from 'fs';
12
14
 
13
15
  export async function installPackages(wixPackages: Record<string, string>, devPackages: Record<string, string>, cwd: string, locked: boolean ) {
14
16
  if (locked) console.log("🐕" + blue.underline(` => Installing & version locked packages!`));
@@ -47,12 +49,23 @@ export async function installPackages(wixPackages: Record<string, string>, devPa
47
49
  }
48
50
  }
49
51
 
50
- export async function gitInit(cwd: string, modules: Record<string, string>) {
51
- const git = simpleGit({ baseDir: cwd });
52
- for (const [name, url] of Object.entries(modules)) {
52
+ export async function gitInit(cwd: string, modules: LucySettings['modules']) {
53
+ for (const [name, repo] of Object.entries(modules)) {
53
54
  console.log(chalk.green.underline.bold(`Cloning ${name}`));
55
+ const git = simpleGit({ baseDir: cwd });
56
+
54
57
  try {
55
- await git.submoduleAdd(url, name)
58
+ const repoPath = path.resolve(cwd, name);
59
+ if (!fs.existsSync(repoPath)) {
60
+ await git.submoduleAdd(repo.url, name)
61
+ }
62
+
63
+ if (fs.existsSync(repoPath)) {
64
+ console.log(`🐕 ${blue.underline(' => Module already cloned!')}`);
65
+ }
66
+
67
+ const localGit = simpleGit({ baseDir: `${cwd}/${name}` });
68
+ await localGit.checkout(repo.branch);
56
69
  } catch (err) {
57
70
  console.log((`💩 ${red.underline.bold("=> Command failed =>")} ${orange(err)}`));
58
71
  } finally {
package/src/index.ts CHANGED
@@ -17,7 +17,10 @@ import { spawnSync } from 'child_process';
17
17
 
18
18
  export type LucySettings = {
19
19
  modules: {
20
- [llibName: string]: string;
20
+ [llibName: string]: {
21
+ url: string;
22
+ branch: string;
23
+ };
21
24
  };
22
25
  wixSettings: {
23
26
  compilerOptions: {