npm-pkgbuild 7.19.6 → 7.20.0
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
|
@@ -55,7 +55,7 @@ export class NodeModulesContentProvider extends ContentProvider {
|
|
|
55
55
|
})) {
|
|
56
56
|
if (
|
|
57
57
|
!name.match(
|
|
58
|
-
/(~|\.orig|\.log|\.tmp|\.bak|\.bat|yarn\.lock|\.DS_Store|\.travis\.yml|\.npm.*|\.git.*|rollup\.config\.(js|mjs|cjs)|
|
|
58
|
+
/(~|\.orig|\.log|\.tmp|\.bak|\.bat|\.gyp|yarn\.lock|\.DS_Store|\.travis\.yml|\.npm.*|\.git.*|rollup\.config\.(js|mjs|cjs)|CONTRIBUTING(.md)?|CHANGELOG(\.md)?|HISTORY(\.md)?|LICENSE(\-\w+|\.md)?|README(.*\.md)?|\.o|\.a|\.c|\.cc|\.h|Makefile(\.in)?|\.cmake|\.mk|\.\d)$/i
|
|
59
59
|
)
|
|
60
60
|
) {
|
|
61
61
|
yield Object.assign(
|
|
@@ -74,7 +74,6 @@ const toBeIgnored = [
|
|
|
74
74
|
"*.d.ts*",
|
|
75
75
|
"*.patch",
|
|
76
76
|
"*.h.in",
|
|
77
|
-
"*.gyp",
|
|
78
77
|
".jshintrc*",
|
|
79
78
|
".esl*",
|
|
80
79
|
".zuul.yml",
|
|
@@ -110,13 +109,10 @@ const toBeIgnored = [
|
|
|
110
109
|
{
|
|
111
110
|
options: { ignoreCase: true },
|
|
112
111
|
pattern: [
|
|
113
|
-
"CONTRIBUTING*",
|
|
114
112
|
"Contributors*",
|
|
115
|
-
"CHANGES*",
|
|
116
113
|
"PATENTS*",
|
|
117
114
|
"AUTHORS*",
|
|
118
115
|
"NOTICE*",
|
|
119
|
-
"HISTORY*",
|
|
120
116
|
"SUMMARY.md",
|
|
121
117
|
"MIGRAT*.md",
|
|
122
118
|
"UPGRAD*.md",
|
|
@@ -130,8 +126,7 @@ const toBeIgnored = [
|
|
|
130
126
|
"Porting-Buffer.md",
|
|
131
127
|
"chains and topics.md",
|
|
132
128
|
"CODE_OF_CONDUCT*",
|
|
133
|
-
"CODEOWNERS"
|
|
134
|
-
"LICENSE.DOCS*"
|
|
129
|
+
"CODEOWNERS"
|
|
135
130
|
]
|
|
136
131
|
}
|
|
137
132
|
];
|
package/src/npm-pkgbuild-cli.mjs
CHANGED
|
@@ -49,7 +49,16 @@ program
|
|
|
49
49
|
.addOption(
|
|
50
50
|
new program.Option("--publish <url>", "publishing url of the package").env(
|
|
51
51
|
"PACMAN_PUBLISH"
|
|
52
|
-
)
|
|
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;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return value;
|
|
61
|
+
})
|
|
53
62
|
)
|
|
54
63
|
.action(async options => {
|
|
55
64
|
try {
|
package/src/output/packager.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { join, dirname } from "path";
|
|
2
2
|
import { tmpdir } from "os";
|
|
3
3
|
import { mkdtemp, mkdir } from "fs/promises";
|
|
4
|
+
import { analysePublish } from "../publish.mjs";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* @typedef {Object} Field
|
|
@@ -83,14 +84,9 @@ export class Packager {
|
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
if (options.publish) {
|
|
86
|
-
const
|
|
87
|
+
const { publish, scheme } = analysePublish(options.publish, out.properties);
|
|
87
88
|
|
|
88
|
-
|
|
89
|
-
out.destination = m[1] === "file" ? m[2] : tmpdir;
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
out.destination = options.publish;
|
|
93
|
-
}
|
|
89
|
+
out.destination = scheme === 'file:' ? publish : tmpdir;
|
|
94
90
|
|
|
95
91
|
await mkdir(dirname(out.destination), { recursive: true });
|
|
96
92
|
}
|
package/src/publish.mjs
CHANGED
|
@@ -2,24 +2,30 @@ import { basename } from "path";
|
|
|
2
2
|
import { createReadStream } from "fs";
|
|
3
3
|
import fetch from "node-fetch";
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
if(!destination) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
destination = destination.replace(
|
|
5
|
+
export function analysePublish(publish, properties) {
|
|
6
|
+
publish = publish.replace(
|
|
12
7
|
/\{\{(\w+)\}\}/m,
|
|
13
8
|
(match, key, offset, string) => properties[key]
|
|
14
9
|
);
|
|
15
10
|
|
|
16
|
-
|
|
11
|
+
const m = publish.match(/^([\w_\+]+:)\/\/(.*)/);
|
|
12
|
+
const scheme = m ? m[0] : "file:";
|
|
17
13
|
|
|
18
|
-
|
|
14
|
+
return { publish, scheme };
|
|
15
|
+
}
|
|
19
16
|
|
|
20
|
-
|
|
17
|
+
export async function publish(fileName, destination, properties) {
|
|
18
|
+
if (!destination) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let { publish, scheme } = analysePublish(destination, properties);
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
publish = publish + "/" + basename(fileName);
|
|
25
|
+
|
|
26
|
+
console.log(publish);
|
|
27
|
+
|
|
28
|
+
if (scheme === "http:" || scheme === "https:") {
|
|
23
29
|
const headers = {};
|
|
24
30
|
|
|
25
31
|
if (properties.username) {
|
|
@@ -28,11 +34,9 @@ export async function publish(fileName, destination, properties) {
|
|
|
28
34
|
Buffer.from(properties.username + ":" + properties.password).toString(
|
|
29
35
|
"base64"
|
|
30
36
|
);
|
|
31
|
-
|
|
32
|
-
console.log(headers.authorization);
|
|
33
37
|
}
|
|
34
38
|
|
|
35
|
-
const response = await fetch(
|
|
39
|
+
const response = await fetch(publish, {
|
|
36
40
|
method: "PUT",
|
|
37
41
|
headers,
|
|
38
42
|
body: createReadStream(fileName)
|