npm-pkgbuild 20.9.1 → 20.9.3

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
@@ -189,14 +189,12 @@ See [mf-hosting](https://www.npmjs.com/package/mf-hosting) or [mf-hosting-fronte
189
189
  * [Properties](#properties-6)
190
190
  * [extractFunctions](#extractfunctions)
191
191
  * [Parameters](#parameters-29)
192
- * [asArray](#asarray)
193
- * [Parameters](#parameters-30)
194
192
  * [fieldProvider](#fieldprovider)
195
- * [Parameters](#parameters-31)
193
+ * [Parameters](#parameters-30)
196
194
  * [Expander](#expander)
197
- * [Parameters](#parameters-32)
195
+ * [Parameters](#parameters-31)
198
196
  * [copyEntries](#copyentries)
199
- * [Parameters](#parameters-33)
197
+ * [Parameters](#parameters-32)
200
198
 
201
199
  ## allInputs
202
200
 
@@ -737,16 +735,6 @@ Extract shell functions from a given text.
737
735
 
738
736
  Returns **AsyncIterable<[FunctionDecl](#functiondecl)>**&#x20;
739
737
 
740
- ## asArray
741
-
742
- Convert scalar or iterable into Array.
743
-
744
- ### Parameters
745
-
746
- * `value` **any**&#x20;
747
-
748
- Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<any>**&#x20;
749
-
750
738
  ## fieldProvider
751
739
 
752
740
  ### Parameters
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-pkgbuild",
3
- "version": "20.9.1",
3
+ "version": "20.9.3",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": false
@@ -60,7 +60,7 @@
60
60
  "key-value-transformer": "^3.3.2",
61
61
  "npm-package-walker": "^8.0.11",
62
62
  "npm-packlist": "^11.3.0",
63
- "pacc": "^11.3.0",
63
+ "pacc": "^11.5.1",
64
64
  "package-directory": "^8.2.0",
65
65
  "pacote": "^22.0.0",
66
66
  "tar-stream": "^3.1.7",
@@ -75,7 +75,7 @@
75
75
  "stream-buffers": "^3.0.3"
76
76
  },
77
77
  "engines": {
78
- "node": ">=24.16.0"
78
+ "node": ">=24.19.0"
79
79
  },
80
80
  "repository": {
81
81
  "type": "git",
@@ -36,7 +36,7 @@ export class ContentProvider {
36
36
  *
37
37
  * @param {string} name
38
38
  * @param {boolean} isCollection
39
- * @returns {Object}
39
+ * @returns {Object|undefined}
40
40
  */
41
41
  propertiesFor(name, isCollection) {
42
42
  for (const [pattern, properties] of Object.entries(this.properties)) {
@@ -230,18 +230,19 @@ export class ARCH extends Packager {
230
230
  out.end();
231
231
  }
232
232
 
233
+ const depends = this.makeDepends(properties.dependencies).join(" ");
234
+ const dependsStatement = depends.length ? `depends=(${depends})` : "";
233
235
  const verbose = options.verbose ? 'ls -laR "$pkgdir"' : "";
234
236
 
235
- const self = this;
236
237
  async function* trailingLines() {
237
238
  yield `
238
239
  package() {
239
- depends=(${self.makeDepends(properties.dependencies).join(" ")})
240
+ ${dependsStatement}
240
241
 
241
242
  if [ "$(ls -A $srcdir)" ]
242
243
  then
243
244
  cp -rp $srcdir/* "$pkgdir"
244
- ### CHOWN ###
245
+ ### PERMISSION ###
245
246
 
246
247
  ${verbose}
247
248
  fi
@@ -270,15 +271,15 @@ package() {
270
271
  createEntryWhenMissing: () => new ContentEntry(PKGBUILD)
271
272
  });
272
273
 
273
- const ownership = [];
274
+ const permissions = [];
274
275
 
275
276
  for await (const file of copyEntries(
276
277
  transform(aggregate(sources), transformer),
277
278
  join(staging, "src"),
278
279
  expander
279
280
  )) {
280
- if (file.owner || file.group) {
281
- ownership.push(file);
281
+ if (file.user || file.group || file.mode) {
282
+ permissions.push(file);
282
283
  }
283
284
 
284
285
  if (options.verbose) {
@@ -286,22 +287,30 @@ package() {
286
287
  }
287
288
  }
288
289
 
289
- if (ownership.length) {
290
+ if (permissions.length) {
290
291
  const pkgbuild = join(staging, PKGBUILD);
291
292
  let content = await readFile(pkgbuild, utf8StreamOptions);
292
- const markerPos = content.indexOf("### CHOWN ###");
293
+ const markerPos = content.indexOf("### PERMISSION ###");
294
+
295
+ const flags = {
296
+ user: ["-u", f => f.user],
297
+ group: ["-g", f => f.group],
298
+ mode: ["-m", f => Number(f.mode).toString(8)]
299
+ };
293
300
 
294
301
  content =
295
302
  content.substring(0, markerPos) +
296
- ownership
297
- .map(
298
- f =>
299
- ` chown ${[f.owner ?? "", f.group ?? ""].join(
300
- ":"
301
- )} \"$pkgdir/${f.destination}\"`
302
- )
303
+ permissions
304
+ .filter(f=>f.isBlob)
305
+ .map(f => {
306
+ const options = Object.keys(flags)
307
+ .filter(name => f[name])
308
+ .map(name => `${flags[name][0]} ${flags[name][1](f)}`)
309
+ .join(" ");
310
+ return ` install -D ${options} \"$srcdir/${f.name}\" \"$pkgdir/${f.destination}\"`;
311
+ })
303
312
  .join("\n") +
304
- content.substring(markerPos + 14);
313
+ content.substring(markerPos + 18);
305
314
 
306
315
  await writeFile(pkgbuild, content, utf8StreamOptions);
307
316
  }