npm-pkgbuild 7.21.2 → 7.22.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.21.2",
3
+ "version": "7.22.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -46,7 +46,7 @@
46
46
  "content-entry-transform": "^1.3.4",
47
47
  "execa": "^6.0.0",
48
48
  "expression-expander": "^7.0.9",
49
- "globby": "^12.2.0",
49
+ "globby": "^13.0.0",
50
50
  "iterable-string-interceptor": "^1.0.8",
51
51
  "key-value-transformer": "^2.0.0",
52
52
  "node-fetch": "^3.2.0",
@@ -88,6 +88,7 @@ const toBeSkipped = new RegExp(
88
88
  "~",
89
89
  "\\.map",
90
90
  "\\.ts",
91
+ "\\.mts",
91
92
  "\\.orig",
92
93
  "\\.log",
93
94
  "\\.tmp",
@@ -117,6 +118,7 @@ const toBeSkipped = new RegExp(
117
118
  "HISTORY(\\.md)?",
118
119
  "LICENSE(\\-\\w+|\\.md|\\.txt)?",
119
120
  "README(.*\\.md)?",
121
+ "\\.armv6\\.node",
120
122
  "\\.o",
121
123
  "\\.a",
122
124
  "\\.c",
@@ -127,7 +129,6 @@ const toBeSkipped = new RegExp(
127
129
  "\\.cmake",
128
130
  "\\.mk",
129
131
  "\\.d",
130
-
131
132
  "\\.patch",
132
133
  "\\.esl*",
133
134
  "\\.zuul\\.yml",
@@ -47,18 +47,17 @@ program
47
47
  )
48
48
  .option("-m --meta <dir>", "meta directory", (c, a) => a.concat([c]), [])
49
49
  .addOption(
50
- new program.Option("--publish <url>", "publishing url of the package").env(
51
- "PACMAN_PUBLISH"
52
- ).argParser((value) => {
53
- let [url, user, password] = value.split(/,/);
54
- if(user) {
55
- url = process.env[url];
56
- console.log(this,url,user,password);
57
- return url;
50
+ new program.Option("--publish <url>", "publishing url of the package")
51
+ .env("PACMAN_PUBLISH")
52
+ .argParser(value => {
53
+ let values = value.split(/,/);
54
+ if (values.length > 1) {
55
+ values = values.map(v => process.env[v] || v);
56
+ return { url: value[0], user: value[1], password: value[2] };
58
57
  }
59
58
 
60
- return value;
61
- })
59
+ return { url: value };
60
+ })
62
61
  )
63
62
  .action(async options => {
64
63
  try {
@@ -58,7 +58,6 @@ export class Packager {
58
58
  return properties;
59
59
  }
60
60
 
61
-
62
61
  async prepareExecute(options) {
63
62
  const tmpdir = await this.tmpdir;
64
63
 
@@ -80,13 +79,13 @@ export class Packager {
80
79
  mkdir(join(tmpdir, d), mdo)
81
80
  ])) {
82
81
  await nd[2];
83
- out[nd[0]] = nd[1];
82
+ out[nd[0]] = nd[1];
84
83
  }
85
84
 
86
85
  if (options.publish) {
87
- const { publish, scheme } = analysePublish(options.publish, out.properties);
86
+ const publish = analysePublish(options.publish, out.properties);
88
87
 
89
- out.destination = scheme === 'file:' ? publish : tmpdir;
88
+ out.destination = publish.scheme === "file:" ? publish.url : tmpdir;
90
89
 
91
90
  await mkdir(dirname(out.destination), { recursive: true });
92
91
  }
package/src/publish.mjs CHANGED
@@ -3,15 +3,16 @@ import { createReadStream } from "fs";
3
3
  import fetch from "node-fetch";
4
4
 
5
5
  export function analysePublish(publish, properties) {
6
- publish = publish.replace(
6
+ publish.url = publish.url.replace(
7
7
  /\{\{(\w+)\}\}/m,
8
8
  (match, key, offset, string) => properties[key]
9
9
  );
10
10
 
11
- const m = publish.match(/^([\w_\+]+:)\/\/(.*)/);
12
- const scheme = m ? m[0] : "file:";
11
+ const m = publish.url.match(/^([\w_\+]+:)\/\/(.*)/);
13
12
 
14
- return { publish, scheme };
13
+ publish.scheme = m ? m[0] : "file:";
14
+
15
+ return publish;
15
16
  }
16
17
 
17
18
  export async function publish(fileName, destination, properties) {
@@ -19,24 +20,24 @@ export async function publish(fileName, destination, properties) {
19
20
  return;
20
21
  }
21
22
 
22
- let { publish, scheme } = analysePublish(destination, properties);
23
+ const publish = analysePublish(destination, properties);
23
24
 
24
- publish = publish + "/" + basename(fileName);
25
+ publish.url = publish.url + "/" + basename(fileName);
25
26
 
26
- console.log(publish);
27
+ console.log(publish.url);
27
28
 
28
- if (scheme === "http:" || scheme === "https:") {
29
+ if (publish.scheme === "http:" || publish.scheme === "https:") {
29
30
  const headers = {};
30
31
 
31
- if (properties.username) {
32
+ if (publish.username) {
32
33
  headers.authorization =
33
34
  "Basic " +
34
- Buffer.from(properties.username + ":" + properties.password).toString(
35
+ Buffer.from(publish.username + ":" + publish.password).toString(
35
36
  "base64"
36
37
  );
37
38
  }
38
39
 
39
- const response = await fetch(publish, {
40
+ const response = await fetch(publish.url, {
40
41
  method: "PUT",
41
42
  headers,
42
43
  body: createReadStream(fileName)