underpost 2.8.857 → 2.8.861

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.
@@ -8,7 +8,7 @@ on:
8
8
 
9
9
  jobs:
10
10
  after-publish:
11
- if: github.repository == 'underpostnet/pwa-microservices-template'
11
+ if: github.repository == 'underpostnet/pwa-microservices-template' || startsWith(github.event.head_commit.message, 'cd(ssh-release)')
12
12
  runs-on: ubuntu-latest
13
13
  steps:
14
14
  - name: Run remote deploy via SSH
@@ -33,4 +33,5 @@ jobs:
33
33
  underpost config set GITHUB_TOKEN ${{ secrets.GITHUB_TOKEN }}
34
34
  node bin run --dev pull
35
35
  underpost run secret
36
+ underpost run underpost-config
36
37
  underpost run release-deploy
package/README.md CHANGED
@@ -21,10 +21,16 @@
21
21
 
22
22
 
23
23
 
24
+
25
+
26
+
27
+
28
+
29
+
24
30
  <!-- badges -->
25
31
 
26
32
 
27
- [![Node.js CI](https://github.com/underpostnet/engine/actions/workflows/docker-image.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [![Test](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/coverall.yml) [![Downloads](https://img.shields.io/npm/dm/underpost.svg)](https://www.npmjs.com/package/underpost) [![Socket Badge](https://socket.dev/api/badge/npm/package/underpost/2.8.857)](https://socket.dev/npm/package/underpost/overview/2.8.857) [![Coverage Status](https://coveralls.io/repos/github/underpostnet/engine/badge.svg?branch=master)](https://coveralls.io/github/underpostnet/engine?branch=master) [![Version](https://img.shields.io/npm/v/underpost.svg)](https://www.npmjs.org/package/underpost) [![License](https://img.shields.io/npm/l/underpost.svg)](https://www.npmjs.com/package/underpost)
33
+ [![Node.js CI](https://github.com/underpostnet/engine/actions/workflows/docker-image.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [![Test](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/coverall.yml) [![Downloads](https://img.shields.io/npm/dm/underpost.svg)](https://www.npmjs.com/package/underpost) [![Socket Badge](https://socket.dev/api/badge/npm/package/underpost/2.8.861)](https://socket.dev/npm/package/underpost/overview/2.8.861) [![Coverage Status](https://coveralls.io/repos/github/underpostnet/engine/badge.svg?branch=master)](https://coveralls.io/github/underpostnet/engine?branch=master) [![Version](https://img.shields.io/npm/v/underpost.svg)](https://www.npmjs.org/package/underpost) [![License](https://img.shields.io/npm/l/underpost.svg)](https://www.npmjs.com/package/underpost)
28
34
 
29
35
 
30
36
  <!-- end-badges -->
@@ -34,6 +40,12 @@
34
40
 
35
41
 
36
42
 
43
+
44
+
45
+
46
+
47
+
48
+
37
49
  </div>
38
50
 
39
51
  <div align="center">
@@ -78,44 +90,44 @@ Run dev client server
78
90
  npm run dev
79
91
  ```
80
92
  <!-- -->
81
- ## underpost ci/cd cli v2.8.857
93
+ ## underpost ci/cd cli v2.8.861
82
94
 
83
95
  ### Usage: `underpost [options] [command]`
84
- ```
85
- Options:
86
- -V, --version output the version number
87
- -h, --help display help for command
96
+
97
+ ```
98
+ Options:
99
+ -V, --version output the version number
100
+ -h, --help display help for command
88
101
 
89
102
  Commands:
90
- new <app-name> Initializes a new Underpost project with a predefined structure.
91
- start [options] <deploy-id> [env] Initiates application servers, build pipelines, or other defined services based on the deployment ID.
92
- clone [options] <uri> Clones a specified GitHub repository into the current directory.
93
- pull [options] <path> <uri> Pulls the latest changes from a specified GitHub repository.
94
- cmt [options] <path> <commit-type> [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
95
- push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
96
- env <deploy-id> [env] Sets environment variables and configurations related to a specific deployment ID.
97
- config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
98
- root Displays the root path of the npm installation.
99
- cluster [options] [pod-name] Manages Kubernetes clusters, defaulting to Kind cluster initialization.
100
- deploy [options] [deploy-list] [env] Manages application deployments, defaulting to deploying development pods.
101
- secret [options] <platform> Manages secrets for various platforms.
102
- dockerfile-image-build [options] Builds a Docker image from a specified Dockerfile with various options for naming, saving, and loading.
103
- dockerfile-pull-base-images [options] Pulls required Underpost Dockerfile base images and optionally loads them into clusters.
104
- install Quickly imports Underpost npm dependencies by copying them.
105
- db [options] <deploy-list> Manages database operations, including import, export, and collection management.
106
- metadata [options] [deploy-id] [host] [path] Manages cluster metadata operations, including import and export.
107
- script [options] <operator> <script-name> [script-value] Supports a variety of built-in Underpost global scripts, their preset lifecycle events, and arbitrary custom scripts.
108
- cron [options] [deploy-list] [job-list] Manages cron jobs, including initialization, execution, and configuration updates.
109
- fs [options] [path] Manages file storage, defaulting to file upload operations.
110
- test [options] [deploy-list] Manages and runs tests, defaulting to the current Underpost default test suite.
111
- monitor [options] <deploy-id> [env] Manages health server monitoring for specified deployments.
112
- ssh [options] Import and start ssh server and client based on current default deployment ID.
113
- run [options] <runner-id> [path] Runs a script from the specified path.
114
- lxd [options] Manages LXD containers and virtual machines.
115
- baremetal [options] [workflow-id] [hostname] [ip-address] Manages baremetal server operations, including installation, database setup, commissioning, and user management.
116
- help [command] display help for command
117
-
103
+ new [options] <app-name> Initializes a new Underpost project with a predefined structure.
104
+ start [options] <deploy-id> [env] Initiates application servers, build pipelines, or other defined services based on the deployment ID.
105
+ clone [options] <uri> Clones a specified GitHub repository into the current directory.
106
+ pull [options] <path> <uri> Pulls the latest changes from a specified GitHub repository.
107
+ cmt [options] <path> <commit-type> [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
108
+ push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
109
+ env <deploy-id> [env] Sets environment variables and configurations related to a specific deployment ID.
110
+ config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
111
+ root Displays the root path of the npm installation.
112
+ cluster [options] [pod-name] Manages Kubernetes clusters, defaulting to Kind cluster initialization.
113
+ deploy [options] [deploy-list] [env] Manages application deployments, defaulting to deploying development pods.
114
+ secret [options] <platform> Manages secrets for various platforms.
115
+ dockerfile-image-build [options] Builds a Docker image from a specified Dockerfile with various options for naming, saving, and loading.
116
+ dockerfile-pull-base-images [options] Pulls required Underpost Dockerfile base images and optionally loads them into clusters.
117
+ install Quickly imports Underpost npm dependencies by copying them.
118
+ db [options] <deploy-list> Manages database operations, including import, export, and collection management.
119
+ metadata [options] [deploy-id] [host] [path] Manages cluster metadata operations, including import and export.
120
+ script [options] <operator> <script-name> [script-value] Supports a variety of built-in Underpost global scripts, their preset lifecycle events, and arbitrary custom scripts.
121
+ cron [options] [deploy-list] [job-list] Manages cron jobs, including initialization, execution, and configuration updates.
122
+ fs [options] [path] Manages file storage, defaulting to file upload operations.
123
+ test [options] [deploy-list] Manages and runs tests, defaulting to the current Underpost default test suite.
124
+ monitor [options] <deploy-id> [env] Manages health server monitoring for specified deployments.
125
+ ssh [options] Import and start ssh server and client based on current default deployment ID.
126
+ run [options] <runner-id> [path] Runs a script from the specified path.
127
+ lxd [options] Manages LXD containers and virtual machines.
128
+ baremetal [options] [workflow-id] [hostname] [ip-address] Manages baremetal server operations, including installation, database setup, commissioning, and user management.
129
+ help [command] display help for command
130
+
118
131
  ```
119
-
132
+
120
133
  <a target="_top" href="https://github.com/underpostnet/pwa-microservices-template/blob/master/cli.md">See complete CLI Docs here.</a>
121
-
@@ -0,0 +1,78 @@
1
+ #! /usr/bin/env node
2
+
3
+ import dotenv from 'dotenv';
4
+ import { Command } from 'commander';
5
+ import fs from 'fs-extra';
6
+ import { pbcopy, shellExec } from '../src/server/process.js';
7
+ import Jimp from 'jimp';
8
+ import Underpost from '../src/index.js';
9
+ import { loggerFactory } from '../src/server/logger.js';
10
+ import { DataBaseProvider } from '../src/db/DataBaseProvider.js';
11
+
12
+ dotenv.config();
13
+
14
+ const logger = loggerFactory(import.meta);
15
+
16
+ const deployId = process.env.DEFAULT_DEPLOY_ID;
17
+ const host = process.env.DEFAULT_DEPLOY_HOST;
18
+ const path = process.env.DEFAULT_DEPLOY_PATH;
19
+
20
+ const confServerPath = `./engine-private/conf/${deployId}/conf.server.json`;
21
+ const confServer = JSON.parse(fs.readFileSync(confServerPath, 'utf8'));
22
+ const { db } = confServer[host][path];
23
+
24
+ logger.info('env', {
25
+ deployId,
26
+ host,
27
+ path,
28
+ db,
29
+ });
30
+
31
+ await DataBaseProvider.load({
32
+ apis: ['object-layer'],
33
+ host,
34
+ path,
35
+ db,
36
+ });
37
+
38
+ const ObjectLayer = DataBaseProvider.instance[`${host}${path}`].mongoose.models.ObjectLayer;
39
+
40
+ const program = new Command();
41
+
42
+ program.name('cyberia').description(`content generator cli ${Underpost.version}`).version(Underpost.version);
43
+
44
+ const pngDirectoryIteratorByObjectLayerType = async (
45
+ objectLayerType = 'skin',
46
+ callback = ({ path, objectLayerType, objectLayerId, direction, frame }) => {},
47
+ ) => {
48
+ for (const objectLayerId of await fs.readdir(`./src/client/public/cyberia/assets/${objectLayerType}`)) {
49
+ for (const direction of await fs.readdir(
50
+ `./src/client/public/cyberia/assets/${objectLayerType}/${objectLayerId}`,
51
+ )) {
52
+ const dirFolder = `./src/client/public/cyberia/assets/${objectLayerType}/${objectLayerId}/${direction}`;
53
+ if (!fs.statSync(dirFolder).isDirectory()) continue;
54
+ for (const frame of await fs.readdir(dirFolder)) {
55
+ const imageFilePath = `./src/client/public/cyberia/assets/${objectLayerType}/${objectLayerId}/${direction}/${frame}`;
56
+ await callback({ path: imageFilePath, objectLayerType, objectLayerId, direction, frame });
57
+ }
58
+ }
59
+ }
60
+ };
61
+
62
+ program
63
+ .command('ol')
64
+ .option('--import [object-layer-type]', 'Import object layer from type storage png image')
65
+ .action(async (options = { import: false }) => {
66
+ if (options.import) {
67
+ await pngDirectoryIteratorByObjectLayerType(
68
+ options.import,
69
+ async ({ path, objectLayerType, objectLayerId, direction, frame }) => {
70
+ console.log(path, { objectLayerType, objectLayerId, direction, frame });
71
+ },
72
+ );
73
+ }
74
+ await DataBaseProvider.instance[`${host}${path}`].mongoose.close();
75
+ })
76
+ .description('Object layer management');
77
+
78
+ program.parse();
package/bin/deploy.js CHANGED
@@ -42,13 +42,25 @@ try {
42
42
  case 'save':
43
43
  {
44
44
  let deployId = process.argv[3] ?? 'dd-default';
45
- if (!deployId.startsWith('dd-')) deployId = 'dd-' + deployId;
45
+ if (!deployId.startsWith('dd-')) deployId = 'dd-default';
46
46
  const folder = `./engine-private/conf/${deployId}`;
47
47
  if (fs.existsSync(folder)) fs.removeSync(folder);
48
48
  await Config.build({ folder });
49
- fs.writeFileSync(`${folder}/.env.production`, fs.readFileSync('./.env.production', 'utf8'), 'utf8');
50
- fs.writeFileSync(`${folder}/.env.development`, fs.readFileSync('./.env.development', 'utf8'), 'utf8');
51
- fs.writeFileSync(`${folder}/.env.test`, fs.readFileSync('./.env.test', 'utf8'), 'utf8');
49
+ fs.writeFileSync(
50
+ `${folder}/.env.production`,
51
+ fs.readFileSync('./.env.production', 'utf8').replace('dd-default', deployId),
52
+ 'utf8',
53
+ );
54
+ fs.writeFileSync(
55
+ `${folder}/.env.development`,
56
+ fs.readFileSync('./.env.development', 'utf8').replace('dd-default', deployId),
57
+ 'utf8',
58
+ );
59
+ fs.writeFileSync(
60
+ `${folder}/.env.test`,
61
+ fs.readFileSync('./.env.test', 'utf8').replace('dd-default', deployId),
62
+ 'utf8',
63
+ );
52
64
  fs.writeFileSync(`${folder}/package.json`, fs.readFileSync('./package.json', 'utf8'), 'utf8');
53
65
  }
54
66
  break;
@@ -205,7 +217,7 @@ try {
205
217
  case 'build-full-client':
206
218
  {
207
219
  dotenv.config({ override: true });
208
- if (!process.argv[3]) process.argv[3] = 'default';
220
+ if (!process.argv[3]) process.argv[3] = 'dd-default';
209
221
  const { deployId, folder } = loadConf(process.argv[3]);
210
222
 
211
223
  let argHost = process.argv[4] ? process.argv[4].split(',') : [];
@@ -383,7 +395,7 @@ try {
383
395
  }
384
396
 
385
397
  case 'version-build': {
386
- shellExec(`node bin clean-core-repo`);
398
+ shellExec(`node bin/deploy clean-core-repo`);
387
399
  shellCd(`/home/dd/engine`);
388
400
  const originPackageJson = JSON.parse(fs.readFileSync(`package.json`, 'utf8'));
389
401
  const newVersion = process.argv[3] ?? originPackageJson.version;
package/bin/file.js CHANGED
@@ -55,7 +55,15 @@ try {
55
55
 
56
56
  console.log('copy paths', result);
57
57
 
58
- if (type !== 'update-template') fs.removeSync(toPath);
58
+ if (type === 'update-template') {
59
+ if (!fs.existsSync(toPath)) shellExec(`cd .. && underpost clone underpostnet/pwa-microservices-template`);
60
+ else {
61
+ shellExec(`cd ${toPath} && git reset && git checkout . && git clean -f -d`);
62
+ shellExec(`underpost pull ${toPath} underpostnet/pwa-microservices-template`);
63
+ }
64
+ } else {
65
+ fs.removeSync(toPath);
66
+ }
59
67
 
60
68
  for (const copyPath of result) {
61
69
  const folder = getDirname(`${toPath}/${copyPath}`);
@@ -117,8 +125,8 @@ try {
117
125
  templatePackageJson.scripts = originPackageJson.scripts;
118
126
  templatePackageJson.name = name;
119
127
  templatePackageJson.description = description;
120
- templatePackageJson.scripts.dev = dev;
121
- templatePackageJson.scripts.build = build;
128
+ // templatePackageJson.scripts.dev = dev;
129
+ // templatePackageJson.scripts.build = build;
122
130
  templatePackageJson.keywords = uniqueArray(
123
131
  ['pwa', 'microservices', 'template', 'builder'].concat(templatePackageJson.keywords),
124
132
  );