@travetto/pack 5.0.0-rc.8 → 5.0.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": "5.0.0-rc.8",
3
+ "version": "5.0.0-rc.9",
4
4
  "description": "Code packing utilities",
5
5
  "keywords": [
6
6
  "travetto",
@@ -29,12 +29,12 @@
29
29
  "@rollup/plugin-json": "^6.1.0",
30
30
  "@rollup/plugin-node-resolve": "^15.2.3",
31
31
  "@rollup/plugin-terser": "^0.4.4",
32
- "@travetto/runtime": "^5.0.0-rc.8",
33
- "@travetto/terminal": "^5.0.0-rc.8",
32
+ "@travetto/runtime": "^5.0.0-rc.9",
33
+ "@travetto/terminal": "^5.0.0-rc.9",
34
34
  "rollup": "^4.18.0"
35
35
  },
36
36
  "peerDependencies": {
37
- "@travetto/cli": "^5.0.0-rc.8"
37
+ "@travetto/cli": "^5.0.0-rc.9"
38
38
  },
39
39
  "peerDependenciesMeta": {
40
40
  "@travetto/cli": {
@@ -74,7 +74,7 @@ export class PackConfigUtil {
74
74
  }
75
75
 
76
76
  /**
77
- * Docker app files copied and permissioned
77
+ * Docker app files copied with proper permissions
78
78
  */
79
79
  static dockerAppFiles(cfg: DockerPackConfig): string {
80
80
  const { user, group, folder } = cfg.dockerRuntime;
@@ -22,8 +22,13 @@ export class DockerPackOperation {
22
22
  // Read os before writing
23
23
  cfg.dockerRuntime.os = await PackUtil.runCommand(
24
24
  ['docker', 'run', '--entrypoint', '/bin/sh', cfg.dockerImage, '-c', 'cat /etc/*release*']
25
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
26
- ).then(out => out.match(/\b(?:debian|alpine|centos)\b/i)?.[0].toLowerCase() as 'alpine' ?? 'unknown');
25
+ ).then(out => {
26
+ const found = out.match(/\b(?:debian|alpine|centos)\b/i)?.[0].toLowerCase();
27
+ switch (found) {
28
+ case 'debian': case 'alpine': case 'centos': return found;
29
+ default: return 'unknown';
30
+ }
31
+ });
27
32
  yield* PackOperation.title(cfg, cliTpl`${{ title: 'Detected Image OS' }} ${{ param: cfg.dockerImage }} as ${{ param: cfg.dockerRuntime.os }}`);
28
33
  }
29
34
 
@@ -29,7 +29,7 @@ export class PackUtil {
29
29
  }
30
30
  await fs.mkdir(final, { recursive: true });
31
31
  await fs.cp(src, final, { recursive: true });
32
- } catch (err) {
32
+ } catch {
33
33
  if (!ignoreFailure) {
34
34
  throw new Error(`Failed to copy ${src} to ${dest}`);
35
35
  }
@@ -21,9 +21,16 @@ function getFilesFromModule(m: ManifestModule): string[] {
21
21
  .map(([f]) => ManifestModuleUtil.withOutputExtension(path.resolve(m.outputFolder, f)));
22
22
  }
23
23
 
24
+ function getFormat(value: string = 'commonjs'): NodeModuleType {
25
+ switch (value) {
26
+ case 'module':
27
+ case 'commonjs': return value;
28
+ default: return 'commonjs';
29
+ }
30
+ }
31
+
24
32
  export function getOutput(): OutputOptions {
25
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
26
- const format = (process.env.BUNDLE_FORMAT ?? 'commonjs') as NodeModuleType;
33
+ const format = getFormat(process.env.BUNDLE_FORMAT);
27
34
  const dir = process.env.BUNDLE_OUTPUT!;
28
35
  const mainFile = process.env.BUNDLE_MAIN_FILE!;
29
36
  return {