lucy-cli 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/.drone/.drone.yml +156 -0
- package/.drone/mail_prod_build.hbs +319 -0
- package/.drone/mail_prod_deploy.hbs +309 -0
- package/.drone/mail_satges.hbs +309 -0
- package/.drone/telegram_prod_build.tpl +23 -0
- package/.drone/telegram_prod_deploy.tpl +20 -0
- package/.drone/telegram_stages.tpl +20 -0
- package/.eslintrc.cjs +96 -0
- package/.eslintrc.json +3 -0
- package/.nvmrc +1 -0
- package/.yarnrc.yml +5 -0
- package/README.md +1 -0
- package/dist/Gulpfile.d.ts +28 -0
- package/dist/Gulpfile.js +179 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +44 -0
- package/dist/dev.d.ts +1 -0
- package/dist/dev.js +14 -0
- package/dist/gulp/backend copy.d.ts +4 -0
- package/dist/gulp/backend copy.js +50 -0
- package/dist/gulp/backend.d.ts +4 -0
- package/dist/gulp/backend.js +49 -0
- package/dist/gulp/checks.d.ts +3 -0
- package/dist/gulp/checks.js +119 -0
- package/dist/gulp/clean copy.d.ts +2 -0
- package/dist/gulp/clean copy.js +19 -0
- package/dist/gulp/clean.d.ts +1 -0
- package/dist/gulp/clean.js +14 -0
- package/dist/gulp/copy.d.ts +3 -0
- package/dist/gulp/copy.js +22 -0
- package/dist/gulp/pages copy.d.ts +3 -0
- package/dist/gulp/pages copy.js +22 -0
- package/dist/gulp/pages.d.ts +3 -0
- package/dist/gulp/pages.js +22 -0
- package/dist/gulp/public.d.ts +4 -0
- package/dist/gulp/public.js +50 -0
- package/dist/gulp/styles.d.ts +3 -0
- package/dist/gulp/styles.js +17 -0
- package/dist/gulp/templates.d.ts +1 -0
- package/dist/gulp/templates.js +21 -0
- package/dist/gulp/types.d.ts +5 -0
- package/dist/gulp/types.js +73 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +88 -0
- package/dist/init.d.ts +7 -0
- package/dist/init.js +176 -0
- package/dist/settings.json +91 -0
- package/files/.drone/.drone.yml +156 -0
- package/files/.drone/mail_prod_build.hbs +319 -0
- package/files/.drone/mail_prod_deploy.hbs +309 -0
- package/files/.drone/mail_satges.hbs +309 -0
- package/files/.drone/telegram_prod_build.tpl +23 -0
- package/files/.drone/telegram_prod_deploy.tpl +20 -0
- package/files/.drone/telegram_stages.tpl +20 -0
- package/files/.eslintrc.cjs +96 -0
- package/files/.eslintrc.json +3 -0
- package/files/.nvmrc +1 -0
- package/files/.yarnrc.yml +5 -0
- package/files/currents.config.js +5 -0
- package/files/cypress.config.ts +12 -0
- package/files/docs.tsconfig.json +37 -0
- package/files/jest.config.ts +28 -0
- package/files/lucy.json +5 -0
- package/files/tsconfig.json +51 -0
- package/files/typedoc.json +19 -0
- package/files/typescript/.eslintrc.json +35 -0
- package/files/typescript/__mocks__/.gitkeep +0 -0
- package/files/typescript/backend/index.ts +0 -0
- package/files/typescript/backend/permissions.json +0 -0
- package/files/typescript/pages/.gitkeep +0 -0
- package/files/typescript/public/index.ts +0 -0
- package/files/typescript/styles/.gitkeep +0 -0
- package/files/typescript/styles/global.scss +0 -0
- package/files/typescript/tsconfig.json +45 -0
- package/files/typescript/types/.gitkeep +0 -0
- package/package.json +83 -0
- package/settings/backend-settings.json +19 -0
- package/settings/master-settings.json +17 -0
- package/settings/page-settings.json +18 -0
- package/settings/public-settings.json +21 -0
- package/src/Gulpfile.ts +271 -0
- package/src/dev.ts +20 -0
- package/src/gulp/backend.ts +52 -0
- package/src/gulp/checks.ts +127 -0
- package/src/gulp/clean.ts +21 -0
- package/src/gulp/copy.ts +26 -0
- package/src/gulp/pages.ts +25 -0
- package/src/gulp/public.ts +56 -0
- package/src/gulp/styles.ts +20 -0
- package/src/gulp/templates.ts +25 -0
- package/src/gulp/types.ts +87 -0
- package/src/index.ts +132 -0
- package/src/init.ts +191 -0
- package/src/settings.json +91 -0
- package/src/types.d.ts +5 -0
- package/tsconfig.json +34 -0
@@ -0,0 +1,87 @@
|
|
1
|
+
import chalk from 'chalk';
|
2
|
+
import gulp from 'gulp';
|
3
|
+
import { createGulpEsbuild } from 'gulp-esbuild';
|
4
|
+
import rename from 'gulp-rename';
|
5
|
+
import * as path from 'path';
|
6
|
+
import { File, TaskOptions } from '../Gulpfile';
|
7
|
+
import clean from 'gulp-clean';
|
8
|
+
import replace from 'gulp-string-replace';
|
9
|
+
import foreach from 'gulp-foreach';
|
10
|
+
import jeditor from 'gulp-json-editor';
|
11
|
+
import merge from 'merge-stream';
|
12
|
+
import * as insert from 'gulp-insert';
|
13
|
+
|
14
|
+
export function updateWixTypes(options: TaskOptions) {
|
15
|
+
const { publicSettings, backendSettings, masterSettings, pageSettings, replaceOpions } = options;
|
16
|
+
let count = 0;
|
17
|
+
return () => {
|
18
|
+
return gulp.src(['./.wix/types/*/*.json', '!./.wix/types/wix-code-types/*.json'])
|
19
|
+
.pipe(foreach(function(stream: NodeJS.ReadableStream, file: File) {
|
20
|
+
count ++;
|
21
|
+
if (file.dirname.endsWith('public')) return stream.pipe(jeditor(publicSettings));
|
22
|
+
if (file.dirname.endsWith('backend')) return stream.pipe(jeditor(backendSettings));
|
23
|
+
if (file.dirname.endsWith('masterPage')) return stream.pipe(jeditor(masterSettings));
|
24
|
+
|
25
|
+
return stream.pipe(jeditor(pageSettings));
|
26
|
+
}))
|
27
|
+
.pipe(replace('masterPage.masterPage.js', 'masterPage.ts', replaceOpions))
|
28
|
+
.pipe(replace('/src/', '/typescript/', replaceOpions))
|
29
|
+
.pipe(replace('.js"', '.ts"', replaceOpions))
|
30
|
+
// .pipe(tap(function(file) { // tap into the stream to log the output
|
31
|
+
// console.log(file.contents?.toString() ?? 'no content');
|
32
|
+
// }))
|
33
|
+
.pipe(gulp.dest((file: File) => {
|
34
|
+
const filePath = file.dirname;
|
35
|
+
const outputDir = path.dirname(filePath);
|
36
|
+
|
37
|
+
return path.join(outputDir);
|
38
|
+
}))
|
39
|
+
.on('error', function () {
|
40
|
+
console.log(chalk.red.underline.bold('Modification of WIX configs failed!'));
|
41
|
+
this.emit('end');
|
42
|
+
})
|
43
|
+
.on('end', function() { console.log(chalk.blueBright.underline(`Modification of ${count} WIX configs succeeded!`)); });
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
|
48
|
+
export function addTypes(options: TaskOptions, done: gulp.TaskFunctionCallback): NodeJS.ReadWriteStream {
|
49
|
+
const { replaceOpions, cwd } = options;
|
50
|
+
console.log('CWD', cwd);
|
51
|
+
const processPages = gulp.src(['./.wix/types/wix-code-types/dist/types/page/$w.d.ts'])
|
52
|
+
.pipe(replace('declare namespace \\$w {', ' declare namespace $w{\nconst api: $w.Api;\n', replaceOpions))
|
53
|
+
.pipe(gulp.dest('./.wix/types/wix-code-types/dist/types/page/'));
|
54
|
+
|
55
|
+
const exportTypes = gulp.src(['./.wix/types/wix-code-types/dist/types/common/*.d.ts', '!./.wix/types/wix-code-types/dist/types/common/$w.d.ts'])
|
56
|
+
.pipe(replace('interface ', 'export interface ', replaceOpions))
|
57
|
+
.pipe(replace('enum ', 'export enum ', replaceOpions))
|
58
|
+
.pipe(replace('type ', 'export type ', replaceOpions))
|
59
|
+
.pipe(gulp.dest('./.wix/types/wix-code-types/dist/types/common/'));
|
60
|
+
|
61
|
+
const exportTypesBeta = gulp.src(['./.wix/types/wix-code-types/dist/types/beta/common/*.d.ts', '!./.wix/types/wix-code-types/dist/types/beta/common/$w.d.ts'])
|
62
|
+
.pipe(replace('interface ', 'export interface ', replaceOpions))
|
63
|
+
.pipe(replace('enum ', 'export enum ', replaceOpions))
|
64
|
+
.pipe(replace('type ', 'export type ', replaceOpions))
|
65
|
+
.pipe(gulp.dest('./.wix/types/wix-code-types/dist/types/beta/common/'));
|
66
|
+
|
67
|
+
const processCommon = gulp.src(['./.wix/types/wix-code-types/dist/types/common/$w.d.ts'])
|
68
|
+
.pipe(insert.prepend("import { FrontendAPISchema } from '../../../../../../typescript/public/models/common/frontendApi.model';\nimport '@total-typescript/ts-reset';\n"))
|
69
|
+
.pipe(replace('namespace \\$w {', 'declare namespace $w{\ntype Api = FrontendAPISchema;\n', replaceOpions))
|
70
|
+
.pipe(gulp.dest('./.wix/types/wix-code-types/dist/types/common/'));
|
71
|
+
|
72
|
+
return merge(
|
73
|
+
processPages,
|
74
|
+
processCommon,
|
75
|
+
exportTypesBeta,
|
76
|
+
exportTypes,
|
77
|
+
)
|
78
|
+
.on('error', function() {
|
79
|
+
console.log(chalk.red.underline.bold('Add of new Types (store & Global) failed!'));
|
80
|
+
this.emit('end');
|
81
|
+
done();
|
82
|
+
})
|
83
|
+
.on('end', function() {
|
84
|
+
console.log(chalk.blueBright.underline('Add of new Types (store & Global) succeeded!'));
|
85
|
+
done();
|
86
|
+
});
|
87
|
+
};
|
package/src/index.ts
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
import { dirname } from 'path';
|
3
|
+
import { fileURLToPath } from 'url';
|
4
|
+
import { spawnSync } from 'child_process';
|
5
|
+
import { existsSync, mkdirSync, promises as fsPromises } from 'fs';
|
6
|
+
import chalk from 'chalk';
|
7
|
+
import settings from './settings.json' assert { type: 'json' };
|
8
|
+
|
9
|
+
import { join } from 'path';
|
10
|
+
import fs from 'fs/promises';
|
11
|
+
|
12
|
+
import { init } from './init.js';
|
13
|
+
import { dev } from './dev.js';
|
14
|
+
|
15
|
+
type ModuleSettings = {
|
16
|
+
packageRoot: string;
|
17
|
+
targetFolder: string;
|
18
|
+
args: string[];
|
19
|
+
wixConfigPath: string;
|
20
|
+
lucyConfigPath: string;
|
21
|
+
}
|
22
|
+
|
23
|
+
type ProjectSettings = {
|
24
|
+
packages?: Record<string, string>;
|
25
|
+
modules?: Record<string, string>;
|
26
|
+
}
|
27
|
+
|
28
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
29
|
+
const __filename = fileURLToPath(import.meta.url);
|
30
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
31
|
+
const __dirname = dirname(__filename);
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
/**
|
36
|
+
*
|
37
|
+
*/
|
38
|
+
async function main() {
|
39
|
+
|
40
|
+
const moduleSettings: ModuleSettings = {
|
41
|
+
packageRoot: dirname(__dirname),
|
42
|
+
targetFolder: process.cwd(),
|
43
|
+
args: process.argv.slice(2),
|
44
|
+
wixConfigPath: join(process.cwd(), 'wix.config.json'),
|
45
|
+
lucyConfigPath: join(process.cwd(), 'lucy.json')
|
46
|
+
}
|
47
|
+
|
48
|
+
let projectSettings: ProjectSettings | undefined;
|
49
|
+
|
50
|
+
if (!existsSync(moduleSettings.wixConfigPath)) {
|
51
|
+
console.log(chalk.red.underline.bold(`This is not a WIX project ${moduleSettings.targetFolder}`));
|
52
|
+
return;
|
53
|
+
}
|
54
|
+
|
55
|
+
const packageJSONraw = await fs.readFile(join(moduleSettings.targetFolder, 'package.json'), 'utf8');
|
56
|
+
const packageJSON = JSON.parse(packageJSONraw);
|
57
|
+
|
58
|
+
if(existsSync(moduleSettings.lucyConfigPath)) {
|
59
|
+
try {
|
60
|
+
const data = await fs.readFile(moduleSettings.lucyConfigPath, 'utf8');
|
61
|
+
projectSettings = JSON.parse(data);
|
62
|
+
} catch (parseError) {
|
63
|
+
console.error(chalk.red.underline.bold('Error parsing Lucy.json', parseError));
|
64
|
+
}
|
65
|
+
} else {
|
66
|
+
console.log(chalk.blueBright.underline.bold('Project not Intialized!'));
|
67
|
+
return;
|
68
|
+
}
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
if(packageJSON?.wixLucy?.intialized && ! args.includes('-f')) {
|
73
|
+
console.error(chalk.red.underline.bold(`This project is already initialized ${moduleSettings.targetFolder}`));
|
74
|
+
return;
|
75
|
+
}
|
76
|
+
|
77
|
+
console.log({ args, cwd });
|
78
|
+
if(args.includes('help') || args.includes('-h')){
|
79
|
+
console.log('Help is on the way!');
|
80
|
+
|
81
|
+
return;
|
82
|
+
}
|
83
|
+
if(args.includes('version') || args.includes('-v')){
|
84
|
+
console.log('1.0.0');
|
85
|
+
|
86
|
+
return;
|
87
|
+
}
|
88
|
+
|
89
|
+
if(args.includes('init')){
|
90
|
+
init(cwd, packageRoot, args);
|
91
|
+
|
92
|
+
return;
|
93
|
+
}
|
94
|
+
|
95
|
+
if(args.includes('dev')){
|
96
|
+
dev(cwd, args);
|
97
|
+
|
98
|
+
return;
|
99
|
+
}
|
100
|
+
|
101
|
+
if(args.includes('sync')){
|
102
|
+
console.log('Hello serve');
|
103
|
+
|
104
|
+
return;
|
105
|
+
}
|
106
|
+
|
107
|
+
}
|
108
|
+
|
109
|
+
main();
|
110
|
+
|
111
|
+
// const fs = require("fs"),
|
112
|
+
// path = require("path")
|
113
|
+
|
114
|
+
// /** Parse the command line */
|
115
|
+
// var args = process.argv.slice(2);
|
116
|
+
|
117
|
+
// // Validate input
|
118
|
+
// if (args.length !== 2) {
|
119
|
+
// console.log("Warning: Requires 2 arguments");
|
120
|
+
// console.log("node index.js [path/source.html] [targetfile]");
|
121
|
+
// process.exit();
|
122
|
+
// }
|
123
|
+
|
124
|
+
// const src = args[0];
|
125
|
+
// const target = args[1];
|
126
|
+
// const dirsrc = path.dirname(src);
|
127
|
+
|
128
|
+
// if (!fs.existsSync(src)) {
|
129
|
+
// console.log("Error: Source file doesn't exist. Given: ", src);
|
130
|
+
// process.exit();
|
131
|
+
// }
|
132
|
+
|
package/src/init.ts
ADDED
@@ -0,0 +1,191 @@
|
|
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 { simpleGit, SimpleGit, SimpleGitOptions } from 'simple-git';
|
6
|
+
import fs from 'fs/promises';
|
7
|
+
import { spawnSync } from 'child_process';
|
8
|
+
import settings from './settings.json' assert { type: 'json' };
|
9
|
+
import path from 'path';
|
10
|
+
|
11
|
+
|
12
|
+
type ProjectSettings = {
|
13
|
+
packages?: Record<string, string>;
|
14
|
+
modules?: Record<string, string>;
|
15
|
+
}
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Init Lucy project
|
19
|
+
* @param {string} cwd Current working directory
|
20
|
+
* @param {string} packageRoot Package root directory
|
21
|
+
* @returns {void}
|
22
|
+
*/
|
23
|
+
export async function init(cwd: string, packageRoot:string, args: string[]) {
|
24
|
+
const sourceFolder = join(packageRoot, 'files');
|
25
|
+
const targetFolder = cwd;
|
26
|
+
let projectSettings: ProjectSettings|undefined;
|
27
|
+
|
28
|
+
if(existsSync(join(targetFolder, 'lucy.json'))) {
|
29
|
+
try {
|
30
|
+
const lucyConfig = join(targetFolder, 'lucy.json');
|
31
|
+
const data = await fs.readFile(lucyConfig, 'utf8');
|
32
|
+
projectSettings = JSON.parse(data);
|
33
|
+
} catch (parseError) {
|
34
|
+
console.error(chalk.red.underline.bold('Error parsinc Lucy.json', parseError));
|
35
|
+
}
|
36
|
+
} else {
|
37
|
+
const lucyConfig = {
|
38
|
+
packages: settings.packages,
|
39
|
+
modules: settings.modules
|
40
|
+
}
|
41
|
+
await fs.writeFile(join(targetFolder, 'lucy.json'), JSON.stringify(lucyConfig, null, 2), 'utf8');
|
42
|
+
console.log(chalk.blueBright.underline.bold('Created Lucy config file!'));
|
43
|
+
}
|
44
|
+
|
45
|
+
const wixConfigPath = join(targetFolder, 'wix.config.json');
|
46
|
+
const packageJSONraw = await fs.readFile(join(targetFolder, 'package.json'), 'utf8');
|
47
|
+
const packageJSON = JSON.parse(packageJSONraw);
|
48
|
+
|
49
|
+
if(packageJSON?.wixLucy?.intialized && ! args.includes('-f')) {
|
50
|
+
console.error(chalk.red.underline.bold(`This project is already initialized ${targetFolder}`));
|
51
|
+
return;
|
52
|
+
}
|
53
|
+
|
54
|
+
if (!existsSync(wixConfigPath)) {
|
55
|
+
console.error(chalk.red.underline.bold(`This is not a WIX project ${targetFolder}`));
|
56
|
+
return;
|
57
|
+
}
|
58
|
+
|
59
|
+
await copyFolder(sourceFolder, targetFolder);
|
60
|
+
|
61
|
+
await editJson(join(targetFolder, 'package.json'), ['type', 'scripts', 'wixLucy'], ['module', settings.scripts, settings.lucySettings ]);
|
62
|
+
await stringReplace(join(targetFolder, 'currents.config.js'), ['__ProjectName__'], [path.basename(targetFolder)]);
|
63
|
+
|
64
|
+
await installPackages(projectSettings?.packages ? projectSettings?.packages : settings.packages, targetFolder);
|
65
|
+
|
66
|
+
await editJson(join(targetFolder, 'jsconfig.json'), ['compilerOptions', 'exclude'], [settings.wixSettings.compilerOptions, settings.wixSettings.exclude]);
|
67
|
+
await editJson(join(targetFolder, 'typedoc.json'), ['name'], [path.basename(targetFolder)]);
|
68
|
+
|
69
|
+
await gitInit(targetFolder, projectSettings?.modules ? projectSettings?.modules : settings.modules);
|
70
|
+
console.log(chalk.blueBright.underline.bold('Done!'));
|
71
|
+
}
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Copy files from source to target
|
75
|
+
* @param {string} source Source folder
|
76
|
+
* @param {string} target Target folder
|
77
|
+
* @returns {Promise<void>}
|
78
|
+
*/
|
79
|
+
async function copyFolder(source: string, target: string): Promise<void> {
|
80
|
+
if (!existsSync(target)){
|
81
|
+
console.error(chalk.red.underline.bold(`Target folder doesn't exist: ${target}`));
|
82
|
+
return;
|
83
|
+
}
|
84
|
+
|
85
|
+
try {
|
86
|
+
const files = await fsPromises.readdir(source);
|
87
|
+
for (const file of files){
|
88
|
+
const sourcePath = join(source, file);
|
89
|
+
const targetPath = join(target, file);
|
90
|
+
|
91
|
+
if (file === 'lucy.json' && existsSync(targetPath)){
|
92
|
+
continue;
|
93
|
+
}
|
94
|
+
const stats = await fsPromises.stat(sourcePath);
|
95
|
+
if (stats.isDirectory()){
|
96
|
+
if (!existsSync(file)){
|
97
|
+
mkdirSync(file);
|
98
|
+
}
|
99
|
+
await fse.copySync(sourcePath, targetPath, { overwrite: true });
|
100
|
+
} else {
|
101
|
+
fse.copySync(sourcePath, targetPath, { overwrite: true });
|
102
|
+
}
|
103
|
+
}
|
104
|
+
} catch (err){
|
105
|
+
console.error(chalk.red.underline.bold(err));
|
106
|
+
} finally {
|
107
|
+
console.log(chalk.blueBright.underline.bold('Copy files completed!'));
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
/**
|
112
|
+
* Edit Json files
|
113
|
+
* @param {string} filePath File path
|
114
|
+
* @param {string[]} keys Keys to edit
|
115
|
+
* @param {string[]} values Values to edit
|
116
|
+
* @returns {void}
|
117
|
+
*/
|
118
|
+
async function editJson(filePath: string, keys: string[], values: string[] | Object[] ) {
|
119
|
+
try {
|
120
|
+
const data = await fs.readFile(filePath, 'utf8');
|
121
|
+
|
122
|
+
let jsonData;
|
123
|
+
try {
|
124
|
+
jsonData = JSON.parse(data);
|
125
|
+
} catch (parseError) {
|
126
|
+
console.error(chalk.red.underline.bold('Error parsing JSON:', parseError));
|
127
|
+
return;
|
128
|
+
}
|
129
|
+
|
130
|
+
for (const key of keys){
|
131
|
+
const index = keys.indexOf(key);
|
132
|
+
const value = values[index];
|
133
|
+
jsonData[key] = value;
|
134
|
+
}
|
135
|
+
|
136
|
+
const updatedJsonData = JSON.stringify(jsonData, null, 2);
|
137
|
+
await fs.writeFile(filePath, updatedJsonData, 'utf8');
|
138
|
+
} catch (err) {
|
139
|
+
console.log(chalk.red.underline.bold(err));
|
140
|
+
} finally {
|
141
|
+
console.log(chalk.blueBright.underline.bold(`File ${filePath} updated successfully!`));
|
142
|
+
}
|
143
|
+
}
|
144
|
+
|
145
|
+
async function stringReplace(filePath: string, keys: string[], values: string[]) {
|
146
|
+
try {
|
147
|
+
let modifiedContent: string = '';
|
148
|
+
const data = await fs.readFile(filePath, 'utf8');
|
149
|
+
|
150
|
+
for (const key of keys){
|
151
|
+
const index = keys.indexOf(key);
|
152
|
+
const value = values[index];
|
153
|
+
const regex = new RegExp(`${key}`, 'g');
|
154
|
+
modifiedContent = data.replace(regex, `${value}`);
|
155
|
+
}
|
156
|
+
|
157
|
+
await fs.writeFile(filePath, modifiedContent, 'utf8');
|
158
|
+
} catch (err) {
|
159
|
+
console.log(chalk.red.underline.bold(err));
|
160
|
+
} finally {
|
161
|
+
console.log(chalk.blueBright.underline.bold(`File ${filePath} updated successfully!`));
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
async function installPackages(packages: Record<string, string>, cwd: string) {
|
166
|
+
const packageNames = Object.keys(packages);
|
167
|
+
const packageVersions = Object.values(packages);
|
168
|
+
const packageNamesAndVersions = packageNames.map((name, index) => `${name}@${packageVersions[index]}`);
|
169
|
+
const command = `yarn add ${packageNamesAndVersions.join(' ')}`;
|
170
|
+
const result = spawnSync(command, { shell: true, stdio: 'inherit' });
|
171
|
+
if (result.error) {
|
172
|
+
console.error(chalk.red.underline.bold(`Command failed: ${result.error.message}`));
|
173
|
+
} else {
|
174
|
+
console.log(chalk.blueBright.underline.bold(`Command succeeded: ${result.stdout}`));
|
175
|
+
}
|
176
|
+
}
|
177
|
+
|
178
|
+
async function gitInit(cwd: string, modules: Record<string, string>) {
|
179
|
+
const git = simpleGit({ baseDir: cwd });
|
180
|
+
for (const [name, url] of Object.entries(modules)) {
|
181
|
+
console.log(chalk.green.underline.bold(`Cloning ${name}`));
|
182
|
+
try {
|
183
|
+
await git.submoduleAdd(url, name)
|
184
|
+
} catch (e) {
|
185
|
+
console.error(chalk.red.underline.bold(`Command failed: ${e}`));
|
186
|
+
} finally {
|
187
|
+
console.log(chalk.blueBright.underline.bold(`Cloned ${name}`));
|
188
|
+
}
|
189
|
+
}
|
190
|
+
console.log(chalk.blueBright.underline.bold(`All Modules cloned!`));
|
191
|
+
}
|
@@ -0,0 +1,91 @@
|
|
1
|
+
{
|
2
|
+
"modules": {
|
3
|
+
"wix-lucy-lib": "git@github.com:Integral-Systems/wix-lucy-lib.git"
|
4
|
+
},
|
5
|
+
"wixSettings": {
|
6
|
+
"compilerOptions": {
|
7
|
+
"composite": true,
|
8
|
+
"noEmit": false,
|
9
|
+
"lib": [
|
10
|
+
"DOM"
|
11
|
+
],
|
12
|
+
"jsx": "react"
|
13
|
+
},
|
14
|
+
"exclude": [
|
15
|
+
"**/*.js"
|
16
|
+
]
|
17
|
+
},
|
18
|
+
"lucySettings": {
|
19
|
+
"intialized": true,
|
20
|
+
},
|
21
|
+
"packages": {
|
22
|
+
"@danpercic86/helpful-decorators": "^2.4.0",
|
23
|
+
"@js-joda/core": "5.5.3",
|
24
|
+
"@js-joda/locale": "4.8.10",
|
25
|
+
"@js-joda/locale_de": "4.8.10",
|
26
|
+
"@js-joda/locale_en": "4.8.10",
|
27
|
+
"@js-joda/timezone": "2.18.0",
|
28
|
+
"@react-pdf/renderer": "2.0.17",
|
29
|
+
"@total-typescript/ts-reset": "^0.4.2",
|
30
|
+
"@types/i18n": "^0.13.6",
|
31
|
+
"@types/jest": "^29.5.3",
|
32
|
+
"@types/node": "^20.5.7",
|
33
|
+
"@types/nodemailer": "^6.4.10",
|
34
|
+
"@types/react": "^18.2.21",
|
35
|
+
"@typescript-eslint/eslint-plugin": "^5.61.0",
|
36
|
+
"@typescript-eslint/parser": "^5.61.0",
|
37
|
+
"@typescript-eslint/utils": "^5.61.0",
|
38
|
+
"@wix/cli": "1.0.83",
|
39
|
+
"@wix/eslint-plugin-cli": "^1.0.1",
|
40
|
+
"@wix/image": "1.96.0",
|
41
|
+
"@wix/velo-bind": "1.0.8",
|
42
|
+
"add": "^2.0.6",
|
43
|
+
"await-semaphore": "0.1.3",
|
44
|
+
"axios": "1.4.0",
|
45
|
+
"crypto-js": "4.1.1",
|
46
|
+
"cypress": "^12.17.2",
|
47
|
+
"cypress-cloud": "^1.9.3",
|
48
|
+
"esbuild": "^0.18.11",
|
49
|
+
"eslint": "^8.25.0",
|
50
|
+
"eslint-plugin-import": "^2.27.5",
|
51
|
+
"eslint-plugin-jsdoc": "^46.4.3",
|
52
|
+
"eslint-plugin-named-import-spacing": "^1.0.3",
|
53
|
+
"eslint-plugin-simple-import-sort": "^10.0.0",
|
54
|
+
"eventemitter3": "4.0.7",
|
55
|
+
"gsap": "3.11.4",
|
56
|
+
"helpful-decorators": "^2.1.0",
|
57
|
+
"i18next": "22.4.7",
|
58
|
+
"jest": "^29.6.1",
|
59
|
+
"merge-stream": "^2.0.0",
|
60
|
+
"mobx": "6.8.0",
|
61
|
+
"mobx-utils": "6.0.3",
|
62
|
+
"node-cache": "5.1.2",
|
63
|
+
"nodemailer": "6.9.3",
|
64
|
+
"payment": "2.3.0",
|
65
|
+
"prettier": "^3.0.3",
|
66
|
+
"react": "18.2.0",
|
67
|
+
"react-dom": "18.1.0",
|
68
|
+
"react-transition-group": "4.4.5",
|
69
|
+
"sass": "^1.65.1",
|
70
|
+
"ts-jest": "^29.1.1",
|
71
|
+
"ts-node": "^10.9.1",
|
72
|
+
"tsx": "^3.13.0",
|
73
|
+
"typedoc": "^0.25.1",
|
74
|
+
"typedoc-theme-hierarchy": "^4.0.0",
|
75
|
+
"typescript": "^5.1.6",
|
76
|
+
"uuid": "9.0.0",
|
77
|
+
"zod": "3.22.2"
|
78
|
+
},
|
79
|
+
"scripts": {
|
80
|
+
"postinstall": "wix sync-types",
|
81
|
+
"wix:dev": "wix dev",
|
82
|
+
"dev": "gulp dev",
|
83
|
+
"lint": "eslint .",
|
84
|
+
"docs": "typedoc --tsconfig typescript/tsconfig.json --skipErrorChecking",
|
85
|
+
"build": "gulp build-prod",
|
86
|
+
"fix-wix": "gulp fix-wix",
|
87
|
+
"tsc": "tsc -p ./typescript/tsconfig.json --noEmit",
|
88
|
+
"test": "jest --config jest.config.ts --passWithNoTests",
|
89
|
+
"test:watch": "jest --config jest.config.ts --watch"
|
90
|
+
}
|
91
|
+
}
|
package/src/types.d.ts
ADDED
package/tsconfig.json
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
{
|
2
|
+
"typeAcquisition": {
|
3
|
+
"enable": true
|
4
|
+
},
|
5
|
+
"compilerOptions": {
|
6
|
+
"outDir": "./dist",
|
7
|
+
"rootDir": "./src",
|
8
|
+
"target": "ES2020",
|
9
|
+
"build": true,
|
10
|
+
"module": "ESNext",
|
11
|
+
"moduleResolution": "Node",
|
12
|
+
"preserveConstEnums": true,
|
13
|
+
"allowSyntheticDefaultImports": true,
|
14
|
+
"skipLibCheck": true,
|
15
|
+
"declaration": true,
|
16
|
+
"strict": true,
|
17
|
+
"noEmitOnError": false,
|
18
|
+
"strictNullChecks": true,
|
19
|
+
"noImplicitAny": true,
|
20
|
+
"noImplicitReturns": true,
|
21
|
+
"noUncheckedIndexedAccess": true,
|
22
|
+
"noImplicitThis": false,
|
23
|
+
"strictBindCallApply": false,
|
24
|
+
"strictFunctionTypes": true,
|
25
|
+
"strictPropertyInitialization": true,
|
26
|
+
"experimentalDecorators": true,
|
27
|
+
"esModuleInterop": true,
|
28
|
+
"resolveJsonModule": true,
|
29
|
+
},
|
30
|
+
"exclude": ["../node_modules"],
|
31
|
+
"include":[
|
32
|
+
"src/**/*.ts"
|
33
|
+
],
|
34
|
+
}
|