@travetto/pack 3.4.0-rc.7 → 3.4.0-rc.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/pack",
3
- "version": "3.4.0-rc.7",
3
+ "version": "3.4.0-rc.9",
4
4
  "description": "Code packing utilities",
5
5
  "keywords": [
6
6
  "travetto",
@@ -28,11 +28,11 @@
28
28
  "@rollup/plugin-json": "^6.0.1",
29
29
  "@rollup/plugin-node-resolve": "^15.2.3",
30
30
  "@rollup/plugin-terser": "^0.4.4",
31
- "@travetto/base": "^3.4.0-rc.1",
31
+ "@travetto/base": "^3.4.0-rc.2",
32
32
  "rollup": "^4.3.0"
33
33
  },
34
34
  "peerDependencies": {
35
- "@travetto/cli": "^3.4.0-rc.2"
35
+ "@travetto/cli": "^3.4.0-rc.3"
36
36
  },
37
37
  "peerDependenciesMeta": {
38
38
  "@travetto/cli": {
@@ -67,14 +67,10 @@ export function getFiles(): string[] {
67
67
  }
68
68
 
69
69
  export function getIgnoredModules(): string[] {
70
- const out = [...RootIndex.getModuleList('all')]
70
+ return [...RootIndex.getModuleList('all')]
71
71
  .map(x => RootIndex.manifest.modules[x])
72
72
  .filter(m => !m.prod)
73
73
  .map(m => m.name);
74
-
75
- out.push('@travetto/pack', '@travetto/compiler');
76
-
77
- return out;
78
74
  }
79
75
 
80
76
  export function getTerserConfig(): Parameters<typeof terser>[0] {
@@ -65,6 +65,8 @@ export class DockerPackOperation {
65
65
  yield ActiveShellCommand.chdir(path.cwd());
66
66
  } else {
67
67
  await PackUtil.runCommand(cmd, { cwd: cfg.workspace, stdio: [0, 'pipe', 2] });
68
+ const [image] = JSON.parse(await PackUtil.runCommand(['docker', 'inspect', cfg.dockerImage]));
69
+ yield [cliTpl`${{ title: 'Built Docker Container ' }} ${{ identifier: 'sizeMb' }}=${{ param: Math.trunc(image.Size / 2 ** 20) }}`];
68
70
  }
69
71
  }
70
72
 
@@ -88,6 +88,8 @@ export class PackOperation {
88
88
  yield ActiveShellCommand.chdir(path.cwd());
89
89
  } else {
90
90
  await PackUtil.runCommand(bundleCommand, { cwd, env });
91
+ const stat = await fs.stat(path.resolve(cfg.workspace, `${cfg.mainName}.js`));
92
+ yield [cliTpl`${{ title: 'Bundled Output ' }} ${{ identifier: 'sizeKb' }}=${{ param: Math.trunc(stat.size / 2 ** 10) }}`];
91
93
  }
92
94
  }
93
95
 
@@ -1,7 +1,7 @@
1
1
  import fs from 'fs/promises';
2
2
 
3
3
  import { path, RootIndex } from '@travetto/manifest';
4
- import { AppError, ExecUtil, ExecutionOptions } from '@travetto/base';
4
+ import { AppError, ExecUtil, ExecutionOptions, ExecutionResult } from '@travetto/base';
5
5
 
6
6
  import { ActiveShellCommand } from './shell';
7
7
 
@@ -66,8 +66,8 @@ export class PackUtil {
66
66
  /**
67
67
  * Track result response
68
68
  */
69
- static async runCommand(cmd: string[], opts: ExecutionOptions = {}): Promise<void> {
70
- const { valid, code, stderr, message } = await ExecUtil.spawn(cmd[0], cmd.slice(1), {
69
+ static async runCommand(cmd: string[], opts: ExecutionOptions = {}): Promise<string> {
70
+ const { valid, code, stderr, message, stdout } = await ExecUtil.spawn(cmd[0], cmd.slice(1), {
71
71
  stdio: [0, 'pipe', 'pipe', 'ipc'],
72
72
  ...opts,
73
73
  catchAsResult: true
@@ -76,5 +76,6 @@ export class PackUtil {
76
76
  process.exitCode = code;
77
77
  throw new AppError(stderr || message || 'An unexpected error has occurred');
78
78
  }
79
+ return stdout;
79
80
  }
80
81
  }