underpost 2.8.31 → 2.8.42
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/.github/workflows/ghpkg.yml +10 -7
- package/.github/workflows/pwa-microservices-template.page.yml +10 -3
- package/.vscode/extensions.json +9 -0
- package/.vscode/settings.json +10 -4
- package/AUTHORS.md +16 -5
- package/CHANGELOG.md +8 -0
- package/Dockerfile +19 -26
- package/README.md +1 -1
- package/bin/build.js +283 -0
- package/bin/db.js +2 -24
- package/bin/deploy.js +59 -49
- package/bin/file.js +3 -2
- package/bin/index.js +34 -41
- package/bin/util.js +9 -89
- package/bin/vs.js +22 -0
- package/conf.js +27 -143
- package/docker-compose.yml +1 -1
- package/manifests/core/kustomization.yaml +11 -0
- package/manifests/kind-config.yaml +12 -0
- package/manifests/letsencrypt-prod.yaml +15 -0
- package/package.json +4 -33
- package/src/api/user/user.model.js +7 -2
- package/src/client/components/core/CalendarCore.js +3 -0
- package/src/client/components/core/CommonJs.js +25 -0
- package/src/client/components/core/Modal.js +5 -5
- package/src/client/components/core/Panel.js +3 -1
- package/src/client/components/core/Translate.js +16 -4
- package/src/client/components/core/Validator.js +9 -1
- package/src/client/services/default/default.management.js +4 -2
- package/src/index.js +8 -1
- package/src/runtime/lampp/Lampp.js +1 -13
- package/src/runtime/xampp/Xampp.js +0 -13
- package/src/server/auth.js +3 -3
- package/src/server/client-build.js +3 -13
- package/src/server/conf.js +294 -27
- package/src/server/dns.js +2 -3
- package/src/server/logger.js +10 -5
- package/src/server/network.js +0 -36
- package/src/server/process.js +1 -1
- package/src/server/project.js +39 -0
- package/src/server/proxy.js +4 -26
- package/src/server/runtime.js +6 -7
- package/manifests/test/underpost-engine-pod.yaml +0 -108
- package/src/server/prompt-optimizer.js +0 -28
- /package/manifests/{underpost-engine-backup-access.yaml → core/underpost-engine-backup-access.yaml} +0 -0
- /package/manifests/{underpost-engine-backup-pv-pvc.yaml → core/underpost-engine-backup-pv-pvc.yaml} +0 -0
- /package/manifests/{underpost-engine-headless-service.yaml → core/underpost-engine-headless-service.yaml} +0 -0
- /package/manifests/{underpost-engine-mongodb-backup-cronjob.yaml → core/underpost-engine-mongodb-backup-cronjob.yaml} +0 -0
- /package/manifests/{test → core}/underpost-engine-mongodb-configmap.yaml +0 -0
- /package/manifests/{underpost-engine-pv-pvc.yaml → core/underpost-engine-pv-pvc.yaml} +0 -0
- /package/manifests/{underpost-engine-statefulset.yaml → core/underpost-engine-statefulset.yaml} +0 -0
- /package/manifests/{test → deployment}/mongo-express.yaml +0 -0
- /package/manifests/{test → deployment}/phpmyadmin.yaml +0 -0
package/bin/deploy.js
CHANGED
|
@@ -4,7 +4,7 @@ import axios from 'axios';
|
|
|
4
4
|
import dotenv from 'dotenv';
|
|
5
5
|
import plantuml from 'plantuml';
|
|
6
6
|
|
|
7
|
-
import { shellCd, shellExec } from '../src/server/process.js';
|
|
7
|
+
import { pbcopy, shellCd, shellExec } from '../src/server/process.js';
|
|
8
8
|
import { loggerFactory } from '../src/server/logger.js';
|
|
9
9
|
import {
|
|
10
10
|
Config,
|
|
@@ -29,7 +29,6 @@ import {
|
|
|
29
29
|
} from '../src/server/conf.js';
|
|
30
30
|
import { buildClient } from '../src/server/client-build.js';
|
|
31
31
|
import { range, setPad, timer, uniqueArray } from '../src/client/components/core/CommonJs.js';
|
|
32
|
-
import simpleGit from 'simple-git';
|
|
33
32
|
import { MongooseDB } from '../src/db/mongo/MongooseDB.js';
|
|
34
33
|
import { Lampp } from '../src/runtime/lampp/Lampp.js';
|
|
35
34
|
import { DefaultConf } from '../conf.js';
|
|
@@ -139,8 +138,7 @@ try {
|
|
|
139
138
|
}
|
|
140
139
|
break;
|
|
141
140
|
case 'conf': {
|
|
142
|
-
loadConf(process.argv[3]);
|
|
143
|
-
if (process.argv[4]) fs.writeFileSync(`.env`, fs.readFileSync(`.env.${process.argv[4]}`, 'utf8'), 'utf8');
|
|
141
|
+
loadConf(process.argv[3], process.argv[4]);
|
|
144
142
|
break;
|
|
145
143
|
}
|
|
146
144
|
case 'run':
|
|
@@ -307,7 +305,7 @@ try {
|
|
|
307
305
|
}
|
|
308
306
|
|
|
309
307
|
case 'adminer': {
|
|
310
|
-
const directory = '/dd/engine/public/adminer';
|
|
308
|
+
const directory = '/home/dd/engine/public/adminer';
|
|
311
309
|
// const host = '127.0.0.1';
|
|
312
310
|
const host = 'localhost';
|
|
313
311
|
const port = 80;
|
|
@@ -337,7 +335,7 @@ try {
|
|
|
337
335
|
|
|
338
336
|
case 'pma':
|
|
339
337
|
{
|
|
340
|
-
const directory = '/dd/engine/public/phpmyadmin';
|
|
338
|
+
const directory = '/home/dd/engine/public/phpmyadmin';
|
|
341
339
|
// const host = '127.0.0.1';
|
|
342
340
|
const host = 'localhost';
|
|
343
341
|
const port = 80;
|
|
@@ -733,6 +731,16 @@ try {
|
|
|
733
731
|
originPackage.version = newVersion;
|
|
734
732
|
fs.writeFileSync(filePah, JSON.stringify(originPackage, null, 4), 'utf8');
|
|
735
733
|
}
|
|
734
|
+
if (filePah.split('/').pop() === 'deployment.yaml') {
|
|
735
|
+
fs.writeFileSync(
|
|
736
|
+
filePah,
|
|
737
|
+
fs
|
|
738
|
+
.readFileSync(filePah, 'utf8')
|
|
739
|
+
.replaceAll(`v${version}`, `v${newVersion}`)
|
|
740
|
+
.replaceAll(`engine.version: ${version}`, `engine.version: ${newVersion}`),
|
|
741
|
+
'utf8',
|
|
742
|
+
);
|
|
743
|
+
}
|
|
736
744
|
}
|
|
737
745
|
}
|
|
738
746
|
|
|
@@ -753,14 +761,6 @@ try {
|
|
|
753
761
|
'utf8',
|
|
754
762
|
);
|
|
755
763
|
|
|
756
|
-
fs.writeFileSync(
|
|
757
|
-
`./manifests/test/underpost-engine-pod.yaml`,
|
|
758
|
-
fs
|
|
759
|
-
.readFileSync(`./manifests/test/underpost-engine-pod.yaml`, 'utf8')
|
|
760
|
-
.replaceAll(`underpost-engine:v${version}`, `underpost-engine:v${newVersion}`),
|
|
761
|
-
'utf8',
|
|
762
|
-
);
|
|
763
|
-
|
|
764
764
|
fs.writeFileSync(
|
|
765
765
|
`./src/index.js`,
|
|
766
766
|
fs.readFileSync(`./src/index.js`, 'utf8').replaceAll(`${version}`, `${newVersion}`),
|
|
@@ -773,29 +773,19 @@ try {
|
|
|
773
773
|
break;
|
|
774
774
|
|
|
775
775
|
case 'update-authors': {
|
|
776
|
-
//
|
|
777
|
-
const logs = await simpleGit().log();
|
|
778
|
-
|
|
776
|
+
// #### Ordered by first contribution.
|
|
779
777
|
fs.writeFileSync(
|
|
780
778
|
'./AUTHORS.md',
|
|
781
779
|
`# Authors
|
|
782
780
|
|
|
783
|
-
#### Ordered by first contribution.
|
|
784
781
|
|
|
785
|
-
${
|
|
786
|
-
`)}
|
|
782
|
+
${shellExec(`git log | grep Author: | sort -u`, { stdout: true }).split(`\n`).join(`\n\n\n`)}
|
|
787
783
|
|
|
788
784
|
#### Generated by [underpost.net](https://underpost.net)`,
|
|
789
785
|
'utf8',
|
|
790
786
|
);
|
|
791
787
|
|
|
792
|
-
|
|
793
|
-
// date: '2024-09-16T17:10:13-03:00',
|
|
794
|
-
// message: 'update',
|
|
795
|
-
// refs: '',
|
|
796
|
-
// body: '',
|
|
797
|
-
// author_name: 'fcoverdugo',
|
|
798
|
-
// author_email: 'fcoverdugoa@underpost.net'
|
|
788
|
+
break;
|
|
799
789
|
}
|
|
800
790
|
|
|
801
791
|
case 'restore-macro-db':
|
|
@@ -837,10 +827,10 @@ ${uniqueArray(logs.all.map((log) => `- ${log.author_name} ([${log.author_email}]
|
|
|
837
827
|
shellExec(`bin/besu --help`);
|
|
838
828
|
|
|
839
829
|
// Set env path
|
|
840
|
-
// export PATH=$PATH:/dd/besu-24.9.1/bin
|
|
830
|
+
// export PATH=$PATH:/home/dd/besu-24.9.1/bin
|
|
841
831
|
|
|
842
832
|
// Open src
|
|
843
|
-
// shellExec(`sudo code /dd/besu-24.9.1 --user-data-dir="/root/.vscode-root" --no-sandbox`);
|
|
833
|
+
// shellExec(`sudo code /home/dd/besu-24.9.1 --user-data-dir="/root/.vscode-root" --no-sandbox`);
|
|
844
834
|
}
|
|
845
835
|
|
|
846
836
|
break;
|
|
@@ -858,23 +848,43 @@ ${uniqueArray(logs.all.map((log) => `- ${log.author_name} ([${log.author_email}]
|
|
|
858
848
|
}
|
|
859
849
|
|
|
860
850
|
case 'update-default-conf': {
|
|
861
|
-
const
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
`,
|
|
876
|
-
'utf8'
|
|
877
|
-
|
|
851
|
+
const defaultServer = DefaultConf.server['default.net']['/'];
|
|
852
|
+
let confName = process.argv[3];
|
|
853
|
+
if (confName === 'ghpkg') {
|
|
854
|
+
confName = undefined;
|
|
855
|
+
const host = 'underpostnet.github.io';
|
|
856
|
+
const path = '/pwa-microservices-template-ghpkg';
|
|
857
|
+
DefaultConf.server = {
|
|
858
|
+
[host]: { [path]: defaultServer },
|
|
859
|
+
};
|
|
860
|
+
DefaultConf.server[host][path].apiBaseProxyPath = '/';
|
|
861
|
+
DefaultConf.server[host][path].apiBaseHost = 'www.nexodev.org';
|
|
862
|
+
} else if (confName) {
|
|
863
|
+
DefaultConf.client = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.client.json`, 'utf8'));
|
|
864
|
+
DefaultConf.server = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.server.json`, 'utf8'));
|
|
865
|
+
DefaultConf.ssr = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.ssr.json`, 'utf8'));
|
|
866
|
+
DefaultConf.cron = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.cron.json`, 'utf8'));
|
|
867
|
+
|
|
868
|
+
for (const host of Object.keys(DefaultConf.server)) {
|
|
869
|
+
for (const path of Object.keys(DefaultConf.server[host])) {
|
|
870
|
+
DefaultConf.server[host][path].db = defaultServer.db;
|
|
871
|
+
DefaultConf.server[host][path].mailer = defaultServer.mailer;
|
|
872
|
+
|
|
873
|
+
delete DefaultConf.server[host][path]._wp_client;
|
|
874
|
+
delete DefaultConf.server[host][path]._wp_git;
|
|
875
|
+
delete DefaultConf.server[host][path]._wp_directory;
|
|
876
|
+
delete DefaultConf.server[host][path].wp;
|
|
877
|
+
delete DefaultConf.server[host][path].git;
|
|
878
|
+
delete DefaultConf.server[host][path].directory;
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
const sepRender = '/**/';
|
|
883
|
+
const confRawPaths = fs.readFileSync('./conf.js', 'utf8').split(sepRender);
|
|
884
|
+
confRawPaths[1] = `${JSON.stringify(DefaultConf)};`;
|
|
885
|
+
const targetConfPath = `./conf${confName ? `.${confName}` : ''}.js`;
|
|
886
|
+
fs.writeFileSync(targetConfPath, confRawPaths.join(sepRender), 'utf8');
|
|
887
|
+
shellExec(`prettier --write ${targetConfPath}`);
|
|
878
888
|
|
|
879
889
|
break;
|
|
880
890
|
}
|
|
@@ -1045,15 +1055,15 @@ ${uniqueArray(logs.all.map((log) => `- ${log.author_name} ([${log.author_email}]
|
|
|
1045
1055
|
shellExec(`sudo systemctl start valkey`);
|
|
1046
1056
|
shellExec(`valkey-cli ping`);
|
|
1047
1057
|
} else {
|
|
1048
|
-
shellExec(`cd /dd && git clone https://github.com/valkey-io/valkey.git`);
|
|
1049
|
-
shellExec(`cd /dd/valkey && make`);
|
|
1058
|
+
shellExec(`cd /home/dd && git clone https://github.com/valkey-io/valkey.git`);
|
|
1059
|
+
shellExec(`cd /home/dd/valkey && make`);
|
|
1050
1060
|
shellExec(`apt install valkey-tools`); // valkey-cli
|
|
1051
1061
|
}
|
|
1052
1062
|
}
|
|
1053
1063
|
if (process.argv.includes('rocky')) {
|
|
1054
1064
|
shellExec(`sudo systemctl stop valkey`);
|
|
1055
1065
|
shellExec(`sudo systemctl start valkey`);
|
|
1056
|
-
} else shellExec(`cd /dd/valkey && ./src/valkey-server`);
|
|
1066
|
+
} else shellExec(`cd /home/dd/valkey && ./src/valkey-server`);
|
|
1057
1067
|
|
|
1058
1068
|
break;
|
|
1059
1069
|
}
|
package/bin/file.js
CHANGED
|
@@ -86,10 +86,11 @@ try {
|
|
|
86
86
|
'.github/workflows/docker-image.yml',
|
|
87
87
|
'.github/workflows/deploy.ssh.yml',
|
|
88
88
|
'.github/workflows/deploy.api-rest.yml',
|
|
89
|
+
'.github/workflows/engine.lampp.ci.yml',
|
|
90
|
+
'.github/workflows/engine.core.ci.yml',
|
|
91
|
+
'.github/workflows/engine.cyberia.ci.yml',
|
|
89
92
|
'bin/web3.js',
|
|
90
93
|
'bin/cyberia.js',
|
|
91
|
-
'src/ipfs.js',
|
|
92
|
-
'src/k8s.js',
|
|
93
94
|
]) {
|
|
94
95
|
fs.removeSync('../pwa-microservices-template/' + deletePath);
|
|
95
96
|
}
|
package/bin/index.js
CHANGED
|
@@ -2,22 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import dotenv from 'dotenv';
|
|
4
4
|
import { shellCd, shellExec } from '../src/server/process.js';
|
|
5
|
-
import fs from 'fs-extra';
|
|
6
5
|
import { Command } from 'commander';
|
|
7
|
-
import {
|
|
8
|
-
import { loggerFactory, underpostASCI } from '../src/server/logger.js';
|
|
6
|
+
import { actionInitLog, loggerFactory } from '../src/server/logger.js';
|
|
9
7
|
import Underpost from '../src/index.js';
|
|
10
8
|
|
|
11
9
|
dotenv.config();
|
|
12
10
|
|
|
13
11
|
const logger = loggerFactory(import.meta);
|
|
14
12
|
|
|
15
|
-
const globalBinFolder = `${shellExec(`npm root -g`, {
|
|
16
|
-
stdout: true,
|
|
17
|
-
silent: true,
|
|
18
|
-
disableLog: true,
|
|
19
|
-
}).trim()}/underpost`;
|
|
20
|
-
|
|
21
13
|
const program = new Command();
|
|
22
14
|
|
|
23
15
|
program.name('underpost').description(`underpost.net ci/cd cli ${Underpost.version}`).version(Underpost.version);
|
|
@@ -25,40 +17,39 @@ program.name('underpost').description(`underpost.net ci/cd cli ${Underpost.versi
|
|
|
25
17
|
program
|
|
26
18
|
.command('new <app-name>')
|
|
27
19
|
.description('Create a new project')
|
|
28
|
-
.action(
|
|
29
|
-
console.log(
|
|
30
|
-
underpostASCI() +
|
|
31
|
-
`
|
|
32
|
-
${Underpost.version} https://www.nexodev.org/docs
|
|
33
|
-
`,
|
|
34
|
-
);
|
|
35
|
-
await logger.setUpInfo();
|
|
36
|
-
const destFolder = `${process.cwd()}/${appName}`;
|
|
37
|
-
logger.info('Note: This process may take several minutes to complete');
|
|
38
|
-
logger.info('build app', { destFolder });
|
|
39
|
-
fs.mkdirSync(destFolder, { recursive: true });
|
|
40
|
-
fs.copySync(globalBinFolder, destFolder);
|
|
41
|
-
fs.writeFileSync(`${destFolder}/.gitignore`, fs.readFileSync(`${globalBinFolder}/.dockerignore`, 'utf8'), 'utf8');
|
|
42
|
-
shellCd(`${destFolder}`);
|
|
43
|
-
shellExec(`git init && git add . && git commit -m "Base template implementation"`);
|
|
44
|
-
shellExec(`npm install`);
|
|
45
|
-
shellExec(`npm run build`);
|
|
46
|
-
shellExec(`npm run dev`);
|
|
47
|
-
});
|
|
20
|
+
.action((...args) => ((args[1] = Underpost.version), new Underpost.project(...args)));
|
|
48
21
|
|
|
49
22
|
program
|
|
50
|
-
.command('
|
|
51
|
-
.description('
|
|
52
|
-
.action(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
23
|
+
.command('clone <uri>')
|
|
24
|
+
.description('Clone github repository, if your GITHUB_TOKEN environment exists, it will be used')
|
|
25
|
+
.action(Underpost.project.clone);
|
|
26
|
+
|
|
27
|
+
program
|
|
28
|
+
.command('pull <path> <uri>')
|
|
29
|
+
.description('Pull github repository, if your GITHUB_TOKEN environment exists, it will be used')
|
|
30
|
+
.action(Underpost.project.pull);
|
|
31
|
+
|
|
32
|
+
program
|
|
33
|
+
.option('--copy')
|
|
34
|
+
.option('--info')
|
|
35
|
+
.option('--empty')
|
|
36
|
+
.command('cmt <path> [commit-type] [sub-module] [message]')
|
|
37
|
+
.description(
|
|
38
|
+
'Commit github repository, if your GITHUB_TOKEN environment exists, it will be used, use --copy will copy to clipboard message, use --info will see info commit types, use --empty will allow empty files',
|
|
39
|
+
)
|
|
40
|
+
.action((...args) => ((args[4] = options), Underpost.project.commit(...args)));
|
|
41
|
+
|
|
42
|
+
program
|
|
43
|
+
.command('push <path> <uri>')
|
|
44
|
+
.description('Push github repository, if your GITHUB_TOKEN environment exists, it will be used')
|
|
45
|
+
.action(Underpost.project.push);
|
|
46
|
+
|
|
47
|
+
program
|
|
48
|
+
.command('env <deploy-id> [env]')
|
|
49
|
+
.description('Set environment variables files and conf related to <deploy-id>')
|
|
50
|
+
.action(Underpost.project.useEnv);
|
|
51
|
+
|
|
52
|
+
program.command('test').description('Run tests').action(Underpost.runTest);
|
|
62
53
|
|
|
63
54
|
program
|
|
64
55
|
.command('help')
|
|
@@ -67,4 +58,6 @@ program
|
|
|
67
58
|
program.outputHelp();
|
|
68
59
|
});
|
|
69
60
|
|
|
61
|
+
const options = program.opts();
|
|
62
|
+
|
|
70
63
|
program.parse();
|
package/bin/util.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
|
-
import merge from 'deepmerge';
|
|
3
2
|
import si from 'systeminformation';
|
|
4
3
|
import * as dir from 'path';
|
|
5
4
|
import { svg } from 'font-awesome-assets';
|
|
@@ -7,12 +6,10 @@ import axios from 'axios';
|
|
|
7
6
|
import https from 'https';
|
|
8
7
|
|
|
9
8
|
import { loggerFactory } from '../src/server/logger.js';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { network } from '../src/server/network.js';
|
|
13
|
-
import { Config } from '../src/server/conf.js';
|
|
9
|
+
import { pbcopy, shellExec } from '../src/server/process.js';
|
|
10
|
+
import { buildKindPorts } from '../src/server/conf.js';
|
|
14
11
|
import { FileFactory } from '../src/api/file/file.service.js';
|
|
15
|
-
import {
|
|
12
|
+
import { faBase64Png, getBufferPngText } from '../src/server/client-icons.js';
|
|
16
13
|
import keyword_extractor from 'keyword-extractor';
|
|
17
14
|
|
|
18
15
|
const httpsAgent = new https.Agent({
|
|
@@ -29,35 +26,10 @@ const operator = process.argv[2];
|
|
|
29
26
|
try {
|
|
30
27
|
// let cmd;
|
|
31
28
|
switch (operator) {
|
|
32
|
-
case 'cls':
|
|
33
|
-
fs.removeSync('./public');
|
|
34
|
-
fs.removeSync('./logs');
|
|
35
|
-
fs.removeSync('./conf');
|
|
36
|
-
// fs.removeSync('./engine-private');
|
|
37
|
-
// fs.removeSync('./node_modules');
|
|
38
|
-
break;
|
|
39
29
|
case 'log':
|
|
40
|
-
(()
|
|
41
|
-
const logPath = `./logs/${process.argv[3]}/${process.argv[4]}.log`;
|
|
42
|
-
logger.info('Read', logPath);
|
|
43
|
-
console.log(fs.readFileSync(logPath, 'utf8'));
|
|
44
|
-
})();
|
|
45
|
-
break;
|
|
46
|
-
case 'kill-ports':
|
|
47
|
-
if (!process.argv[3]) process.argv[3] = '22,80,443,3000-3020';
|
|
48
|
-
for (const port of process.argv[3].split(',')) {
|
|
49
|
-
const rangePort = port.split('-');
|
|
50
|
-
if (rangePort[1])
|
|
51
|
-
for (const port of range(parseInt(rangePort[0]), parseInt(rangePort[1]))) {
|
|
52
|
-
logger.info('clean port', port);
|
|
53
|
-
await network.port.portClean(port);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
logger.info('clean port', parseInt(port));
|
|
57
|
-
await network.port.portClean(port);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
30
|
+
console.log(fs.readFileSync(process.argv[3], 'utf8'));
|
|
60
31
|
break;
|
|
32
|
+
|
|
61
33
|
case 'system-info':
|
|
62
34
|
await (async () => {
|
|
63
35
|
for (const infoKey of Object.keys(si)) {
|
|
@@ -74,56 +46,6 @@ try {
|
|
|
74
46
|
}
|
|
75
47
|
})();
|
|
76
48
|
break;
|
|
77
|
-
case 'export-git-changes':
|
|
78
|
-
{
|
|
79
|
-
const baseFrom = process.argv[3];
|
|
80
|
-
const baseTo = process.argv[4];
|
|
81
|
-
// if (fs.existsSync(baseTo)) fs.removeSync(baseTo);
|
|
82
|
-
shellCd(baseFrom);
|
|
83
|
-
{
|
|
84
|
-
try {
|
|
85
|
-
let output = shellExec('git status', { silent: true, stdout: true });
|
|
86
|
-
console.log('output:', output);
|
|
87
|
-
output = output
|
|
88
|
-
.split(`to discard changes in working directory)`)[1]
|
|
89
|
-
.split(`Untracked files:`)[0]
|
|
90
|
-
.split('modified:')
|
|
91
|
-
.map((c) => c.trim().replaceAll(`\n`, ''));
|
|
92
|
-
output[output.length - 1] = output[output.length - 1].split('no changes added to commit')[0];
|
|
93
|
-
output.shift();
|
|
94
|
-
for (const fromPath of output) {
|
|
95
|
-
const from = `${baseFrom}/${fromPath}`;
|
|
96
|
-
const to = `${baseTo}/${fromPath}`;
|
|
97
|
-
logger.info('Copy path', { from, to });
|
|
98
|
-
fs.copySync(from, to);
|
|
99
|
-
}
|
|
100
|
-
} catch (error) {
|
|
101
|
-
logger.error(error);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
{
|
|
105
|
-
try {
|
|
106
|
-
let output = shellExec('git status', { silent: true, stdout: true });
|
|
107
|
-
console.log('output:', output);
|
|
108
|
-
output = output
|
|
109
|
-
.split(`to include in what will be committed)`)[1]
|
|
110
|
-
.split(`no changes added to commit`)[0]
|
|
111
|
-
.split(`\n`)
|
|
112
|
-
.map((l) => l.trim())
|
|
113
|
-
.filter((l) => l);
|
|
114
|
-
|
|
115
|
-
for (const fromPath of output) {
|
|
116
|
-
const from = `${baseFrom}/${fromPath}`;
|
|
117
|
-
const to = `${baseTo}/${fromPath}`;
|
|
118
|
-
logger.info('Copy path', { from, to });
|
|
119
|
-
fs.copySync(from, to);
|
|
120
|
-
}
|
|
121
|
-
} catch (error) {
|
|
122
|
-
logger.error(error);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
break;
|
|
127
49
|
case 'delete-empty-folder':
|
|
128
50
|
function cleanEmptyFoldersRecursively(folder) {
|
|
129
51
|
if (!fs.existsSync(folder)) {
|
|
@@ -190,12 +112,6 @@ try {
|
|
|
190
112
|
fs.writeFileSync('b64-image', `data:image/jpg;base64,${fs.readFileSync(process.argv[3]).toString('base64')}`);
|
|
191
113
|
break;
|
|
192
114
|
|
|
193
|
-
case 'get-ip': {
|
|
194
|
-
const response = await axios.get(process.argv[3]);
|
|
195
|
-
logger.info(process.argv[3] + ' IP', response.request.socket.remoteAddress);
|
|
196
|
-
break;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
115
|
case 'clean-env': {
|
|
200
116
|
shellExec(`git checkout package.json`);
|
|
201
117
|
shellExec(`git checkout .env.production`);
|
|
@@ -222,6 +138,10 @@ try {
|
|
|
222
138
|
console.log(extraction_result.join(', '));
|
|
223
139
|
break;
|
|
224
140
|
}
|
|
141
|
+
|
|
142
|
+
case 'build-ports': {
|
|
143
|
+
pbcopy(buildKindPorts(process.argv[3], process.argv[4]));
|
|
144
|
+
}
|
|
225
145
|
default:
|
|
226
146
|
break;
|
|
227
147
|
}
|
package/bin/vs.js
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import { shellExec } from '../src/server/process.js';
|
|
3
|
+
import { loggerFactory } from '../src/server/logger.js';
|
|
4
|
+
|
|
5
|
+
const logger = loggerFactory(import.meta);
|
|
3
6
|
|
|
4
7
|
switch (process.argv[2]) {
|
|
8
|
+
case 'info': {
|
|
9
|
+
logger.info('Formatted', 'Ctrl shift I');
|
|
10
|
+
logger.info('Command', 'Ctrl shift P');
|
|
11
|
+
logger.info('Search', 'Ctrl shift F');
|
|
12
|
+
logger.info('Debug', 'Ctrl shift D');
|
|
13
|
+
logger.info('New File', 'Ctrl N');
|
|
14
|
+
logger.info('Change tab', 'Ctrl Tab');
|
|
15
|
+
logger.info('Fold All', 'Ctrl K + Ctrl 0');
|
|
16
|
+
logger.info('Unfold All', 'Ctrl K + Ctrl J');
|
|
17
|
+
logger.info('Close All tabs', 'Ctrl K + W');
|
|
18
|
+
logger.info('Go to line number', 'Ctrl G');
|
|
19
|
+
logger.info('Change current project folder', 'Ctrl K + Ctrl O');
|
|
20
|
+
logger.info('Open new vs windows', 'Ctrl Shift N');
|
|
21
|
+
logger.info('Close current vs windows', 'Ctrl Shift W');
|
|
22
|
+
logger.info('Preview md', 'Ctrl shift V');
|
|
23
|
+
logger.warn('Terminal shortcut configure with command pallette', 'Ctl shift T');
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
5
26
|
case 'import':
|
|
6
27
|
{
|
|
7
28
|
const extensions = JSON.parse(fs.readFileSync(`./.vscode/extensions.json`, 'utf8'));
|
|
@@ -32,5 +53,6 @@ switch (process.argv[2]) {
|
|
|
32
53
|
}
|
|
33
54
|
break;
|
|
34
55
|
default:
|
|
56
|
+
shellExec(`sudo code ${process.argv[2]} --user-data-dir="/root/.vscode-root" --no-sandbox`);
|
|
35
57
|
break;
|
|
36
58
|
}
|