@giteeteam/apps-cli 0.2.4 → 0.2.6

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 +19 -14
  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.4";
34
+ var version = "0.2.6";
35
35
 
36
36
  const packageApp = async ({ outputDir, manifest, copyFiles }) => {
37
37
  const { resources } = manifest;
@@ -211,7 +211,7 @@ var run$2 = async ({ outputDir, inputDir, prod, copyFiles, zip }) => {
211
211
  };
212
212
 
213
213
  const defaultCopyFiles = ['manifest.yml'];
214
- var build = async (options) => {
214
+ var build$1 = async (options) => {
215
215
  const { input = 'src', output = 'dist', prod, copy = [], zip } = options;
216
216
  await run$2({
217
217
  outputDir: path__default["default"].resolve(output),
@@ -385,8 +385,9 @@ class DockerService {
385
385
  this.imageName = imageName;
386
386
  }
387
387
  async downloadImage() {
388
+ console.log(`Downloading image(${this.imageName}) ...`);
388
389
  await this.execPromise(`docker pull ${this.imageName}`);
389
- console.log(`Download image(${this.imageName}) success`);
390
+ console.log(`Download image(${this.imageName}) success!`);
390
391
  }
391
392
  async runContainer({ port, env, name, volume = [] }) {
392
393
  // 先删掉容器
@@ -399,7 +400,7 @@ class DockerService {
399
400
  await this.execPromise(command);
400
401
  }
401
402
  async removeContainer(containerName) {
402
- await this.execPromise(`docker rm -f ${containerName}`);
403
+ await this.execPromise(`docker rm -f ${containerName}`).catch(() => { });
403
404
  }
404
405
  execPromise(cmd) {
405
406
  return new Promise((resolve, reject) => {
@@ -416,10 +417,21 @@ class DockerService {
416
417
  }
417
418
  }
418
419
 
420
+ const build = (functionFiles, inputDir, outputDir) => {
421
+ for (const fileName of functionFiles) {
422
+ appsBundler.bundle({
423
+ inputDir,
424
+ outputDir,
425
+ fileName,
426
+ mode: appsBundler.MODE.DEV,
427
+ });
428
+ }
429
+ };
419
430
  const watchFiles = async (options) => {
420
431
  const { inputDir, outputDir } = options;
421
432
  const manifest = await getManifest();
422
433
  const functionFiles = manifest.getFunctionFiles();
434
+ build(functionFiles, inputDir, outputDir);
423
435
  let timer;
424
436
  // 监听整个文件夹,有一个文件改动,则全部重新build
425
437
  // TODO 解析出文件之间的依赖关系,提升构建速度
@@ -428,14 +440,7 @@ const watchFiles = async (options) => {
428
440
  clearTimeout(timer);
429
441
  timer = setTimeout(() => {
430
442
  console.log(`build ${inputDir}`);
431
- for (const fileName of functionFiles) {
432
- appsBundler.bundle({
433
- inputDir,
434
- outputDir,
435
- fileName,
436
- mode: appsBundler.MODE.DEV,
437
- });
438
- }
443
+ build(functionFiles, inputDir, outputDir);
439
444
  }, 1000);
440
445
  });
441
446
  };
@@ -443,7 +448,7 @@ const watchFiles = async (options) => {
443
448
  var _a, _b;
444
449
  const image = {
445
450
  repository: 'registry.baidubce.com/proxima/proxima-apps-runtime-server',
446
- tag: (_a = process.env.IMAGE_TAG) !== null && _a !== void 0 ? _a : '2.5.0-alpha-41',
451
+ tag: (_a = process.env.IMAGE_TAG) !== null && _a !== void 0 ? _a : '2.7.0-alpha-45',
447
452
  };
448
453
  const containerPort = Number((_b = process.env.CONTAINER_PORT) !== null && _b !== void 0 ? _b : 8455);
449
454
  const containerName = 'cli-dev-apps-runtime-server';
@@ -508,7 +513,7 @@ program
508
513
  .option('-c --copy [letters...]', 'copy files')
509
514
  .option('-i --input [dir]', 'input dir')
510
515
  .option('-o --output [dir]', 'output dir')
511
- .action(build);
516
+ .action(build$1);
512
517
  program.command('create [name]').action(create);
513
518
  program
514
519
  .command('dev')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giteeteam/apps-cli",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
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": "8f986a59969dc6e5902a17b1d608b2f27d46b559"
62
+ "gitHead": "f32eb236ef8765f6788e9906416745043cf76158"
63
63
  }