@travetto/pack 5.0.0-rc.12 → 5.0.0-rc.14
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 +15 -0
- package/src/types.ts +2 -0
- package/support/bin/operation.ts +2 -1
- package/support/pack.base.ts +3 -0
- package/support/rollup/build.ts +1 -0
- package/support/rollup/config.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/pack",
|
|
3
|
-
"version": "5.0.0-rc.
|
|
3
|
+
"version": "5.0.0-rc.14",
|
|
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.
|
|
33
|
-
"@travetto/terminal": "^5.0.0-rc.
|
|
32
|
+
"@travetto/runtime": "^5.0.0-rc.13",
|
|
33
|
+
"@travetto/terminal": "^5.0.0-rc.13",
|
|
34
34
|
"rollup": "^4.20.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@travetto/cli": "^5.0.0-rc.
|
|
37
|
+
"@travetto/cli": "^5.0.0-rc.14"
|
|
38
38
|
},
|
|
39
39
|
"peerDependenciesMeta": {
|
|
40
40
|
"@travetto/cli": {
|
package/src/config-util.ts
CHANGED
|
@@ -29,6 +29,20 @@ export class PackConfigUtil {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Install docker pages in either apk or apt environments
|
|
34
|
+
*/
|
|
35
|
+
static dockerNodePackageInstall(cfg: DockerPackConfig): string {
|
|
36
|
+
const out: string[] = [];
|
|
37
|
+
for (const item of cfg.externalDependencies ?? []) {
|
|
38
|
+
out.push(item.endsWith(':from-source') ?
|
|
39
|
+
`RUN npm_config_build_from_source=true npm install ${item.split(':')[0]} --build-from-source` :
|
|
40
|
+
`RUN npm install ${item}`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
return out.join('\n');
|
|
44
|
+
}
|
|
45
|
+
|
|
32
46
|
/**
|
|
33
47
|
* Setup docker ports
|
|
34
48
|
*/
|
|
@@ -100,6 +114,7 @@ export class PackConfigUtil {
|
|
|
100
114
|
this.dockerPorts(cfg),
|
|
101
115
|
this.dockerUser(cfg),
|
|
102
116
|
this.dockerPackageInstall(cfg),
|
|
117
|
+
this.dockerNodePackageInstall(cfg),
|
|
103
118
|
this.dockerAppFolder(cfg),
|
|
104
119
|
this.dockerAppFiles(cfg),
|
|
105
120
|
this.dockerEnvVars(cfg),
|
package/src/types.ts
CHANGED
|
@@ -19,6 +19,7 @@ export type CommonPackConfig = {
|
|
|
19
19
|
rollupConfiguration: string;
|
|
20
20
|
entryPoint: string;
|
|
21
21
|
entryArguments: string[];
|
|
22
|
+
externalDependencies: string[];
|
|
22
23
|
minify: boolean;
|
|
23
24
|
sourcemap: boolean;
|
|
24
25
|
includeSources: boolean;
|
|
@@ -72,5 +73,6 @@ export type CoreRollupConfig = {
|
|
|
72
73
|
entry: string;
|
|
73
74
|
files: string[];
|
|
74
75
|
ignore: Set<string>;
|
|
76
|
+
external: string[];
|
|
75
77
|
minify: Parameters<typeof terser>[0];
|
|
76
78
|
};
|
package/support/bin/operation.ts
CHANGED
|
@@ -67,7 +67,8 @@ export class PackOperation {
|
|
|
67
67
|
['BUNDLE_SOURCES', cfg.includeSources],
|
|
68
68
|
['BUNDLE_OUTPUT', cfg.buildDir],
|
|
69
69
|
['BUNDLE_FORMAT', Runtime.workspace.type],
|
|
70
|
-
['BUNDLE_ENV_FILE', cfg.envFile]
|
|
70
|
+
['BUNDLE_ENV_FILE', cfg.envFile],
|
|
71
|
+
['BUNDLE_EXTERNAL', cfg.externalDependencies.join(',')]
|
|
71
72
|
] as const)
|
|
72
73
|
.filter(x => x[1] === false || x[1])
|
|
73
74
|
.map(x => [x[0], `${x[1]}`])
|
package/support/pack.base.ts
CHANGED
|
@@ -71,6 +71,9 @@ export abstract class BasePackCommand implements CliCommandShape {
|
|
|
71
71
|
@CliFlag({ desc: 'Include workspace resources', short: 'wr' })
|
|
72
72
|
includeWorkspaceResources: boolean = false;
|
|
73
73
|
|
|
74
|
+
@CliFlag({ desc: 'External NPM Packages', short: 'np', name: 'npm-package', envVars: ['PACK_EXTERNAL_PACKAGES'] })
|
|
75
|
+
externalDependencies: string[] = [];
|
|
76
|
+
|
|
74
77
|
@Ignore()
|
|
75
78
|
module: string;
|
|
76
79
|
|
package/support/rollup/build.ts
CHANGED
package/support/rollup/config.ts
CHANGED
|
@@ -86,9 +86,10 @@ export function getCoreConfig(): CoreRollupConfig {
|
|
|
86
86
|
const ignoreFiles = ignoreModules.flatMap(getFilesFromModule);
|
|
87
87
|
const minify = getMinifyConfig();
|
|
88
88
|
const envFile = new EnvProp('BUNDLE_ENV_FILE').val;
|
|
89
|
+
const external = new EnvProp('BUNDLE_EXTERNAL').list ?? [];
|
|
89
90
|
|
|
90
91
|
return {
|
|
91
|
-
output, entry, files, envFile, minify,
|
|
92
|
+
output, entry, files, envFile, minify, external,
|
|
92
93
|
ignore: new Set([...ignoreModules.map(x => x.name), ...ignoreFiles]),
|
|
93
94
|
};
|
|
94
95
|
}
|