lucy-cli 2.0.0-beta.13 → 2.0.0-beta.14
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/package.json +7 -2
- package/.cursorignore +0 -4
- package/.eslintrc.cjs +0 -96
- package/.github/funding.yml +0 -2
- package/.nvmrc +0 -1
- package/.stylelintrc.js +0 -8
- package/.wix/debug.log +0 -10
- package/.yarnrc.yml +0 -2
- package/files/sync-data/data/test.csv +0 -17
- package/files/sync-data/files/lucy.jpg +0 -0
- package/files/sync-data/schema/test.json +0 -11
- package/lucy.jpg +0 -0
- package/mitarbeiter-login.html +0 -188
- package/old/Gulpfile.d.ts +0 -34
- package/old/Gulpfile.js +0 -116
- package/old/Gulpfile.js.map +0 -1
- package/old/Gulpfile.ts +0 -231
- package/old/gulp/backend.d.ts +0 -3
- package/old/gulp/backend.js +0 -92
- package/old/gulp/backend.js.map +0 -1
- package/old/gulp/backend.ts +0 -109
- package/old/gulp/checks.d.ts +0 -3
- package/old/gulp/checks.js +0 -205
- package/old/gulp/checks.js.map +0 -1
- package/old/gulp/checks.ts +0 -228
- package/old/gulp/clean.d.ts +0 -3
- package/old/gulp/clean.js +0 -29
- package/old/gulp/clean.js.map +0 -1
- package/old/gulp/clean.ts +0 -33
- package/old/gulp/copy.d.ts +0 -2
- package/old/gulp/copy.js +0 -34
- package/old/gulp/copy.js.map +0 -1
- package/old/gulp/copy.ts +0 -42
- package/old/gulp/helpers.d.ts +0 -2
- package/old/gulp/helpers.js +0 -25
- package/old/gulp/helpers.js.map +0 -1
- package/old/gulp/helpers.ts +0 -26
- package/old/gulp/pages.d.ts +0 -2
- package/old/gulp/pages.js +0 -37
- package/old/gulp/pages.js.map +0 -1
- package/old/gulp/pages.ts +0 -40
- package/old/gulp/pipeline.d.ts +0 -1
- package/old/gulp/pipeline.js +0 -29
- package/old/gulp/pipeline.js.map +0 -1
- package/old/gulp/pipeline.ts +0 -31
- package/old/gulp/public.d.ts +0 -2
- package/old/gulp/public.js +0 -50
- package/old/gulp/public.js.map +0 -1
- package/old/gulp/public.ts +0 -59
- package/old/gulp/styles.d.ts +0 -2
- package/old/gulp/styles.js +0 -40
- package/old/gulp/styles.js.map +0 -1
- package/old/gulp/styles.ts +0 -46
- package/old/gulp/templates.d.ts +0 -2
- package/old/gulp/templates.js +0 -33
- package/old/gulp/templates.js.map +0 -1
- package/old/gulp/templates.ts +0 -39
- package/old/gulp/types.d.ts +0 -4
- package/old/gulp/types.js +0 -289
- package/old/gulp/types.js.map +0 -1
- package/old/gulp/types.ts +0 -311
- package/old/gulp/watchers.d.ts +0 -9
- package/old/gulp/watchers.js +0 -59
- package/old/gulp/watchers.js.map +0 -1
- package/old/gulp/watchers.ts +0 -105
- package/old/helpers.d.ts +0 -32
- package/old/helpers.js +0 -267
- package/old/helpers.js.map +0 -1
- package/old/helpers.ts +0 -307
- package/old/index.d.ts +0 -59
- package/old/index.js +0 -288
- package/old/index.js.map +0 -1
- package/old/index.ts +0 -379
- package/old/init.d.ts +0 -8
- package/old/init.js +0 -165
- package/old/init.js.map +0 -1
- package/old/init.ts +0 -183
- package/old/models.d.ts +0 -37
- package/old/models.js +0 -2
- package/old/models.js.map +0 -1
- package/old/models.ts +0 -35
- package/old/prepare.d.ts +0 -8
- package/old/prepare.js +0 -20
- package/old/prepare.js.map +0 -1
- package/old/prepare.ts +0 -24
- package/old/schemas/index.d.ts +0 -0
- package/old/schemas/index.js +0 -2
- package/old/schemas/index.js.map +0 -1
- package/old/schemas/index.ts +0 -0
- package/old/schemas/types.d.ts +0 -0
- package/old/schemas/types.js +0 -2
- package/old/schemas/types.js.map +0 -1
- package/old/schemas/types.ts +0 -0
- package/old/settings.json +0 -67
- package/old/sync.d.ts +0 -2
- package/old/sync.js +0 -88
- package/old/sync.js.map +0 -1
- package/old/sync.ts +0 -97
- package/old/types.d.ts +0 -8
- package/pnpm-workspace.yaml +0 -6
- package/settings/backend-settings.json +0 -19
- package/settings/master-settings.json +0 -20
- package/settings/page-settings.json +0 -21
- package/settings/public-settings.json +0 -22
- package/src/args.ts +0 -121
- package/src/commands/checks.ts +0 -51
- package/src/commands/cleanup.ts +0 -11
- package/src/commands/copy.ts +0 -29
- package/src/commands/edit.ts +0 -81
- package/src/commands/exec.ts +0 -73
- package/src/commands/git.ts +0 -152
- package/src/commands/home.ts +0 -20
- package/src/commands/install.ts +0 -269
- package/src/commands/read.ts +0 -45
- package/src/commands/write.ts +0 -45
- package/src/commands.ts +0 -21
- package/src/config.ts +0 -142
- package/src/error.ts +0 -3
- package/src/helpers.ts +0 -93
- package/src/index.ts +0 -113
- package/src/init/blocks.ts +0 -85
- package/src/init/cargo.ts +0 -25
- package/src/init/expo.ts +0 -69
- package/src/init/gitModules.ts +0 -15
- package/src/init/index.ts +0 -86
- package/src/init/monorepo.ts +0 -72
- package/src/init/prepareVelo.ts +0 -19
- package/src/init/tauri.ts +0 -42
- package/src/init/templates.ts +0 -98
- package/src/init/velo.ts +0 -66
- package/src/policy.ts +0 -6
- package/src/prepare.ts +0 -24
- package/src/runtime.ts +0 -21
- package/src/schemas/gulp.ts +0 -31
- package/src/schemas/index.ts +0 -17
- package/src/schemas/lucy.ts +0 -43
- package/src/schemas/tsconfig.ts +0 -35
- package/src/schemas/types.ts +0 -40
- package/src/settings.json +0 -67
- package/src/states.ts +0 -15
- package/src/tasks/Gulpfile.ts +0 -207
- package/src/tasks/gulp/backend.ts +0 -113
- package/src/tasks/gulp/checks.ts +0 -219
- package/src/tasks/gulp/clean.ts +0 -38
- package/src/tasks/gulp/copy.ts +0 -38
- package/src/tasks/gulp/helpers.ts +0 -18
- package/src/tasks/gulp/pages.ts +0 -43
- package/src/tasks/gulp/pipeline.ts +0 -31
- package/src/tasks/gulp/public.ts +0 -61
- package/src/tasks/gulp/styles.ts +0 -47
- package/src/tasks/gulp/templates.ts +0 -53
- package/src/tasks/gulp/types.ts +0 -310
- package/src/tasks/gulp/watchers.ts +0 -97
- package/src/tasks/index.ts +0 -24
- package/src/tasks/syncSettings.ts +0 -21
- package/src/types.d.ts +0 -8
- package/src/utils/index.ts +0 -0
- package/src/utils/logger.ts +0 -40
- package/src/wix-sdk/check.ts +0 -24
- package/src/wix-sdk/client.ts +0 -18
- package/src/wix-sdk/index.ts +0 -17
- package/src/wix-sdk/init.ts +0 -54
- package/src/wix-sdk/run.ts +0 -56
- package/src/wix-sync/client.ts +0 -6
- package/src/wix-sync/export.ts +0 -19
- package/src/wix-sync/import.ts +0 -27
- package/src/wix-sync/index.ts +0 -36
- package/src/wix-sync/init.ts +0 -77
- package/src/wix-sync/is-alive.ts +0 -25
- package/src/wix-sync/migrate.ts +0 -23
- package/src/wix-sync/sync.ts +0 -27
- package/tsconfig.json +0 -34
package/old/init.ts
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { existsSync, mkdirSync, promises as fsPromises } from 'fs';
|
|
3
|
-
import fse from 'fs-extra';
|
|
4
|
-
import { join } from 'path';
|
|
5
|
-
import fs from 'fs/promises';
|
|
6
|
-
import path from 'path';
|
|
7
|
-
import os from 'os';
|
|
8
|
-
import enquirer from 'enquirer';
|
|
9
|
-
import { ModuleSettings, ProjectSettings, blue, green, orange, red } from './index.js';
|
|
10
|
-
import { createTemplateFolder, gitInit, installPackages } from './helpers.js';
|
|
11
|
-
|
|
12
|
-
const { Select } = enquirer as any;
|
|
13
|
-
/**
|
|
14
|
-
* Init Lucy project
|
|
15
|
-
* @param {string} cwd Current working directory
|
|
16
|
-
* @param {string} packageRoot Package root directory
|
|
17
|
-
* @returns {void}
|
|
18
|
-
*/
|
|
19
|
-
export async function init(moduleSettings: ModuleSettings, projectSettings: ProjectSettings) {
|
|
20
|
-
|
|
21
|
-
if(projectSettings.packageJSON && projectSettings.packageJSON.wixLucy?.initialized && !moduleSettings.args.includes('-f')) {
|
|
22
|
-
console.log((`💩 ${red.underline.bold("=> This project is already initialized =>")} ${orange(moduleSettings.targetFolder)}`));
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const templatesPath = join(os.homedir(), '.lucy-cli');
|
|
27
|
-
if (!existsSync(templatesPath)) {
|
|
28
|
-
console.log(chalk.yellow(`Templates folder not found at ${orange(templatesPath)}. Creating it with a default template...`));
|
|
29
|
-
await createTemplateFolder(moduleSettings);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const templateChoices = (await fs.readdir(templatesPath, { withFileTypes: true }))
|
|
33
|
-
.filter(dirent => dirent.isDirectory())
|
|
34
|
-
.map(dirent => dirent.name);
|
|
35
|
-
|
|
36
|
-
if (templateChoices.length === 0) {
|
|
37
|
-
console.log((`💩 ${red.underline.bold("=> No templates found in =>")} ${orange(templatesPath)}`));
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const prompt = new Select({
|
|
42
|
-
name: 'template',
|
|
43
|
-
message: 'Select a project template',
|
|
44
|
-
choices: templateChoices
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const selectedTemplate = await prompt.run();
|
|
48
|
-
const templateDir = join(templatesPath, selectedTemplate);
|
|
49
|
-
const templateFilesDir = join(templateDir, 'files');
|
|
50
|
-
const templateSettingsPath = join(templateDir, 'settings.json');
|
|
51
|
-
|
|
52
|
-
if (!existsSync(templateSettingsPath)) {
|
|
53
|
-
console.log((`💩 ${red.underline.bold("=> Template is missing settings.json at =>")} ${orange(templateSettingsPath)}`));
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
try {
|
|
58
|
-
const templateSettingsRaw = await fs.readFile(templateSettingsPath, 'utf8');
|
|
59
|
-
moduleSettings.settings = JSON.parse(templateSettingsRaw);
|
|
60
|
-
} catch (e) {
|
|
61
|
-
console.log((`💩 ${red.underline.bold("=> Error reading or parsing template settings =>")} ${orange(e)}`));
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
await copyFolder(templateFilesDir, moduleSettings.targetFolder);
|
|
66
|
-
|
|
67
|
-
await editJson(moduleSettings.packageJsonPath, ['type', 'scripts'], ['module', moduleSettings.settings.scripts ]);
|
|
68
|
-
await stringReplace(join(moduleSettings.targetFolder, 'currents.config.js'), ['__ProjectName__'], [path.basename(moduleSettings.targetFolder)]);
|
|
69
|
-
|
|
70
|
-
await installPackages(moduleSettings.settings.wixPackages, moduleSettings.settings.devPackages, moduleSettings.targetFolder, moduleSettings.lockVersion);
|
|
71
|
-
|
|
72
|
-
await editJson(join(moduleSettings.targetFolder, 'jsconfig.json'), ['compilerOptions', 'exclude'], [moduleSettings.settings.wixSettings.compilerOptions, moduleSettings.settings.wixSettings.exclude]);
|
|
73
|
-
await editJson(join(moduleSettings.targetFolder, 'typedoc.json'), ['name'], [path.basename(moduleSettings.targetFolder)]);
|
|
74
|
-
|
|
75
|
-
await gitInit(moduleSettings.targetFolder, moduleSettings.settings.modules, moduleSettings.force);
|
|
76
|
-
|
|
77
|
-
moduleSettings.settings.initialized = true;
|
|
78
|
-
|
|
79
|
-
const eslintrcPath = join(moduleSettings.targetFolder, '.eslintrc.json');
|
|
80
|
-
if(existsSync(eslintrcPath)) {
|
|
81
|
-
console.log((`🐕 ${blue.underline.bold("=> Deleting .eslintrc.json")}`));
|
|
82
|
-
await fs.rm(join(eslintrcPath), { recursive: false }).catch(e => {
|
|
83
|
-
console.log((`💩 ${red.underline.bold("=> Could not delete .eslintrc.json ")} ${red.bold("=> ", e)}`));
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
console.log((`🐕 ${blue.underline.bold("=> Writing settings to lucy.json")}`));
|
|
88
|
-
await fs.writeFile(join(moduleSettings.targetFolder, 'lucy.json'), JSON.stringify(moduleSettings.settings, null, 2));
|
|
89
|
-
|
|
90
|
-
console.log(chalk.greenBright.underline('🐶 => Initialization done!'));
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Copy files from source to target
|
|
95
|
-
* @param {string} source Source folder
|
|
96
|
-
* @param {string} target Target folder
|
|
97
|
-
* @returns {Promise<void>}
|
|
98
|
-
*/
|
|
99
|
-
async function copyFolder(source: string, target: string): Promise<void> {
|
|
100
|
-
if (!existsSync(target)){
|
|
101
|
-
console.log((`💩 ${red.underline.bold("=> Target folder doesn't exist =>")} ${orange(target)}`));
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
try {
|
|
106
|
-
const files = await fsPromises.readdir(source);
|
|
107
|
-
for (const file of files){
|
|
108
|
-
const sourcePath = join(source, file);
|
|
109
|
-
const targetPath = join(target, file);
|
|
110
|
-
|
|
111
|
-
if (file === 'lucy.json' && existsSync(targetPath)){
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
const stats = await fsPromises.stat(sourcePath);
|
|
115
|
-
if (stats.isDirectory()){
|
|
116
|
-
if (!existsSync(file)){
|
|
117
|
-
mkdirSync(file);
|
|
118
|
-
}
|
|
119
|
-
await fse.copySync(sourcePath, targetPath, { overwrite: true });
|
|
120
|
-
} else {
|
|
121
|
-
fse.copySync(sourcePath, targetPath, { overwrite: true });
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
} catch (err){
|
|
125
|
-
console.log((`💩 ${red.underline.bold("=> There was an error while copying files =>")} ${orange(err)}`));
|
|
126
|
-
} finally {
|
|
127
|
-
console.log("🐕" + blue.underline.bold(' => Copy files completed!'));
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Edit Json files
|
|
133
|
-
* @param {string} filePath File path
|
|
134
|
-
* @param {string[]} keys Keys to edit
|
|
135
|
-
* @param {string[]} values Values to edit
|
|
136
|
-
* @returns {void}
|
|
137
|
-
*/
|
|
138
|
-
async function editJson(filePath: string, keys: string[], values: string[] | Object[] ) {
|
|
139
|
-
try {
|
|
140
|
-
const data = await fs.readFile(filePath, 'utf8');
|
|
141
|
-
|
|
142
|
-
let jsonData;
|
|
143
|
-
try {
|
|
144
|
-
jsonData = JSON.parse(data);
|
|
145
|
-
} catch (parseError) {
|
|
146
|
-
console.log((`💩 ${red.underline.bold("=> Error parsing JSON =>")} ${orange(parseError)}`));
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
for (const key of keys){
|
|
151
|
-
const index = keys.indexOf(key);
|
|
152
|
-
const value = values[index];
|
|
153
|
-
jsonData[key] = value;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const updatedJsonData = JSON.stringify(jsonData, null, 2);
|
|
157
|
-
await fs.writeFile(filePath, updatedJsonData, 'utf8');
|
|
158
|
-
} catch (err) {
|
|
159
|
-
console.log((`💩 ${red.underline.bold("=> Error editing JSON Data =>")} ${orange(err)}`));
|
|
160
|
-
} finally {
|
|
161
|
-
console.log("🐕" + blue.underline(` => Updated file ${orange(filePath)}`));
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
async function stringReplace(filePath: string, keys: string[], values: string[]) {
|
|
166
|
-
try {
|
|
167
|
-
let modifiedContent: string = '';
|
|
168
|
-
const data = await fs.readFile(filePath, 'utf8');
|
|
169
|
-
|
|
170
|
-
for (const key of keys){
|
|
171
|
-
const index = keys.indexOf(key);
|
|
172
|
-
const value = values[index];
|
|
173
|
-
const regex = new RegExp(`${key}`, 'g');
|
|
174
|
-
modifiedContent = data.replace(regex, `${value}`);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
await fs.writeFile(filePath, modifiedContent, 'utf8');
|
|
178
|
-
} catch (err) {
|
|
179
|
-
console.log((`💩 ${red.underline.bold("=> During string replace =>")} ${orange(err)}`));
|
|
180
|
-
} finally {
|
|
181
|
-
console.log(blue.underline(`🐕 => Updated file ${orange(filePath)}`));
|
|
182
|
-
}
|
|
183
|
-
}
|
package/old/models.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export type TSConfig = {
|
|
2
|
-
compilerOptions?: {
|
|
3
|
-
target?: string;
|
|
4
|
-
module?: string;
|
|
5
|
-
lib?: string[];
|
|
6
|
-
outDir?: string;
|
|
7
|
-
rootDir?: string;
|
|
8
|
-
strict?: boolean;
|
|
9
|
-
esModuleInterop?: boolean;
|
|
10
|
-
allowJs?: boolean;
|
|
11
|
-
checkJs?: boolean;
|
|
12
|
-
declaration?: boolean;
|
|
13
|
-
declarationMap?: boolean;
|
|
14
|
-
sourceMap?: boolean;
|
|
15
|
-
removeComments?: boolean;
|
|
16
|
-
noImplicitAny?: boolean;
|
|
17
|
-
moduleResolution?: "node" | "classic";
|
|
18
|
-
resolveJsonModule?: boolean;
|
|
19
|
-
skipLibCheck?: boolean;
|
|
20
|
-
types?: string[];
|
|
21
|
-
typeRoots?: string[];
|
|
22
|
-
jsx?: "preserve" | "react" | "react-jsx" | "react-jsxdev" | "react-native";
|
|
23
|
-
incremental?: boolean;
|
|
24
|
-
noEmit?: boolean;
|
|
25
|
-
paths?: Record<string, string[]>;
|
|
26
|
-
[key: string]: any;
|
|
27
|
-
};
|
|
28
|
-
include?: string[];
|
|
29
|
-
exclude?: string[];
|
|
30
|
-
files?: string[];
|
|
31
|
-
extends?: string;
|
|
32
|
-
references?: {
|
|
33
|
-
path: string;
|
|
34
|
-
}[];
|
|
35
|
-
compileOnSave?: boolean;
|
|
36
|
-
[key: string]: any;
|
|
37
|
-
};
|
package/old/models.js
DELETED
package/old/models.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["models.ts"],"names":[],"mappings":""}
|
package/old/models.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export type TSConfig = {
|
|
2
|
-
compilerOptions?: {
|
|
3
|
-
target?: string; // e.g., "ES5", "ES6", "ES2015", "ESNext"
|
|
4
|
-
module?: string; // e.g., "CommonJS", "ES6", "ESNext"
|
|
5
|
-
lib?: string[]; // e.g., ["ES2015", "DOM"]
|
|
6
|
-
outDir?: string;
|
|
7
|
-
rootDir?: string;
|
|
8
|
-
strict?: boolean;
|
|
9
|
-
esModuleInterop?: boolean;
|
|
10
|
-
allowJs?: boolean;
|
|
11
|
-
checkJs?: boolean;
|
|
12
|
-
declaration?: boolean;
|
|
13
|
-
declarationMap?: boolean;
|
|
14
|
-
sourceMap?: boolean;
|
|
15
|
-
removeComments?: boolean;
|
|
16
|
-
noImplicitAny?: boolean;
|
|
17
|
-
moduleResolution?: "node" | "classic";
|
|
18
|
-
resolveJsonModule?: boolean;
|
|
19
|
-
skipLibCheck?: boolean;
|
|
20
|
-
types?: string[]; // e.g., ["node", "jest"]
|
|
21
|
-
typeRoots?: string[]; // e.g., ["./types"]
|
|
22
|
-
jsx?: "preserve" | "react" | "react-jsx" | "react-jsxdev" | "react-native";
|
|
23
|
-
incremental?: boolean;
|
|
24
|
-
noEmit?: boolean;
|
|
25
|
-
paths?: Record<string, string[]>; // Aliases for module paths
|
|
26
|
-
[key: string]: any; // Allow additional compiler options
|
|
27
|
-
};
|
|
28
|
-
include?: string[]; // Glob patterns to include
|
|
29
|
-
exclude?: string[]; // Glob patterns to exclude
|
|
30
|
-
files?: string[]; // Specific files to include
|
|
31
|
-
extends?: string; // Path to a base tsconfig.json
|
|
32
|
-
references?: { path: string }[]; // Project references
|
|
33
|
-
compileOnSave?: boolean;
|
|
34
|
-
[key: string]: any; // Allow additional top-level options
|
|
35
|
-
};
|
package/old/prepare.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ModuleSettings, ProjectSettings } from './index.js';
|
|
2
|
-
/**
|
|
3
|
-
* Init Lucy project
|
|
4
|
-
* @param {string} cwd Current working directory
|
|
5
|
-
* @param {string} packageRoot Package root directory
|
|
6
|
-
* @returns {void}
|
|
7
|
-
*/
|
|
8
|
-
export declare function prepare(moduleSettings: ModuleSettings, projectSettings: ProjectSettings): Promise<void>;
|
package/old/prepare.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { orange, red, magenta } from './index.js';
|
|
3
|
-
import { gitInit, installPackages } from './helpers.js';
|
|
4
|
-
/**
|
|
5
|
-
* Init Lucy project
|
|
6
|
-
* @param {string} cwd Current working directory
|
|
7
|
-
* @param {string} packageRoot Package root directory
|
|
8
|
-
* @returns {void}
|
|
9
|
-
*/
|
|
10
|
-
export async function prepare(moduleSettings, projectSettings) {
|
|
11
|
-
if (!projectSettings.lucySettings?.initialized) {
|
|
12
|
-
console.log((`💩 ${red.underline.bold("=> This project is not initialized =>")} ${orange(moduleSettings.targetFolder)}`));
|
|
13
|
-
console.log("🐕" + magenta.underline(' => Use init to initialize'));
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
await installPackages(projectSettings.lucySettings.wixPackages, projectSettings.lucySettings.devPackages, moduleSettings.targetFolder, moduleSettings.lockVersion);
|
|
17
|
-
await gitInit(moduleSettings.targetFolder, projectSettings?.lucySettings?.modules, moduleSettings.force);
|
|
18
|
-
console.log(chalk.greenBright.underline('🐶 => Prepare done!'));
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=prepare.js.map
|
package/old/prepare.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prepare.js","sourceRoot":"","sources":["prepare.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAgD,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAChG,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAExD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,cAA8B,EAAE,eAAgC;IAE7F,IAAG,CAAC,eAAe,CAAC,YAAY,EAAE,WAAW,EAAE,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,uCAAuC,CAAC,IAAI,MAAM,CAAC,cAAc,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1H,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,4BAA4B,CAAC,CAAC,CAAC;QACpE,OAAO;IACR,CAAC;IAED,MAAM,eAAe,CAAC,eAAe,CAAC,YAAY,CAAC,WAAW,EAAE,eAAe,CAAC,YAAY,CAAC,WAAW,EAAE,cAAc,CAAC,YAAY,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;IAEnK,MAAM,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IAEzG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC,CAAC;AACjE,CAAC"}
|
package/old/prepare.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { ModuleSettings, ProjectSettings, blue, green, orange, red, magenta } from './index.js';
|
|
3
|
-
import { gitInit, installPackages } from './helpers.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Init Lucy project
|
|
7
|
-
* @param {string} cwd Current working directory
|
|
8
|
-
* @param {string} packageRoot Package root directory
|
|
9
|
-
* @returns {void}
|
|
10
|
-
*/
|
|
11
|
-
export async function prepare(moduleSettings: ModuleSettings, projectSettings: ProjectSettings) {
|
|
12
|
-
|
|
13
|
-
if(!projectSettings.lucySettings?.initialized) {
|
|
14
|
-
console.log((`💩 ${red.underline.bold("=> This project is not initialized =>")} ${orange(moduleSettings.targetFolder)}`));
|
|
15
|
-
console.log("🐕" + magenta.underline(' => Use init to initialize'));
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
await installPackages(projectSettings.lucySettings.wixPackages, projectSettings.lucySettings.devPackages, moduleSettings.targetFolder, moduleSettings.lockVersion);
|
|
20
|
-
|
|
21
|
-
await gitInit(moduleSettings.targetFolder, projectSettings?.lucySettings?.modules, moduleSettings.force);
|
|
22
|
-
|
|
23
|
-
console.log(chalk.greenBright.underline('🐶 => Prepare done!'));
|
|
24
|
-
}
|
package/old/schemas/index.d.ts
DELETED
|
File without changes
|
package/old/schemas/index.js
DELETED
package/old/schemas/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":""}
|
package/old/schemas/index.ts
DELETED
|
File without changes
|
package/old/schemas/types.d.ts
DELETED
|
File without changes
|
package/old/schemas/types.js
DELETED
package/old/schemas/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":""}
|
package/old/schemas/types.ts
DELETED
|
File without changes
|
package/old/settings.json
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"modules": {},
|
|
3
|
-
"wixSettings": {
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"composite": true,
|
|
6
|
-
"noEmit": false,
|
|
7
|
-
"lib": [],
|
|
8
|
-
"jsx": "react-jsx"
|
|
9
|
-
},
|
|
10
|
-
"exclude": ["**/*.js"]
|
|
11
|
-
},
|
|
12
|
-
"initialized": false,
|
|
13
|
-
"wixPackages": {},
|
|
14
|
-
"devPackages": {
|
|
15
|
-
"@eslint/js": "^9.30.1",
|
|
16
|
-
"@styled/typescript-styled-plugin": "^1.0.1",
|
|
17
|
-
"@total-typescript/ts-reset": "^0.6.1",
|
|
18
|
-
"@types/node": "^24.0.10",
|
|
19
|
-
"@types/nodemailer": "^6.4.17",
|
|
20
|
-
"@types/react": "^19.1.8",
|
|
21
|
-
"madge": "^8.0.0",
|
|
22
|
-
"@typescript-eslint/eslint-plugin": "^8.35.1",
|
|
23
|
-
"@typescript-eslint/parser": "^8.35.1",
|
|
24
|
-
"@typescript-eslint/utils": "^8.35.1",
|
|
25
|
-
"@vitest/coverage-v8": "^3.2.4",
|
|
26
|
-
"@vitest/ui": "^3.2.4",
|
|
27
|
-
"@wix/cli": "^1.1.101",
|
|
28
|
-
"@wix/eslint-plugin-cli": "^1.0.2",
|
|
29
|
-
"cypress": "^14.5.1",
|
|
30
|
-
"cypress-cloud": "^1.13.1",
|
|
31
|
-
"esbuild": "^0.25.5",
|
|
32
|
-
"eslint": "^9.30.1",
|
|
33
|
-
"eslint-plugin-exception-handling": "^1.5.4",
|
|
34
|
-
"eslint-plugin-import": "^2.32.0",
|
|
35
|
-
"eslint-plugin-jsdoc": "^51.3.3",
|
|
36
|
-
"eslint-plugin-named-import-spacing": "^1.0.3",
|
|
37
|
-
"eslint-plugin-promise": "^7.2.1",
|
|
38
|
-
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
39
|
-
"prettier": "^3.6.2",
|
|
40
|
-
"sass": "^1.89.2",
|
|
41
|
-
"ts-node": "^10.9.2",
|
|
42
|
-
"tsx": "^4.20.3",
|
|
43
|
-
"typedoc": "^0.28.7",
|
|
44
|
-
"typedoc-github-theme": "^0.3.0",
|
|
45
|
-
"typescript": "^5.8.3",
|
|
46
|
-
"typescript-eslint": "^8.35.1",
|
|
47
|
-
"typescript-eslint-language-service": "^5.0.5",
|
|
48
|
-
"vite-tsconfig-paths": "^5.1.4",
|
|
49
|
-
"vitest": "^3.2.4",
|
|
50
|
-
"vitest-tsconfig-paths": "^3.4.1"
|
|
51
|
-
},
|
|
52
|
-
"scripts": {
|
|
53
|
-
"postinstall": "wix sync-types",
|
|
54
|
-
"wix:dev": "wix dev",
|
|
55
|
-
"dev": "lucy-cli dev",
|
|
56
|
-
"lint": "NODE_OPTIONS=\"--max-old-space-size=32768\" eslint .",
|
|
57
|
-
"docs": "typedoc --tsconfig typescript/tsconfig.json --skipErrorChecking",
|
|
58
|
-
"build": "lucy-cli build-prod",
|
|
59
|
-
"fix-wix": "lucy-cli fix-wix",
|
|
60
|
-
"tsc": "tsc -p ./typescript/tsconfig.json --noEmit",
|
|
61
|
-
"test": "vitest --ui --coverage",
|
|
62
|
-
"coverage": "vitest run --coverage",
|
|
63
|
-
"cypress": "cypress open",
|
|
64
|
-
"e2e": "cypress-cloud run --parallel --record",
|
|
65
|
-
"graph": "madge --image graph.svg src"
|
|
66
|
-
}
|
|
67
|
-
}
|
package/old/sync.d.ts
DELETED
package/old/sync.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import { green, orange, red } from "./index.js";
|
|
3
|
-
import readline from 'node:readline';
|
|
4
|
-
import veloAPI from 'velo-sync/dist/velo/velo-api.js';
|
|
5
|
-
import syncTask from 'velo-sync/dist/tasks/sync-task.js';
|
|
6
|
-
import { readConfig, saveConfig } from "./helpers.js";
|
|
7
|
-
import optimist from 'optimist';
|
|
8
|
-
import migrateFileCache from 'velo-sync/dist/tasks/migrate-files-cache-task.js';
|
|
9
|
-
function printUsage() {
|
|
10
|
-
console.log('Usage: ');
|
|
11
|
-
console.log('');
|
|
12
|
-
console.log('Commands:');
|
|
13
|
-
console.log(' init generates a config file for the import / export / sync process');
|
|
14
|
-
console.log(' is-alive tests the config and the connection to the site');
|
|
15
|
-
console.log(' sync runs the sync process');
|
|
16
|
-
console.log(' import runs an import process');
|
|
17
|
-
console.log(' migrate migrate existing nedb cache to sqlite cache (.upload-cache.db => .upload-cache.sqlite.db)');
|
|
18
|
-
}
|
|
19
|
-
function syncOrImportTask(importOnly) {
|
|
20
|
-
let argv = optimist
|
|
21
|
-
.usage(`Usage: $0 ${importOnly ? 'import' : 'sync'} -f <scv filename> -c <collection>`)
|
|
22
|
-
.demand('f')
|
|
23
|
-
.alias('f', 'filename')
|
|
24
|
-
.describe('f', 'csv filename to import')
|
|
25
|
-
.demand('c')
|
|
26
|
-
.describe('c', 'the name of the collection to import into')
|
|
27
|
-
.alias('c', 'collection')
|
|
28
|
-
.demand('s')
|
|
29
|
-
.describe('s', 'schema file describing the fields of the collection')
|
|
30
|
-
.alias('s', 'schema')
|
|
31
|
-
.describe('dry', 'dry-run that does not upload any data or files, and does not remove or update anything on the site')
|
|
32
|
-
.alias('dry', 'dryrun')
|
|
33
|
-
.parse(process.argv.slice(3));
|
|
34
|
-
let filename = argv.filename;
|
|
35
|
-
let collection = argv.collection;
|
|
36
|
-
let schema = argv.schema;
|
|
37
|
-
let dryrun = argv.dryrun;
|
|
38
|
-
//@ts-ignore
|
|
39
|
-
syncTask.default(filename, collection, schema, importOnly, dryrun);
|
|
40
|
-
}
|
|
41
|
-
export async function sync(moduleSettings, projectSettings) {
|
|
42
|
-
if (moduleSettings.args.includes('-h') || moduleSettings.args.includes('help'))
|
|
43
|
-
return printUsage();
|
|
44
|
-
if (moduleSettings.args.includes('init')) {
|
|
45
|
-
const rl = readline.createInterface({
|
|
46
|
-
input: process.stdin,
|
|
47
|
-
output: process.stdout,
|
|
48
|
-
terminal: true
|
|
49
|
-
});
|
|
50
|
-
async function askQuestion(query) {
|
|
51
|
-
return new Promise((resolve) => rl.question(query, (answer) => resolve(answer)));
|
|
52
|
-
}
|
|
53
|
-
console.log(chalk.yellow('hello to velo-sync init'));
|
|
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
|
-
rl.close();
|
|
57
|
-
let config = { siteUrl, secret };
|
|
58
|
-
await saveConfig(config, moduleSettings.veloConfigName);
|
|
59
|
-
return console.log(chalk.green("🐕" + ' => config saved!'));
|
|
60
|
-
}
|
|
61
|
-
if (moduleSettings.args.includes('is-alive')) {
|
|
62
|
-
try {
|
|
63
|
-
let config = await readConfig(moduleSettings.veloConfigName);
|
|
64
|
-
console.log("🐕" + green(` => checking if the API for site ${chalk.greenBright(config.siteUrl)} is alive...`));
|
|
65
|
-
await veloAPI.isAlive(config);
|
|
66
|
-
return console.log(chalk.green("🐕" + ` => API of site ${chalk.greenBright(config.siteUrl)} is working and alive!!!`));
|
|
67
|
-
}
|
|
68
|
-
catch (e) {
|
|
69
|
-
if (e instanceof Error) {
|
|
70
|
-
return console.log((`💩 ${red.underline.bold("=> Failed to check endpoint")} ${orange(e.message)}`));
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (moduleSettings.args.includes('sync')) {
|
|
75
|
-
return syncOrImportTask(false);
|
|
76
|
-
}
|
|
77
|
-
if (moduleSettings.args.includes('import')) {
|
|
78
|
-
return syncOrImportTask(true);
|
|
79
|
-
}
|
|
80
|
-
if (moduleSettings.args.includes('export')) {
|
|
81
|
-
return console.log((`💩 ${red.underline.bold("=> Not implemented")}`));
|
|
82
|
-
}
|
|
83
|
-
if (moduleSettings.args.includes('migrate')) {
|
|
84
|
-
//@ts-ignore
|
|
85
|
-
migrateFileCache.default();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
//# sourceMappingURL=sync.js.map
|
package/old/sync.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sync.js","sourceRoot":"","sources":["sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAQ,KAAK,EAAkB,MAAM,EAAmB,GAAG,EAAE,MAAM,YAAY,CAAC;AACvF,OAAO,QAAQ,MAAM,eAAe,CAAC;AAErC,OAAO,OAAO,MAAM,iCAAiC,CAAC;AACtD,OAAO,QAAQ,MAAM,mCAAmC,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAkB,MAAM,cAAc,CAAC;AACtE,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,gBAAgB,MAAM,kDAAkD,CAAC;AAChF,SAAS,UAAU;IACf,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACxB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACzB,OAAO,CAAC,GAAG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c,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QACzC,YAAY;QACZ,gBAAgB,CAAC,OAAO,EAAE,CAAC;IAC/B,CAAC;AAEL,CAAC"}
|
package/old/sync.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import chalk, { modifierNames } from "chalk";
|
|
2
|
-
import { blue, green, ModuleSettings, orange, ProjectSettings, red } from "./index.js";
|
|
3
|
-
import readline from 'node:readline';
|
|
4
|
-
import {createDataSync, LoggingStatistics, LoggerRejectsReporter} from 'velo-sync';
|
|
5
|
-
import veloAPI from 'velo-sync/dist/velo/velo-api.js';
|
|
6
|
-
import syncTask from 'velo-sync/dist/tasks/sync-task.js';
|
|
7
|
-
import { readConfig, saveConfig, VeloSyncConfig } from "./helpers.js";
|
|
8
|
-
import optimist from 'optimist';
|
|
9
|
-
import migrateFileCache from 'velo-sync/dist/tasks/migrate-files-cache-task.js';
|
|
10
|
-
function printUsage() {
|
|
11
|
-
console.log('Usage: ');
|
|
12
|
-
console.log('');
|
|
13
|
-
console.log('Commands:');
|
|
14
|
-
console.log(' init generates a config file for the import / export / sync process');
|
|
15
|
-
console.log(' is-alive tests the config and the connection to the site');
|
|
16
|
-
console.log(' sync runs the sync process');
|
|
17
|
-
console.log(' import runs an import process');
|
|
18
|
-
console.log(' migrate migrate existing nedb cache to sqlite cache (.upload-cache.db => .upload-cache.sqlite.db)');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function syncOrImportTask(importOnly: boolean) {
|
|
22
|
-
let argv = optimist
|
|
23
|
-
.usage(`Usage: $0 ${importOnly ? 'import' : 'sync'} -f <scv filename> -c <collection>`)
|
|
24
|
-
.demand('f')
|
|
25
|
-
.alias('f', 'filename')
|
|
26
|
-
.describe('f', 'csv filename to import')
|
|
27
|
-
.demand('c')
|
|
28
|
-
.describe('c', 'the name of the collection to import into')
|
|
29
|
-
.alias('c', 'collection')
|
|
30
|
-
.demand('s')
|
|
31
|
-
.describe('s', 'schema file describing the fields of the collection')
|
|
32
|
-
.alias('s', 'schema')
|
|
33
|
-
.describe('dry', 'dry-run that does not upload any data or files, and does not remove or update anything on the site')
|
|
34
|
-
.alias('dry', 'dryrun')
|
|
35
|
-
.parse(process.argv.slice(3));
|
|
36
|
-
let filename = argv.filename;
|
|
37
|
-
let collection = argv.collection;
|
|
38
|
-
let schema = argv.schema;
|
|
39
|
-
let dryrun = argv.dryrun;
|
|
40
|
-
//@ts-ignore
|
|
41
|
-
syncTask.default(filename, collection, schema, importOnly, dryrun);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export async function sync(moduleSettings: ModuleSettings, projectSettings: ProjectSettings) {
|
|
45
|
-
|
|
46
|
-
if(moduleSettings.args.includes('-h') || moduleSettings.args.includes('help')) return printUsage();
|
|
47
|
-
if(moduleSettings.args.includes('init')) {
|
|
48
|
-
const rl = readline.createInterface({
|
|
49
|
-
input: process.stdin,
|
|
50
|
-
output: process.stdout,
|
|
51
|
-
terminal: true
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
async function askQuestion(query: string):Promise<string> {
|
|
55
|
-
return new Promise((resolve) => rl.question(query, (answer) => resolve(answer)));
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
console.log(chalk.yellow('hello to velo-sync init'));
|
|
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
|
-
rl.close();
|
|
62
|
-
let config: VeloSyncConfig = { siteUrl, secret };
|
|
63
|
-
await saveConfig(config, moduleSettings.veloConfigName);
|
|
64
|
-
return console.log(chalk.green("🐕" + ' => config saved!'));
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if(moduleSettings.args.includes('is-alive')) {
|
|
68
|
-
try {
|
|
69
|
-
let config = await readConfig(moduleSettings.veloConfigName);
|
|
70
|
-
console.log("🐕" + green(` => checking if the API for site ${chalk.greenBright(config.siteUrl)} is alive...`));
|
|
71
|
-
await veloAPI.isAlive(config);
|
|
72
|
-
return console.log(chalk.green("🐕" + ` => API of site ${chalk.greenBright(config.siteUrl)} is working and alive!!!`));
|
|
73
|
-
}
|
|
74
|
-
catch (e) {
|
|
75
|
-
if(e instanceof Error) {
|
|
76
|
-
return console.log((`💩 ${red.underline.bold("=> Failed to check endpoint")} ${orange(e.message)}`));
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
if(moduleSettings.args.includes('sync')) {
|
|
81
|
-
return syncOrImportTask(false);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if(moduleSettings.args.includes('import')) {
|
|
85
|
-
return syncOrImportTask(true);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if(moduleSettings.args.includes('export')) {
|
|
89
|
-
return console.log((`💩 ${red.underline.bold("=> Not implemented")}`));
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if(moduleSettings.args.includes('migrate')) {
|
|
93
|
-
//@ts-ignore
|
|
94
|
-
migrateFileCache.default();
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
}
|
package/old/types.d.ts
DELETED
package/pnpm-workspace.yaml
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"composite": false,
|
|
4
|
-
"noEmit": true,
|
|
5
|
-
"experimentalDecorators": true,
|
|
6
|
-
"noUncheckedIndexedAccess": true,
|
|
7
|
-
"jsx": "react-jsx",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"strictNullChecks": true,
|
|
10
|
-
"paths": {
|
|
11
|
-
"public/*": [],
|
|
12
|
-
"mocks": [],
|
|
13
|
-
"backend/*": [],
|
|
14
|
-
"wix-types/*": ["../wix-code-types/dist/types/*"],
|
|
15
|
-
"types/*": []
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"include": []
|
|
19
|
-
}
|