lucy-cli 1.0.5 β 1.0.7
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 +9 -0
- package/dist/gulp/types.js +26 -2
- package/dist/sync.js +4 -4
- package/files/eslint.config.mjs +19 -7
- package/files/typescript/tsconfig.json +5 -8
- package/package.json +1 -1
- package/settings/backend-settings.json +2 -0
- package/settings/master-settings.json +2 -1
- package/settings/page-settings.json +2 -1
- package/settings/public-settings.json +2 -0
- package/src/gulp/types.ts +26 -2
- package/src/sync.ts +4 -4
package/README.md
CHANGED
@@ -15,6 +15,15 @@ Libraries are expected to have the same folder structure as the main typescript
|
|
15
15
|
(backend, public, styles)
|
16
16
|
The lucy CLI is opinionated and may not work with all projects.
|
17
17
|
|
18
|
+
Importing backend endpoint into the frontend
|
19
|
+
Please be aware that the backend endpoint should be imported with the following code:
|
20
|
+
|
21
|
+
``` javascript
|
22
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
23
|
+
//@ts-ignore
|
24
|
+
import { initialize, InitResponse } from 'backend/lib/initialize.web';
|
25
|
+
```
|
26
|
+
|
18
27
|
## What It Does
|
19
28
|
|
20
29
|
Lucy-CLI is designed to streamline the setup and management of TypeScript within Wix Velo projects, providing tools to enhance code quality and reduce development time. Hereβs what it offers:
|
package/dist/gulp/types.js
CHANGED
@@ -26,13 +26,19 @@ export function updateWixTypes(options) {
|
|
26
26
|
publicSettings.include = [
|
27
27
|
"../../../typescript/public/**/*",
|
28
28
|
"../../../typescript/__mocks__/**/*",
|
29
|
+
// "../../../typescript/backend/**/*.jsw.ts",
|
30
|
+
// "../../../typescript/backend/**/*.web.ts",
|
31
|
+
// "../../../typescript/backend/**/*.web"
|
29
32
|
];
|
30
33
|
// Add module to backendSettings
|
31
34
|
backendSettings.compilerOptions.paths.mocks = ["../../../typescript/__mocks__/*"];
|
32
35
|
backendSettings.compilerOptions.paths['types/*'] = [`../../../typescript/types/*`];
|
33
36
|
backendSettings.include = [
|
34
37
|
"../../../typescript/backend/**/*",
|
35
|
-
"../../../typescript/__mocks__/**/*"
|
38
|
+
"../../../typescript/__mocks__/**/*",
|
39
|
+
// "../../../typescript/backend/**/*.jsw.ts",
|
40
|
+
// "../../../typescript/backend/**/*.web.ts",
|
41
|
+
// "../../../typescript/backend/**/*.web"
|
36
42
|
];
|
37
43
|
// Add module to masterSettings
|
38
44
|
masterSettings.compilerOptions.paths['backend/*.web'] = ["../../../typescript/backend/*.web.ts"];
|
@@ -42,6 +48,9 @@ export function updateWixTypes(options) {
|
|
42
48
|
masterSettings.include = [
|
43
49
|
"../../../typescript/public/**/*",
|
44
50
|
"../../../typescript/__mocks__/**/*",
|
51
|
+
// "../../../typescript/backend/**/*.jsw.ts",
|
52
|
+
// "../../../typescript/backend/**/*.web.ts",
|
53
|
+
// "../../../typescript/backend/**/*.web"
|
45
54
|
];
|
46
55
|
// Add module to pageSettings
|
47
56
|
pageSettings.compilerOptions.paths['backend/*.web'] = ["../../../typescript/backend/*.web.ts"];
|
@@ -52,6 +61,9 @@ export function updateWixTypes(options) {
|
|
52
61
|
pageSettings.include = [
|
53
62
|
"../../../typescript/public/**/*",
|
54
63
|
"../../../typescript/__mocks__/**/*",
|
64
|
+
// "../../../typescript/backend/**/*.jsw.ts",
|
65
|
+
// "../../../typescript/backend/**/*.web.ts",
|
66
|
+
// "../../../typescript/backend/**/*.web"
|
55
67
|
];
|
56
68
|
if (modules) {
|
57
69
|
for (const [name] of Object.entries(modules)) {
|
@@ -65,6 +77,9 @@ export function updateWixTypes(options) {
|
|
65
77
|
publicSettings.include.push(...[
|
66
78
|
`../../../${name}/public/**/*`,
|
67
79
|
`../../../${name}__mocks__/**/*`,
|
80
|
+
// `../../../${name}/backend/**/*.jsw.ts`,
|
81
|
+
// `../../../${name}/backend/**/*.web.ts`,
|
82
|
+
// `../../../${name}/backend/**/*.web`
|
68
83
|
]);
|
69
84
|
// Add module to backendSettings
|
70
85
|
backendSettings.compilerOptions.paths['public/*'].push(`../../../${name}/public/*`);
|
@@ -74,7 +89,10 @@ export function updateWixTypes(options) {
|
|
74
89
|
backendSettings.include.push(...[
|
75
90
|
`../../../${name}/public/**/*`,
|
76
91
|
`../../../${name}__mocks__/**/*`,
|
77
|
-
`../../../${name}/backend
|
92
|
+
`../../../${name}/backend/**/*`,
|
93
|
+
// `../../../${name}/backend/**/*.jsw.ts`,
|
94
|
+
// `../../../${name}/backend/**/*.web.ts`,
|
95
|
+
// `../../../${name}/backend/**/*.web`
|
78
96
|
]);
|
79
97
|
// Add module to masterSettings
|
80
98
|
masterSettings.compilerOptions.paths['backend/*.web.js'].push(`../../../${name}/backend/*.web.ts`);
|
@@ -85,6 +103,9 @@ export function updateWixTypes(options) {
|
|
85
103
|
masterSettings.include.push(...[
|
86
104
|
`../../../${name}/public/**/*`,
|
87
105
|
`../../../${name}__mocks__/**/*`,
|
106
|
+
// `../../../${name}/backend/**/*.jsw.ts`,
|
107
|
+
// `../../../${name}/backend/**/*.web.ts`,
|
108
|
+
// `../../../${name}/backend/**/*.web`
|
88
109
|
]);
|
89
110
|
// Add module to pageSettings
|
90
111
|
pageSettings.compilerOptions.paths['backend/*.web.js'].push(`../../../${name}/backend/*.web.ts`);
|
@@ -95,6 +116,9 @@ export function updateWixTypes(options) {
|
|
95
116
|
pageSettings.include.push(...[
|
96
117
|
`../../../${name}/public/**/*`,
|
97
118
|
`../../../${name}__mocks__/**/*`,
|
119
|
+
// `../../../${name}/backend/**/*.jsw.ts`,
|
120
|
+
// `../../../${name}/backend/**/*.web.ts`,
|
121
|
+
// `../../../${name}/backend/**/*.web`
|
98
122
|
]);
|
99
123
|
}
|
100
124
|
}
|
package/dist/sync.js
CHANGED
@@ -51,19 +51,19 @@ export async function sync(moduleSettings, projectSettings) {
|
|
51
51
|
return new Promise((resolve) => rl.question(query, (answer) => resolve(answer)));
|
52
52
|
}
|
53
53
|
console.log(chalk.yellow('hello to velo-sync init'));
|
54
|
-
let siteUrl = await askQuestion('what is the url of the site homepage? ');
|
55
|
-
let secret = await askQuestion('what is the velo-sync secret? ');
|
54
|
+
let siteUrl = await askQuestion(orange('what is the url of the site homepage? '));
|
55
|
+
let secret = await askQuestion(orange('what is the velo-sync secret? '));
|
56
56
|
rl.close();
|
57
57
|
let config = { siteUrl, secret };
|
58
58
|
await saveConfig(config, moduleSettings.veloConfigName);
|
59
|
-
return console.log(chalk.green("π" + 'config saved!'));
|
59
|
+
return console.log(chalk.green("π" + ' => config saved!'));
|
60
60
|
}
|
61
61
|
if (moduleSettings.args.includes('is-alive')) {
|
62
62
|
try {
|
63
63
|
let config = await readConfig(moduleSettings.veloConfigName);
|
64
64
|
console.log("π" + green(` => checking if the API for site ${chalk.greenBright(config.siteUrl)} is alive...`));
|
65
65
|
await veloAPI.isAlive(config);
|
66
|
-
return console.log(chalk.green("π" + `API of site ${chalk.greenBright(config.siteUrl)} is working and alive!!!`));
|
66
|
+
return console.log(chalk.green("π" + ` => API of site ${chalk.greenBright(config.siteUrl)} is working and alive!!!`));
|
67
67
|
}
|
68
68
|
catch (e) {
|
69
69
|
if (e instanceof Error) {
|
package/files/eslint.config.mjs
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
2
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
3
1
|
import eslint from '@eslint/js';
|
4
2
|
import importPlugin from 'eslint-plugin-import';
|
5
3
|
import jsdoc from 'eslint-plugin-jsdoc';
|
@@ -9,7 +7,6 @@ import globals from 'globals';
|
|
9
7
|
import tseslint from 'typescript-eslint';
|
10
8
|
|
11
9
|
export default tseslint.config(
|
12
|
-
|
13
10
|
eslint.configs.recommended,
|
14
11
|
tseslint.configs.recommendedTypeChecked,
|
15
12
|
jsdoc.configs['flat/recommended-typescript'],
|
@@ -24,7 +21,12 @@ export default tseslint.config(
|
|
24
21
|
},
|
25
22
|
settings: {
|
26
23
|
'import/resolver': {
|
27
|
-
typescript: {
|
24
|
+
typescript: {
|
25
|
+
project: [
|
26
|
+
'typescript/tsconfig.json',
|
27
|
+
'lib/tsconfig.json'
|
28
|
+
],
|
29
|
+
}
|
28
30
|
}
|
29
31
|
},
|
30
32
|
languageOptions: {
|
@@ -45,7 +47,7 @@ export default tseslint.config(
|
|
45
47
|
'no-restricted-imports': [
|
46
48
|
'error',
|
47
49
|
{
|
48
|
-
'patterns': ['
|
50
|
+
'patterns': ['*/**/backend/*', '*/**/public/*']
|
49
51
|
}
|
50
52
|
],
|
51
53
|
'no-restricted-syntax': [
|
@@ -56,9 +58,9 @@ export default tseslint.config(
|
|
56
58
|
},
|
57
59
|
],
|
58
60
|
'@typescript-eslint/no-unsafe-argument': 'error',
|
59
|
-
'@typescript-eslint/no-unsafe-assignment': '
|
61
|
+
'@typescript-eslint/no-unsafe-assignment': 'off',
|
60
62
|
'@typescript-eslint/no-unsafe-call': 'error',
|
61
|
-
'@typescript-eslint/no-unsafe-member-access': '
|
63
|
+
'@typescript-eslint/no-unsafe-member-access': 'off',
|
62
64
|
'@typescript-eslint/no-unsafe-return': 'error',
|
63
65
|
quotes: [2, 'single', { avoidEscape: true, allowTemplateLiterals: true }],
|
64
66
|
curly: ['error', 'multi-line'],
|
@@ -100,6 +102,16 @@ export default tseslint.config(
|
|
100
102
|
format: ['camelCase'],
|
101
103
|
leadingUnderscore: 'allow',
|
102
104
|
},
|
105
|
+
{
|
106
|
+
selector: ['objectLiteralMethod',],
|
107
|
+
format: ['camelCase', 'PascalCase'],
|
108
|
+
leadingUnderscore: 'allow',
|
109
|
+
},
|
110
|
+
{
|
111
|
+
selector: ['import',],
|
112
|
+
format: ['camelCase', 'PascalCase'],
|
113
|
+
leadingUnderscore: 'allow',
|
114
|
+
},
|
103
115
|
{
|
104
116
|
selector: ['objectLiteralProperty'],
|
105
117
|
format: null,
|
@@ -5,27 +5,24 @@
|
|
5
5
|
"compilerOptions": {
|
6
6
|
"outDir": "../src",
|
7
7
|
"rootDir": ".",
|
8
|
-
"baseUrl": "./",
|
9
8
|
"target": "ES2020",
|
10
9
|
"module": "ES2020",
|
11
10
|
"moduleResolution": "Node",
|
12
11
|
"preserveConstEnums": true,
|
13
12
|
"allowSyntheticDefaultImports": true,
|
14
|
-
"skipLibCheck":
|
15
|
-
"
|
16
|
-
"declaration": true,
|
17
|
-
"jsx": "react",
|
13
|
+
"skipLibCheck": true,
|
14
|
+
"declaration": false,
|
18
15
|
"strict": true,
|
19
|
-
"alwaysStrict": false,
|
16
|
+
"alwaysStrict": false,
|
20
17
|
"noImplicitAny": true,
|
21
18
|
"noImplicitReturns": true,
|
22
19
|
"noImplicitThis": true,
|
23
20
|
"strictNullChecks": true,
|
24
|
-
"exactOptionalPropertyTypes": true,
|
25
21
|
"strictBindCallApply": true,
|
26
22
|
"strictFunctionTypes": true,
|
27
23
|
"strictPropertyInitialization": true,
|
28
|
-
"
|
24
|
+
"exactOptionalPropertyTypes": true,
|
25
|
+
"noEmit": true,
|
29
26
|
"plugins": [
|
30
27
|
{
|
31
28
|
"name": "@styled/typescript-styled-plugin"
|
package/package.json
CHANGED
package/src/gulp/types.ts
CHANGED
@@ -32,6 +32,9 @@ export function updateWixTypes(options: TaskOptions) {
|
|
32
32
|
publicSettings.include = [
|
33
33
|
"../../../typescript/public/**/*",
|
34
34
|
"../../../typescript/__mocks__/**/*",
|
35
|
+
// "../../../typescript/backend/**/*.jsw.ts",
|
36
|
+
// "../../../typescript/backend/**/*.web.ts",
|
37
|
+
// "../../../typescript/backend/**/*.web"
|
35
38
|
] as never;
|
36
39
|
|
37
40
|
// Add module to backendSettings
|
@@ -39,7 +42,10 @@ export function updateWixTypes(options: TaskOptions) {
|
|
39
42
|
backendSettings.compilerOptions.paths['types/*'] = [ `../../../typescript/types/*` ] as never;
|
40
43
|
backendSettings.include = [
|
41
44
|
"../../../typescript/backend/**/*",
|
42
|
-
"../../../typescript/__mocks__/**/*"
|
45
|
+
"../../../typescript/__mocks__/**/*",
|
46
|
+
// "../../../typescript/backend/**/*.jsw.ts",
|
47
|
+
// "../../../typescript/backend/**/*.web.ts",
|
48
|
+
// "../../../typescript/backend/**/*.web"
|
43
49
|
] as never;
|
44
50
|
// Add module to masterSettings
|
45
51
|
masterSettings.compilerOptions.paths['backend/*.web'] = [ "../../../typescript/backend/*.web.ts" ] as never;
|
@@ -49,6 +55,9 @@ export function updateWixTypes(options: TaskOptions) {
|
|
49
55
|
masterSettings.include = [
|
50
56
|
"../../../typescript/public/**/*",
|
51
57
|
"../../../typescript/__mocks__/**/*",
|
58
|
+
// "../../../typescript/backend/**/*.jsw.ts",
|
59
|
+
// "../../../typescript/backend/**/*.web.ts",
|
60
|
+
// "../../../typescript/backend/**/*.web"
|
52
61
|
] as never;
|
53
62
|
// Add module to pageSettings
|
54
63
|
pageSettings.compilerOptions.paths['backend/*.web'] = [ "../../../typescript/backend/*.web.ts" ] as never;
|
@@ -59,6 +68,9 @@ export function updateWixTypes(options: TaskOptions) {
|
|
59
68
|
pageSettings.include = [
|
60
69
|
"../../../typescript/public/**/*",
|
61
70
|
"../../../typescript/__mocks__/**/*",
|
71
|
+
// "../../../typescript/backend/**/*.jsw.ts",
|
72
|
+
// "../../../typescript/backend/**/*.web.ts",
|
73
|
+
// "../../../typescript/backend/**/*.web"
|
62
74
|
] as never;
|
63
75
|
|
64
76
|
if (modules) {
|
@@ -73,6 +85,9 @@ export function updateWixTypes(options: TaskOptions) {
|
|
73
85
|
publicSettings.include.push(...[
|
74
86
|
`../../../${name}/public/**/*`,
|
75
87
|
`../../../${name}__mocks__/**/*`,
|
88
|
+
// `../../../${name}/backend/**/*.jsw.ts`,
|
89
|
+
// `../../../${name}/backend/**/*.web.ts`,
|
90
|
+
// `../../../${name}/backend/**/*.web`
|
76
91
|
] as never[]);
|
77
92
|
// Add module to backendSettings
|
78
93
|
backendSettings.compilerOptions.paths['public/*'].push(`../../../${name}/public/*` as never);
|
@@ -82,7 +97,10 @@ export function updateWixTypes(options: TaskOptions) {
|
|
82
97
|
backendSettings.include.push(...[
|
83
98
|
`../../../${name}/public/**/*`,
|
84
99
|
`../../../${name}__mocks__/**/*`,
|
85
|
-
`../../../${name}/backend
|
100
|
+
`../../../${name}/backend/**/*`,
|
101
|
+
// `../../../${name}/backend/**/*.jsw.ts`,
|
102
|
+
// `../../../${name}/backend/**/*.web.ts`,
|
103
|
+
// `../../../${name}/backend/**/*.web`
|
86
104
|
] as never[]);
|
87
105
|
// Add module to masterSettings
|
88
106
|
masterSettings.compilerOptions.paths['backend/*.web.js'].push(`../../../${name}/backend/*.web.ts` as never);
|
@@ -93,6 +111,9 @@ export function updateWixTypes(options: TaskOptions) {
|
|
93
111
|
masterSettings.include.push(...[
|
94
112
|
`../../../${name}/public/**/*`,
|
95
113
|
`../../../${name}__mocks__/**/*`,
|
114
|
+
// `../../../${name}/backend/**/*.jsw.ts`,
|
115
|
+
// `../../../${name}/backend/**/*.web.ts`,
|
116
|
+
// `../../../${name}/backend/**/*.web`
|
96
117
|
] as never[]);
|
97
118
|
// Add module to pageSettings
|
98
119
|
pageSettings.compilerOptions.paths['backend/*.web.js'].push(`../../../${name}/backend/*.web.ts` as never);
|
@@ -103,6 +124,9 @@ export function updateWixTypes(options: TaskOptions) {
|
|
103
124
|
pageSettings.include.push(...[
|
104
125
|
`../../../${name}/public/**/*`,
|
105
126
|
`../../../${name}__mocks__/**/*`,
|
127
|
+
// `../../../${name}/backend/**/*.jsw.ts`,
|
128
|
+
// `../../../${name}/backend/**/*.web.ts`,
|
129
|
+
// `../../../${name}/backend/**/*.web`
|
106
130
|
] as never[]);
|
107
131
|
}
|
108
132
|
}
|
package/src/sync.ts
CHANGED
@@ -56,12 +56,12 @@ export async function sync(moduleSettings: ModuleSettings, projectSettings: Proj
|
|
56
56
|
}
|
57
57
|
|
58
58
|
console.log(chalk.yellow('hello to velo-sync init'));
|
59
|
-
let siteUrl = await askQuestion('what is the url of the site homepage? ');
|
60
|
-
let secret = await askQuestion('what is the velo-sync secret? ');
|
59
|
+
let siteUrl = await askQuestion(orange('what is the url of the site homepage? '));
|
60
|
+
let secret = await askQuestion(orange('what is the velo-sync secret? '));
|
61
61
|
rl.close();
|
62
62
|
let config: VeloSyncConfig = { siteUrl, secret };
|
63
63
|
await saveConfig(config, moduleSettings.veloConfigName);
|
64
|
-
return console.log(chalk.green("π" + 'config saved!'));
|
64
|
+
return console.log(chalk.green("π" + ' => config saved!'));
|
65
65
|
}
|
66
66
|
|
67
67
|
if(moduleSettings.args.includes('is-alive')) {
|
@@ -69,7 +69,7 @@ export async function sync(moduleSettings: ModuleSettings, projectSettings: Proj
|
|
69
69
|
let config = await readConfig(moduleSettings.veloConfigName);
|
70
70
|
console.log("π" + green(` => checking if the API for site ${chalk.greenBright(config.siteUrl)} is alive...`));
|
71
71
|
await veloAPI.isAlive(config);
|
72
|
-
return console.log(chalk.green("π" + `API of site ${chalk.greenBright(config.siteUrl)} is working and alive!!!`));
|
72
|
+
return console.log(chalk.green("π" + ` => API of site ${chalk.greenBright(config.siteUrl)} is working and alive!!!`));
|
73
73
|
}
|
74
74
|
catch (e) {
|
75
75
|
if(e instanceof Error) {
|