npm-pkgbuild 8.3.9 → 8.3.12

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
@@ -67,7 +67,7 @@ content as provided by npm pack
67
67
  content of all (production) dependencies
68
68
 
69
69
  options:
70
- - withoutDevelpmentDependencies when to stip away dev dependencies
70
+ - withoutDevelpmentDependencies when to stip away dev dependencies (defaults to true)
71
71
 
72
72
 
73
73
  # API
@@ -76,40 +76,49 @@ options:
76
76
 
77
77
  ### Table of Contents
78
78
 
79
- * [ContentProvider](#contentprovider)
80
- * [asyncIterator](#asynciterator)
81
- * [FileContentProvider](#filecontentprovider)
82
- * [Parameters](#parameters)
83
- * [name](#name)
84
- * [NodeModulesContentProvider](#nodemodulescontentprovider)
85
- * [Parameters](#parameters-1)
86
- * [name](#name-1)
87
- * [NPMPackContentProvider](#npmpackcontentprovider)
88
- * [Parameters](#parameters-2)
89
- * [name](#name-2)
90
- * [pkgKeyValuePairOptions](#pkgkeyvaluepairoptions)
91
- * [fields](#fields)
92
- * [fields](#fields-1)
93
- * [fields](#fields-2)
94
- * [hookMapping](#hookmapping)
95
- * [hookMapping](#hookmapping-1)
96
- * [Field](#field)
97
- * [Properties](#properties)
98
- * [Packager](#packager)
99
- * [Parameters](#parameters-3)
100
- * [tmpdir](#tmpdir)
101
- * [execute](#execute)
102
- * [Parameters](#parameters-4)
103
- * [decodePassword](#decodepassword)
104
- * [Parameters](#parameters-5)
105
- * [extractFunctions](#extractfunctions)
106
- * [Parameters](#parameters-6)
107
- * [fieldProvider](#fieldprovider)
108
- * [Parameters](#parameters-7)
109
- * [Expander](#expander)
110
- * [Parameters](#parameters-8)
111
- * [copyEntries](#copyentries)
112
- * [Parameters](#parameters-9)
79
+ - [usage](#usage)
80
+ - [content providers](#content-providers)
81
+ - [files (default)](#files-default)
82
+ - [npm-pack](#npm-pack)
83
+ - [node-modules](#node-modules)
84
+ - [API](#api)
85
+ - [Table of Contents](#table-of-contents)
86
+ - [ContentProvider](#contentprovider)
87
+ - [asyncIterator](#asynciterator)
88
+ - [FileContentProvider](#filecontentprovider)
89
+ - [Parameters](#parameters)
90
+ - [name](#name)
91
+ - [NodeModulesContentProvider](#nodemodulescontentprovider)
92
+ - [Parameters](#parameters-1)
93
+ - [name](#name-1)
94
+ - [NPMPackContentProvider](#npmpackcontentprovider)
95
+ - [Parameters](#parameters-2)
96
+ - [name](#name-2)
97
+ - [pkgKeyValuePairOptions](#pkgkeyvaluepairoptions)
98
+ - [fields](#fields)
99
+ - [fields](#fields-1)
100
+ - [fields](#fields-2)
101
+ - [hookMapping](#hookmapping)
102
+ - [hookMapping](#hookmapping-1)
103
+ - [Field](#field)
104
+ - [Properties](#properties)
105
+ - [Packager](#packager)
106
+ - [Parameters](#parameters-3)
107
+ - [tmpdir](#tmpdir)
108
+ - [execute](#execute)
109
+ - [Parameters](#parameters-4)
110
+ - [decodePassword](#decodepassword)
111
+ - [Parameters](#parameters-5)
112
+ - [extractFunctions](#extractfunctions)
113
+ - [Parameters](#parameters-6)
114
+ - [fieldProvider](#fieldprovider)
115
+ - [Parameters](#parameters-7)
116
+ - [Expander](#expander)
117
+ - [Parameters](#parameters-8)
118
+ - [copyEntries](#copyentries)
119
+ - [Parameters](#parameters-9)
120
+ - [install](#install)
121
+ - [license](#license)
113
122
 
114
123
  ## ContentProvider
115
124
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-pkgbuild",
3
- "version": "8.3.9",
3
+ "version": "8.3.12",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -40,7 +40,7 @@
40
40
  "lint:docs": "documentation lint ./src/**/*.mjs"
41
41
  },
42
42
  "dependencies": {
43
- "@npmcli/arborist": "^5.0.4",
43
+ "@npmcli/arborist": "^5.0.5",
44
44
  "aggregate-async-iterator": "^1.1.10",
45
45
  "commander": "^9.1.0",
46
46
  "content-entry": "^4.1.9",
@@ -30,11 +30,6 @@ export class FileContentProvider extends ContentProvider {
30
30
  } else {
31
31
  this.definitions = { pattern: ["**/*"], ...definitions };
32
32
  this.definitions.pattern = asArray(this.definitions.pattern);
33
- /*
34
- if(entryProperties && entryProperties.destination && !entryProperties.destination.endsWith('/')) {
35
- entryProperties.destination += '/';
36
- }
37
- */
38
33
  }
39
34
 
40
35
  this.entryProperties = entryProperties;
@@ -214,6 +214,6 @@ const toBeSkipped = new RegExp(
214
214
  "chains and topics\\.md",
215
215
  "build_detect_platform"
216
216
  ].join("|") +
217
- ")$|(node_modules/(@types|node-addon-api|node-gyp)|(win32|android|darwin)-(ia32|x64|arm|arm64))",
217
+ ")$|(node_modules/(@types|node-addon-api)|(node_modules/node-gyp$)|(win32|android|darwin)-(ia32|x64|arm|arm64))",
218
218
  "i"
219
219
  );
@@ -28,78 +28,78 @@ export const archMapping = Object.fromEntries(
28
28
  * @param {string} dir
29
29
  * @returns {Object}
30
30
  */
31
- export async function extractFromPackage(pkg, dir) {
31
+ export async function extractFromPackage(json, dir) {
32
32
  const properties = Object.fromEntries(
33
33
  ["name", "version", "description", "homepage", "license"]
34
- .map(key => [key, pkg[key]])
34
+ .map(key => [key, json[key]])
35
35
  .filter(([k, v]) => v !== undefined)
36
36
  );
37
37
 
38
- if (pkg.bugs) {
39
- if (pkg.bugs.url) {
40
- properties.bugs = pkg.bugs.url;
38
+ if (json.bugs) {
39
+ if (json.bugs.url) {
40
+ properties.bugs = json.bugs.url;
41
41
  }
42
42
  }
43
43
 
44
- Object.assign(properties, pkg.config);
44
+ Object.assign(properties, json.config);
45
45
 
46
46
  if (properties.name) {
47
47
  properties.name = properties.name.replace(/^\@\w+\//, "");
48
48
  }
49
49
 
50
50
  properties.access = "private";
51
- if (pkg.publishConfig) {
52
- properties.access = pkg.publishConfig.access;
51
+ if (json.publishConfig) {
52
+ properties.access = json.publishConfig.access;
53
53
  }
54
54
 
55
- if (pkg.contributors) {
56
- properties.maintainer = pkg.contributors.map(
55
+ if (json.contributors) {
56
+ properties.maintainer = json.contributors.map(
57
57
  c => `${c.name} <${c.email}>`
58
58
  )[0];
59
59
  }
60
60
 
61
- if (pkg.repository) {
62
- if (typeof pkg.repository === "string") {
63
- properties.source = pkg.repository;
61
+ if (json.repository) {
62
+ if (typeof json.repository === "string") {
63
+ properties.source = json.repository;
64
64
  } else {
65
- if (pkg.repository.url) {
66
- properties.source = pkg.repository.url;
65
+ if (json.repository.url) {
66
+ properties.source = json.repository.url;
67
67
  }
68
68
  }
69
69
  }
70
70
 
71
71
  const context = createContext({ properties });
72
72
 
73
- let dependencies = { ...pkg.engines };
73
+ let dependencies = { ...json.engines };
74
74
  let sources = [];
75
75
  let output = {};
76
76
  let arch = new Set();
77
77
 
78
- const processPkg = (pkg, dir, modulePath) => {
79
- if (pkg.pkg) {
80
- const pkgbuild = pkg.pkg;
78
+ const processPkg = (json, dir, modulePath) => {
79
+ const pkg = json.pkg;
81
80
 
82
- if (pkgbuild.abstract || !modulePath) {
83
- if (pkg.cpu) {
84
- for (const a of asArray(pkg.cpu)) {
85
- arch.add(npmArchMapping[a]);
86
- }
81
+ if (pkg) {
82
+ if (json.cpu) {
83
+ for (const a of asArray(json.cpu)) {
84
+ arch.add(npmArchMapping[a]);
87
85
  }
86
+ }
88
87
 
89
- if (pkgbuild.arch) {
90
- for (const a of asArray(pkgbuild.arch)) {
88
+ if (pkg.abstract || !modulePath) {
89
+ if (pkg.arch) {
90
+ for (const a of asArray(pkg.arch)) {
91
91
  arch.add(a);
92
92
  }
93
93
  }
94
94
 
95
- Object.assign(output, pkgbuild.output);
95
+ Object.assign(output, pkg.output);
96
96
 
97
- Object.entries(pkgbuild)
97
+ Object.entries(pkg)
98
98
  .filter(([k, v]) => typeof v === "string")
99
99
  .forEach(([k, v]) => (properties[k] = v));
100
100
 
101
- if (pkgbuild.content && !modulePath) {
102
- Object.entries(pkgbuild.content).forEach(
101
+ if (pkg.content && !modulePath) {
102
+ Object.entries(pkg.content).forEach(
103
103
  ([destination, definitions]) => {
104
104
  destination = context.expand(destination);
105
105
  definitions = context.expand(definitions);
@@ -126,18 +126,18 @@ export async function extractFromPackage(pkg, dir) {
126
126
  );
127
127
  }
128
128
  }
129
- Object.assign(dependencies, pkgbuild.depends);
129
+ Object.assign(dependencies, pkg.depends);
130
130
  }
131
131
  };
132
132
 
133
- await packageWalker(async (pkg, base, modulePath) => {
133
+ await packageWalker(async (json, base, modulePath) => {
134
134
  if (modulePath.length > 0) {
135
- processPkg(pkg, base, modulePath);
135
+ processPkg(json, base, modulePath);
136
136
  }
137
137
  return true;
138
138
  }, dir);
139
139
 
140
- processPkg(pkg, dir);
140
+ processPkg(json, dir);
141
141
 
142
142
  if (arch.size > 0) {
143
143
  properties.arch = [...arch].filter(a => a === npmArchMapping[hostArch]);
@@ -128,6 +128,7 @@ program
128
128
  if (options.verbose) {
129
129
  console.log(output.properties);
130
130
  console.log(`sources: ${sources.join("\n ")}`);
131
+ console.log(`dependencies: ${JSON.stringify(dependencies)}`);
131
132
  }
132
133
 
133
134
  const fileName = await output.execute(
package/src/util.mjs CHANGED
@@ -144,7 +144,7 @@ export function fieldProvider(properties, fields) {
144
144
 
145
145
  /**
146
146
  * Copy content from source into destinationDirectory.
147
- * destination paths a generated without leading '/'
147
+ * Destination paths a generated without leading '/' (as for as entry names too).
148
148
  * @param {AsyncIterator<ContentEntry>} source
149
149
  * @param {string} destinationDirectory
150
150
  * @param {Expander} expander