npm-pkgbuild 7.28.4 → 8.0.0
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 +10 -5
- package/package.json +1 -1
- package/src/extract-from-package.mjs +2 -2
- package/src/module.mjs +1 -1
- package/src/npm-pkgbuild-cli.mjs +1 -2
- package/src/output/arch.mjs +2 -1
- package/src/output/{deb.mjs → debian.mjs} +37 -36
- package/src/output/rpm.mjs +2 -1
- package/src/util.mjs +1 -1
package/README.md
CHANGED
|
@@ -45,6 +45,8 @@ The resulting pkg will contain the package dist content and all production depen
|
|
|
45
45
|
* [fields](#fields)
|
|
46
46
|
* [fields](#fields-1)
|
|
47
47
|
* [fields](#fields-2)
|
|
48
|
+
* [hookMapping](#hookmapping)
|
|
49
|
+
* [hookMapping](#hookmapping-1)
|
|
48
50
|
* [Field](#field)
|
|
49
51
|
* [Properties](#properties)
|
|
50
52
|
* [Packager](#packager)
|
|
@@ -52,7 +54,6 @@ The resulting pkg will contain the package dist content and all production depen
|
|
|
52
54
|
* [tmpdir](#tmpdir)
|
|
53
55
|
* [execute](#execute)
|
|
54
56
|
* [Parameters](#parameters-4)
|
|
55
|
-
* [hookMapping](#hookmapping)
|
|
56
57
|
* [decodePassword](#decodepassword)
|
|
57
58
|
* [Parameters](#parameters-5)
|
|
58
59
|
* [extractFunctions](#extractfunctions)
|
|
@@ -138,6 +139,14 @@ well known package properties
|
|
|
138
139
|
|
|
139
140
|
* **See**: <https://rpm-packaging-guide.github.io>
|
|
140
141
|
|
|
142
|
+
## hookMapping
|
|
143
|
+
|
|
144
|
+
map install hook named from arch to deb
|
|
145
|
+
|
|
146
|
+
## hookMapping
|
|
147
|
+
|
|
148
|
+
map install hook named from arch to rpm
|
|
149
|
+
|
|
141
150
|
## Field
|
|
142
151
|
|
|
143
152
|
Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
@@ -173,10 +182,6 @@ Execute package generation
|
|
|
173
182
|
* `options`
|
|
174
183
|
* `expander`
|
|
175
184
|
|
|
176
|
-
## hookMapping
|
|
177
|
-
|
|
178
|
-
map install hook named from arch to rpm
|
|
179
|
-
|
|
180
185
|
## decodePassword
|
|
181
186
|
|
|
182
187
|
Decode a password
|
package/package.json
CHANGED
|
@@ -5,12 +5,12 @@ import { asArray } from "./util.mjs";
|
|
|
5
5
|
import { NPMPackContentProvider } from "./content/npm-pack-content-provider.mjs";
|
|
6
6
|
import { NodeModulesContentProvider } from "./content/node-modules-content-provider.mjs";
|
|
7
7
|
import { FileContentProvider } from "./content/file-content-provider.mjs";
|
|
8
|
-
import {
|
|
8
|
+
import { DEBIAN } from "./output/debian.mjs";
|
|
9
9
|
import { ARCH } from "./output/arch.mjs";
|
|
10
10
|
import { RPM } from "./output/rpm.mjs";
|
|
11
11
|
|
|
12
12
|
export const allInputs = [NPMPackContentProvider, NodeModulesContentProvider];
|
|
13
|
-
export const allOutputs = [
|
|
13
|
+
export const allOutputs = [DEBIAN, ARCH, RPM];
|
|
14
14
|
|
|
15
15
|
export const npmArchMapping = {
|
|
16
16
|
arm64: "aarch64",
|
package/src/module.mjs
CHANGED
|
@@ -6,7 +6,7 @@ export * from "./content/content-provider.mjs";
|
|
|
6
6
|
export * from "./content/file-content-provider.mjs";
|
|
7
7
|
export * from "./content/node-modules-content-provider.mjs";
|
|
8
8
|
export * from "./content/npm-pack-content-provider.mjs";
|
|
9
|
-
export * from "./output/
|
|
9
|
+
export * from "./output/debian.mjs";
|
|
10
10
|
export * from "./output/rpm.mjs";
|
|
11
11
|
export * from "./output/arch.mjs";
|
|
12
12
|
export * from "./output/packager.mjs";
|
package/src/npm-pkgbuild-cli.mjs
CHANGED
|
@@ -4,7 +4,6 @@ import { readFileSync } from "fs";
|
|
|
4
4
|
import { readFile } from "fs/promises";
|
|
5
5
|
import { join } from "path";
|
|
6
6
|
import { program } from "commander";
|
|
7
|
-
import { aggregateFifo } from "aggregate-async-iterator";
|
|
8
7
|
import { createContext } from "expression-expander";
|
|
9
8
|
import { packageDirectory } from "pkg-dir";
|
|
10
9
|
import {
|
|
@@ -131,7 +130,7 @@ program
|
|
|
131
130
|
}
|
|
132
131
|
|
|
133
132
|
const fileName = await output.execute(
|
|
134
|
-
|
|
133
|
+
sources.map(c => c[Symbol.asyncIterator]()),
|
|
135
134
|
transformer,
|
|
136
135
|
dependencies,
|
|
137
136
|
options,
|
package/src/output/arch.mjs
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
keyValueTransformer,
|
|
13
13
|
equalSeparatedKeyValuePairOptions
|
|
14
14
|
} from "key-value-transformer";
|
|
15
|
+
import { aggregateFifo } from "aggregate-async-iterator";
|
|
15
16
|
import { Packager } from "./packager.mjs";
|
|
16
17
|
import {
|
|
17
18
|
copyEntries,
|
|
@@ -136,7 +137,7 @@ package() {
|
|
|
136
137
|
});
|
|
137
138
|
|
|
138
139
|
for await (const file of copyEntries(
|
|
139
|
-
transform(sources, transformer),
|
|
140
|
+
transform(aggregateFifo(sources), transformer),
|
|
140
141
|
join(staging, "src"),
|
|
141
142
|
expander
|
|
142
143
|
)) {
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
transform,
|
|
11
11
|
createPropertiesTransformer
|
|
12
12
|
} from "content-entry-transform";
|
|
13
|
+
import { aggregateFifo } from "aggregate-async-iterator";
|
|
13
14
|
import { keyValueTransformer } from "key-value-transformer";
|
|
14
15
|
import { Packager } from "./packager.mjs";
|
|
15
16
|
import {
|
|
@@ -27,9 +28,9 @@ const hookMapping = {
|
|
|
27
28
|
post_remove: "DEBIAN/postrm"
|
|
28
29
|
};
|
|
29
30
|
|
|
30
|
-
export class
|
|
31
|
+
export class DEBIAN extends Packager {
|
|
31
32
|
static get name() {
|
|
32
|
-
return "
|
|
33
|
+
return "debian";
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
static get description() {
|
|
@@ -58,40 +59,30 @@ export class DEB extends Packager {
|
|
|
58
59
|
return `${p.name}_${p.version}_${p.arch}${this.constructor.fileNameExtension}`;
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
async
|
|
62
|
-
const { properties, staging, destination } = await this.prepareExecute(
|
|
63
|
-
options
|
|
64
|
-
);
|
|
65
|
-
|
|
62
|
+
async *hookFiles(properties) {
|
|
66
63
|
if (properties.hooks) {
|
|
67
64
|
for await (const f of extractFunctions(
|
|
68
65
|
createReadStream(properties.hooks, utf8StreamOptions)
|
|
69
66
|
)) {
|
|
70
67
|
const name = hookMapping[f.name];
|
|
71
68
|
if (name) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
Object.create(
|
|
81
|
-
new StringContentEntry(
|
|
82
|
-
name,
|
|
83
|
-
f.body.replace(
|
|
84
|
-
/\{\{(\w+)\}\}/m,
|
|
85
|
-
(match, key, offset, string) =>
|
|
86
|
-
properties[key] || "{{" + key + "}}"
|
|
87
|
-
)
|
|
88
|
-
),
|
|
89
|
-
{ mode: { value: 0o775 } }
|
|
90
|
-
)
|
|
91
|
-
});
|
|
69
|
+
yield new StringContentEntry(
|
|
70
|
+
name,
|
|
71
|
+
f.body.replace(
|
|
72
|
+
/\{\{(\w+)\}\}/m,
|
|
73
|
+
(match, key, offset, string) =>
|
|
74
|
+
properties[key] || "{{" + key + "}}"
|
|
75
|
+
)
|
|
76
|
+
);
|
|
92
77
|
}
|
|
93
78
|
}
|
|
94
79
|
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async execute(sources, transformer, dependencies, options, expander) {
|
|
83
|
+
const { properties, staging, destination } = await this.prepareExecute(
|
|
84
|
+
options
|
|
85
|
+
);
|
|
95
86
|
|
|
96
87
|
transformer.push(
|
|
97
88
|
createPropertiesTransformer(
|
|
@@ -101,6 +92,10 @@ export class DEB extends Packager {
|
|
|
101
92
|
)
|
|
102
93
|
);
|
|
103
94
|
|
|
95
|
+
properties.Depends = Object.entries(dependencies).map(
|
|
96
|
+
([n, e]) => `${n} (${e})`
|
|
97
|
+
);
|
|
98
|
+
|
|
104
99
|
const fp = fieldProvider(properties, fields);
|
|
105
100
|
const debianControlName = "DEBIAN/control";
|
|
106
101
|
|
|
@@ -115,12 +110,15 @@ export class DEB extends Packager {
|
|
|
115
110
|
});
|
|
116
111
|
|
|
117
112
|
for await (const file of copyEntries(
|
|
118
|
-
transform(
|
|
113
|
+
transform(
|
|
114
|
+
aggregateFifo([...sources, this.hookFiles(properties)]),
|
|
115
|
+
transformer
|
|
116
|
+
),
|
|
119
117
|
staging,
|
|
120
118
|
expander
|
|
121
119
|
)) {
|
|
122
120
|
if (options.verbose) {
|
|
123
|
-
console.log(file.destination);
|
|
121
|
+
console.log(file.destination, `mode=${file.mode}`);
|
|
124
122
|
}
|
|
125
123
|
}
|
|
126
124
|
|
|
@@ -156,13 +154,16 @@ const fields = {
|
|
|
156
154
|
},
|
|
157
155
|
Homepage: { alias: "homepage", type: "string" },
|
|
158
156
|
Bugs: { alias: "bugs", type: "string" },
|
|
159
|
-
Depends: {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
157
|
+
Depends: { type: "string[]" },
|
|
158
|
+
"Pre-Depends": { type: "string[]" },
|
|
159
|
+
"Build-Depends": { type: "string[]" },
|
|
160
|
+
"Build-Depends-Indep": { type: "string[]" },
|
|
161
|
+
"Build-Depends-Arch": { type: "string[]" },
|
|
162
|
+
Recommends: { type: "string[]" },
|
|
163
|
+
Suggests: { type: "string[]" },
|
|
164
|
+
Provides: { type: "string[]" },
|
|
165
|
+
Breaks: { type: "string[]" },
|
|
166
|
+
Replaces: { type: "string[]" },
|
|
166
167
|
Source: { alias: "source", type: "string" },
|
|
167
168
|
Uploaders: { mandatory: false },
|
|
168
169
|
"Installed-Size": {}
|
package/src/output/rpm.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
keyValueTransformer,
|
|
9
9
|
colonSeparatedKeyValuePairOptions
|
|
10
10
|
} from "key-value-transformer";
|
|
11
|
+
import { aggregateFifo } from "aggregate-async-iterator";
|
|
11
12
|
import { Packager } from "./packager.mjs";
|
|
12
13
|
import {
|
|
13
14
|
copyEntries,
|
|
@@ -122,7 +123,7 @@ export class RPM extends Packager {
|
|
|
122
123
|
const fp = fieldProvider(properties, fields);
|
|
123
124
|
|
|
124
125
|
for await (const file of copyEntries(
|
|
125
|
-
transform(sources, [
|
|
126
|
+
transform(aggregateFifo(sources), [
|
|
126
127
|
{
|
|
127
128
|
match: entry => entry.name === specFileName,
|
|
128
129
|
transform: async entry =>
|