underpost 2.6.3 → 2.7.1
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/AUTHORS.md +10 -0
- package/CHANGELOG.md +91 -0
- package/README.md +6 -6
- package/bin/deploy.js +37 -2
- package/bin/index.js +45 -26
- package/bin/ssl.js +3 -0
- package/conf.js +2 -2
- package/docker-compose.yml +1 -1
- package/package.json +9 -5
- package/src/client/components/core/CommonJs.js +2 -2
- package/src/client/components/core/Docs.js +1 -1
- package/src/client/components/core/VanillaJs.js +7 -7
- package/src/client/ssr/body-components/CacheControl.js +1 -1
- package/src/index.js +29 -0
- package/src/server/auth.js +1 -1
- package/src/server/backup.js +15 -5
- package/src/server/client-build.js +3 -3
- package/src/server/dns.js +12 -1
- package/src/server/logger.js +54 -9
- package/src/server/process.js +4 -4
- package/src/server/prompt-optimizer.js +28 -0
- package/bin/help.js +0 -110
package/AUTHORS.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Authors
|
|
2
|
+
|
|
3
|
+
#### Ordered by first contribution.
|
|
4
|
+
|
|
5
|
+
- fcoverdugo ([fcoverdugoa@underpost.net](mailto:fcoverdugoa@underpost.net))
|
|
6
|
+
- underpost.net ([52893447+underpostnet@users.noreply.github.com](mailto:52893447+underpostnet@users.noreply.github.com))
|
|
7
|
+
- fcoverdugoa ([52893447+underpostnet@users.noreply.github.com](mailto:52893447+underpostnet@users.noreply.github.com))
|
|
8
|
+
- underpostnet ([fcoverdugoa@underpost.net](mailto:fcoverdugoa@underpost.net))
|
|
9
|
+
|
|
10
|
+
#### Generated by [underpost.net](https://underpost.net)
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
### Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
|
|
4
|
+
|
|
5
|
+
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
|
+
|
|
7
|
+
#### [v2.6.3](https://github.com/underpostnet/engine/compare/v2.6.2...v2.6.3)
|
|
8
|
+
|
|
9
|
+
> 14 September 2024
|
|
10
|
+
|
|
11
|
+
- update version 2.6.3 [`85c585d`](https://github.com/underpostnet/engine/commit/85c585d1cce30de4389772605cf56e774e2b7d3c)
|
|
12
|
+
- update refactor docs and coverage [`b455016`](https://github.com/underpostnet/engine/commit/b455016f5f2b2bdc142aacb4dfd66ab890125662)
|
|
13
|
+
- update [`b8f01f2`](https://github.com/underpostnet/engine/commit/b8f01f258999c9ebc1173b0616f0f7b8f7171048)
|
|
14
|
+
|
|
15
|
+
#### [v2.6.2](https://github.com/underpostnet/engine/compare/v2.5.6...v2.6.2)
|
|
16
|
+
|
|
17
|
+
> 13 September 2024
|
|
18
|
+
|
|
19
|
+
- update version 2.6.2 [`0895afb`](https://github.com/underpostnet/engine/commit/0895afbde42dd5a573507ccfcb07c328648b4eb0)
|
|
20
|
+
- update [`344d303`](https://github.com/underpostnet/engine/commit/344d303702ebce22dff50d8c0f8d8d870a2860ee)
|
|
21
|
+
|
|
22
|
+
#### [v2.5.6](https://github.com/underpostnet/engine/compare/v2.5.2...v2.5.6)
|
|
23
|
+
|
|
24
|
+
> 13 September 2024
|
|
25
|
+
|
|
26
|
+
- update version 2.5.6 [`ca57b87`](https://github.com/underpostnet/engine/commit/ca57b87c56a544e7b7e53baa5a6e15415e16b99b)
|
|
27
|
+
- update [`eec4943`](https://github.com/underpostnet/engine/commit/eec49433f50b4dfa7b7bbff48891a60f5be25545)
|
|
28
|
+
- update [`5f0a6ac`](https://github.com/underpostnet/engine/commit/5f0a6aca1ae971bc42f654cf3f2bf7ace7fe613d)
|
|
29
|
+
|
|
30
|
+
#### [v2.5.2](https://github.com/underpostnet/engine/compare/v2.5.1...v2.5.2)
|
|
31
|
+
|
|
32
|
+
> 12 September 2024
|
|
33
|
+
|
|
34
|
+
- update dependebot security [`1289b96`](https://github.com/underpostnet/engine/commit/1289b9627dc59bf08e66edbef1bf7bf08e53984c)
|
|
35
|
+
- update [`ec11af8`](https://github.com/underpostnet/engine/commit/ec11af86e884ca3eeaeaa12695edddaa8b46492d)
|
|
36
|
+
- remove toast-ui [`40c207f`](https://github.com/underpostnet/engine/commit/40c207f13f3e6d7ab71fc4cc203ce6ff02101bb5)
|
|
37
|
+
|
|
38
|
+
#### [v2.5.1](https://github.com/underpostnet/engine/compare/v2.5.0...v2.5.1)
|
|
39
|
+
|
|
40
|
+
> 27 August 2024
|
|
41
|
+
|
|
42
|
+
- refactor ssr [`4fa5d24`](https://github.com/underpostnet/engine/commit/4fa5d24531f791fa860a4ba38b9784491f084a68)
|
|
43
|
+
- bucket to document [`747cb0b`](https://github.com/underpostnet/engine/commit/747cb0bf5198e4b97df186e642413fa49ed9383f)
|
|
44
|
+
- add user control table managements [`2cfb710`](https://github.com/underpostnet/engine/commit/2cfb7103a591b941897ff3834ad5874565cba6b4)
|
|
45
|
+
|
|
46
|
+
#### [v2.5.0](https://github.com/underpostnet/engine/compare/v2.0.0...v2.5.0)
|
|
47
|
+
|
|
48
|
+
> 23 August 2024
|
|
49
|
+
|
|
50
|
+
- css refactor [`49b1904`](https://github.com/underpostnet/engine/commit/49b1904e83162f9066fbf843ced37d4e87db5581)
|
|
51
|
+
- refactor [`dad4f95`](https://github.com/underpostnet/engine/commit/dad4f9567629b737254702ce8be6b243e68fb01e)
|
|
52
|
+
- add sitemap builder [`53d05a6`](https://github.com/underpostnet/engine/commit/53d05a62d03ea327df3d37181a4b5c272d417289)
|
|
53
|
+
|
|
54
|
+
### [v2.0.0](https://github.com/underpostnet/engine/compare/v1.0.4...v2.0.0)
|
|
55
|
+
|
|
56
|
+
> 30 March 2024
|
|
57
|
+
|
|
58
|
+
- seed-city assets [`6d9decb`](https://github.com/underpostnet/engine/commit/6d9decbae96b828aa001777f96dd75aab3fc71d1)
|
|
59
|
+
- update [`1069fc5`](https://github.com/underpostnet/engine/commit/1069fc5268aa5ef7c101695393de59edfc14daf8)
|
|
60
|
+
- update [`41ae7d4`](https://github.com/underpostnet/engine/commit/41ae7d4c969cce0608171c820e05ebab42610a7f)
|
|
61
|
+
|
|
62
|
+
#### [v1.0.4](https://github.com/underpostnet/engine/compare/v1.0.3...v1.0.4)
|
|
63
|
+
|
|
64
|
+
> 14 January 2023
|
|
65
|
+
|
|
66
|
+
- update [`8109700`](https://github.com/underpostnet/engine/commit/81097008baa95ac50efb760b228dc4abae63c379)
|
|
67
|
+
- update [`b6bb47f`](https://github.com/underpostnet/engine/commit/b6bb47f95bd56c0062066ecae5f03813cf1ed6f8)
|
|
68
|
+
- update [`15c0ca9`](https://github.com/underpostnet/engine/commit/15c0ca9f9a8203bec53a9677d5a8edcd04a7f1df)
|
|
69
|
+
|
|
70
|
+
#### [v1.0.3](https://github.com/underpostnet/engine/compare/v1.0.2...v1.0.3)
|
|
71
|
+
|
|
72
|
+
> 21 December 2022
|
|
73
|
+
|
|
74
|
+
- update [`69418ba`](https://github.com/underpostnet/engine/commit/69418ba34831983e07aa458d1ea4a742c7b66096)
|
|
75
|
+
- update [`003412f`](https://github.com/underpostnet/engine/commit/003412fadf3efe6b819f037e99855192f13ccd7e)
|
|
76
|
+
|
|
77
|
+
#### [v1.0.2](https://github.com/underpostnet/engine/compare/v1.0.1...v1.0.2)
|
|
78
|
+
|
|
79
|
+
> 21 December 2022
|
|
80
|
+
|
|
81
|
+
- update [`470f07a`](https://github.com/underpostnet/engine/commit/470f07a72398792ac9ecf07bf1ba5170bc427dc5)
|
|
82
|
+
- update [`dacc20a`](https://github.com/underpostnet/engine/commit/dacc20a14971388bcf2a5077286989a77197aadc)
|
|
83
|
+
- update [`d2efee0`](https://github.com/underpostnet/engine/commit/d2efee08f9b31dd9fca31a3b1b15bdaa0e75faea)
|
|
84
|
+
|
|
85
|
+
#### v1.0.1
|
|
86
|
+
|
|
87
|
+
> 11 October 2022
|
|
88
|
+
|
|
89
|
+
- update [`bd40237`](https://github.com/underpostnet/engine/commit/bd402372513151a15a972a7727f7d77d014739f1)
|
|
90
|
+
- update [`39dd3b9`](https://github.com/underpostnet/engine/commit/39dd3b9a5a6b4292b899840dd5cd333cc80410d1)
|
|
91
|
+
- First Commit [`ad7b2a3`](https://github.com/underpostnet/engine/commit/ad7b2a3be0746b34fa19ba896d3faa7f1b4f40dc)
|
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://underpost.net/assets/splash/apple-touch-icon-precomposed.png" alt="underpost
|
|
2
|
+
<img src="https://underpost.net/assets/splash/apple-touch-icon-precomposed.png" alt="underpost.net"/>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<div align="center">
|
|
@@ -22,7 +22,7 @@ template
|
|
|
22
22
|
|
|
23
23
|
<div align="center">
|
|
24
24
|
|
|
25
|
-
[](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [](https://github.com/underpostnet/engine/actions/workflows/coverall.yml) [](https://coveralls.io/github/underpostnet/engine?branch=master)
|
|
25
|
+
[](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [](https://github.com/underpostnet/engine/actions/workflows/coverall.yml) [](https://www.npmjs.com/package/underpost) [](https://coveralls.io/github/underpostnet/engine?branch=master) [](https://www.npmjs.org/package/underpost) [](https://www.npmjs.com/package/underpost)
|
|
26
26
|
|
|
27
27
|
</div>
|
|
28
28
|
|
|
@@ -45,7 +45,7 @@ npm install -g underpost
|
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
```bash
|
|
48
|
-
underpost new
|
|
48
|
+
underpost new app-name
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
After template installation, the server will be running on [http://localhost:4001](http://localhost:4001)
|
|
@@ -53,7 +53,7 @@ After template installation, the server will be running on [http://localhost:400
|
|
|
53
53
|
#### Usage
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
|
-
cd
|
|
56
|
+
cd app-name
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
Build client bundle
|
|
@@ -90,7 +90,7 @@ Run on `docker`
|
|
|
90
90
|
|
|
91
91
|
```bash
|
|
92
92
|
# build image
|
|
93
|
-
docker build . -t
|
|
93
|
+
docker build . -t app-name
|
|
94
94
|
# run image
|
|
95
|
-
docker run --name
|
|
95
|
+
docker run --name app-name-instance -p 41061:3001 -p 41062:3002 app-name
|
|
96
96
|
```
|
package/bin/deploy.js
CHANGED
|
@@ -23,8 +23,9 @@ import {
|
|
|
23
23
|
getDataDeploy,
|
|
24
24
|
} from '../src/server/conf.js';
|
|
25
25
|
import { buildClient } from '../src/server/client-build.js';
|
|
26
|
-
import { range, setPad, timer } from '../src/client/components/core/CommonJs.js';
|
|
26
|
+
import { range, setPad, timer, uniqueArray } from '../src/client/components/core/CommonJs.js';
|
|
27
27
|
import toJsonSchema from 'to-json-schema';
|
|
28
|
+
import simpleGit from 'simple-git';
|
|
28
29
|
|
|
29
30
|
const logger = loggerFactory(import.meta);
|
|
30
31
|
|
|
@@ -337,7 +338,7 @@ try {
|
|
|
337
338
|
if (argHost && argPath && (!argHost.includes(host) || !argPath.includes(path))) {
|
|
338
339
|
delete serverConf[host][path];
|
|
339
340
|
} else {
|
|
340
|
-
serverConf[host][path].
|
|
341
|
+
serverConf[host][path].liteBuild = process.argv.includes('l') ? true : false;
|
|
341
342
|
serverConf[host][path].minifyBuild = process.env.NODE_ENV === 'production' ? true : false;
|
|
342
343
|
}
|
|
343
344
|
}
|
|
@@ -449,6 +450,8 @@ try {
|
|
|
449
450
|
break;
|
|
450
451
|
|
|
451
452
|
case 'fix-uml': {
|
|
453
|
+
// required: java jdk-11.0.1
|
|
454
|
+
|
|
452
455
|
// comment:
|
|
453
456
|
// '--add-opens=java.xml/com.sun.org.apache.xalan.internal.xsltc.trax="ALL-UNNAMED"'
|
|
454
457
|
// in plantuml.js src
|
|
@@ -616,8 +619,40 @@ try {
|
|
|
616
619
|
.replaceAll(`v${version}`, `v${newVersion}`),
|
|
617
620
|
'utf8',
|
|
618
621
|
);
|
|
622
|
+
|
|
623
|
+
fs.writeFileSync(
|
|
624
|
+
`./bin/index.js`,
|
|
625
|
+
fs.readFileSync(`./bin/index.js`, 'utf8').replaceAll(`${version}`, `${newVersion}`),
|
|
626
|
+
'utf8',
|
|
627
|
+
);
|
|
619
628
|
}
|
|
620
629
|
break;
|
|
630
|
+
|
|
631
|
+
case 'update-authors': {
|
|
632
|
+
// shellExec(`git log --reverse --format='%aN (<%aE>)' | sort -u`, { stdout: true });
|
|
633
|
+
const logs = await simpleGit().log();
|
|
634
|
+
|
|
635
|
+
fs.writeFileSync(
|
|
636
|
+
'./AUTHORS.md',
|
|
637
|
+
`# Authors
|
|
638
|
+
|
|
639
|
+
#### Ordered by first contribution.
|
|
640
|
+
|
|
641
|
+
${uniqueArray(logs.all.map((log) => `- ${log.author_name} ([${log.author_email}](mailto:${log.author_email}))`)).join(`
|
|
642
|
+
`)}
|
|
643
|
+
|
|
644
|
+
#### Generated by [underpost.net](https://underpost.net)`,
|
|
645
|
+
'utf8',
|
|
646
|
+
);
|
|
647
|
+
|
|
648
|
+
// hash: '1c7418ad2f49c7798a6d28d370b34c69d31dce46',
|
|
649
|
+
// date: '2024-09-16T17:10:13-03:00',
|
|
650
|
+
// message: 'update',
|
|
651
|
+
// refs: '',
|
|
652
|
+
// body: '',
|
|
653
|
+
// author_name: 'fcoverdugo',
|
|
654
|
+
// author_email: 'fcoverdugoa@underpost.net'
|
|
655
|
+
}
|
|
621
656
|
default:
|
|
622
657
|
break;
|
|
623
658
|
}
|
package/bin/index.js
CHANGED
|
@@ -1,34 +1,53 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { loggerFactory } from '../src/server/logger.js';
|
|
4
3
|
import dotenv from 'dotenv';
|
|
5
4
|
import { shellCd, shellExec } from '../src/server/process.js';
|
|
6
5
|
import fs from 'fs-extra';
|
|
6
|
+
import { Command } from 'commander';
|
|
7
7
|
|
|
8
8
|
dotenv.config();
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
10
|
+
const globalBinFolder = `${shellExec(`npm root -g`, {
|
|
11
|
+
stdout: true,
|
|
12
|
+
silent: true,
|
|
13
|
+
disableLog: true,
|
|
14
|
+
}).trim()}/underpost`;
|
|
15
|
+
|
|
16
|
+
const program = new Command();
|
|
17
|
+
|
|
18
|
+
const version = '2.7.1';
|
|
19
|
+
|
|
20
|
+
program.name('underpost').description(`underpost.net ci/cd cli ${version}`).version(version);
|
|
21
|
+
|
|
22
|
+
program
|
|
23
|
+
.command('new <app-name>')
|
|
24
|
+
.description('Create a new project')
|
|
25
|
+
.action((appName) => {
|
|
26
|
+
const destFolder = `${process.cwd()}/${appName}`;
|
|
27
|
+
console.log('Note: This process may take several minutes to complete');
|
|
28
|
+
console.log('build app', { destFolder });
|
|
29
|
+
fs.mkdirSync(destFolder, { recursive: true });
|
|
30
|
+
fs.copySync(globalBinFolder, destFolder);
|
|
31
|
+
fs.writeFileSync(`${destFolder}/.gitignore`, fs.readFileSync(`${globalBinFolder}/.dockerignore`, 'utf8'), 'utf8');
|
|
32
|
+
shellCd(`${destFolder}`);
|
|
33
|
+
shellExec(`git init && git add . && git commit -m "Base template implementation"`);
|
|
34
|
+
shellExec(`npm run install-template`);
|
|
35
|
+
shellExec(`npm run dev`);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
program
|
|
39
|
+
.command('test')
|
|
40
|
+
.description('Run tests')
|
|
41
|
+
.action(() => {
|
|
42
|
+
shellCd(`${globalBinFolder}`);
|
|
43
|
+
shellExec(`npm run test`);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
program
|
|
47
|
+
.command('help')
|
|
48
|
+
.description('Display help information')
|
|
49
|
+
.action(() => {
|
|
50
|
+
program.outputHelp();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
program.parse();
|
package/bin/ssl.js
CHANGED
|
@@ -29,6 +29,9 @@ try {
|
|
|
29
29
|
cmd = `certbot certonly --webroot --webroot-path ${
|
|
30
30
|
directory ? directory : `${getRootDirectory()}/public/${host}`
|
|
31
31
|
} -d ${host}`;
|
|
32
|
+
// directory ? directory : `${getRootDirectory()}/public/${host}`
|
|
33
|
+
// directory ? directory : `${getRootDirectory()}/public/www.${host.split('.').slice(-2).join('.')}`
|
|
34
|
+
|
|
32
35
|
// You can get multi domain cert by specifying (extra) -d
|
|
33
36
|
// For example
|
|
34
37
|
// certbot -d example.com -d example.net -d www.example.org
|
package/conf.js
CHANGED
|
@@ -179,7 +179,7 @@ const DefaultConf = {
|
|
|
179
179
|
origins: [],
|
|
180
180
|
minifyBuild: false,
|
|
181
181
|
iconsBuild: true,
|
|
182
|
-
|
|
182
|
+
liteBuild: false,
|
|
183
183
|
docsBuild: false,
|
|
184
184
|
ws: 'core',
|
|
185
185
|
peer: true,
|
|
@@ -217,7 +217,7 @@ const DefaultConf = {
|
|
|
217
217
|
apis: [],
|
|
218
218
|
origins: [],
|
|
219
219
|
minifyBuild: false,
|
|
220
|
-
|
|
220
|
+
liteBuild: true,
|
|
221
221
|
proxy: [80, 443],
|
|
222
222
|
},
|
|
223
223
|
},
|
package/docker-compose.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
|
-
"main": "src/
|
|
3
|
+
"main": "src/index.js",
|
|
4
4
|
"name": "underpost",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.7.1",
|
|
6
6
|
"description": "pwa api rest template",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"docs": "jsdoc -c jsdoc.json",
|
|
16
16
|
"backup": "node bin/db default.net/ export",
|
|
17
17
|
"install-template": "npm install && npm run build",
|
|
18
|
-
"install-global": "npm install -g pm2 && npm install -g jsdoc && npm install -g prettier && npm install -g env-cmd",
|
|
18
|
+
"install-global": "npm install -g pm2 && npm install -g jsdoc && npm install -g prettier && npm install -g env-cmd && npm install -g yarn && npm install -g auto-changelog",
|
|
19
19
|
"install-test": "npm install -g mocha && npm install -g c8 && npm install -g nyc && npm install -g coveralls",
|
|
20
20
|
"install-vs-extensions": "node bin/vs import",
|
|
21
21
|
"preinstall": "npm config set audit false && npm config set loglevel error",
|
|
@@ -58,13 +58,16 @@
|
|
|
58
58
|
"@loadingio/css-spinner": "^2.0.2",
|
|
59
59
|
"@neodrag/vanilla": "^2.0.3",
|
|
60
60
|
"@pinata/sdk": "^2.1.0",
|
|
61
|
+
"@xenova/transformers": "^2.17.2",
|
|
61
62
|
"adm-zip": "^0.5.10",
|
|
62
63
|
"ag-grid-community": "31.0.0",
|
|
63
64
|
"axios": "^1.5.1",
|
|
65
|
+
"chai": "^5.1.0",
|
|
64
66
|
"cli-progress": "^3.12.0",
|
|
65
67
|
"cli-spinners": "^3.0.0",
|
|
66
68
|
"color": "^4.2.3",
|
|
67
69
|
"colors": "^1.4.0",
|
|
70
|
+
"commander": "^12.1.0",
|
|
68
71
|
"compression": "^1.7.4",
|
|
69
72
|
"copy-paste": "^1.5.3",
|
|
70
73
|
"cors": "^2.8.5",
|
|
@@ -96,6 +99,7 @@
|
|
|
96
99
|
"marked": "^12.0.1",
|
|
97
100
|
"mongoose": "^8.0.1",
|
|
98
101
|
"morgan": "^1.10.0",
|
|
102
|
+
"node-cron": "^3.0.3",
|
|
99
103
|
"nodemailer": "^6.9.9",
|
|
100
104
|
"nodemon": "^3.0.1",
|
|
101
105
|
"pathfinding": "^0.4.18",
|
|
@@ -107,6 +111,7 @@
|
|
|
107
111
|
"read": "^2.1.0",
|
|
108
112
|
"sharp": "^0.32.5",
|
|
109
113
|
"shelljs": "^0.8.5",
|
|
114
|
+
"simple-git": "^3.26.0",
|
|
110
115
|
"simple-icons": "^13.9.0",
|
|
111
116
|
"sitemap": "^7.1.1",
|
|
112
117
|
"socket.io": "^4.7.2",
|
|
@@ -116,8 +121,7 @@
|
|
|
116
121
|
"text-to-image": "^5.2.0",
|
|
117
122
|
"uglify-js": "^3.17.4",
|
|
118
123
|
"validator": "^13.11.0",
|
|
119
|
-
"winston": "^3.11.0"
|
|
120
|
-
"chai": "^5.1.0"
|
|
124
|
+
"winston": "^3.11.0"
|
|
121
125
|
},
|
|
122
126
|
"devDependencies": {
|
|
123
127
|
"clean-jsdoc-theme": "^4.3.0",
|
|
@@ -33,10 +33,10 @@ const range = (start, end) => {
|
|
|
33
33
|
* @param arr - The `arr` parameter in the `getId` function is an array of objects or an object. If it
|
|
34
34
|
* is an object, the function converts it into an array of objects where each object has a key
|
|
35
35
|
* specified by the `keyId` parameter.
|
|
36
|
-
* @param
|
|
36
|
+
* @param suffix - The `suffix` parameter in the `getId` function is a string that can be added to
|
|
37
37
|
* the generated ID. It is optional and by default is an empty string. You can provide a suffix to be
|
|
38
38
|
* appended to the generated ID if needed.
|
|
39
|
-
* @param
|
|
39
|
+
* @param keyId - The `keyId` parameter in the `getId` function is used to specify the key in the
|
|
40
40
|
* array elements that contains the unique identifier (ID) for each element. By default, the function
|
|
41
41
|
* assumes that the ID is stored in a property named `'id'`, but you can customize this by providing
|
|
42
42
|
* @returns The `getId` function returns a unique identifier `_id` based on the input array `arr`,
|
|
@@ -136,14 +136,14 @@ const pasteData = () => new Promise((resolve) => navigator.clipboard.readText().
|
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
138
|
* The setPath function in JavaScript updates the browser's history with a new path, state, and title.
|
|
139
|
-
* @param
|
|
139
|
+
* @param path - The `path` parameter is a string that represents the URL path where you want to
|
|
140
140
|
* navigate or update in the browser history. It is the first parameter in the `setPath` function and
|
|
141
141
|
* has a default value of `'/'`.
|
|
142
|
-
* @param
|
|
142
|
+
* @param stateStorage - The `stateStorage` parameter in the `setPath` function is an object that
|
|
143
143
|
* represents the state object associated with the new history entry. It is used to store data related
|
|
144
144
|
* to the state of the application when navigating to a new path using `history.pushState()`. This data
|
|
145
145
|
* can be accessed later
|
|
146
|
-
* @param
|
|
146
|
+
* @param title - The `title` parameter in the `setPath` function is a string that represents the
|
|
147
147
|
* title of the new history entry. It is used as the title of the new history entry in the browser's
|
|
148
148
|
* history.
|
|
149
149
|
* @memberof VanillaJS
|
|
@@ -312,7 +312,7 @@ function downloadFile(fileInstance, fileName) {
|
|
|
312
312
|
|
|
313
313
|
/**
|
|
314
314
|
* The function `getRawContentFile` reads the raw content of a file using a FileReader in JavaScript.
|
|
315
|
-
* @param
|
|
315
|
+
* @param blob - The `blob` parameter in the `getRawContentFile` function is a Buffer object that
|
|
316
316
|
* represents raw binary data. It is used to read the content of a file as text using a FileReader in
|
|
317
317
|
* the browser environment.
|
|
318
318
|
* @memberof VanillaJS
|
|
@@ -329,9 +329,9 @@ const getRawContentFile = (blob = new Buffer()) =>
|
|
|
329
329
|
/**
|
|
330
330
|
* The function `getBlobFromUint8ArrayFile` creates a Blob object from a Uint8Array file data with a
|
|
331
331
|
* specified mimetype.
|
|
332
|
-
* @param
|
|
332
|
+
* @param data - The `data` parameter in the `getBlobFromUint8ArrayFile` function is an array of
|
|
333
333
|
* arrays containing Uint8Array data.
|
|
334
|
-
* @param
|
|
334
|
+
* @param mimetype - The `mimetype` parameter in the
|
|
335
335
|
* `getBlobFromUint8ArrayFile` function is a string that specifies the type of the Blob object being
|
|
336
336
|
* created. It indicates the MIME type of the data contained in the Blob. For example, common MIME
|
|
337
337
|
* types include 'image/jpeg' for JPEG images,
|
|
@@ -409,7 +409,7 @@ const isActiveTab = () => document.hasFocus();
|
|
|
409
409
|
/**
|
|
410
410
|
* The function `isActiveElement` checks if the active element in the document matches a specified
|
|
411
411
|
* class search.
|
|
412
|
-
* @param
|
|
412
|
+
* @param classSearch - The `classSearch` parameter is a string that is used to search for a specific
|
|
413
413
|
* class name within the `classList` of the active element in the document.
|
|
414
414
|
* @memberof VanillaJS
|
|
415
415
|
*/
|
|
@@ -108,6 +108,6 @@ SrrComponent = ({ ttiLoadTimeLimit }) => {
|
|
|
108
108
|
const CacheControl = ${CacheControl};
|
|
109
109
|
CacheControl({ ttiLoadTimeLimit: ${ttiLoadTimeLimit ? ttiLoadTimeLimit : 1000 * 70 * 1} });
|
|
110
110
|
</script>
|
|
111
|
-
<div class="clean-cache-container">v2.
|
|
111
|
+
<div class="clean-cache-container">v2.7.1</div>
|
|
112
112
|
`;
|
|
113
113
|
};
|
package/src/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Underpost index npm package
|
|
3
|
+
* @module src/index.js
|
|
4
|
+
* @namespace Underpost
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { loggerFactory, setUpInfo } from './server/logger.js';
|
|
8
|
+
|
|
9
|
+
const logger = loggerFactory(import.meta);
|
|
10
|
+
|
|
11
|
+
const underpost = {
|
|
12
|
+
/**
|
|
13
|
+
* Logs information about the current process environment to the console.
|
|
14
|
+
*
|
|
15
|
+
* This function is used to log details about
|
|
16
|
+
* the execution context, such as command-line arguments,
|
|
17
|
+
* environment variables, the process's administrative privileges,
|
|
18
|
+
* and the maximum available heap space size.
|
|
19
|
+
*
|
|
20
|
+
* @memberof Underpost
|
|
21
|
+
*/
|
|
22
|
+
setUpInfo: async () => await setUpInfo(logger),
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const up = underpost;
|
|
26
|
+
|
|
27
|
+
export { underpost, up };
|
|
28
|
+
|
|
29
|
+
export default underpost;
|
package/src/server/auth.js
CHANGED
|
@@ -67,7 +67,7 @@ const hashJWT = (payload, expire) =>
|
|
|
67
67
|
/**
|
|
68
68
|
* The function `verifyJWT` is used to verify a JSON Web Token (JWT) using a secret key stored in the
|
|
69
69
|
* environment variables.
|
|
70
|
-
* @param
|
|
70
|
+
* @param token - The `token` parameter is a JSON Web Token (JWT) that is passed to the `verifyJWT`
|
|
71
71
|
* function for verification.
|
|
72
72
|
* @memberof Auth
|
|
73
73
|
*/
|
package/src/server/backup.js
CHANGED
|
@@ -2,15 +2,25 @@ import fs from 'fs-extra';
|
|
|
2
2
|
import { loggerFactory } from './logger.js';
|
|
3
3
|
import { shellExec } from './process.js';
|
|
4
4
|
import { getDataDeploy } from './conf.js';
|
|
5
|
+
import cron from 'node-cron';
|
|
5
6
|
|
|
6
7
|
const logger = loggerFactory(import.meta);
|
|
7
8
|
|
|
8
9
|
const BackUpManagement = {
|
|
9
10
|
Init: async function () {
|
|
10
11
|
await this.Callback();
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
|
|
13
|
+
// Schedule the sending process to run every day at 1 am
|
|
14
|
+
cron.schedule(
|
|
15
|
+
'0 1 * * *',
|
|
16
|
+
async () => {
|
|
17
|
+
await this.Callback();
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
scheduled: true,
|
|
21
|
+
timezone: process.env.TIME_ZONE || 'America/New_York',
|
|
22
|
+
},
|
|
23
|
+
);
|
|
14
24
|
},
|
|
15
25
|
Callback: async function () {
|
|
16
26
|
const privateCronConfPath = `./engine-private/conf/${process.argv[2]}/conf.cron.json`;
|
|
@@ -42,9 +52,9 @@ const BackUpManagement = {
|
|
|
42
52
|
for (const host of Object.keys(confServer))
|
|
43
53
|
for (const path of Object.keys(confServer[host])) {
|
|
44
54
|
// retention policy
|
|
45
|
-
let { db, backupFrequency, maxBackupRetention } = confServer[host][path];
|
|
55
|
+
let { db, backupFrequency, maxBackupRetention, singleReplica } = confServer[host][path];
|
|
46
56
|
|
|
47
|
-
if (!db) continue;
|
|
57
|
+
if (!db || singleReplica) continue;
|
|
48
58
|
|
|
49
59
|
if (!backupFrequency) backupFrequency = 'daily';
|
|
50
60
|
if (!maxBackupRetention) maxBackupRetention = 5;
|
|
@@ -150,7 +150,7 @@ const buildClient = async (options = { liveClientBuildPaths: [], instances: [] }
|
|
|
150
150
|
const rootClientPath = directory ? directory : `${publicPath}/${host}${path}`;
|
|
151
151
|
const port = newInstance(currentPort);
|
|
152
152
|
const publicClientId = publicRef ? publicRef : client;
|
|
153
|
-
const fullBuildEnabled = !process.argv.includes('l') && !confServer[host][path].
|
|
153
|
+
const fullBuildEnabled = !process.argv.includes('l') && !confServer[host][path].liteBuild && !enableLiveRebuild;
|
|
154
154
|
// const baseHost = process.env.NODE_ENV === 'production' ? `https://${host}` : `http://localhost:${port}`;
|
|
155
155
|
const baseHost = process.env.NODE_ENV === 'production' ? `https://${host}` : ``;
|
|
156
156
|
// ''; // process.env.NODE_ENV === 'production' ? `https://${host}` : ``;
|
|
@@ -171,7 +171,7 @@ const buildClient = async (options = { liveClientBuildPaths: [], instances: [] }
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
if (fullBuildEnabled)
|
|
174
|
-
// !(confServer[host]['/'] && confServer[host]['/'].
|
|
174
|
+
// !(confServer[host]['/'] && confServer[host]['/'].liteBuild)
|
|
175
175
|
await fullBuild({
|
|
176
176
|
path,
|
|
177
177
|
logger,
|
|
@@ -540,7 +540,7 @@ Sitemap: https://${host}${path === '/' ? '' : path}/sitemap.xml`,
|
|
|
540
540
|
);
|
|
541
541
|
}
|
|
542
542
|
|
|
543
|
-
if (!enableLiveRebuild && !process.argv.includes('l') && docsBuild) {
|
|
543
|
+
if (!enableLiveRebuild && !process.argv.includes('l') && !process.argv.includes('deploy') && docsBuild) {
|
|
544
544
|
// fullBuildEnabled || process.argv.includes('docs')
|
|
545
545
|
|
|
546
546
|
// https://www.pullrequest.com/blog/leveraging-jsdoc-for-better-code-documentation-in-javascript/
|
package/src/server/dns.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import dotenv from 'dotenv';
|
|
3
3
|
import fs from 'fs';
|
|
4
|
+
import cron from 'node-cron';
|
|
4
5
|
|
|
5
6
|
import { ip } from './network.js';
|
|
6
7
|
import { loggerFactory } from './logger.js';
|
|
@@ -58,7 +59,17 @@ const Dns = {
|
|
|
58
59
|
}
|
|
59
60
|
};
|
|
60
61
|
await callback();
|
|
61
|
-
|
|
62
|
+
// every minute
|
|
63
|
+
cron.schedule(
|
|
64
|
+
'* * * * *',
|
|
65
|
+
async () => {
|
|
66
|
+
await callback();
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
scheduled: true,
|
|
70
|
+
timezone: process.env.TIME_ZONE || 'America/New_York',
|
|
71
|
+
},
|
|
72
|
+
);
|
|
62
73
|
},
|
|
63
74
|
services: {
|
|
64
75
|
updateIp: {
|
package/src/server/logger.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module for managing logger control and configuration
|
|
3
|
+
* @module src/server/logger.js
|
|
4
|
+
* @namespace Logger
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
'use strict';
|
|
2
8
|
|
|
3
9
|
import dotenv from 'dotenv';
|
|
@@ -68,7 +74,38 @@ const format = (meta) =>
|
|
|
68
74
|
}),
|
|
69
75
|
);
|
|
70
76
|
|
|
71
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Logs information about the current process environment to the console.
|
|
79
|
+
*
|
|
80
|
+
* This function is used to log details about
|
|
81
|
+
* the execution context, such as command-line arguments,
|
|
82
|
+
* environment variables, the process's administrative privileges,
|
|
83
|
+
* and the maximum available heap space size.
|
|
84
|
+
*
|
|
85
|
+
* @param {winston.Logger} logger - A pre-configured Winston logger object.
|
|
86
|
+
* @memberof Logger
|
|
87
|
+
*/
|
|
88
|
+
const setUpInfo = async (logger = new winston.Logger()) => {
|
|
89
|
+
logger.info('argv', process.argv);
|
|
90
|
+
logger.info('env', process.env.NODE_ENV);
|
|
91
|
+
logger.info('admin', await isAdmin());
|
|
92
|
+
logger.info('--max-old-space-size', {
|
|
93
|
+
total_available_size: formatBytes(v8.getHeapStatistics().total_available_size),
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The function `loggerFactory` creates a logger instance with specified transports for printing out
|
|
99
|
+
* messages.
|
|
100
|
+
* @param meta - The `meta` parameter in the `loggerFactory` function is used to extract the last part
|
|
101
|
+
* of a URL and use it to create log files in a specific directory.
|
|
102
|
+
* @returns {winston.Logger} The `loggerFactory` function returns a logger instance created using Winston logger
|
|
103
|
+
* library. The logger instance is configured with various transports for printing out messages to
|
|
104
|
+
* different destinations such as the terminal, error.log file, and all.log file. The logger instance
|
|
105
|
+
* also has a method `setUpInfo` attached to it for setting up additional information.
|
|
106
|
+
* @memberof Logger
|
|
107
|
+
*/
|
|
108
|
+
const loggerFactory = (meta = { url: '' }) => {
|
|
72
109
|
meta = meta.url.split('/').pop();
|
|
73
110
|
// Define which transports the logger must use to print out messages.
|
|
74
111
|
// In this example, we are using three different transports
|
|
@@ -98,17 +135,25 @@ const loggerFactory = (meta) => {
|
|
|
98
135
|
// exitOnError: false,
|
|
99
136
|
});
|
|
100
137
|
logger.setUpInfo = async () => {
|
|
101
|
-
logger
|
|
102
|
-
logger.info('env', process.env.NODE_ENV);
|
|
103
|
-
logger.info('admin', await isAdmin());
|
|
104
|
-
logger.info('--max-old-space-size', {
|
|
105
|
-
total_available_size: formatBytes(v8.getHeapStatistics().total_available_size),
|
|
106
|
-
});
|
|
138
|
+
await setUpInfo(logger);
|
|
107
139
|
};
|
|
108
140
|
return logger;
|
|
109
141
|
};
|
|
110
142
|
|
|
111
|
-
|
|
143
|
+
/**
|
|
144
|
+
* The `loggerMiddleware` function creates a middleware for logging HTTP requests using Morgan with
|
|
145
|
+
* custom message format and options.
|
|
146
|
+
* @param meta - The `meta` parameter in the `loggerMiddleware` function is an object that contains
|
|
147
|
+
* information about the request URL. It has a default value of an empty object `{ url: '' }`. This
|
|
148
|
+
* object is used to provide additional metadata for logging purposes.
|
|
149
|
+
* @returns {Handler<any, any>} The `loggerMiddleware` function returns a middleware function that uses the Morgan library
|
|
150
|
+
* to log HTTP request information. The middleware function formats the log message using predefined
|
|
151
|
+
* tokens provided by Morgan and custom tokens like `:host` to include specific request details. The
|
|
152
|
+
* log message format includes information such as remote address, HTTP method, host, URL, status code,
|
|
153
|
+
* content length, and response time in milliseconds. The middleware
|
|
154
|
+
* @memberof Logger
|
|
155
|
+
*/
|
|
156
|
+
const loggerMiddleware = (meta = { url: '' }) => {
|
|
112
157
|
const stream = {
|
|
113
158
|
// Use the http severity
|
|
114
159
|
write: (message) => loggerFactory(meta).http(message),
|
|
@@ -132,4 +177,4 @@ const loggerMiddleware = (meta) => {
|
|
|
132
177
|
);
|
|
133
178
|
};
|
|
134
179
|
|
|
135
|
-
export { loggerFactory, loggerMiddleware };
|
|
180
|
+
export { loggerFactory, loggerMiddleware, setUpInfo };
|
package/src/server/process.js
CHANGED
|
@@ -53,13 +53,13 @@ const ProcessController = {
|
|
|
53
53
|
},
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
const shellExec = (cmd, options = { silent: false, async: false, stdout: false }) => {
|
|
57
|
-
logger.info(`cmd`, cmd);
|
|
56
|
+
const shellExec = (cmd, options = { silent: false, async: false, stdout: false, disableLog: true }) => {
|
|
57
|
+
if (!options.disableLog) logger.info(`cmd`, cmd);
|
|
58
58
|
return options.stdout ? shell.exec(cmd, options).stdout : shell.exec(cmd, options);
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
const shellCd = (cd) => {
|
|
62
|
-
logger.info(`cd`, cd);
|
|
61
|
+
const shellCd = (cd, options = { disableLog: true }) => {
|
|
62
|
+
if (options.disableLog) logger.info(`cd`, cd);
|
|
63
63
|
return shell.cd(cd);
|
|
64
64
|
};
|
|
65
65
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// https://github.com/xenova/transformers.js/blob/f43d3dd348fd7b293008802590bb3a1afa218dc7/src/models.js#L10
|
|
2
|
+
|
|
3
|
+
import { AutoModelForSeq2SeqLM, AutoTokenizer } from '@xenova/transformers';
|
|
4
|
+
import { loggerFactory } from './logger.js';
|
|
5
|
+
import dotenv from 'dotenv';
|
|
6
|
+
|
|
7
|
+
dotenv.config();
|
|
8
|
+
|
|
9
|
+
const logger = loggerFactory(import.meta);
|
|
10
|
+
|
|
11
|
+
const tokenizer = await AutoTokenizer.from_pretrained('Xenova/t5-small');
|
|
12
|
+
|
|
13
|
+
const model = await AutoModelForSeq2SeqLM.from_pretrained('Xenova/t5-small');
|
|
14
|
+
|
|
15
|
+
const prompt = 'translate English to German: I love transformers!';
|
|
16
|
+
|
|
17
|
+
logger.info('input', { prompt });
|
|
18
|
+
|
|
19
|
+
const tokenizerData = await tokenizer(prompt);
|
|
20
|
+
|
|
21
|
+
const { input_ids } = tokenizerData;
|
|
22
|
+
|
|
23
|
+
const outputs = await model.generate(input_ids);
|
|
24
|
+
|
|
25
|
+
for (const output of outputs) {
|
|
26
|
+
const decoded = tokenizer.decode(output, { skip_special_tokens: true });
|
|
27
|
+
logger.info('decoded', { decoded });
|
|
28
|
+
}
|
package/bin/help.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { loggerFactory } from '../src/server/logger.js';
|
|
2
|
-
import colors from 'colors';
|
|
3
|
-
|
|
4
|
-
colors.enable();
|
|
5
|
-
|
|
6
|
-
const logger = loggerFactory(import.meta);
|
|
7
|
-
|
|
8
|
-
// backup: `node bin/db <host><path> export <deploy-id>`
|
|
9
|
-
// restore: `node bin/db <host><path> import <deploy-id>`
|
|
10
|
-
// new-api-src: `node bin/deploy build-nodejs-src-api <api-id>`
|
|
11
|
-
// text-to-image: `node bin/util text-to-image 's4()' white black 100x100`
|
|
12
|
-
// sync-packages: `node bin/deploy update-package`
|
|
13
|
-
// ssl: `npm run ssl <os> <deploy-id> <host>`
|
|
14
|
-
// clean empty folder: `node bin/util delete-empty-folder`
|
|
15
|
-
// sync env port: `node bin/deploy sync-env-port <deployId>`
|
|
16
|
-
// node bin/vs import
|
|
17
|
-
// node bin/vs export
|
|
18
|
-
// build macro replica: `node bin/deploy build-macro-replica dd`
|
|
19
|
-
// node bin/deploy update-version 2.5.2
|
|
20
|
-
|
|
21
|
-
const data = {
|
|
22
|
-
help: `
|
|
23
|
-
---------------------------------------------------------------
|
|
24
|
-
${`Help`.white}
|
|
25
|
-
---------------------------------------------------------------
|
|
26
|
-
|
|
27
|
-
Arguments:
|
|
28
|
-
|
|
29
|
-
> [optional] section: help | install | ssl
|
|
30
|
-
> [optional] sections: section,section,...
|
|
31
|
-
|
|
32
|
-
Command Line:
|
|
33
|
-
|
|
34
|
-
> ${`node bin/help <section/s>`.yellow}
|
|
35
|
-
`,
|
|
36
|
-
install: `
|
|
37
|
-
---------------------------------------------------------------
|
|
38
|
-
${`Programs installer`.white}
|
|
39
|
-
---------------------------------------------------------------
|
|
40
|
-
|
|
41
|
-
Arguments:
|
|
42
|
-
|
|
43
|
-
> [required] os: windows
|
|
44
|
-
> [required] program: certbot | xampp | docker | wordpress
|
|
45
|
-
> [required] host/path: example.com | example.com/path | www.example.com
|
|
46
|
-
|
|
47
|
-
Command Line:
|
|
48
|
-
|
|
49
|
-
> ${`node bin/install <os> <program> <host/path>`.yellow}
|
|
50
|
-
`,
|
|
51
|
-
ssl: `
|
|
52
|
-
---------------------------------------------------------------
|
|
53
|
-
${`SSL management`.white}
|
|
54
|
-
---------------------------------------------------------------
|
|
55
|
-
|
|
56
|
-
Arguments:
|
|
57
|
-
|
|
58
|
-
> [required] os: windows
|
|
59
|
-
> [required] hosts: example.com,www.example.com
|
|
60
|
-
|
|
61
|
-
Command Line:
|
|
62
|
-
|
|
63
|
-
> ${`node bin/ssl <os> <hosts>`.yellow}
|
|
64
|
-
`,
|
|
65
|
-
mariadb: `
|
|
66
|
-
---------------------------------------------------------------
|
|
67
|
-
${`DataBase management`.white}
|
|
68
|
-
---------------------------------------------------------------
|
|
69
|
-
|
|
70
|
-
Arguments:
|
|
71
|
-
|
|
72
|
-
> [required] operator: show | create | delete | import | export
|
|
73
|
-
> [required] host/path: example.com | example.com/path | www.example.com
|
|
74
|
-
|
|
75
|
-
Command Line:
|
|
76
|
-
|
|
77
|
-
> ${`node bin/db <host/path> <operator>`.yellow}
|
|
78
|
-
`,
|
|
79
|
-
shortcut: `
|
|
80
|
-
---------------------------------------------------------------
|
|
81
|
-
${`Shortcut Generator`.white}
|
|
82
|
-
---------------------------------------------------------------
|
|
83
|
-
|
|
84
|
-
Arguments:
|
|
85
|
-
|
|
86
|
-
> [required] os: windows | linux
|
|
87
|
-
> [required] env: development | production | test
|
|
88
|
-
|
|
89
|
-
Command Line:
|
|
90
|
-
|
|
91
|
-
> ${`node bin/shortcut <os> <env>`.yellow}
|
|
92
|
-
`,
|
|
93
|
-
end: '---------------------------------------------------------------',
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
logger.info('argv', process.argv);
|
|
97
|
-
|
|
98
|
-
const [exe, dir, sections] = process.argv;
|
|
99
|
-
|
|
100
|
-
try {
|
|
101
|
-
let out = '';
|
|
102
|
-
if (!sections) Object.keys(data).map((section) => (out += data[section]));
|
|
103
|
-
else {
|
|
104
|
-
for (const section of sections.split(',')) out += data[section];
|
|
105
|
-
out += data['end'];
|
|
106
|
-
}
|
|
107
|
-
logger.info(out);
|
|
108
|
-
} catch (error) {
|
|
109
|
-
logger.error(error, error.stack);
|
|
110
|
-
}
|