npm-pkgbuild 7.3.12 → 7.3.13
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/content/content-provider.mjs +0 -7
- package/src/content/node-modules-content-provider.mjs +0 -1
- package/src/content/npm-pack-content-provider.mjs +1 -1
- package/src/npm-pkgbuild-cli.mjs +2 -5
- package/src/output/deb.mjs +5 -14
- package/src/output/packager.mjs +16 -3
- package/src/output/pkg.mjs +3 -5
- package/src/output/rpm.mjs +8 -5
package/package.json
CHANGED
|
@@ -2,17 +2,10 @@
|
|
|
2
2
|
* Source of package content.
|
|
3
3
|
*/
|
|
4
4
|
export class ContentProvider {
|
|
5
|
-
/**
|
|
6
|
-
* Delivers content entries to be packed.
|
|
7
|
-
* @return {asyncIterator<ContentEntry>} all entries
|
|
8
|
-
*/
|
|
9
|
-
async *entries() {}
|
|
10
|
-
|
|
11
5
|
/**
|
|
12
6
|
* List all entries.
|
|
13
7
|
* @return {asyncIterator<ContentEntry>} all entries
|
|
14
8
|
*/
|
|
15
9
|
async *[Symbol.asyncIterator]() {
|
|
16
|
-
return yield* this.entries();
|
|
17
10
|
}
|
|
18
11
|
}
|
|
@@ -9,7 +9,7 @@ import { BufferContentEntry } from "content-entry";
|
|
|
9
9
|
* content from npm pack
|
|
10
10
|
*/
|
|
11
11
|
export class NPMPackContentProvider extends ContentProvider {
|
|
12
|
-
async *
|
|
12
|
+
async *[Symbol.asyncIterator]() {
|
|
13
13
|
//const m = await pacote.manifest(context.dir);
|
|
14
14
|
//console.log('got it', m);
|
|
15
15
|
|
package/src/npm-pkgbuild-cli.mjs
CHANGED
|
@@ -65,12 +65,9 @@ program
|
|
|
65
65
|
])
|
|
66
66
|
);
|
|
67
67
|
|
|
68
|
-
const output = new outputFactory(
|
|
69
|
-
aggregateFifo(sources.map(([c, d]) => c.entries())),
|
|
70
|
-
properties
|
|
71
|
-
);
|
|
68
|
+
const output = new outputFactory(properties);
|
|
72
69
|
|
|
73
|
-
const fileName = await output.execute(options);
|
|
70
|
+
const fileName = await output.execute(aggregateFifo(sources.map(([c, d]) => c[Symbol.asyncIterator]() )), options);
|
|
74
71
|
|
|
75
72
|
console.log(fileName);
|
|
76
73
|
}
|
package/src/output/deb.mjs
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import { join
|
|
2
|
-
import { tmpdir } from "os";
|
|
3
|
-
import { mkdtemp } from "fs/promises";
|
|
1
|
+
import { join } from "path";
|
|
4
2
|
import { execa } from "execa";
|
|
5
3
|
import { EmptyContentEntry, ReadableStreamContentEntry } from "content-entry";
|
|
6
4
|
import { keyValueTransformer } from "key-value-transformer";
|
|
7
5
|
import { Packager } from "./packager.mjs";
|
|
8
6
|
import { copyEntries, transform } from "../util.mjs";
|
|
9
7
|
|
|
10
|
-
const attributes = [
|
|
11
|
-
{ pattern: /DEBIAN\/.*(inst|rm)/, mode: 0o775 }
|
|
12
|
-
];
|
|
8
|
+
const attributes = [{ pattern: /DEBIAN\/.*(inst|rm)/, mode: 0o775 }];
|
|
13
9
|
|
|
14
10
|
export class DEB extends Packager {
|
|
15
11
|
static get name() {
|
|
@@ -28,11 +24,10 @@ export class DEB extends Packager {
|
|
|
28
24
|
return `${this.properties.name}_${this.properties.version}_${this.properties.arch}${this.constructor.fileNameExtension}`;
|
|
29
25
|
}
|
|
30
26
|
|
|
31
|
-
async execute(options) {
|
|
27
|
+
async execute(sources, options) {
|
|
32
28
|
const properties = this.properties;
|
|
33
29
|
const mandatoryFields = this.mandatoryFields;
|
|
34
|
-
const
|
|
35
|
-
const staging = join(tmp, `${properties.name}-${properties.version}`);
|
|
30
|
+
const staging = await this.tmpdir;
|
|
36
31
|
|
|
37
32
|
function* controlProperties(k, v, presentKeys) {
|
|
38
33
|
if (k === undefined) {
|
|
@@ -60,11 +55,7 @@ export class DEB extends Packager {
|
|
|
60
55
|
}
|
|
61
56
|
];
|
|
62
57
|
|
|
63
|
-
await copyEntries(
|
|
64
|
-
transform(this.source, transformers),
|
|
65
|
-
staging,
|
|
66
|
-
attributes
|
|
67
|
-
);
|
|
58
|
+
await copyEntries(transform(sources, transformers), staging, attributes);
|
|
68
59
|
|
|
69
60
|
await execa("dpkg", ["-b", staging, options.destination]);
|
|
70
61
|
|
package/src/output/packager.mjs
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { join } from "path";
|
|
2
|
+
import { tmpdir } from "os";
|
|
3
|
+
import { mkdtemp } from "fs/promises";
|
|
4
|
+
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* @typedef {Object} Field
|
|
3
8
|
* @property {string} alias interchangeable field name
|
|
@@ -14,8 +19,7 @@ export class Packager {
|
|
|
14
19
|
return {};
|
|
15
20
|
}
|
|
16
21
|
|
|
17
|
-
constructor(
|
|
18
|
-
this.source = source;
|
|
22
|
+
constructor(properties) {
|
|
19
23
|
this._properties = properties;
|
|
20
24
|
}
|
|
21
25
|
|
|
@@ -53,8 +57,17 @@ export class Packager {
|
|
|
53
57
|
return mandatoryFields;
|
|
54
58
|
}
|
|
55
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Create tmp directory.
|
|
62
|
+
* @return {Promise<string>} directory path
|
|
63
|
+
*/
|
|
64
|
+
get tmpdir()
|
|
65
|
+
{
|
|
66
|
+
return mkdtemp(join(tmpdir(), this.constructor.name));
|
|
67
|
+
}
|
|
68
|
+
|
|
56
69
|
/**
|
|
57
70
|
* Execute package generation
|
|
58
71
|
*/
|
|
59
|
-
async execute() {}
|
|
72
|
+
async execute(sources,options) {}
|
|
60
73
|
}
|
package/src/output/pkg.mjs
CHANGED
|
@@ -21,12 +21,10 @@ export class PKG extends Packager {
|
|
|
21
21
|
return fields;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
async execute(options) {
|
|
24
|
+
async execute(sources,options) {
|
|
25
25
|
const properties = this.properties;
|
|
26
26
|
const mandatoryFields = this.mandatoryFields;
|
|
27
|
-
const
|
|
28
|
-
const staging = join(tmp, `${properties.name}-${properties.version}`);
|
|
29
|
-
|
|
27
|
+
const staging = await this.tmpdir;
|
|
30
28
|
|
|
31
29
|
const pkgbuildFileName = join(tmp, "PKGBUILD");
|
|
32
30
|
|
|
@@ -34,7 +32,7 @@ export class PKG extends Packager {
|
|
|
34
32
|
|
|
35
33
|
const transformers = [];
|
|
36
34
|
|
|
37
|
-
await copyEntries(transform(
|
|
35
|
+
await copyEntries(transform(sources, transformers), staging);
|
|
38
36
|
|
|
39
37
|
await execa("makepkg", [], { cwd: tmp });
|
|
40
38
|
}
|
package/src/output/rpm.mjs
CHANGED
|
@@ -14,16 +14,19 @@ export class RPM extends Packager {
|
|
|
14
14
|
return fields;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
async execute(options) {
|
|
17
|
+
async execute(sources,options) {
|
|
18
18
|
const properties = this.properties;
|
|
19
19
|
const mandatoryFields = this.mandatoryFields;
|
|
20
|
+
const staging = await this.tmpdir;
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
const staging = join(tmp, `${properties.name}-${properties.version}`);
|
|
22
|
+
let specFileName = `${properties.name}.spec`;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
const transformers = [];
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
await copyEntries(
|
|
27
|
+
transform(sources, transformers),
|
|
28
|
+
staging
|
|
29
|
+
);
|
|
27
30
|
|
|
28
31
|
await execa("rpmbuild", ["-ba", specFileName]);
|
|
29
32
|
}
|