npm-pkgbuild 7.4.3 → 7.4.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 +6 -1
- package/src/output/deb.mjs +2 -2
- package/src/output/pkg.mjs +3 -3
- package/src/output/rpm.mjs +2 -2
- package/src/util.mjs +5 -2
package/package.json
CHANGED
package/src/npm-pkgbuild-cli.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import { readFile } from "fs/promises";
|
|
|
5
5
|
import { join } from "path";
|
|
6
6
|
import program from "commander";
|
|
7
7
|
import { aggregateFifo } from "aggregate-async-iterator";
|
|
8
|
+
import { createContext } from "expression-expander";
|
|
8
9
|
import { packageDirectory } from "pkg-dir";
|
|
9
10
|
import { utf8StreamOptions, extractFromPackage } from "./util.mjs";
|
|
10
11
|
import { FileContentProvider, DEB, PKG, RPM } from "npm-pkgbuild";
|
|
@@ -65,11 +66,15 @@ program
|
|
|
65
66
|
)
|
|
66
67
|
);
|
|
67
68
|
|
|
69
|
+
const context = createContext();
|
|
70
|
+
context.properties = properties;
|
|
71
|
+
|
|
68
72
|
const output = new outputFactory(properties);
|
|
69
73
|
|
|
70
74
|
const fileName = await output.execute(
|
|
71
75
|
aggregateFifo(sources.map(c => c[Symbol.asyncIterator]())),
|
|
72
|
-
options
|
|
76
|
+
options,
|
|
77
|
+
(object) => context.expand(object)
|
|
73
78
|
);
|
|
74
79
|
|
|
75
80
|
console.log(fileName);
|
package/src/output/deb.mjs
CHANGED
|
@@ -25,7 +25,7 @@ export class DEB extends Packager {
|
|
|
25
25
|
return `${p.name}_${p.version}_${p.arch}${this.constructor.fileNameExtension}`;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
async execute(sources, options) {
|
|
28
|
+
async execute(sources, options, expander) {
|
|
29
29
|
const properties = this.properties;
|
|
30
30
|
const mandatoryFields = this.mandatoryFields;
|
|
31
31
|
const staging = await this.tmpdir;
|
|
@@ -56,7 +56,7 @@ export class DEB extends Packager {
|
|
|
56
56
|
}
|
|
57
57
|
];
|
|
58
58
|
|
|
59
|
-
await copyEntries(transform(sources, transformers), staging, attributes);
|
|
59
|
+
await copyEntries(transform(sources, transformers), staging, expander, attributes);
|
|
60
60
|
|
|
61
61
|
await execa("dpkg", ["-b", staging, options.destination]);
|
|
62
62
|
|
package/src/output/pkg.mjs
CHANGED
|
@@ -48,7 +48,7 @@ export class PKG extends Packager {
|
|
|
48
48
|
return `${p.name}-${p.version}-${p.release}.${p.arch}${this.constructor.fileNameExtension}`;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
async execute(sources, options) {
|
|
51
|
+
async execute(sources, options,expander) {
|
|
52
52
|
const properties = this.properties;
|
|
53
53
|
|
|
54
54
|
//properties.depends = makeDepends({ ...pkg.engines });
|
|
@@ -77,7 +77,7 @@ package() {
|
|
|
77
77
|
`;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
await copyEntries(transform(sources, []), join(staging, "src"));
|
|
80
|
+
await copyEntries(transform(sources, []), join(staging, "src"), expander);
|
|
81
81
|
|
|
82
82
|
const metaTransformers = [
|
|
83
83
|
{
|
|
@@ -94,7 +94,7 @@ package() {
|
|
|
94
94
|
}
|
|
95
95
|
];
|
|
96
96
|
|
|
97
|
-
await copyEntries(transform(sources, metaTransformers, true), staging);
|
|
97
|
+
await copyEntries(transform(sources, metaTransformers, true), staging, expander);
|
|
98
98
|
|
|
99
99
|
await execa("makepkg", ["-f"], { cwd: staging });
|
|
100
100
|
|
package/src/output/rpm.mjs
CHANGED
|
@@ -27,7 +27,7 @@ export class RPM extends Packager {
|
|
|
27
27
|
return fields;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
async execute(sources, options) {
|
|
30
|
+
async execute(sources, options, expander) {
|
|
31
31
|
const properties = this.properties;
|
|
32
32
|
const mandatoryFields = this.mandatoryFields;
|
|
33
33
|
const tmp = await this.tmpdir;
|
|
@@ -76,7 +76,7 @@ export class RPM extends Packager {
|
|
|
76
76
|
}
|
|
77
77
|
];
|
|
78
78
|
|
|
79
|
-
await copyEntries(transform(sources, transformers), staging);
|
|
79
|
+
await copyEntries(transform(sources, transformers), staging, expander);
|
|
80
80
|
|
|
81
81
|
await execa("rpmbuild", [
|
|
82
82
|
"--define",
|
package/src/util.mjs
CHANGED
|
@@ -108,17 +108,20 @@ export async function* transform(source, transformers = [], onlyMatching) {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
|
-
* Copy content from source into destinationDirectory
|
|
111
|
+
* Copy content from source into destinationDirectory.
|
|
112
112
|
* @param {AsyncIterator<ContentEntry>} source
|
|
113
113
|
* @param {string} destinationDirectory
|
|
114
|
+
* @param {Function} expander
|
|
115
|
+
* @param {ContentEntryAttribute[]} attributes
|
|
114
116
|
*/
|
|
115
117
|
export async function copyEntries(
|
|
116
118
|
source,
|
|
117
119
|
destinationDirectory,
|
|
120
|
+
expander = (v) => v,
|
|
118
121
|
attributes = []
|
|
119
122
|
) {
|
|
120
123
|
for await (let entry of source) {
|
|
121
|
-
const destName = entry.destination === undefined ? join(destinationDirectory, entry.name) : join(destinationDirectory, entry.destination, entry.name);
|
|
124
|
+
const destName = expander(entry.destination === undefined ? join(destinationDirectory, entry.name) : join(destinationDirectory, entry.destination, entry.name));
|
|
122
125
|
await mkdir(dirname(destName), { recursive: true });
|
|
123
126
|
|
|
124
127
|
const options = { mode: entry.mode };
|