npm-pkgbuild 7.3.3 → 7.3.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/npm-pkgbuild-cli.mjs +2 -2
- package/src/output/deb.mjs +15 -11
package/package.json
CHANGED
package/src/npm-pkgbuild-cli.mjs
CHANGED
|
@@ -26,7 +26,7 @@ outputs.forEach(o =>
|
|
|
26
26
|
|
|
27
27
|
program
|
|
28
28
|
.option("--pkgver <version>", "package version")
|
|
29
|
-
.option("-
|
|
29
|
+
.option("-d --destination <dir>", "where to put the package(s)", cwd)
|
|
30
30
|
.option("-s --staging <dir>", "staging directory", "build")
|
|
31
31
|
.option(
|
|
32
32
|
"-c --content <dir>",
|
|
@@ -70,7 +70,7 @@ program
|
|
|
70
70
|
properties
|
|
71
71
|
);
|
|
72
72
|
|
|
73
|
-
const fileName = await output.execute();
|
|
73
|
+
const fileName = await output.execute(options);
|
|
74
74
|
|
|
75
75
|
console.log(fileName);
|
|
76
76
|
}
|
package/src/output/deb.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { tmpdir } from "os";
|
|
|
3
3
|
import { createWriteStream } from "fs";
|
|
4
4
|
import { mkdtemp, mkdir, chmod } from "fs/promises";
|
|
5
5
|
import { pipeline } from "stream/promises";
|
|
6
|
-
import {
|
|
6
|
+
import { execa } from "execa";
|
|
7
7
|
import { EmptyContentEntry } from "content-entry";
|
|
8
8
|
import { Packager } from "./packager.mjs";
|
|
9
9
|
import { keyValueTransformer } from "../key-value-transformer.mjs";
|
|
@@ -26,7 +26,11 @@ export class Deb extends Packager {
|
|
|
26
26
|
return ".deb";
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
get packageFileName() {
|
|
30
|
+
return `${this.properties.name}_${this.properties.version}_${this.properties.arch}${this.constructor.fileNameExtension}`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async execute(options) {
|
|
30
34
|
const properties = this.properties;
|
|
31
35
|
|
|
32
36
|
Object.entries(fields).forEach(([k, v]) => {
|
|
@@ -34,6 +38,11 @@ export class Deb extends Packager {
|
|
|
34
38
|
if (e !== undefined) {
|
|
35
39
|
properties[k] = e;
|
|
36
40
|
}
|
|
41
|
+
else {
|
|
42
|
+
if(v.default !== undefined) {
|
|
43
|
+
properties[v.alias] = v.default;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
37
46
|
});
|
|
38
47
|
|
|
39
48
|
const tmp = await mkdtemp(join(tmpdir(), "deb-"));
|
|
@@ -58,8 +67,6 @@ export class Deb extends Packager {
|
|
|
58
67
|
}
|
|
59
68
|
}
|
|
60
69
|
|
|
61
|
-
const output = `${staging}${this.constructor.fileNameExtension}`;
|
|
62
|
-
|
|
63
70
|
let debianControlEntry;
|
|
64
71
|
|
|
65
72
|
for await (const entry of this.source) {
|
|
@@ -71,10 +78,7 @@ export class Deb extends Packager {
|
|
|
71
78
|
debianControlEntry = entry;
|
|
72
79
|
} else {
|
|
73
80
|
console.log("ENTRY", entry.name, entry.basename);
|
|
74
|
-
await pipeline(
|
|
75
|
-
await entry.readStream,
|
|
76
|
-
createWriteStream(destName)
|
|
77
|
-
);
|
|
81
|
+
await pipeline(await entry.readStream, createWriteStream(destName));
|
|
78
82
|
|
|
79
83
|
await Promise.all(
|
|
80
84
|
Object.entries(permissions).map(async ([pattern, option]) => {
|
|
@@ -103,9 +107,9 @@ export class Deb extends Packager {
|
|
|
103
107
|
createWriteStream(destName)
|
|
104
108
|
);
|
|
105
109
|
|
|
106
|
-
await execa("dpkg", ["-b", staging]);
|
|
110
|
+
await execa("dpkg", ["-b", staging, options.destination]);
|
|
107
111
|
|
|
108
|
-
return
|
|
112
|
+
return join(options.destination, this.packageFileName);
|
|
109
113
|
}
|
|
110
114
|
}
|
|
111
115
|
|
|
@@ -123,7 +127,7 @@ const fields = {
|
|
|
123
127
|
Priority: { type: "string", recommended: true },
|
|
124
128
|
Essential: { type: "boolean" },
|
|
125
129
|
Origin: { type: "string" },
|
|
126
|
-
Architecture: { type: "string", default: "any", mandatory: true },
|
|
130
|
+
Architecture: { alias: "arch", type: "string", default: "any", mandatory: true },
|
|
127
131
|
Homepage: { alias: "homepage", type: "string" },
|
|
128
132
|
Bugs: { alias: "bugs", type: "string" },
|
|
129
133
|
Depends: { alias: "depends", type: "packageList" },
|