npm-pkgbuild 11.7.7 → 11.7.9

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": "11.7.7",
3
+ "version": "11.7.9",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,8 +36,9 @@
36
36
  "test:ava": "ava --timeout 2m tests/*-ava.mjs tests/*-ava-node.mjs",
37
37
  "cover": "c8 -x 'tests/**/*' --temp-directory build/tmp ava --timeout 2m tests/*-ava.mjs tests/*-ava-node.mjs && c8 report -r lcov -o build/coverage --temp-directory build/tmp",
38
38
  "docs": "documentation readme --section=API ./src/**/*.mjs",
39
- "lint": "npm run lint:docs",
40
- "lint:docs": "documentation lint ./src/**/*.mjs"
39
+ "lint": "npm run lint:docs && npm run lint:tsc",
40
+ "lint:docs": "documentation lint ./src/**/*.mjs",
41
+ "lint:tsc": "tsc --allowJs --checkJs --noEmit -t esnext -m esnext --moduleResolution nodenext ./src/*.mjs"
41
42
  },
42
43
  "dependencies": {
43
44
  "@npmcli/arborist": "^6.2.7",
@@ -62,11 +63,13 @@
62
63
  "tar-stream": "^3.0.0"
63
64
  },
64
65
  "devDependencies": {
66
+ "@types/node": "^18.15.11",
65
67
  "ava": "^5.2.0",
66
68
  "c8": "^7.13.0",
67
69
  "documentation": "^14.0.1",
68
70
  "semantic-release": "^21.0.1",
69
- "stream-buffers": "^3.0.2"
71
+ "stream-buffers": "^3.0.2",
72
+ "typescript": "^5.0.4"
70
73
  },
71
74
  "engines": {
72
75
  "node": ">=16.20.0"
@@ -82,7 +85,8 @@
82
85
  "template": {
83
86
  "inheritFrom": [
84
87
  "arlac77/template-arlac77-github",
85
- "arlac77/template-esm-only"
88
+ "arlac77/template-esm-only",
89
+ "arlac77/template-typescript"
86
90
  ]
87
91
  }
88
92
  }
@@ -1,10 +1,13 @@
1
+ import { ContentEntry } from "content-entry";
2
+
1
3
  /**
2
4
  * Source of package content.
5
+ * @property {string} dir
3
6
  */
