@stechquick/symphony-cli 0.2.271
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 +378 -0
- package/bin/run +5 -0
- package/bin/run.cmd +3 -0
- package/lib/commands/mui-create.d.ts +14 -0
- package/lib/commands/mui-create.js +39 -0
- package/lib/commands/nc-addcomp.d.ts +11 -0
- package/lib/commands/nc-addcomp.js +22 -0
- package/lib/commands/nc-build.d.ts +9 -0
- package/lib/commands/nc-build.js +20 -0
- package/lib/commands/nc-create.d.ts +14 -0
- package/lib/commands/nc-create.js +38 -0
- package/lib/commands/qui-build.d.ts +6 -0
- package/lib/commands/qui-build.js +16 -0
- package/lib/commands/qui-create.d.ts +14 -0
- package/lib/commands/qui-create.js +39 -0
- package/lib/commands/qui-start.d.ts +9 -0
- package/lib/commands/qui-start.js +30 -0
- package/lib/commands/quick-serve.d.ts +17 -0
- package/lib/commands/quick-serve.js +73 -0
- package/lib/commands/sym-addfunc.d.ts +12 -0
- package/lib/commands/sym-addfunc.js +21 -0
- package/lib/commands/sym-build.d.ts +12 -0
- package/lib/commands/sym-build.js +56 -0
- package/lib/commands/sym-create-module.d.ts +14 -0
- package/lib/commands/sym-create-module.js +39 -0
- package/lib/commands/sym-create.d.ts +14 -0
- package/lib/commands/sym-create.js +39 -0
- package/lib/commands/sym-fn-deploy.d.ts +24 -0
- package/lib/commands/sym-fn-deploy.js +152 -0
- package/lib/commands/sym-nano-deploy.d.ts +11 -0
- package/lib/commands/sym-nano-deploy.js +50 -0
- package/lib/commands/sym-start.d.ts +14 -0
- package/lib/commands/sym-start.js +28 -0
- package/lib/commands/sym-test.d.ts +6 -0
- package/lib/commands/sym-test.js +12 -0
- package/lib/helpers/deploy/fnDeployHelper.d.ts +28 -0
- package/lib/helpers/deploy/fnDeployHelper.js +196 -0
- package/lib/helpers/deploy/nanoDeployHelper.d.ts +20 -0
- package/lib/helpers/deploy/nanoDeployHelper.js +83 -0
- package/lib/helpers/fnDownloadHelper.d.ts +11 -0
- package/lib/helpers/fnDownloadHelper.js +64 -0
- package/lib/helpers/initHelper.d.ts +22 -0
- package/lib/helpers/initHelper.js +78 -0
- package/lib/helpers/microUIHelper.d.ts +10 -0
- package/lib/helpers/microUIHelper.js +33 -0
- package/lib/helpers/namedComponent/ncHelper.d.ts +15 -0
- package/lib/helpers/namedComponent/ncHelper.js +60 -0
- package/lib/helpers/npmHelper.d.ts +23 -0
- package/lib/helpers/npmHelper.js +79 -0
- package/lib/helpers/packageHelper.d.ts +14 -0
- package/lib/helpers/packageHelper.js +32 -0
- package/lib/helpers/shellHelper.d.ts +25 -0
- package/lib/helpers/shellHelper.js +52 -0
- package/lib/helpers/socketServer/socketServerHelper.d.ts +14 -0
- package/lib/helpers/socketServer/socketServerHelper.js +106 -0
- package/lib/helpers/typeHelper.d.ts +3 -0
- package/lib/helpers/typeHelper.js +22 -0
- package/lib/helpers/ui/createuiHelper.d.ts +10 -0
- package/lib/helpers/ui/createuiHelper.js +33 -0
- package/lib/helpers/ui/quiBuilder.d.ts +13 -0
- package/lib/helpers/ui/quiBuilder.js +163 -0
- package/lib/helpers/utils.d.ts +8 -0
- package/lib/helpers/utils.js +20 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +4 -0
- package/lib/pathFinder.d.ts +4 -0
- package/lib/pathFinder.js +13 -0
- package/lib/predeploy/src/fn/fnPostdeploy.d.ts +5 -0
- package/lib/predeploy/src/fn/fnPostdeploy.js +49 -0
- package/lib/predeploy/src/fn/fnPredeploy.d.ts +4 -0
- package/lib/predeploy/src/fn/fnPredeploy.js +30 -0
- package/lib/predeploy/src/nano/nanoPostdeploy.d.ts +5 -0
- package/lib/predeploy/src/nano/nanoPostdeploy.js +41 -0
- package/lib/predeploy/src/nano/nanoPredeploy.d.ts +4 -0
- package/lib/predeploy/src/nano/nanoPredeploy.js +25 -0
- package/lib/predeploy/src/paramReplacer.d.ts +7 -0
- package/lib/predeploy/src/paramReplacer.js +14 -0
- package/lib/predeploy/src/predeployCommon.d.ts +15 -0
- package/lib/predeploy/src/predeployCommon.js +83 -0
- package/oclif.manifest.json +1 -0
- package/package.json +76 -0
- package/templates/addModule/{{ModuleName}}/.jenkins/dev.yaml +43 -0
- package/templates/addModule/{{ModuleName}}/README.md +2 -0
- package/templates/addModule/{{ModuleName}}/index.ts +1 -0
- package/templates/addModule/{{ModuleName}}/src/implementation/object.ts +16 -0
- package/templates/addModule/{{ModuleName}}/src/module.ts +9 -0
- package/templates/addModule/{{ModuleName}}/tsconfig.json +66 -0
- package/templates/addModule/{{ModuleName}}/webpack.config.js +41 -0
- package/templates/addModule/{{ModuleName}}/{{remove}}.gitignore +6 -0
- package/templates/addModule/{{ModuleName}}/{{remove}}package.json +33 -0
- package/templates/addfunc/functions/{{FuncName}}/config.yaml +25 -0
- package/templates/addfunc/functions/{{FuncName}}/func.yaml +9 -0
- package/templates/addfunc/functions/{{FuncName}}/{{FuncName}}.ts +8 -0
- package/templates/addfunc/unitTest/{{FuncName}}.test.ts +18 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/.babelrc +17 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/.editorconfig +9 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/.postcssrc.js +8 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/README.md +45 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/build/build.js +41 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/build/check-versions.js +49 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/build/dev-client.js +10 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/build/dev-server.js +107 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/build/utils.js +73 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/build/vue-loader.conf.js +19 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/build/webpack.base.conf.js +76 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/build/webpack.dev.conf.js +39 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/build/webpack.prod.conf.js +128 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/build/webpack.test.conf.js +32 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/build.gradle +251 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/config/dev.env.js +7 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/config/index.js +50 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/config/prod.env.js +4 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/config/test.env.js +7 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/copyBundle.js +3 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/gradle/base/repos.gradle +48 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/gradlew +172 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/index.html +11 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/index.js +18 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/indexCompNames.js +14 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/indexInitial.js +8 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/indexModuleName.js +1 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/indexVCompNames.json +50 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/package.json +84 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/removeDist.js +2 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/src/App.vue +54 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/src/api/index.js +5 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/src/components/index.js +6 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/src/docker/nginx.conf +39 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/src/localization/en/default.json +3 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/src/localization/tr/default.json +3 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/src/main.js +15 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/src/mockserver/handlers/health.js +8 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/src/mockserver/index.js +8 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/src/mockserver/server.js +45 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/src/pages/index.js +6 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/src/router/index.js +5 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/src/service/serviceConstants.js +1 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/src/store/index.js +14 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/src/worker/a9e657cbf4abb977edda.worker.js +60638 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/static/.gitkeep +0 -0
- package/templates/createmicroui/{{MicroUIName}}-ui/webpack.config.js +257 -0
- package/templates/createui/{{UIName}}/Jenkinsfile +20 -0
- package/templates/createui/{{UIName}}/build.gradle +266 -0
- package/templates/createui/{{UIName}}/gradle/base/repos.gradle +93 -0
- package/templates/createui/{{UIName}}/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/templates/createui/{{UIName}}/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/templates/createui/{{UIName}}/gradlew +172 -0
- package/templates/createui/{{UIName}}/gradlew.bat +90 -0
- package/templates/createui/{{UIName}}/settings/globalLocalization.qjson +29 -0
- package/templates/createui/{{UIName}}/settings/localProxy.yaml +25 -0
- package/templates/createui/{{UIName}}/settings/qjson/alert.qjson +920 -0
- package/templates/createui/{{UIName}}/settings/qjson/loading.qjson +1486 -0
- package/templates/createui/{{UIName}}/settings/qjson/logHandler.qjson +65 -0
- package/templates/createui/{{UIName}}/settings/qjson/pipeline.qjson +116 -0
- package/templates/createui/{{UIName}}/settings/settings-proxy.js +120 -0
- package/templates/createui/{{UIName}}/settings/settings.yaml +85 -0
- package/templates/createui/{{UIName}}/settings.gradle +1 -0
- package/templates/createui/{{UIName}}/static/components/yourNamedCompHere.js +0 -0
- package/templates/createui/{{UIName}}/static/css/main.css +36 -0
- package/templates/createui/{{UIName}}/static/css/myDarkTheme.css +143 -0
- package/templates/createui/{{UIName}}/static/css/myHappyTheme1.css +140 -0
- package/templates/createui/{{UIName}}/static/css/myHappyTheme2.css +140 -0
- package/templates/createui/{{UIName}}/static/images/ahelogo.png +0 -0
- package/templates/createui/{{UIName}}/static/images/avatar.png +0 -0
- package/templates/createui/{{UIName}}/static/images/profile.png +0 -0
- package/templates/createui/{{UIName}}/static/images/profile2.png +0 -0
- package/templates/createui/{{UIName}}/static/images/yourImagesHere.png +0 -0
- package/templates/createui/{{UIName}}/static/js/componentList.ts +4452 -0
- package/templates/createui/{{UIName}}/static/qjsons/VDatatableConditionalRowColoring.qjson +158 -0
- package/templates/createui/{{UIName}}/static/qjsons/alertSamplePage.qjson +772 -0
- package/templates/createui/{{UIName}}/static/qjsons/complicatedSamplePage.qjson +10448 -0
- package/templates/createui/{{UIName}}/static/qjsons/customComponentSample.qjson +803 -0
- package/templates/createui/{{UIName}}/static/qjsons/customerInfoCustomComp.qjson +1451 -0
- package/templates/createui/{{UIName}}/static/qjsons/first.qjson +2180 -0
- package/templates/createui/{{UIName}}/static/qjsons/formatterSample.qjson +877 -0
- package/templates/createui/{{UIName}}/static/qjsons/localizationSample.qjson +1845 -0
- package/templates/createui/{{UIName}}/static/qjsons/pipelineSample.qjson +913 -0
- package/templates/createui/{{UIName}}/static/qjsons/validationSample.qjson +2371 -0
- package/templates/createui/{{UIName}}/static/qjsons/webDashboardSample.qjson +2993 -0
- package/templates/createui/{{UIName}}/{{remove}}.gitignore +3 -0
- package/templates/createui/{{UIName}}/{{remove}}package.json +22 -0
- package/templates/fnPredeploy/Dockerfile +22 -0
- package/templates/init/{{AppName}}/.vscode/launch.json +24 -0
- package/templates/init/{{AppName}}/Jenkinsfile +36 -0
- package/templates/init/{{AppName}}/app.yaml +1 -0
- package/templates/init/{{AppName}}/functions/qjsonfunc/func.yaml +9 -0
- package/templates/init/{{AppName}}/functions/qjsonfunc/qjsonfunc.ts +3 -0
- package/templates/init/{{AppName}}/functions/qjsonfunc/qjsons/test.qjson +180 -0
- package/templates/init/{{AppName}}/functions/samplefunc/config.yaml +46 -0
- package/templates/init/{{AppName}}/functions/samplefunc/func.yaml +9 -0
- package/templates/init/{{AppName}}/functions/samplefunc/samplefunc.ts +27 -0
- package/templates/init/{{AppName}}/jest.config.js +8 -0
- package/templates/init/{{AppName}}/local.ts +6 -0
- package/templates/init/{{AppName}}/sym-engine/config.yaml +7 -0
- package/templates/init/{{AppName}}/sym-engine/localization.yaml +5 -0
- package/templates/init/{{AppName}}/sym-engine/pipeline.ts +64 -0
- package/templates/init/{{AppName}}/test/qjson.http +29 -0
- package/templates/init/{{AppName}}/test/sample.http +24 -0
- package/templates/init/{{AppName}}/tsconfig.json +66 -0
- package/templates/init/{{AppName}}/unitTest/samplefunc.test.ts +55 -0
- package/templates/init/{{AppName}}/{{remove}}.gitignore +6 -0
- package/templates/init/{{AppName}}/{{remove}}package.json +40 -0
- package/templates/nanoPredeploy/Dockerfile +27 -0
- package/templates/nc-addComp/{{ComponentName}}.vue +29 -0
- package/templates/nc-create/{{ProjectName}}/shims/shims-vue.d.ts +4 -0
- package/templates/nc-create/{{ProjectName}}/src/namedComps/{{ProjectName}}.vue +29 -0
- package/templates/nc-create/{{ProjectName}}/tsconfig.json +66 -0
- package/templates/nc-create/{{ProjectName}}/webpack.config.js +2 -0
- package/templates/nc-create/{{ProjectName}}/{{remove}}.gitignore +3 -0
- package/templates/nc-create/{{ProjectName}}/{{remove}}package.json +28 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NpmHelper = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
const fileHelper_1 = require("@stechquick/symphony-common/lib/helpers/fileHelper");
|
|
7
|
+
const path = tslib_1.__importStar(require("path"));
|
|
8
|
+
const initHelper_1 = require("./initHelper");
|
|
9
|
+
const log_1 = require("@stechquick/symphony-common/lib/log");
|
|
10
|
+
const styling_1 = require("@stechquick/symphony-common/lib/styling");
|
|
11
|
+
class NpmHelper {
|
|
12
|
+
static install(settings) {
|
|
13
|
+
log_1.Logger.log({ message: styling_1.Chalk.create("green.bold", "Install starting, please wait...") });
|
|
14
|
+
child_process_1.execSync(`cd ${settings.folderName} && npm install`, { stdio: 'inherit' });
|
|
15
|
+
log_1.Logger.log({ message: styling_1.Chalk.create("green.bold", "Install finished successfully.") });
|
|
16
|
+
}
|
|
17
|
+
static build(settings) {
|
|
18
|
+
log_1.Logger.log({ message: styling_1.Chalk.create("green.bold", "Build starting, please wait...") });
|
|
19
|
+
this.execCommand(this.BUILD_CMD, settings);
|
|
20
|
+
log_1.Logger.log({ message: styling_1.Chalk.create("green.bold", "Build finished successfully.") });
|
|
21
|
+
}
|
|
22
|
+
static buildWebpack(settings) {
|
|
23
|
+
log_1.Logger.log({ message: styling_1.Chalk.create("green.bold", "Webpack starting, please wait...") });
|
|
24
|
+
this.execCommand(this.WEBPACK_CMD, settings);
|
|
25
|
+
log_1.Logger.log({ message: styling_1.Chalk.create("green.bold", "Webpack finished successfully.") });
|
|
26
|
+
}
|
|
27
|
+
static run(environment, settings) {
|
|
28
|
+
log_1.Logger.log({ message: styling_1.Chalk.create("green.bold", "Function starting, please wait..."), timeFormat: "datetime" });
|
|
29
|
+
if (!initHelper_1.InitHelper.AssertInFolder()) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (settings.build) {
|
|
33
|
+
this.build();
|
|
34
|
+
}
|
|
35
|
+
const args = [path.resolve('./dist/local')];
|
|
36
|
+
if (settings.debug) {
|
|
37
|
+
args.unshift('--inspect-brk');
|
|
38
|
+
}
|
|
39
|
+
const customArgs = {
|
|
40
|
+
httpPort: settings.httpPort,
|
|
41
|
+
httpsPort: settings.httpsPort,
|
|
42
|
+
hostedPath: settings.hostedPath,
|
|
43
|
+
};
|
|
44
|
+
args.push(JSON.stringify(customArgs));
|
|
45
|
+
log_1.Logger.log({ message: "spawning with: ", additional: args });
|
|
46
|
+
child_process_1.spawnSync("node", args, { env: Object.assign(process.env, { NODE_ENV: environment }), stdio: 'inherit' });
|
|
47
|
+
log_1.Logger.log({ message: styling_1.Chalk.create("green.bold", "Function started successfully."), timeFormat: "datetime" });
|
|
48
|
+
}
|
|
49
|
+
static getCurrentPackageVersions() {
|
|
50
|
+
let retVal = {};
|
|
51
|
+
const list = child_process_1.execSync("npm list --depth=0", { encoding: "utf8" });
|
|
52
|
+
if (list && list.length > 0) {
|
|
53
|
+
const lines = list.split("\n");
|
|
54
|
+
lines.forEach(line => {
|
|
55
|
+
if (line.indexOf("@") > -1 && line.indexOf("-- ") > -1) {
|
|
56
|
+
const lineValues = line.split("@");
|
|
57
|
+
const name = lineValues[lineValues.length - 2].replace("+-- ", "").replace("`-- ", "").replace(" invalid", "");
|
|
58
|
+
const version = lineValues[lineValues.length - 1];
|
|
59
|
+
retVal[name] = version;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return retVal;
|
|
64
|
+
}
|
|
65
|
+
static execCommand(command, settings) {
|
|
66
|
+
fileHelper_1.FileHelper.removeDist();
|
|
67
|
+
//https://github.com/npm/npx
|
|
68
|
+
//npx added instead of "./node_modules/.bin/"
|
|
69
|
+
//const cwd = "./node_modules/.bin/";
|
|
70
|
+
const stdio = "inherit";
|
|
71
|
+
if (settings === null || settings === void 0 ? void 0 : settings.watch) {
|
|
72
|
+
command = command + " -w";
|
|
73
|
+
}
|
|
74
|
+
child_process_1.execSync(command, { stdio });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.NpmHelper = NpmHelper;
|
|
78
|
+
NpmHelper.BUILD_CMD = "npx tsc";
|
|
79
|
+
NpmHelper.WEBPACK_CMD = "npx webpack";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface IPackageInfo {
|
|
2
|
+
name: string;
|
|
3
|
+
usedVersion: string;
|
|
4
|
+
lastVersion: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IVersionCheckSettings {
|
|
7
|
+
packageNames: string[];
|
|
8
|
+
packageJsonFilePath: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class PackageHelper {
|
|
11
|
+
static getBackwardPackages(settings: IVersionCheckSettings): IPackageInfo[];
|
|
12
|
+
private static getPackageJson;
|
|
13
|
+
private static fixChars;
|
|
14
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PackageHelper = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
6
|
+
const path = tslib_1.__importStar(require("path"));
|
|
7
|
+
const compare_versions_1 = tslib_1.__importDefault(require("compare-versions"));
|
|
8
|
+
const npmHelper_1 = require("./npmHelper");
|
|
9
|
+
class PackageHelper {
|
|
10
|
+
static getBackwardPackages(settings) {
|
|
11
|
+
const list = [];
|
|
12
|
+
const cliFilePath = path.join(path.resolve(__dirname), "../.." + settings.packageJsonFilePath);
|
|
13
|
+
const cliDevDeps = this.getPackageJson(cliFilePath).devDependencies;
|
|
14
|
+
const appDevDeps = npmHelper_1.NpmHelper.getCurrentPackageVersions();
|
|
15
|
+
settings.packageNames.forEach(name => {
|
|
16
|
+
const lastVersion = this.fixChars(cliDevDeps[name]);
|
|
17
|
+
const usedVersion = appDevDeps[name];
|
|
18
|
+
if (compare_versions_1.default.compare(lastVersion, usedVersion, ">")) {
|
|
19
|
+
list.push({ name, usedVersion, lastVersion });
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return list;
|
|
23
|
+
}
|
|
24
|
+
static getPackageJson(filePath) {
|
|
25
|
+
const data = fs.readFileSync(path.resolve(filePath), { encoding: "utf8" });
|
|
26
|
+
return JSON.parse(data);
|
|
27
|
+
}
|
|
28
|
+
static fixChars(value) {
|
|
29
|
+
return value.replace(/[^0-9.]/g, "");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.PackageHelper = PackageHelper;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface IExecuteOptions {
|
|
2
|
+
/**
|
|
3
|
+
* override std err handler
|
|
4
|
+
* @returns true to continue executing standart error handler false to quit standart handler
|
|
5
|
+
*/
|
|
6
|
+
stderr?: (chunkstring: string) => boolean;
|
|
7
|
+
/**
|
|
8
|
+
* override std out handler
|
|
9
|
+
* @returns true to continue executing standart output handler false to quit standart handler
|
|
10
|
+
*/
|
|
11
|
+
stdout?: (chunkstring: string) => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* override exit handler. Caution: should return true, or you should call success or fail. Otherwise execution hangs.
|
|
14
|
+
* @param code: error code of exit if any
|
|
15
|
+
* @returns null to continue executing standart exit handler or code and signal for handler to process
|
|
16
|
+
*/
|
|
17
|
+
exit?: (code: number | null, signal: string | null) => {
|
|
18
|
+
code: number | null;
|
|
19
|
+
signal: string | null;
|
|
20
|
+
} | null;
|
|
21
|
+
noExitCode?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare class ShellHelper {
|
|
24
|
+
static ExecuteCommand(command: string, args?: Array<string>, options?: IExecuteOptions): Promise<void>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ShellHelper = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const log_1 = require("@stechquick/symphony-common/lib/log");
|
|
6
|
+
const styling_1 = require("@stechquick/symphony-common/lib/styling");
|
|
7
|
+
class ShellHelper {
|
|
8
|
+
static ExecuteCommand(command, args, options) {
|
|
9
|
+
return new Promise((res, rej) => {
|
|
10
|
+
const process = child_process_1.spawn(command, args);
|
|
11
|
+
process.stdout.on("data", (chunk) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const chunkstring = chunk.toString();
|
|
14
|
+
if (((_a = options === null || options === void 0 ? void 0 : options.stdout) === null || _a === void 0 ? void 0 : _a.call(options, chunkstring)) === false) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
log_1.Logger.log({ message: chunk.toString() });
|
|
18
|
+
});
|
|
19
|
+
process.stderr.on("data", (chunk) => {
|
|
20
|
+
var _a;
|
|
21
|
+
const chunkstring = chunk.toString();
|
|
22
|
+
if (((_a = options === null || options === void 0 ? void 0 : options.stderr) === null || _a === void 0 ? void 0 : _a.call(options, chunkstring)) === false) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
log_1.Logger.log({ message: styling_1.Chalk.create("red.bold", chunkstring) });
|
|
26
|
+
});
|
|
27
|
+
const exitHandler = (exit) => (code, signal) => {
|
|
28
|
+
var _a;
|
|
29
|
+
const exitOverride = (_a = options === null || options === void 0 ? void 0 : options.exit) === null || _a === void 0 ? void 0 : _a.call(options, code, signal);
|
|
30
|
+
if (exitOverride) {
|
|
31
|
+
code = exitOverride.code;
|
|
32
|
+
signal = exitOverride.signal;
|
|
33
|
+
}
|
|
34
|
+
if (code) {
|
|
35
|
+
if (!(options === null || options === void 0 ? void 0 : options.noExitCode)) {
|
|
36
|
+
console.error(`${exit ? "exited" : "closed"} with: `, code, signal);
|
|
37
|
+
}
|
|
38
|
+
rej(code);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
res();
|
|
42
|
+
};
|
|
43
|
+
process.on("exit", exitHandler(true));
|
|
44
|
+
// process.on("close", exitHandler(false));
|
|
45
|
+
process.on("disconnect", () => {
|
|
46
|
+
console.error("-----disconnect");
|
|
47
|
+
rej("------disconnect");
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.ShellHelper = ShellHelper;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NanoServer } from '@stechquick/symphony-nanoserver';
|
|
2
|
+
export declare class SocketServerHelper {
|
|
3
|
+
private server;
|
|
4
|
+
private nss;
|
|
5
|
+
private messageTypeLookup;
|
|
6
|
+
constructor(server: NanoServer);
|
|
7
|
+
Start(): this;
|
|
8
|
+
private onSocketConnection;
|
|
9
|
+
private onSocketError;
|
|
10
|
+
private listFilesExecution;
|
|
11
|
+
private saveFilesExecution;
|
|
12
|
+
private deleteFilesExecution;
|
|
13
|
+
private getFilesExecution;
|
|
14
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SocketServerHelper = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const symphony_nanoserver_wsplugin_1 = require("@stechquick/symphony-nanoserver-wsplugin");
|
|
6
|
+
const log_1 = require("@stechquick/symphony-common/lib/log");
|
|
7
|
+
const styling_1 = require("@stechquick/symphony-common/lib/styling");
|
|
8
|
+
const cryptoHelper_1 = require("@stechquick/symphony-common/lib/helpers/cryptoHelper");
|
|
9
|
+
const fileHelper_1 = require("@stechquick/symphony-common/lib/helpers/fileHelper");
|
|
10
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
11
|
+
const path = tslib_1.__importStar(require("path"));
|
|
12
|
+
class SocketServerHelper {
|
|
13
|
+
constructor(server) {
|
|
14
|
+
this.server = server;
|
|
15
|
+
this.nss = new symphony_nanoserver_wsplugin_1.NanoSocketServer({
|
|
16
|
+
onConnection: this.onSocketConnection.bind(this),
|
|
17
|
+
onError: this.onSocketError.bind(this)
|
|
18
|
+
});
|
|
19
|
+
this.messageTypeLookup = {
|
|
20
|
+
"list_files": this.listFilesExecution.bind(this),
|
|
21
|
+
"save_files": this.saveFilesExecution.bind(this),
|
|
22
|
+
"delete_files": this.deleteFilesExecution.bind(this),
|
|
23
|
+
"get_files": this.getFilesExecution.bind(this),
|
|
24
|
+
"file_change": this.getFilesExecution.bind(this),
|
|
25
|
+
"watch_files": this.getFilesExecution.bind(this),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
Start() {
|
|
29
|
+
this.server.AddPlugin(this.nss);
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
onSocketConnection(ns) {
|
|
33
|
+
const timer = setTimeout(() => {
|
|
34
|
+
log_1.Logger.log({ message: styling_1.Chalk.create("red", "unverified client") });
|
|
35
|
+
ns.Close(4001, "unverified client");
|
|
36
|
+
}, 3 * 1000);
|
|
37
|
+
ns.OnMessage = (msg) => {
|
|
38
|
+
if (msg != "hello cli") {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
clearTimeout(timer);
|
|
42
|
+
ns.Send("hello nemo");
|
|
43
|
+
ns.OnMessage = verifiedOnMsg;
|
|
44
|
+
};
|
|
45
|
+
const verifiedOnMsg = async (msg) => {
|
|
46
|
+
const request = JSON.parse(msg.toString());
|
|
47
|
+
const res = await this.messageTypeLookup[request.msg.type](request.msg);
|
|
48
|
+
if (!res) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const networkRes = {
|
|
52
|
+
id: cryptoHelper_1.CryptoHelper.CreateGuid(),
|
|
53
|
+
msg: res,
|
|
54
|
+
reply: request.id
|
|
55
|
+
};
|
|
56
|
+
ns.Send(networkRes);
|
|
57
|
+
};
|
|
58
|
+
console.log("connected", ns.ID);
|
|
59
|
+
}
|
|
60
|
+
onSocketError(error) {
|
|
61
|
+
}
|
|
62
|
+
async listFilesExecution(msg) {
|
|
63
|
+
const selectedPath = path.resolve(msg.path || ".");
|
|
64
|
+
return {
|
|
65
|
+
curPath: selectedPath,
|
|
66
|
+
type: "list_files_resp",
|
|
67
|
+
files: fileHelper_1.FileHelper.getFileNamesFormPath({ selectedPath })
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
async saveFilesExecution(msg) {
|
|
71
|
+
try {
|
|
72
|
+
const filePaths = msg.files.map(file => {
|
|
73
|
+
var _a;
|
|
74
|
+
const filePath = path.resolve(file.name + ((_a = file.ext) !== null && _a !== void 0 ? _a : ""));
|
|
75
|
+
fs.writeFileSync(filePath, file.content, { encoding: "UTF8" });
|
|
76
|
+
return filePath;
|
|
77
|
+
});
|
|
78
|
+
return { type: "save_files_resp", result: true, filePaths };
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
log_1.Logger.log({ message: styling_1.Chalk.create("red.bold", `Saving files error!`), error, level: log_1.LogLevel.error });
|
|
82
|
+
return { type: "save_files_resp", result: false };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async deleteFilesExecution(msg) {
|
|
86
|
+
try {
|
|
87
|
+
msg.files.forEach(file => {
|
|
88
|
+
fs.unlinkSync(path.resolve(file));
|
|
89
|
+
});
|
|
90
|
+
return { type: "delete_files_resp", result: true };
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
log_1.Logger.log({ message: styling_1.Chalk.create("red.bold", `Deleting files error!`), error, level: log_1.LogLevel.error });
|
|
94
|
+
return { type: "delete_files_resp", result: true };
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async getFilesExecution(msg) {
|
|
98
|
+
const retFiles = [];
|
|
99
|
+
msg.files.forEach(file => {
|
|
100
|
+
const content = fs.readFileSync(path.resolve(file), { encoding: "UTF8" });
|
|
101
|
+
retFiles.push({ content, name: file, type: "file" });
|
|
102
|
+
});
|
|
103
|
+
return { files: retFiles, type: "get_files_resp" };
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.SocketServerHelper = SocketServerHelper;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TypeHelper = void 0;
|
|
4
|
+
class TypeHelper {
|
|
5
|
+
static convertToBoolean(value) {
|
|
6
|
+
switch (value) {
|
|
7
|
+
case "true":
|
|
8
|
+
case "True":
|
|
9
|
+
case 1:
|
|
10
|
+
case "1":
|
|
11
|
+
return true;
|
|
12
|
+
case "false":
|
|
13
|
+
case "False":
|
|
14
|
+
case 0:
|
|
15
|
+
case "0":
|
|
16
|
+
return false;
|
|
17
|
+
default:
|
|
18
|
+
throw new Error(`The '${value}' value can't convertable to boolean!`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.TypeHelper = TypeHelper;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class CreateUIHelper {
|
|
2
|
+
private subPath;
|
|
3
|
+
private replaceMap;
|
|
4
|
+
private uiNameRegExp;
|
|
5
|
+
private uiDescRegExp;
|
|
6
|
+
private removeRegExp;
|
|
7
|
+
private createuiSearchPath;
|
|
8
|
+
constructor();
|
|
9
|
+
CreateUI(uiName: string, uiDesc: string): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateUIHelper = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
6
|
+
const path = tslib_1.__importStar(require("path"));
|
|
7
|
+
const cli_ux_1 = tslib_1.__importDefault(require("cli-ux"));
|
|
8
|
+
const fileHelper_1 = require("@stechquick/symphony-common/lib/helpers/fileHelper");
|
|
9
|
+
class CreateUIHelper {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.subPath = "./";
|
|
12
|
+
this.replaceMap = new Map();
|
|
13
|
+
this.uiNameRegExp = /{{UIName}}/g;
|
|
14
|
+
this.uiDescRegExp = /{{UIDesc}}/g;
|
|
15
|
+
this.removeRegExp = /{{remove}}/g;
|
|
16
|
+
this.createuiSearchPath = "../../../../templates/createui";
|
|
17
|
+
this.replaceMap.set(this.removeRegExp, "");
|
|
18
|
+
}
|
|
19
|
+
async CreateUI(uiName, uiDesc) {
|
|
20
|
+
this.replaceMap.set(this.uiNameRegExp, uiName);
|
|
21
|
+
this.replaceMap.set(this.uiDescRegExp, uiDesc);
|
|
22
|
+
const existsSubPath = fs.existsSync(this.subPath + uiName);
|
|
23
|
+
if (existsSubPath) {
|
|
24
|
+
const answer = await cli_ux_1.default.confirm("App: " + uiName + " already exists. If you have any, you will lose your pending changes. Would you like to overwrite it?");
|
|
25
|
+
if (!answer) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const templatePath = path.join(path.resolve(__dirname), "../.." + this.createuiSearchPath);
|
|
30
|
+
return fileHelper_1.FileHelper.exportFiles({ sourcePath: templatePath, targetPath: "./", replaceMap: this.replaceMap });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.CreateUIHelper = CreateUIHelper;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class FolderCopier {
|
|
2
|
+
ForEachItemInFolder(folder: string, iterator: (folder: string, item: string, relativeFolder: string, isDirectory: boolean) => void, willIterateFolder?: (folder: string, item: string, relativeFolder: string) => boolean): void;
|
|
3
|
+
CopyFolder(source: string, destination: string, except?: Array<string>): void;
|
|
4
|
+
CopyFile(source: string, destination: string, options?: {
|
|
5
|
+
copyIfExists?: boolean;
|
|
6
|
+
}): void;
|
|
7
|
+
DeleteFolder(target: string): void;
|
|
8
|
+
private ReplaceFile;
|
|
9
|
+
private substringBetween;
|
|
10
|
+
private getReplaceFiles;
|
|
11
|
+
private convertYamlstoJS;
|
|
12
|
+
Execute(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FolderCopier = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
6
|
+
const path = tslib_1.__importStar(require("path"));
|
|
7
|
+
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
8
|
+
const log_1 = require("@stechquick/symphony-common/lib/log");
|
|
9
|
+
const styling_1 = require("@stechquick/symphony-common/lib/styling");
|
|
10
|
+
;
|
|
11
|
+
class FolderCopier {
|
|
12
|
+
ForEachItemInFolder(folder, iterator, willIterateFolder) {
|
|
13
|
+
function forEachItemInFoderInternal(folder, curRelative) {
|
|
14
|
+
fs.readdirSync(folder).forEach(item => {
|
|
15
|
+
const curItemPath = path.join(folder, item);
|
|
16
|
+
const isDirectory = fs.statSync(curItemPath).isDirectory();
|
|
17
|
+
if (isDirectory) {
|
|
18
|
+
if (!willIterateFolder || (willIterateFolder === null || willIterateFolder === void 0 ? void 0 : willIterateFolder(folder, item, curRelative))) {
|
|
19
|
+
forEachItemInFoderInternal(curItemPath, curRelative + "/" + item);
|
|
20
|
+
iterator(folder, item, curRelative, true);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
iterator(folder, item, curRelative, false);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
forEachItemInFoderInternal(folder, "");
|
|
29
|
+
}
|
|
30
|
+
;
|
|
31
|
+
CopyFolder(source, destination, except) {
|
|
32
|
+
const exceptDict = (except === null || except === void 0 ? void 0 : except.length) ? except.reduce((prev, current) => { prev[current] = true; return prev; }, {}) : undefined;
|
|
33
|
+
this.ForEachItemInFolder(source, (folder, item, relativeFolder, isDirectory) => {
|
|
34
|
+
if (isDirectory) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (exceptDict) {
|
|
38
|
+
const relativeItemPath = path.join(relativeFolder, item);
|
|
39
|
+
if (exceptDict[relativeItemPath]) {
|
|
40
|
+
console.log("Skip: " + relativeItemPath);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const srcPath = path.resolve(path.join(folder, item));
|
|
45
|
+
const destPath = path.resolve(path.join(destination, relativeFolder));
|
|
46
|
+
if (!fs.existsSync(destPath)) {
|
|
47
|
+
fs.mkdirSync(destPath, { recursive: true });
|
|
48
|
+
}
|
|
49
|
+
//console.log(`Dir: ${srcPath}-->${destPath}`);
|
|
50
|
+
fs.copyFileSync(srcPath, path.join(destPath, item));
|
|
51
|
+
}, (folder, item, relativeFolder) => {
|
|
52
|
+
const relativeItemPath = path.join(relativeFolder, item);
|
|
53
|
+
if (exceptDict === null || exceptDict === void 0 ? void 0 : exceptDict[relativeItemPath]) {
|
|
54
|
+
console.log("Skip: " + relativeItemPath);
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
CopyFile(source, destination, options = {}) {
|
|
61
|
+
const pathParsed = path.parse(source);
|
|
62
|
+
const srcFile = path.resolve(source);
|
|
63
|
+
if (options.copyIfExists && !fs.existsSync(srcFile)) {
|
|
64
|
+
log_1.Logger.log({ message: "Skipping copy: " + srcFile });
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const destPath = path.resolve(destination);
|
|
68
|
+
if (!fs.existsSync(destPath)) {
|
|
69
|
+
fs.mkdirSync(destPath, { recursive: true });
|
|
70
|
+
}
|
|
71
|
+
const destFile = path.join(destPath, pathParsed.base);
|
|
72
|
+
console.log(`File: ${srcFile}-->${destFile}`);
|
|
73
|
+
fs.copyFileSync(srcFile, destFile);
|
|
74
|
+
}
|
|
75
|
+
DeleteFolder(target) {
|
|
76
|
+
if (!fs.existsSync(target)) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
this.ForEachItemInFolder(target, (folder, item, relativeFolder, isDirectory) => {
|
|
80
|
+
const curPath = path.join(folder, item);
|
|
81
|
+
if (isDirectory) {
|
|
82
|
+
fs.rmdirSync(curPath);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
fs.unlinkSync(path.join(folder, item));
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
ReplaceFile(source, skipIfNone, cb) {
|
|
90
|
+
const srcFile = path.resolve(source);
|
|
91
|
+
if (!fs.existsSync(srcFile)) {
|
|
92
|
+
console.log(`${srcFile} does not exists skip: ${skipIfNone}`);
|
|
93
|
+
if (skipIfNone) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const fileBody = fs.readFileSync(srcFile, { encoding: "utf-8" });
|
|
98
|
+
const fileName = path.parse(srcFile).base;
|
|
99
|
+
const newFileData = cb({ fileBody, fileName });
|
|
100
|
+
fs.unlinkSync(srcFile);
|
|
101
|
+
fs.writeFileSync(srcFile.replace(fileName, newFileData.fileName), newFileData.fileBody, { encoding: "utf-8" });
|
|
102
|
+
}
|
|
103
|
+
substringBetween(sourceString, start, end) {
|
|
104
|
+
let startIndex = sourceString.indexOf(start);
|
|
105
|
+
if (startIndex < 0) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
startIndex = startIndex + start.length;
|
|
109
|
+
let endIndex = sourceString.length;
|
|
110
|
+
if (end) {
|
|
111
|
+
endIndex = sourceString.indexOf(end, startIndex);
|
|
112
|
+
if (endIndex < 0) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return sourceString.substring(startIndex, endIndex);
|
|
117
|
+
}
|
|
118
|
+
getReplaceFiles() {
|
|
119
|
+
return [{
|
|
120
|
+
fileName: "./dist/client/static/js/componentList.ts",
|
|
121
|
+
fileReplacer: (fileData) => {
|
|
122
|
+
const retVal = { fileName: fileData.fileName.replace(".ts", ".js"), fileBody: "" };
|
|
123
|
+
let fileBody = this.substringBetween(fileData.fileBody, "//#region JS Section");
|
|
124
|
+
if (!fileBody) {
|
|
125
|
+
return retVal;
|
|
126
|
+
}
|
|
127
|
+
retVal.fileBody = fileBody.replace(": ComponentOptions =", " =");
|
|
128
|
+
return retVal;
|
|
129
|
+
}
|
|
130
|
+
}];
|
|
131
|
+
}
|
|
132
|
+
convertYamlstoJS() {
|
|
133
|
+
const yamlPaths = ["settings", "localProxy"];
|
|
134
|
+
let arrangedJSON = Object.create({ settings: {}, proxy: {} });
|
|
135
|
+
let resolvedPath = "";
|
|
136
|
+
let fileName = "";
|
|
137
|
+
yamlPaths.forEach(item => {
|
|
138
|
+
let tempPath = `./settings/${item}.yaml`;
|
|
139
|
+
resolvedPath = path.resolve(tempPath);
|
|
140
|
+
fileName = path.parse(resolvedPath).base;
|
|
141
|
+
let fileContent = fs.readFileSync(tempPath, "utf8");
|
|
142
|
+
arrangedJSON[item] = js_yaml_1.default.safeLoad(fileContent);
|
|
143
|
+
});
|
|
144
|
+
let concattedYamlString = "const yamlObject = "
|
|
145
|
+
+ JSON.stringify(arrangedJSON, null, '\t')
|
|
146
|
+
+ "\nif (typeof exports === 'object' && typeof module === 'object'){\n \tmodule.exports = yamlObject;\n}else{ \n\twindow['QEditorSettingsProxy'] = yamlObject;\n}";
|
|
147
|
+
fs.writeFileSync(resolvedPath.replace(fileName, "settings-proxy.js"), concattedYamlString, { encoding: "utf-8" });
|
|
148
|
+
}
|
|
149
|
+
Execute() {
|
|
150
|
+
this.DeleteFolder("./dist");
|
|
151
|
+
log_1.Logger.log({ message: styling_1.Chalk.create("green.bold", "Folders copying..."), timeFormat: "datetime" });
|
|
152
|
+
this.CopyFolder("./node_modules/quick_qui/dist", "./dist", ["build"]); // build'klasörünü hariç tut
|
|
153
|
+
this.convertYamlstoJS();
|
|
154
|
+
this.CopyFolder("./settings", "./dist/client/settings", ["localProxy.yaml", "server"]);
|
|
155
|
+
this.CopyFolder("./settings", "./dist/server/settings");
|
|
156
|
+
//this.CopyFolder("./certificates", "./dist/server/certificates");
|
|
157
|
+
this.CopyFolder("./static", "./dist/client/static");
|
|
158
|
+
this.CopyFile("./worker/a9e657cbf4abb977edda.worker.js", "./dist/client", { copyIfExists: true });
|
|
159
|
+
log_1.Logger.log({ message: styling_1.Chalk.create("green.bold", "Folders copied successfully."), timeFormat: "datetime" });
|
|
160
|
+
this.getReplaceFiles().forEach(item => this.ReplaceFile(item.fileName, true, item.fileReplacer));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
exports.FolderCopier = FolderCopier;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Utils = void 0;
|
|
4
|
+
class Utils {
|
|
5
|
+
static getDateAsString({ date, dateSplitter, timeSplitter, dateAndTimeSplitter } = {}) {
|
|
6
|
+
date = date !== null && date !== void 0 ? date : new Date();
|
|
7
|
+
dateSplitter = dateSplitter !== null && dateSplitter !== void 0 ? dateSplitter : "-";
|
|
8
|
+
timeSplitter = timeSplitter !== null && timeSplitter !== void 0 ? timeSplitter : ".";
|
|
9
|
+
dateAndTimeSplitter = dateAndTimeSplitter !== null && dateAndTimeSplitter !== void 0 ? dateAndTimeSplitter : "@";
|
|
10
|
+
const locale = "tr-TR";
|
|
11
|
+
const year = new Intl.DateTimeFormat(locale, { year: 'numeric' }).format(date);
|
|
12
|
+
const month = new Intl.DateTimeFormat(locale, { month: '2-digit' }).format(date);
|
|
13
|
+
const day = new Intl.DateTimeFormat(locale, { day: '2-digit' }).format(date);
|
|
14
|
+
const hour = new Intl.DateTimeFormat(locale, { hour: '2-digit' }).format(date);
|
|
15
|
+
const minute = new Intl.DateTimeFormat(locale, { minute: '2-digit' }).format(date);
|
|
16
|
+
const second = new Intl.DateTimeFormat(locale, { second: '2-digit' }).format(date);
|
|
17
|
+
return `${year}${dateSplitter}${month}${dateSplitter}${day}${dateAndTimeSplitter}${hour}${timeSplitter}${minute}${timeSplitter}${second}`;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.Utils = Utils;
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { run } from '@oclif/command';
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PathFinder = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const path = tslib_1.__importStar(require("path"));
|
|
6
|
+
class PathFinder {
|
|
7
|
+
static RootPath(fromRootPath) {
|
|
8
|
+
const retVal = path.join(PathFinder.dirname, fromRootPath);
|
|
9
|
+
return retVal;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.PathFinder = PathFinder;
|
|
13
|
+
PathFinder.dirname = path.resolve(__dirname + "/..");
|