@travetto/pack 8.0.0-alpha.1 → 8.0.0-alpha.2
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/README.md +3 -3
- package/package.json +2 -2
- package/support/cli.pack_docker.ts +15 -14
- package/support/cli.pack_zip.ts +2 -3
package/README.md
CHANGED
|
@@ -97,7 +97,7 @@ Usage: pack:zip [options] [args...:string]
|
|
|
97
97
|
Options:
|
|
98
98
|
-b, --buildDir <string> Workspace for building (default: "/tmp/<temp-folder>")
|
|
99
99
|
--clean, --no-clean Clean workspace (default: true)
|
|
100
|
-
-o, --output <string> Output location (default: "
|
|
100
|
+
-o, --output <string> Output location (default: "<module>.zip")
|
|
101
101
|
--main-scripts, --no-main-scripts Create entry scripts (default: true)
|
|
102
102
|
-f, --main-name <string> Main name for build artifact
|
|
103
103
|
-e, --entry-point <string> Entry point (default: "@travetto/cli/support/entry.trv.ts")
|
|
@@ -142,7 +142,7 @@ Options:
|
|
|
142
142
|
-m, --module <module> Module to run for
|
|
143
143
|
-df, --docker-factory <string> Docker Factory source (default: "@travetto/pack/support/pack.dockerfile.ts")
|
|
144
144
|
-di, --docker-image <string> Docker Image to extend (default: "node:25-alpine")
|
|
145
|
-
-dn, --docker-name <string> Docker Image Name (default: "
|
|
145
|
+
-dn, --docker-name <string> Docker Image Name (default: "<module>")
|
|
146
146
|
-ru, --runtime-user <string> Docker Runtime user
|
|
147
147
|
-rp, --runtime-package <string> Docker Runtime Packages (default: [])
|
|
148
148
|
-dp, --docker-port <number> Docker Image Port (default: [])
|
|
@@ -273,6 +273,6 @@ echo "ENTRYPOINT [\"/app/todo-app.sh\"]" >> $DIST/Dockerfile
|
|
|
273
273
|
echo "Building Docker Container latest"
|
|
274
274
|
|
|
275
275
|
cd $DIST
|
|
276
|
-
docker build -t
|
|
276
|
+
docker build -t <module>:latest .
|
|
277
277
|
cd $ROOT
|
|
278
278
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/pack",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Code packing utilities",
|
|
6
6
|
"keywords": [
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"rollup": "^4.59.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@travetto/cli": "^8.0.0-alpha.
|
|
38
|
+
"@travetto/cli": "^8.0.0-alpha.2"
|
|
39
39
|
},
|
|
40
40
|
"peerDependenciesMeta": {
|
|
41
41
|
"@travetto/cli": {
|
|
@@ -9,6 +9,8 @@ import { BasePackCommand, type PackOperationShape } from './pack.base';
|
|
|
9
9
|
import type { DockerPackConfig } from '../src/types.ts';
|
|
10
10
|
|
|
11
11
|
const NODE_MAJOR = process.version.match(/\d+/)?.[0] ?? '22';
|
|
12
|
+
const asNumber = (input?: string): number | undefined => (!input || isNaN(+input)) ? undefined : +input;
|
|
13
|
+
const asString = (input?: string): string | undefined => (input && asNumber(input)) ? input : undefined;
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Standard docker support for pack
|
|
@@ -66,26 +68,25 @@ export class PackDockerCommand extends BasePackCommand {
|
|
|
66
68
|
defaultUserId = 2000;
|
|
67
69
|
|
|
68
70
|
finalize(forHelp?: boolean): void {
|
|
69
|
-
if (
|
|
70
|
-
this.
|
|
71
|
+
if (forHelp) {
|
|
72
|
+
this.dockerName = '<module>';
|
|
71
73
|
}
|
|
72
74
|
|
|
73
|
-
if (
|
|
74
|
-
this.
|
|
75
|
-
} else {
|
|
76
|
-
this.dockerName ??= CliUtil.getSimpleModuleName('<module>', this.module || undefined);
|
|
75
|
+
if (this.dockerFactory.startsWith('.')) {
|
|
76
|
+
this.dockerFactory = RuntimeIndex.getFromSource(path.resolve(this.dockerFactory))?.import ?? this.dockerFactory;
|
|
77
77
|
}
|
|
78
|
+
this.dockerName ??= CliUtil.getSimpleModuleName('<module>', this.module);
|
|
78
79
|
|
|
79
80
|
// Finalize user/group and ids
|
|
80
81
|
const [userOrUserId, groupOrGroupId = userOrUserId] = (this.dockerRuntimeUser ?? '').split(':');
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
this.dockerRuntime = {
|
|
83
|
+
user: asString(userOrUserId) ?? this.defaultUser,
|
|
84
|
+
userId: asNumber(userOrUserId) ?? this.defaultUserId,
|
|
85
|
+
group: asString(groupOrGroupId) ?? this.defaultUser,
|
|
86
|
+
groupId: asNumber(groupOrGroupId) ?? this.defaultUserId,
|
|
87
|
+
folder: `/${this.appFolder}`,
|
|
88
|
+
packages: this.dockerRuntimePackages
|
|
89
|
+
};
|
|
89
90
|
|
|
90
91
|
if (this.dockerStageOnly) {
|
|
91
92
|
if (this.dockerRegistry) {
|
package/support/cli.pack_zip.ts
CHANGED
|
@@ -11,10 +11,9 @@ export class PackZipCommand extends BasePackCommand {
|
|
|
11
11
|
|
|
12
12
|
finalize(forHelp?: boolean): void {
|
|
13
13
|
if (forHelp) {
|
|
14
|
-
this.output =
|
|
15
|
-
} else {
|
|
16
|
-
this.output ??= CliUtil.getSimpleModuleName('<module>.zip', this.module);
|
|
14
|
+
this.output = '<module>.zip';
|
|
17
15
|
}
|
|
16
|
+
this.output ??= CliUtil.getSimpleModuleName('<module>.zip', this.module);
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
getOperations(): PackOperationShape<this>[] {
|