@travetto/pack 5.0.0-rc.13 → 5.0.0-rc.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 +1 -1
- package/src/config-util.ts +18 -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
package/src/config-util.ts
CHANGED
|
@@ -29,6 +29,23 @@ 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
|
+
if (out.length) {
|
|
44
|
+
out.unshift(`WORKDIR ${cfg.dockerRuntime.folder}`);
|
|
45
|
+
}
|
|
46
|
+
return out.join('\n');
|
|
47
|
+
}
|
|
48
|
+
|
|
32
49
|
/**
|
|
33
50
|
* Setup docker ports
|
|
34
51
|
*/
|
|
@@ -100,6 +117,7 @@ export class PackConfigUtil {
|
|
|
100
117
|
this.dockerPorts(cfg),
|
|
101
118
|
this.dockerUser(cfg),
|
|
102
119
|
this.dockerPackageInstall(cfg),
|
|
120
|
+
this.dockerNodePackageInstall(cfg),
|
|
103
121
|
this.dockerAppFolder(cfg),
|
|
104
122
|
this.dockerAppFiles(cfg),
|
|
105
123
|
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
|
}
|