npm-pkgbuild 7.23.8 → 7.24.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-pkgbuild",
3
- "version": "7.23.8",
3
+ "version": "7.24.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -30,7 +30,7 @@ export class FileContentProvider extends ContentProvider {
30
30
  } else {
31
31
  this.definitions = { pattern: ["**/*"], ...definitions };
32
32
  this.definitions.pattern = asArray(this.definitions.pattern);
33
- /*
33
+ /*
34
34
  if(entryProperties && entryProperties.destination && !entryProperties.destination.endsWith('/')) {
35
35
  entryProperties.destination += '/';
36
36
  }
@@ -41,13 +41,14 @@ export class FileContentProvider extends ContentProvider {
41
41
  }
42
42
 
43
43
  toString() {
44
- return `${this.constructor.name}: ${this.definitions.base}, ${this.definitions.pattern}`;
44
+ return `${this.constructor.name}: ${this.definitions.base}, ${this.definitions.pattern} -> ${this.entryProperties.destination}`;
45
45
  }
46
46
 
47
47
  async *[Symbol.asyncIterator]() {
48
48
  const definitions = this.definitions;
49
49
  const base = definitions.base;
50
50
 
51
+ console.log("XXX", base, definitions.pattern);
51
52
  for (const name of await globby(definitions.pattern, {
52
53
  cwd: base
53
54
  })) {
@@ -30,7 +30,7 @@ export class NodeModulesContentProvider extends ContentProvider {
30
30
  }
31
31
 
32
32
  toString() {
33
- return `${this.constructor.name}: ${this.dir}`;
33
+ return `${this.constructor.name}: ${this.dir} -> ${this.entryProperties.destination}`;
34
34
  }
35
35
 
36
36
  async *[Symbol.asyncIterator]() {
@@ -85,6 +85,7 @@ const toBeSkipped = new RegExp(
85
85
  "(" +
86
86
  [
87
87
  "~",
88
+ "\\.\\d",
88
89
  "\\.map",
89
90
  "\\.ts",
90
91
  "\\.mts",
@@ -109,6 +110,7 @@ const toBeSkipped = new RegExp(
109
110
  "COPYING",
110
111
  "Copyrightnotice\\.txt",
111
112
  "Doxyfile",
113
+ "Dockerfile",
112
114
  "CODE_OF_CONDUCT(\\.md)?",
113
115
  "GOVERNANCE(\\.md)?",
114
116
  "CODEOWNERS(\\.md)?",
@@ -117,8 +119,9 @@ const toBeSkipped = new RegExp(
117
119
  "CONTRIBUT(ORS|ING)(\\.md)?",
118
120
  "CHANGELOG(\\.md)?",
119
121
  "HISTORY(\\.md)?",
120
- "LICENSE(\\-\\w+|\\.md|\\.txt|\\.BSD)?",
121
- "README(.*\\.md)?",
122
+ "LICENSE(\\-\\w+(\\.txt)?|\\.md|\\.txt|\\.BSD|\\.APACHE2|\\.MIT|\\.terms)?",
123
+ "README(.*\\.md|\\.txt)?",
124
+ "INSTALL(.*\\.md)?",
122
125
  "\\.armv6\\.node",
123
126
  "\\.py",
124
127
  "\\.o",
@@ -128,10 +131,11 @@ const toBeSkipped = new RegExp(
128
131
  "\\.cpp",
129
132
  "\\.h",
130
133
  "\\.in",
131
- "Makefile",
134
+ "\\.vc",
135
+ "\\.m4",
136
+ "Makefile(\\.am|\\.fallback|\\.msc)?",
132
137
  "\\.cmake",
133
138
  "\\.mk",
134
- "\\.d",
135
139
  "\\.patch",
136
140
  "\\.esl*",
137
141
  "\\.zuul\\.yml",
@@ -171,6 +175,7 @@ const toBeSkipped = new RegExp(
171
175
  "SECURITY\\.md",
172
176
  "SFTPStream\\.md",
173
177
  "LIMITS\\.md",
178
+ "DEPS",
174
179
  "Porting-Buffer\\.md",
175
180
  "chains and topics\\.md",
176
181
  "build_detect_platform"
@@ -28,7 +28,7 @@ export class NPMPackContentProvider extends ContentProvider {
28
28
 
29
29
  toString()
30
30
  {
31
- return `${this.constructor.name}: ${this.dir}`;
31
+ return `${this.constructor.name}: ${this.dir} -> ${this.entryProperties.destination}`;
32
32
  }
33
33
 
34
34
  async *[Symbol.asyncIterator]() {
@@ -1,5 +1,6 @@
1
1
  import { arch as hostArch } from "process";
2
2
  import { packageWalker } from "npm-package-walker";
3
+ import { createContext } from "expression-expander";
3
4
  import { asArray } from "./util.mjs";
4
5
  import { NPMPackContentProvider } from "./content/npm-pack-content-provider.mjs";
5
6
  import { NodeModulesContentProvider } from "./content/node-modules-content-provider.mjs";
@@ -46,6 +47,11 @@ export async function extractFromPackage(pkg, dir) {
46
47
  properties.name = properties.name.replace(/^\@\w+\//, "");
47
48
  }
48
49
 
50
+ properties.access = "private";
51
+ if (pkg.publishConfig) {
52
+ properties.access = pkg.publishConfig.access;
53
+ }
54
+
49
55
  if (pkg.contributors) {
50
56
  properties.maintainer = pkg.contributors.map(
51
57
  c => `${c.name} <${c.email}>`
@@ -62,6 +68,8 @@ export async function extractFromPackage(pkg, dir) {
62
68
  }
63
69
  }
64
70
 
71
+ const context = createContext({ properties });
72
+
65
73
  let dependencies = { ...pkg.engines };
66
74
  let sources = [];
67
75
  let output = {};
@@ -77,10 +85,10 @@ export async function extractFromPackage(pkg, dir) {
77
85
  arch.add(npmArchMapping[a]);
78
86
  }
79
87
  }
80
-
88
+
81
89
  if (pkgbuild.arch) {
82
90
  for (const a of asArray(pkgbuild.arch)) {
83
- arch.add(a);
91
+ arch.add(a);
84
92
  }
85
93
  }
86
94
 
@@ -93,6 +101,8 @@ export async function extractFromPackage(pkg, dir) {
93
101
  if (pkgbuild.content && !modulePath) {
94
102
  Object.entries(pkgbuild.content).forEach(
95
103
  ([destination, definitions]) => {
104
+ destination = context.expand(destination);
105
+ definitions = context.expand(definitions);
96
106
  for (const definition of asArray(definitions)) {
97
107
  const entryProperties = { destination };
98
108
 
@@ -130,7 +140,7 @@ export async function extractFromPackage(pkg, dir) {
130
140
  processPkg(pkg, dir);
131
141
 
132
142
  if (arch.size > 0) {
133
- properties.arch = [...arch].filter(a => a === npmArchMapping[hostArch])
143
+ properties.arch = [...arch].filter(a => a === npmArchMapping[hostArch]);
134
144
  }
135
145
 
136
146
  return { properties, sources, dependencies, output };
@@ -3,7 +3,7 @@
3
3
  import { readFileSync } from "fs";
4
4
  import { readFile } from "fs/promises";
5
5
  import { join } from "path";
6
- import { program } from "commander";
6
+ import { program } from "commander";
7
7
  import { aggregateFifo } from "aggregate-async-iterator";
8
8
  import { createContext } from "expression-expander";
9
9
  import { packageDirectory } from "pkg-dir";