npm-pkgbuild 7.2.13 → 7.3.3
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 +6 -6
- package/src/content/file-content-provider.mjs +12 -4
- package/src/npm-pkgbuild-cli.mjs +21 -14
- package/src/output/deb.mjs +10 -7
- package/src/output/pkg.mjs +1 -1
- package/src/util.mjs +12 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-pkgbuild",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"aggregate-async-iterator": "^1.1.7",
|
|
42
42
|
"commander": "^8.3.0",
|
|
43
|
-
"content-entry": "^2.
|
|
44
|
-
"content-entry-filesystem": "^3.
|
|
45
|
-
"execa": "^
|
|
43
|
+
"content-entry": "^2.9.6",
|
|
44
|
+
"content-entry-filesystem": "^3.1.9",
|
|
45
|
+
"execa": "^6.0.0",
|
|
46
46
|
"expression-expander": "^7.0.9",
|
|
47
47
|
"globby": "^12.0.2",
|
|
48
48
|
"iterable-string-interceptor": "^1.0.8",
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
"ava": "^3.15.0",
|
|
56
56
|
"c8": "^7.10.0",
|
|
57
57
|
"documentation": "^13.2.5",
|
|
58
|
-
"semantic-release": "^18.0.
|
|
58
|
+
"semantic-release": "^18.0.1",
|
|
59
59
|
"stream-buffers": "^3.0.2"
|
|
60
60
|
},
|
|
61
61
|
"engines": {
|
|
62
|
-
"node": ">=16.
|
|
62
|
+
"node": ">=16.13.0"
|
|
63
63
|
},
|
|
64
64
|
"repository": {
|
|
65
65
|
"type": "git",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { dirname } from "path";
|
|
1
2
|
import { globby } from "globby";
|
|
2
3
|
import { FileSystemEntry } from "content-entry-filesystem";
|
|
3
4
|
import { asArray } from "../util.mjs";
|
|
@@ -10,13 +11,20 @@ export class FileContentProvider extends ContentProvider {
|
|
|
10
11
|
constructor(definitions) {
|
|
11
12
|
super();
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
if (typeof definitions === "string") {
|
|
15
|
+
const base = dirname(definitions);
|
|
16
|
+
this.definitions = {
|
|
17
|
+
base,
|
|
18
|
+
pattern: [definitions.substring(base.length)]
|
|
19
|
+
};
|
|
20
|
+
} else {
|
|
21
|
+
this.definitions = { pattern: ["**/*"], ...definitions };
|
|
22
|
+
this.definitions.pattern = asArray(this.definitions.pattern);
|
|
23
|
+
}
|
|
15
24
|
}
|
|
16
25
|
|
|
17
|
-
async *
|
|
26
|
+
async *[Symbol.asyncIterator]() {
|
|
18
27
|
const definitions = this.definitions;
|
|
19
|
-
|
|
20
28
|
const base = definitions.base;
|
|
21
29
|
|
|
22
30
|
for (const name of await globby(definitions.pattern, {
|
package/src/npm-pkgbuild-cli.mjs
CHANGED
|
@@ -24,7 +24,6 @@ outputs.forEach(o =>
|
|
|
24
24
|
program.option(`--${o.name}`, `generate ${o.name} package`)
|
|
25
25
|
);
|
|
26
26
|
|
|
27
|
-
|
|
28
27
|
program
|
|
29
28
|
.option("--pkgver <version>", "package version")
|
|
30
29
|
.option("-p --package <dir>", "where to put the package(s)", cwd)
|
|
@@ -46,22 +45,30 @@ program
|
|
|
46
45
|
for (const outputFactory of outputs.filter(
|
|
47
46
|
o => options[o.name] === true
|
|
48
47
|
)) {
|
|
49
|
-
const {properties,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
const { properties, sources } = extractFromPackage(
|
|
49
|
+
JSON.parse(
|
|
50
|
+
await readFile(
|
|
51
|
+
join(await packageDirectory(), "package.json"),
|
|
52
|
+
utf8StreamOptions
|
|
53
|
+
)
|
|
53
54
|
)
|
|
54
|
-
)
|
|
55
|
+
);
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
sources.push(
|
|
58
|
+
...[...options.content, ...options.meta]
|
|
59
|
+
.filter(x => x)
|
|
60
|
+
.map(source => [
|
|
61
|
+
new FileContentProvider({
|
|
62
|
+
base: source
|
|
63
|
+
}),
|
|
64
|
+
""
|
|
65
|
+
])
|
|
66
|
+
);
|
|
63
67
|
|
|
64
|
-
const output = new outputFactory(
|
|
68
|
+
const output = new outputFactory(
|
|
69
|
+
aggregateFifo(sources.map(([c, d]) => c.entries())),
|
|
70
|
+
properties
|
|
71
|
+
);
|
|
65
72
|
|
|
66
73
|
const fileName = await output.execute();
|
|
67
74
|
|
package/src/output/deb.mjs
CHANGED
|
@@ -3,16 +3,18 @@ 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 execa from "execa";
|
|
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";
|
|
10
10
|
|
|
11
|
+
const executableAttributes = { chmod: "0775" };
|
|
12
|
+
|
|
11
13
|
const permissions = {
|
|
12
|
-
"DEBIAN/preinst":
|
|
13
|
-
"DEBIAN/postinst":
|
|
14
|
-
"DEBIAN/prerm":
|
|
15
|
-
"DEBIAN/postrm":
|
|
14
|
+
"DEBIAN/preinst": executableAttributes,
|
|
15
|
+
"DEBIAN/postinst": executableAttributes,
|
|
16
|
+
"DEBIAN/prerm": executableAttributes,
|
|
17
|
+
"DEBIAN/postrm": executableAttributes
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
export class Deb extends Packager {
|
|
@@ -68,8 +70,9 @@ export class Deb extends Packager {
|
|
|
68
70
|
if (entry.name === "DEBIAN/control") {
|
|
69
71
|
debianControlEntry = entry;
|
|
70
72
|
} else {
|
|
73
|
+
console.log("ENTRY", entry.name, entry.basename);
|
|
71
74
|
await pipeline(
|
|
72
|
-
await entry.
|
|
75
|
+
await entry.readStream,
|
|
73
76
|
createWriteStream(destName)
|
|
74
77
|
);
|
|
75
78
|
|
|
@@ -94,7 +97,7 @@ export class Deb extends Packager {
|
|
|
94
97
|
|
|
95
98
|
await pipeline(
|
|
96
99
|
keyValueTransformer(
|
|
97
|
-
await debianControlEntry.
|
|
100
|
+
await debianControlEntry.readStream,
|
|
98
101
|
controlProperties
|
|
99
102
|
),
|
|
100
103
|
createWriteStream(destName)
|
package/src/output/pkg.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { tmpdir } from "os";
|
|
|
3
3
|
import { finished } from "stream";
|
|
4
4
|
import { promisify } from "util";
|
|
5
5
|
import { mkdtemp, mkdir, chmod } from "fs/promises";
|
|
6
|
-
import execa from "execa";
|
|
6
|
+
import { execa } from "execa";
|
|
7
7
|
import { Packager } from "./packager.mjs";
|
|
8
8
|
import { quote } from "../util.mjs";
|
|
9
9
|
|
package/src/util.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export const utf8StreamOptions = { encoding: "utf8" };
|
|
2
1
|
import { FileContentProvider } from "npm-pkgbuild";
|
|
3
2
|
|
|
3
|
+
export const utf8StreamOptions = { encoding: "utf8" };
|
|
4
|
+
|
|
4
5
|
export function quote(v) {
|
|
5
6
|
if (v === undefined) return "";
|
|
6
7
|
|
|
@@ -20,7 +21,7 @@ export function asArray(o) {
|
|
|
20
21
|
/**
|
|
21
22
|
*
|
|
22
23
|
* @param {Object} pkg package.json content
|
|
23
|
-
* @returns
|
|
24
|
+
* @returns {Object}
|
|
24
25
|
*/
|
|
25
26
|
export function extractFromPackage(pkg) {
|
|
26
27
|
const properties = Object.fromEntries(
|
|
@@ -43,15 +44,19 @@ export function extractFromPackage(pkg) {
|
|
|
43
44
|
)[0];
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
let
|
|
47
|
+
let sources = [];
|
|
47
48
|
|
|
48
49
|
if (pkg.pkgbuild) {
|
|
50
|
+
Object.entries(pkg.pkgbuild)
|
|
51
|
+
.filter(([k, v]) => typeof v === "string")
|
|
52
|
+
.forEach(([k, v]) => (properties[k] = v));
|
|
53
|
+
|
|
49
54
|
if (pkg.pkgbuild.content) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
sources = Object.entries(pkg.pkgbuild.content).map(
|
|
56
|
+
([destination, value]) => [new FileContentProvider(value), destination]
|
|
57
|
+
);
|
|
53
58
|
}
|
|
54
59
|
}
|
|
55
60
|
|
|
56
|
-
return { properties,
|
|
61
|
+
return { properties, sources };
|
|
57
62
|
}
|