@travetto/pack 5.0.14 → 5.0.15
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 +4 -4
- package/src/config-util.ts +7 -4
- package/support/bin/operation.ts +1 -1
- package/support/pack.base.ts +19 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/pack",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.15",
|
|
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.3.0",
|
|
31
31
|
"@rollup/plugin-terser": "^0.4.4",
|
|
32
|
-
"@travetto/runtime": "^5.0.
|
|
33
|
-
"@travetto/terminal": "^5.0.
|
|
32
|
+
"@travetto/runtime": "^5.0.12",
|
|
33
|
+
"@travetto/terminal": "^5.0.14",
|
|
34
34
|
"rollup": "^4.24.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@travetto/cli": "^5.0.
|
|
37
|
+
"@travetto/cli": "^5.0.15"
|
|
38
38
|
},
|
|
39
39
|
"peerDependenciesMeta": {
|
|
40
40
|
"@travetto/cli": {
|
package/src/config-util.ts
CHANGED
|
@@ -35,10 +35,13 @@ export class PackConfigUtil {
|
|
|
35
35
|
static dockerNodePackageInstall(cfg: DockerPackConfig): string {
|
|
36
36
|
const out: string[] = [];
|
|
37
37
|
for (const item of cfg.externalDependencies ?? []) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
const [name, directive] = item.split(':');
|
|
39
|
+
switch (directive) {
|
|
40
|
+
case 'from-source':
|
|
41
|
+
out.push(`RUN npm_config_build_from_source=true npm install ${name} --build-from-source`); break;
|
|
42
|
+
default:
|
|
43
|
+
out.push(`RUN npm install ${name}`); break;
|
|
44
|
+
}
|
|
42
45
|
}
|
|
43
46
|
if (out.length) {
|
|
44
47
|
out.unshift(`WORKDIR ${cfg.dockerRuntime.folder}`);
|
package/support/bin/operation.ts
CHANGED
|
@@ -68,7 +68,7 @@ export class PackOperation {
|
|
|
68
68
|
['BUNDLE_OUTPUT', cfg.buildDir],
|
|
69
69
|
['BUNDLE_FORMAT', Runtime.workspace.type],
|
|
70
70
|
['BUNDLE_ENV_FILE', cfg.envFile],
|
|
71
|
-
['BUNDLE_EXTERNAL', cfg.externalDependencies.join(',')]
|
|
71
|
+
['BUNDLE_EXTERNAL', cfg.externalDependencies.map(x => x.split(':')[0]).join(',')]
|
|
72
72
|
] as const)
|
|
73
73
|
.filter(x => x[1] === false || x[1])
|
|
74
74
|
.map(x => [x[0], `${x[1]}`])
|
package/support/pack.base.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { CliCommandShape, CliFlag, ParsedState, cliTpl } from '@travetto/cli';
|
|
|
5
5
|
import { TimeUtil, Runtime, RuntimeIndex } from '@travetto/runtime';
|
|
6
6
|
import { Terminal } from '@travetto/terminal';
|
|
7
7
|
import { Ignore, Required, Schema } from '@travetto/schema';
|
|
8
|
+
import { PackageUtil } from '@travetto/manifest';
|
|
8
9
|
|
|
9
10
|
import { PackOperation } from './bin/operation';
|
|
10
11
|
import { PackUtil } from './bin/util';
|
|
@@ -111,6 +112,19 @@ export abstract class BasePackCommand implements CliCommandShape {
|
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Get all binary dependencies
|
|
117
|
+
*/
|
|
118
|
+
getBinaryDependencies(): string[] {
|
|
119
|
+
return [...RuntimeIndex.getModuleList('all')]
|
|
120
|
+
.map(m => RuntimeIndex.getModule(m))
|
|
121
|
+
.filter(m => !!m)
|
|
122
|
+
.filter(m => m.prod)
|
|
123
|
+
.map(m => PackageUtil.readPackage(m?.sourcePath))
|
|
124
|
+
.map(p => p?.travetto?.build?.binaryDependencies ?? [])
|
|
125
|
+
.flat();
|
|
126
|
+
}
|
|
127
|
+
|
|
114
128
|
async main(args: string[] = []): Promise<void> {
|
|
115
129
|
// Resolve all files to absolute paths
|
|
116
130
|
this.output = this.output ? path.resolve(this.output) : undefined!;
|
|
@@ -123,6 +137,11 @@ export abstract class BasePackCommand implements CliCommandShape {
|
|
|
123
137
|
this.mainName ??= path.basename(this.module);
|
|
124
138
|
this.mainFile = `${this.mainName}.js`;
|
|
125
139
|
|
|
140
|
+
// Collect binary dependencies
|
|
141
|
+
const binaryDeps = await this.getBinaryDependencies();
|
|
142
|
+
console.log('Binary Dependencies:', binaryDeps);
|
|
143
|
+
this.externalDependencies = [...this.externalDependencies, ...binaryDeps];
|
|
144
|
+
|
|
126
145
|
const stream = this.runOperations();
|
|
127
146
|
|
|
128
147
|
// Eject to file
|