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.
- package/.yarnrc.yml +0 -2
- package/config.json +1 -0
- package/dist/Gulpfile.js +24 -115
- package/dist/dev.d.ts +2 -1
- package/dist/dev.js +2 -3
- package/dist/gulp/backend.d.ts +2 -0
- package/dist/gulp/backend.js +52 -8
- package/dist/gulp/checks.d.ts +3 -3
- package/dist/gulp/checks.js +37 -27
- package/dist/gulp/clean.d.ts +2 -0
- package/dist/gulp/clean.js +15 -3
- package/dist/gulp/copy.d.ts +1 -0
- package/dist/gulp/copy.js +24 -4
- package/dist/gulp/docs.d.ts +2 -0
- package/dist/gulp/docs.js +27 -0
- package/dist/gulp/pages.js +3 -3
- package/dist/gulp/pipeline.d.ts +1 -0
- package/dist/gulp/pipeline.js +27 -0
- package/dist/gulp/public.js +13 -7
- package/dist/gulp/styles.js +4 -4
- package/dist/gulp/templates.d.ts +1 -0
- package/dist/gulp/templates.js +21 -3
- package/dist/gulp/test.d.ts +2 -0
- package/dist/gulp/test.js +82 -0
- package/dist/gulp/types.js +7 -8
- package/dist/gulp/watchers.d.ts +17 -0
- package/dist/gulp/watchers.js +94 -0
- package/dist/index.d.ts +23 -1
- package/dist/index.js +46 -46
- package/dist/init.d.ts +2 -1
- package/dist/init.js +27 -55
- package/dist/settings.json +4 -1
- package/dist/sync.d.ts +2 -0
- package/dist/sync.js +5 -0
- package/files/lucy.json +1 -1
- package/files/typedoc.json +2 -2
- package/package.json +9 -3
- package/settings/backend-settings.json +13 -3
- package/settings/master-settings.json +10 -3
- package/settings/page-settings.json +11 -3
- package/settings/public-settings.json +13 -4
- package/src/Gulpfile.ts +75 -145
- package/src/dev.ts +4 -3
- package/src/gulp/backend.ts +57 -9
- package/src/gulp/checks.ts +36 -29
- package/src/gulp/clean.ts +17 -7
- package/src/gulp/copy.ts +27 -5
- package/src/gulp/pages.ts +4 -4
- package/src/gulp/pipeline.ts +30 -0
- package/src/gulp/public.ts +16 -8
- package/src/gulp/styles.ts +6 -5
- package/src/gulp/templates.ts +24 -5
- package/src/gulp/test.ts +82 -0
- package/src/gulp/types.ts +9 -12
- package/src/gulp/watchers.ts +175 -0
- package/src/index.ts +59 -68
- package/src/init.ts +28 -62
- package/src/settings.json +4 -1
- package/src/sync.ts +10 -0
- package/src/types.d.ts +2 -1
- package/.eslintrc.json +0 -3
- package/files/jest.config.ts +0 -28
- 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(
|
17
|
-
|
18
|
-
|
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(
|
50
|
-
await editJson(
|
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.
|
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.
|
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.
|
62
|
+
console.log((`💩 ${red.underline.bold("=> There was an error while copying files =>")} ${orange(err)}`));
|
91
63
|
}
|
92
64
|
finally {
|
93
|
-
console.log(
|
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.
|
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(
|
95
|
+
console.log((`💩 ${red.underline.bold("=> Error editing JSON Data =>")} ${orange(err)}`));
|
124
96
|
}
|
125
97
|
finally {
|
126
|
-
console.log(
|
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(
|
114
|
+
console.log((`💩 ${red.underline.bold("=> Durring string replace =>")} ${orange(err)}`));
|
143
115
|
}
|
144
116
|
finally {
|
145
|
-
console.log(
|
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.
|
127
|
+
console.log((`💩 ${red.underline.bold("=> Failed to install packages =>")} ${orange(result.error.message)}`));
|
156
128
|
}
|
157
129
|
else {
|
158
|
-
console.log(
|
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 (
|
169
|
-
console.
|
140
|
+
catch (err) {
|
141
|
+
console.log((`💩 ${red.underline.bold("=> Command failed =>")} ${orange(err)}`));
|
170
142
|
}
|
171
143
|
finally {
|
172
|
-
console.log(
|
144
|
+
console.log("🐕" + blue.underline(` => Cloned ${orange(name)}`));
|
173
145
|
}
|
174
146
|
}
|
175
|
-
console.log(
|
147
|
+
console.log("🐶" + green.underline(' => All Modules cloned!'));
|
176
148
|
}
|
package/dist/settings.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"modules": {
|
3
|
-
"
|
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
package/dist/sync.js
ADDED
package/files/lucy.json
CHANGED
package/files/typedoc.json
CHANGED
@@ -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": "
|
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
|
+
"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.
|
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
|
-
"
|
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
|
-
"
|
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
|
-
"../../../
|
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
|
-
"
|
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": [
|
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
|
-
"
|
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": [
|
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/*": [
|
12
|
-
|
13
|
-
|
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
|
-
"../../../
|
26
|
+
"../../../lucy-lib/__mocks__/**/*",
|
27
|
+
"../../../typescript/backend/**/*",
|
28
|
+
"../../../lucy-lib/backend/**/*"
|
20
29
|
]
|
21
30
|
}
|