@giteeteam/apps-cli 0.2.1 → 0.2.3
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/dist/index.js +35 -30
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var execa__default = /*#__PURE__*/_interopDefaultLegacy(execa);
|
|
|
31
31
|
var child_process__default = /*#__PURE__*/_interopDefaultLegacy(child_process);
|
|
32
32
|
var chokidar__default = /*#__PURE__*/_interopDefaultLegacy(chokidar);
|
|
33
33
|
|
|
34
|
-
var version = "0.2.
|
|
34
|
+
var version = "0.2.3";
|
|
35
35
|
|
|
36
36
|
const packageApp = async ({ outputDir, manifest, copyFiles }) => {
|
|
37
37
|
const { resources } = manifest;
|
|
@@ -169,7 +169,7 @@ class Manifest {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
const getManifest = async () => {
|
|
172
|
-
const manifestFile = path__default["default"].resolve('
|
|
172
|
+
const manifestFile = path__default["default"].resolve('manifest.yml');
|
|
173
173
|
const strBuffer = await fse__default["default"].readFile(manifestFile);
|
|
174
174
|
return new Manifest(strBuffer.toString());
|
|
175
175
|
};
|
|
@@ -442,34 +442,43 @@ const watchFiles = async (options) => {
|
|
|
442
442
|
}
|
|
443
443
|
};
|
|
444
444
|
|
|
445
|
-
var _a
|
|
446
|
-
const
|
|
445
|
+
var _a, _b;
|
|
446
|
+
const image = {
|
|
447
|
+
repository: 'registry.baidubce.com/proxima/proxima-apps-runtime-server',
|
|
448
|
+
tag: (_a = process.env.IMAGE_TAG) !== null && _a !== void 0 ? _a : '2.5.0-alpha-41',
|
|
449
|
+
};
|
|
450
|
+
const containerPort = Number((_b = process.env.CONTAINER_PORT) !== null && _b !== void 0 ? _b : 8455);
|
|
447
451
|
const containerName = 'cli-dev-apps-runtime-server';
|
|
448
|
-
const
|
|
449
|
-
|
|
450
|
-
|
|
452
|
+
const tempApp = '/app/production/1.0';
|
|
453
|
+
const tempAppDir = `${tempApp}/server-side`;
|
|
454
|
+
const containerEnv = {
|
|
455
|
+
PORT: containerPort,
|
|
456
|
+
APPS_DIR: '/usr/src/app/apps',
|
|
457
|
+
LRU_TTL: 0,
|
|
458
|
+
DEBUG: 'runtime*',
|
|
459
|
+
PARSE_PUBLIC_SERVER_URL: process.env.PARSE_PUBLIC_SERVER_URL,
|
|
460
|
+
PARSE_SERVER_MASTER_KEY: process.env.PARSE_SERVER_MASTER_KEY,
|
|
461
|
+
PROXIMA_CORE_URL: process.env.PROXIMA_CORE_URL,
|
|
462
|
+
PGSQL_CLIENT_HOST: process.env.PGSQL_CLIENT_HOST,
|
|
463
|
+
PGSQL_CLIENT_PORT: process.env.PGSQL_CLIENT_PORT,
|
|
464
|
+
PGSQL_CLIENT_USER: process.env.PGSQL_CLIENT_USER,
|
|
465
|
+
PGSQL_CLIENT_PASSWORD: process.env.PGSQL_CLIENT_PASSWORD,
|
|
466
|
+
};
|
|
467
|
+
const copyManifest = async (appDir) => {
|
|
468
|
+
const manifestFile = path__default["default"].resolve('manifest.yml');
|
|
469
|
+
const targetFile = path__default["default"].join(appDir, 'manifest.yml');
|
|
451
470
|
await fse__default["default"].copy(manifestFile, targetFile);
|
|
452
471
|
};
|
|
453
472
|
var run = async (options) => {
|
|
454
|
-
const {
|
|
473
|
+
const { inputDir, outputDir } = options;
|
|
474
|
+
await fse__default["default"].emptyDir(outputDir);
|
|
475
|
+
const imageName = `${image.repository}:${image.tag}`;
|
|
476
|
+
const appDir = path__default["default"].join(outputDir, tempAppDir);
|
|
455
477
|
const dockerService = new DockerService(imageName);
|
|
456
|
-
const pluginDir = path__default["default"].join(outputDir, '_test/production/1.0/server-side');
|
|
457
478
|
await dockerService.downloadImage();
|
|
458
479
|
await dockerService.runContainer({
|
|
459
480
|
port: containerPort,
|
|
460
|
-
env:
|
|
461
|
-
PORT: containerPort,
|
|
462
|
-
APPS_DIR: '/usr/src/app/apps',
|
|
463
|
-
LRU_TTL: 0,
|
|
464
|
-
DEBUG: 'runtime*',
|
|
465
|
-
PARSE_PUBLIC_SERVER_URL: process.env.PARSE_PUBLIC_SERVER_URL,
|
|
466
|
-
PARSE_SERVER_MASTER_KEY: process.env.PARSE_SERVER_MASTER_KEY,
|
|
467
|
-
PROXIMA_CORE_URL: process.env.PROXIMA_CORE_URL,
|
|
468
|
-
PGSQL_CLIENT_HOST: process.env.PGSQL_CLIENT_HOST,
|
|
469
|
-
PGSQL_CLIENT_PORT: process.env.PGSQL_CLIENT_PORT,
|
|
470
|
-
PGSQL_CLIENT_USER: process.env.PGSQL_CLIENT_USER,
|
|
471
|
-
PGSQL_CLIENT_PASSWORD: process.env.PGSQL_CLIENT_PASSWORD,
|
|
472
|
-
},
|
|
481
|
+
env: containerEnv,
|
|
473
482
|
volume: [`${outputDir}:/usr/src/app/apps`],
|
|
474
483
|
name: containerName,
|
|
475
484
|
});
|
|
@@ -478,19 +487,15 @@ var run = async (options) => {
|
|
|
478
487
|
await fse__default["default"].remove(outputDir);
|
|
479
488
|
process.exit();
|
|
480
489
|
});
|
|
481
|
-
await copyManifest(
|
|
482
|
-
await watchFiles({ inputDir, outputDir:
|
|
490
|
+
await copyManifest(appDir);
|
|
491
|
+
await watchFiles({ inputDir, outputDir: appDir });
|
|
492
|
+
console.log('You can use this url for test:');
|
|
493
|
+
console.log(`POST http://localhost:${containerPort}/v1/apps${tempApp}/functions/:key`);
|
|
483
494
|
};
|
|
484
495
|
|
|
485
|
-
var _a;
|
|
486
|
-
const image = {
|
|
487
|
-
repository: 'registry.baidubce.com/proxima/proxima-apps-runtime-server',
|
|
488
|
-
tag: (_a = process.env.IMAGE_TAG) !== null && _a !== void 0 ? _a : '2.5.0-alpha-41',
|
|
489
|
-
};
|
|
490
496
|
var dev = async (options) => {
|
|
491
497
|
const { input = 'src', output = 'cache' } = options;
|
|
492
498
|
await run({
|
|
493
|
-
imageName: `${image.repository}:${image.tag}`,
|
|
494
499
|
outputDir: path__default["default"].resolve(output),
|
|
495
500
|
inputDir: path__default["default"].resolve(input),
|
|
496
501
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@giteeteam/apps-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Giteeteam Apps cli",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -58,6 +58,5 @@
|
|
|
58
58
|
"@types/fs-extra": "^9.0.13",
|
|
59
59
|
"@types/inquirer": "^8.2.1",
|
|
60
60
|
"@types/uuid": "^8.3.4"
|
|
61
|
-
}
|
|
62
|
-
"gitHead": "668caac9b1c7f4a82beb57b615ef827a84912823"
|
|
61
|
+
}
|
|
63
62
|
}
|