npm-pkgbuild 7.14.7 → 7.14.11
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-pkgbuild",
|
|
3
|
-
"version": "7.14.
|
|
3
|
+
"version": "7.14.11",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"tar-stream": "^2.2.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"ava": "^4.0.
|
|
57
|
+
"ava": "^4.0.1",
|
|
58
58
|
"c8": "^7.11.0",
|
|
59
59
|
"documentation": "^13.2.5",
|
|
60
60
|
"semantic-release": "^18.0.1",
|
|
@@ -10,6 +10,12 @@ import { RPM } from "./output/rpm.mjs";
|
|
|
10
10
|
export const allInputs = [NPMPackContentProvider, NodeModulesContentProvider];
|
|
11
11
|
export const allOutputs = [DEB, ARCH, RPM];
|
|
12
12
|
|
|
13
|
+
const npmArchMapping = {
|
|
14
|
+
"arm64" : "aarch64",
|
|
15
|
+
"armv7h": "armv7h",
|
|
16
|
+
"x86" : "a86_64"
|
|
17
|
+
};
|
|
18
|
+
|
|
13
19
|
/**
|
|
14
20
|
* Extract package definition from package.json.
|
|
15
21
|
* @param {Object} pkg package.json content
|
|
@@ -50,11 +56,25 @@ export async function extractFromPackage(pkg, dir) {
|
|
|
50
56
|
let dependencies = { ...pkg.engines };
|
|
51
57
|
let sources = [];
|
|
52
58
|
let output = {};
|
|
53
|
-
|
|
59
|
+
let arch = new Set();
|
|
60
|
+
|
|
54
61
|
const processPkg = (pkg, dir) => {
|
|
62
|
+
|
|
63
|
+
if(pkg.cpu) {
|
|
64
|
+
for(const a of asArray(pkg.cpu)) {
|
|
65
|
+
arch.add(npmArchMapping[a]);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
55
69
|
if (pkg.pkg) {
|
|
56
70
|
const pkgbuild = pkg.pkg;
|
|
57
71
|
|
|
72
|
+
if(pkgbuild.arch) {
|
|
73
|
+
for(const a of asArray(pkgbuild.arch)) {
|
|
74
|
+
arch.add(a);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
58
78
|
Object.assign(output, pkgbuild.output);
|
|
59
79
|
|
|
60
80
|
Object.entries(pkgbuild)
|
|
@@ -75,7 +95,7 @@ export async function extractFromPackage(pkg, dir) {
|
|
|
75
95
|
new type({ ...definition, dir }, entryProperties)
|
|
76
96
|
);
|
|
77
97
|
} else {
|
|
78
|
-
console.error(
|
|
98
|
+
console.error(`Unknown type '${type}'`);
|
|
79
99
|
}
|
|
80
100
|
} else {
|
|
81
101
|
sources.push(
|
|
@@ -98,5 +118,9 @@ export async function extractFromPackage(pkg, dir) {
|
|
|
98
118
|
|
|
99
119
|
processPkg(pkg, dir);
|
|
100
120
|
|
|
121
|
+
if(arch.size > 0) {
|
|
122
|
+
properties.arch = [...arch];
|
|
123
|
+
}
|
|
124
|
+
|
|
101
125
|
return { properties, sources, dependencies, output };
|
|
102
126
|
}
|
package/src/npm-pkgbuild-cli.mjs
CHANGED
|
@@ -94,7 +94,7 @@ program
|
|
|
94
94
|
);
|
|
95
95
|
|
|
96
96
|
const context = createContext({ properties });
|
|
97
|
-
const output = new outputFactory(properties);
|
|
97
|
+
const output = new outputFactory(context.expand(properties));
|
|
98
98
|
const transformer = [createExpressionTransformer(properties)];
|
|
99
99
|
|
|
100
100
|
if (options.verbose) {
|
package/src/output/arch.mjs
CHANGED
|
@@ -28,7 +28,7 @@ export const pkgKeyValuePairOptions = {
|
|
|
28
28
|
keyValueLine: (key, value, lineEnding) =>
|
|
29
29
|
`${keyPrefix(key)}=${
|
|
30
30
|
Array.isArray(value)
|
|
31
|
-
? "(" + value.map(v => quote(v)).join("
|
|
31
|
+
? "(" + value.map(v => quote(v)).join(" ") + ")"
|
|
32
32
|
: quote(value)
|
|
33
33
|
}${lineEnding}`
|
|
34
34
|
};
|
package/src/output/packager.mjs
CHANGED
|
@@ -34,8 +34,9 @@ export class Packager {
|
|
|
34
34
|
if (e !== undefined) {
|
|
35
35
|
properties[k] = e;
|
|
36
36
|
} else {
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
const vak = v.alias || k;
|
|
38
|
+
if (properties[vak] === undefined && v.default !== undefined) {
|
|
39
|
+
properties[vak] = v.default;
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
});
|