4
7
  export class ContentProvider {
5
8
  /**
6
9
  * List all entries.
7
- * @return {asyncIterator<ContentEntry>} all entries
10
+ * @return {AsyncIterator<ContentEntry>} all entries
8
11
  */
9
12
  async *[Symbol.asyncIterator]() {
10
13
  }
@@ -12,6 +12,8 @@ import { shrinkNPM } from "../npm-shrink.mjs";
12
12
 
13
13
  /**
14
14
  * Content from node_modules
15
+ *
16
+ * @property {boolean} withoutDevelpmentDependencies
15
17
  */
16
18
  export class NodeModulesContentProvider extends ContentProvider {
17
19
  /**
@@ -8,6 +8,7 @@ import { NPMPackContentProvider } from "./content/npm-pack-content-provider.mjs"
8
8
  import { NodeModulesContentProvider } from "./content/node-modules-content-provider.mjs";
9
9
  import { FileContentProvider } from "./content/file-content-provider.mjs";
10
10
  import { NFTContentProvider } from "./content/nft-content-provider.mjs";
11
+ import { ContentProvider } from "./content/content-provider.mjs";
11
12
  import { DEBIAN } from "./output/debian.mjs";
12
13
  import { ARCH } from "./output/arch.mjs";
13
14
  import { RPM } from "./output/rpm.mjs";
@@ -1,6 +1,6 @@
1
1
  const nameAndVersion = ["name", "version"];
2
2
 
3
- export function shrinkNPM(pkg, options = { removeKeys: nameAndVersion, removeDefaults: flase }) {
3
+ export function shrinkNPM(pkg, options = { removeKeys: nameAndVersion, removeDefaults: false }) {
4
4
  const toBeRemoved = [
5
5
  "dependencies",
6
6
  "sideEffects",
@@ -32,7 +32,7 @@ function* keyValueLines(key, value, options) {
32
32
  }
33
33
 
34
34
  /**
35
- * @type KeyValueTransformOptions
35
+ * @type {Object} KeyValueTransformOptions
36
36
  * Options to describe key value pair separated by an equal sign '='
37
37
  */
38
38
  export const pkgKeyValuePairOptions = {
@@ -208,6 +208,7 @@ function person(contributors) {
208
208
  }
209
209
 
210
210
  const default_attribute = { type: "string" };
211
+ const default_array_attribute = { type: "string[]" };
211
212
 
212
213
  /**
213
214
  * well known package properties
@@ -225,19 +226,19 @@ const fields = {
225
226
  license: { type: "string[]", mandatory: true },
226
227
  install: { type: "string" },
227
228
  changelog: { type: "string" },
228
- source: default_attribute,
229
- validpgpkeys: default_attribute,
229
+ source: default_array_attribute,
230
+ validpgpkeys: default_array_attribute,
230
231
  noextract: default_attribute,
231
- cksums: default_attribute,
232
- md5sums: default_attribute,
233
- sha1sums: default_attribute,
234
- sha256sums: default_attribute,
235
- sha384sums: default_attribute,
236
- sha512sums: default_attribute,
237
- groups: default_attribute,
238
- arch: { default: ["any"], type: "string[]", mandatory: true },
232
+ cksums: default_array_attribute,
233
+ md5sums: default_array_attribute,
234
+ sha1sums: default_array_attribute,
235
+ sha256sums: default_array_attribute,
236
+ sha384sums: default_array_attribute,
237
+ sha512sums: default_array_attribute,
238
+ groups: default_array_attribute,
239
+ arch: { ...default_array_attribute, default: ["any"], mandatory: true },
239
240
  backup: default_attribute,
240
- depends: default_attribute,
241
+ depends: default_array_attribute,
241
242
  makedepends: default_attribute,
242
243
  checkdepends: default_attribute,
243
244
  optdepends: default_attribute,
@@ -132,7 +132,7 @@ export class DOCKER extends Packager {
132
132
  }
133
133
 
134
134
  /**
135
- * @see {https://docs.docker.com/engine/reference/builder/}
135
+ * @see {@link https://docs.docker.com/engine/reference/builder/}
136
136
  */
137
137
  const fields = {
138
138
  version: { type: "string", mandatory: true },
@@ -45,6 +45,9 @@ export function requiresFromDependencies(dependencies) {
45
45
  );
46
46
  }
47
47
 
48
+ /**
49
+ * produce rpm packages
50
+ */
48
51
  export class RPM extends Packager {
49
52
  static get name() {
50
53
  return "rpm";
@@ -78,7 +81,10 @@ export class RPM extends Packager {
78
81
 
79
82
  /**
80
83
  * Check for rpmbuild presence.
81
- * @returns {boolean} true when rpmbuild is present
84
+ * @param {Object} options
85
+ * @param {Object} variant
86
+ * @param {string} variant.arch
87
+ * @returns {Promise<boolean>} true when rpmbuild executable is present
82
88
  */
83
89
  static async prepare(options, variant) {
84
90
  try {
package/src/util.mjs CHANGED
@@ -2,7 +2,12 @@ import { join, dirname } from "node:path";
2
2
  import { mkdir } from "node:fs/promises";
3
3
  import { pipeline } from "node:stream/promises";
4
4
  import { createWriteStream } from "node:fs";
5
+ import { ContentEntry } from "content-entry";
5
6
 
7
+ /**
8
+ * @type {Object}
9
+ * @property {BufferEncoding} encoding
10
+ */
6
11
  export const utf8StreamOptions = { encoding: "utf8" };
7
12
 
8
13
  /**
@@ -147,7 +152,6 @@ export function fieldProvider(properties, fields) {
147
152
  * @param {AsyncIterator<ContentEntry>} source
148
153
  * @param {string} destinationDirectory
149
154
  * @param {Expander} expander
150
- * @param {ContentEntryAttribute[]} attributes
151
155
  */
152
156
  export async function* copyEntries(
153
157
  source,