@giteeteam/apps-cli 0.2.1 → 0.2.2

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.
Files changed (2) hide show
  1. package/dist/index.js +32 -30
  2. package/package.json +2 -2
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.1";
34
+ var version = "0.2.2";
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('./manifest.yml');
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,42 @@ const watchFiles = async (options) => {
442
442
  }
443
443
  };
444
444
 
445
- var _a$1;
446
- const containerPort = Number((_a$1 = process.env.CONTAINER_PORT) !== null && _a$1 !== void 0 ? _a$1 : 8455);
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 copyManifest = async (pluginDir) => {
449
- const manifestFile = path__default["default"].resolve('./manifest.yml');
450
- const targetFile = path__default["default"].join(pluginDir, 'manifest.yml');
452
+ const tempAppDir = 'app/production/1.0/server-side';
453
+ const containerEnv = {
454
+ PORT: containerPort,
455
+ APPS_DIR: '/usr/src/app/apps',
456
+ LRU_TTL: 0,
457
+ DEBUG: 'runtime*',
458
+ PARSE_PUBLIC_SERVER_URL: process.env.PARSE_PUBLIC_SERVER_URL,
459
+ PARSE_SERVER_MASTER_KEY: process.env.PARSE_SERVER_MASTER_KEY,
460
+ PROXIMA_CORE_URL: process.env.PROXIMA_CORE_URL,
461
+ PGSQL_CLIENT_HOST: process.env.PGSQL_CLIENT_HOST,
462
+ PGSQL_CLIENT_PORT: process.env.PGSQL_CLIENT_PORT,
463
+ PGSQL_CLIENT_USER: process.env.PGSQL_CLIENT_USER,
464
+ PGSQL_CLIENT_PASSWORD: process.env.PGSQL_CLIENT_PASSWORD,
465
+ };
466
+ const copyManifest = async (appDir) => {
467
+ const manifestFile = path__default["default"].resolve('manifest.yml');
468
+ const targetFile = path__default["default"].join(appDir, 'manifest.yml');
451
469
  await fse__default["default"].copy(manifestFile, targetFile);
452
470
  };
453
471
  var run = async (options) => {
454
- const { imageName, inputDir, outputDir } = options;
472
+ const { inputDir, outputDir } = options;
473
+ await fse__default["default"].emptyDir(outputDir);
474
+ const imageName = `${image.repository}:${image.tag}`;
475
+ const appDir = path__default["default"].join(outputDir, tempAppDir);
455
476
  const dockerService = new DockerService(imageName);
456
- const pluginDir = path__default["default"].join(outputDir, '_test/production/1.0/server-side');
457
477
  await dockerService.downloadImage();
458
478
  await dockerService.runContainer({
459
479
  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
- },
480
+ env: containerEnv,
473
481
  volume: [`${outputDir}:/usr/src/app/apps`],
474
482
  name: containerName,
475
483
  });
@@ -478,19 +486,13 @@ var run = async (options) => {
478
486
  await fse__default["default"].remove(outputDir);
479
487
  process.exit();
480
488
  });
481
- await copyManifest(pluginDir);
482
- await watchFiles({ inputDir, outputDir: pluginDir });
489
+ await copyManifest(appDir);
490
+ await watchFiles({ inputDir, outputDir: appDir });
483
491
  };
484
492
 
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
493
  var dev = async (options) => {
491
494
  const { input = 'src', output = 'cache' } = options;
492
495
  await run({
493
- imageName: `${image.repository}:${image.tag}`,
494
496
  outputDir: path__default["default"].resolve(output),
495
497
  inputDir: path__default["default"].resolve(input),
496
498
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giteeteam/apps-cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Giteeteam Apps cli",
5
5
  "keywords": [
6
6
  "typescript",
@@ -59,5 +59,5 @@
59
59
  "@types/inquirer": "^8.2.1",
60
60
  "@types/uuid": "^8.3.4"
61
61
  },
62
- "gitHead": "668caac9b1c7f4a82beb57b615ef827a84912823"
62
+ "gitHead": "21e371df9bb6e4b94ccd508f17db93f5055a0b3d"
63
63
  }