npm-pkgbuild 11.5.2 → 11.5.4
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/output/docker.mjs +8 -3
- package/src/util.mjs +4 -4
package/package.json
CHANGED
package/src/output/docker.mjs
CHANGED
|
@@ -9,12 +9,17 @@ import {
|
|
|
9
9
|
equalSeparatedKeyValuePairOptions
|
|
10
10
|
} from "key-value-transformer";
|
|
11
11
|
import { Packager } from "./packager.mjs";
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
fieldProvider,
|
|
14
|
+
copyEntries,
|
|
15
|
+
utf8StreamOptions,
|
|
16
|
+
quote
|
|
17
|
+
} from "../util.mjs";
|
|
13
18
|
|
|
14
19
|
const DOCKERFILE = "Dockerfile";
|
|
15
20
|
|
|
16
21
|
function* keyValueLines(key, value, options) {
|
|
17
|
-
yield `LABEL ${key}
|
|
22
|
+
yield `LABEL ${quote(key, '"')}=${quote(value, '"')}${options.lineEnding}`;
|
|
18
23
|
}
|
|
19
24
|
|
|
20
25
|
const labelKeyValuePairs = {
|
|
@@ -48,7 +53,7 @@ export class DOCKER extends Packager {
|
|
|
48
53
|
|
|
49
54
|
async function* trailingLines() {
|
|
50
55
|
for (const [k, v] of Object.entries({
|
|
51
|
-
...
|
|
56
|
+
...properties.from,
|
|
52
57
|
...Object.fromEntries(
|
|
53
58
|
Object.entries(dependencies)
|
|
54
59
|
.filter(([k, v]) => dependenciesToFrom[k])
|
package/src/util.mjs
CHANGED
|
@@ -84,16 +84,16 @@ async function* asLines(source) {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
export function quote(v) {
|
|
87
|
+
export function quote(v, qc = "'") {
|
|
88
88
|
if (v === undefined) return "";
|
|
89
89
|
|
|
90
90
|
if (Array.isArray(v)) {
|
|
91
|
-
return "(" + v.map(x => quote(x)).join(" ") + ")";
|
|
91
|
+
return "(" + v.map(x => quote(x, qc)).join(" ") + ")";
|
|
92
92
|
}
|
|
93
93
|
if (typeof v === "number" || v instanceof Number) return v;
|
|
94
94
|
|
|
95
95
|
if (typeof v === "string" || v instanceof String)
|
|
96
|
-
return v.match(/^\w+$/) ? v :
|
|
96
|
+
return v.match(/^\w+$/) ? v : qc + v + qc;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
export function asArray(o) {
|
|
@@ -159,7 +159,7 @@ export async function* copyEntries(
|
|
|
159
159
|
|
|
160
160
|
const name = expander(
|
|
161
161
|
d === undefined ? entry.name : d.endsWith("/") ? join(d, entry.name) : d
|
|
162
|
-
).replace(/^\//,
|
|
162
|
+
).replace(/^\//, "");
|
|
163
163
|
|
|
164
164
|
entry.destination = name;
|
|
165
165
|
const destination = join(destinationDirectory, name);
|