npm-pkgbuild 14.1.1 → 14.2.1

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 CHANGED
@@ -547,7 +547,7 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
547
547
 
548
548
  ### Parameters
549
549
 
550
- * `locations` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**&#x20;
550
+ * `locations` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** (optional, default `[]`)
551
551
  * `properties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?**&#x20;
552
552
 
553
553
  * `properties.PKGBUILD_PUBLISH` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?**&#x20;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-pkgbuild",
3
- "version": "14.1.1",
3
+ "version": "14.2.1",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -56,7 +56,7 @@
56
56
  "aggregate-async-iterator": "^1.2.0",
57
57
  "commander": "^12.0.0",
58
58
  "compare-versions": "^6.1.0",
59
- "content-entry": "^9.0.3",
59
+ "content-entry": "^10.0.0",
60
60
  "content-entry-filesystem": "^6.0.0",
61
61
  "content-entry-transform": "^1.4.29",
62
62
  "execa": "^8.0.1",
@@ -366,7 +366,7 @@ export async function* extractFromPackage(options = {}, env = {}) {
366
366
  result.dependencies,
367
367
  output.dependencies
368
368
  ),
369
- properties: { ...result.properties, ...output.properties }
369
+ properties: { output: name, ...result.properties, ...output.properties }
370
370
  };
371
371
  }
372
372
  }
@@ -50,8 +50,6 @@ program
50
50
  const uc = new UTIController();
51
51
  uc.register(additionalUTIs);
52
52
 
53
- const publishingDetails = createPublishingDetails(options.publish, process.env);
54
-
55
53
  for await (const {
56
54
  properties,
57
55
  sources,
@@ -67,11 +65,11 @@ program
67
65
  }
68
66
 
69
67
  for (const outputFactory of allOutputs.filter(
70
- o => (options[o.name] === true || output[o.name] !== undefined) && options[o.name] !== false
68
+ o =>
69
+ (options[o.name] === true || output[o.name] !== undefined) &&
70
+ options[o.name] !== false
71
71
  )) {
72
- if (
73
- !(await outputFactory.prepare(options, variant))
74
- ) {
72
+ if (!(await outputFactory.prepare(options, variant))) {
75
73
  console.warn(`output format ${outputFactory.name} not avaliable`);
76
74
  continue;
77
75
  }
@@ -123,6 +121,11 @@ program
123
121
  console.log(kv(dependencies, " "));
124
122
  }
125
123
 
124
+ const publishingDetails = createPublishingDetails(options.publish, {
125
+ ...properties,
126
+ ...process.env
127
+ });
128
+
126
129
  const artifact = await o.create(
127
130
  sources.map(c => c[Symbol.asyncIterator]()),
128
131
  transformer,
@@ -133,7 +136,11 @@ program
133
136
  );
134
137
 
135
138
  if (!options.dry) {
136
- await Promise.all(publishingDetails.map(publishDetail => o.publish(artifact, publishDetail, o.properties)));
139
+ await Promise.all(
140
+ publishingDetails.map(publishDetail =>
141
+ o.publish(artifact, publishDetail, o.properties)
142
+ )
143
+ );
137
144
  }
138
145
  } catch (e) {
139
146
  handleError(e, options);
@@ -3,7 +3,7 @@ import { createReadStream, createWriteStream } from "node:fs";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import { pipeline } from "node:stream/promises";
5
5
  import { execa } from "execa";
6
- import { EmptyContentEntry, ReadableStreamContentEntry } from "content-entry";
6
+ import { ContentEntry, ReadableStreamContentEntry } from "content-entry";
7
7
  import {
8
8
  transform,
9
9
  createPropertiesInterceptor
@@ -174,7 +174,7 @@ package() {
174
174
  trailingLines
175
175
  })
176
176
  ),
177
- createEntryWhenMissing: () => new EmptyContentEntry(PKGBUILD)
177
+ createEntryWhenMissing: () => new ContentEntry(PKGBUILD)
178
178
  });
179
179
 
180
180
  for await (const file of copyEntries(
@@ -3,7 +3,7 @@ import { createReadStream } from "node:fs";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import { execa } from "execa";
5
5
  import {
6
- EmptyContentEntry,
6
+ ContentEntry,
7
7
  ReadableStreamContentEntry,
8
8
  StringContentEntry
9
9
  } from "content-entry";
@@ -135,7 +135,7 @@ export class DEBIAN extends Packager {
135
135
  entry.name,
136
136
  keyValueTransformer(await entry.readStream, fp)
137
137
  ),
138
- createEntryWhenMissing: () => new EmptyContentEntry(debianControlName)
138
+ createEntryWhenMissing: () => new ContentEntry(debianControlName)
139
139
  });
140
140
 
141
141
  for await (const file of copyEntries(
@@ -1,7 +1,7 @@
1
1
  import { join } from "node:path";
2
2
  import { readFile } from "node:fs/promises";
3
3
  import { execa } from "execa";
4
- import { EmptyContentEntry, ReadableStreamContentEntry } from "content-entry";
4
+ import { ContentEntry, ReadableStreamContentEntry } from "content-entry";
5
5
  import { transform } from "content-entry-transform";
6
6
  import { aggregateFifo } from "aggregate-async-iterator";
7
7
  import {
@@ -120,7 +120,7 @@ export class DOCKER extends Packager {
120
120
  trailingLines
121
121
  })
122
122
  ),
123
- createEntryWhenMissing: () => new EmptyContentEntry(DOCKERFILE)
123
+ createEntryWhenMissing: () => new ContentEntry(DOCKERFILE)
124
124
  });
125
125
 
126
126
  for await (const file of copyEntries(
@@ -3,7 +3,7 @@ import { createReadStream } from "node:fs";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import { cp } from "node:fs/promises";
5
5
  import { execa } from "execa";
6
- import { EmptyContentEntry, ReadableStreamContentEntry } from "content-entry";
6
+ import { ContentEntry, ReadableStreamContentEntry } from "content-entry";
7
7
  import { transform } from "content-entry-transform";
8
8
  import {
9
9
  keyValueTransformer,
@@ -172,7 +172,7 @@ export class RPM extends Packager {
172
172
  trailingLines
173
173
  })
174
174
  ),
175
- createEntryWhenMissing: () => new EmptyContentEntry(specFileName)
175
+ createEntryWhenMissing: () => new ContentEntry(specFileName)
176
176
  }
177
177
  ]),
178
178
  staging,
package/src/publish.mjs CHANGED
@@ -20,20 +20,39 @@ import { decodePassword } from "./util.mjs";
20
20
  * @param {string} [properties.access]
21
21
  * @return {PublishingDetail[]}
22
22
  */
23
- export function createPublishingDetails(locations=[], properties) {
24
- const e = properties?.PKGBUILD_PUBLISH;
25
- if (e) {
26
- locations.push(e);
23
+ export function createPublishingDetails(locations = [], properties) {
24
+ locations = [...locations];
25
+
26
+ let publishPropertyFound = false;
27
+
28
+ for (const s of ["output"]) {
29
+ let key = properties?.[s];
30
+ if (key !== undefined) {
31
+ const envKey = `PKGBUILD_PUBLISH_${key.toUpperCase()}`;
32
+ const e = properties[envKey];
33
+ if (e) {
34
+ locations.push(e);
35
+ }
36
+ publishPropertyFound = true;
37
+ }
38
+ }
39
+
40
+ if (!publishPropertyFound) {
41
+ const e = properties?.PKGBUILD_PUBLISH;
42
+ if (e) {
43
+ locations.push(e);
44
+ }
27
45
  }
28
46
 
29
47
  const vm = k => properties?.[k] || k;
30
48
 
31
49
  return locations.map(location => {
32
-
33
50
  let url = location;
34
51
 
35
52
  const result = {
36
- set properties(p) { properties = p;},
53
+ set properties(p) {
54
+ properties = p;
55
+ },
37
56
  get url() {
38
57
  return url.replace(
39
58
  /\{\{(\w+)\}\}/gm,
@@ -86,7 +105,7 @@ export async function publish(
86
105
  if (!publishingDetail) {
87
106
  return;
88
107
  }
89
-
108
+
90
109
  publishingDetail.properties = properties;
91
110
 
92
111
  const url = publishingDetail.url + "/" + basename(artifactIdentifier);