pkg-pr-new 0.0.14 → 0.0.16
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/dist/index.js +14 -13
- package/index.ts +9 -12
- package/package.json +2 -1
- package/template.ts +1 -1
package/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { createHash } from "node:crypto";
|
|
|
6
6
|
import { hash } from "ohash";
|
|
7
7
|
import fsSync from "fs";
|
|
8
8
|
import fs from "fs/promises";
|
|
9
|
+
import { detect } from "detect-package-manager";
|
|
9
10
|
import { getPackageManifest, type PackageManifest } from "query-registry";
|
|
10
11
|
import type { Comment } from "@pkg-pr-new/utils";
|
|
11
12
|
import {
|
|
@@ -60,11 +61,7 @@ const main = defineCommand({
|
|
|
60
61
|
},
|
|
61
62
|
run: async ({ args }) => {
|
|
62
63
|
const paths = (args._.length ? args._ : ["."])
|
|
63
|
-
.flatMap((p) =>
|
|
64
|
-
fg.isDynamicPattern(p)
|
|
65
|
-
? fg.sync(p, { onlyDirectories: true })
|
|
66
|
-
: p,
|
|
67
|
-
)
|
|
64
|
+
.flatMap((p) => fg.sync(p, { onlyDirectories: true }))
|
|
68
65
|
.map((p) => path.resolve(p.trim()));
|
|
69
66
|
|
|
70
67
|
const templates = (
|
|
@@ -72,11 +69,7 @@ const main = defineCommand({
|
|
|
72
69
|
? [args.template]
|
|
73
70
|
: ([...(args.template || [])] as string[])
|
|
74
71
|
)
|
|
75
|
-
.flatMap((p) =>
|
|
76
|
-
fg.isDynamicPattern(p)
|
|
77
|
-
? fg.sync(p, { onlyDirectories: true })
|
|
78
|
-
: p,
|
|
79
|
-
)
|
|
72
|
+
.flatMap((p) => fg.sync(p, { onlyDirectories: true }))
|
|
80
73
|
.map((p) => path.resolve(p.trim()));
|
|
81
74
|
|
|
82
75
|
const formData = new FormData();
|
|
@@ -177,8 +170,9 @@ const main = defineCommand({
|
|
|
177
170
|
const restore = await writeDeps(templateDir, deps);
|
|
178
171
|
|
|
179
172
|
const gitignorePath = path.join(templateDir, ".gitignore");
|
|
180
|
-
const ig = ignore()
|
|
181
|
-
|
|
173
|
+
const ig = ignore()
|
|
174
|
+
.add("node_modules")
|
|
175
|
+
.add(".git");
|
|
182
176
|
|
|
183
177
|
if (fsSync.existsSync(gitignorePath)) {
|
|
184
178
|
const gitignoreContent = await fs.readFile(gitignorePath, "utf8");
|
|
@@ -189,6 +183,7 @@ const main = defineCommand({
|
|
|
189
183
|
cwd: templateDir,
|
|
190
184
|
dot: true,
|
|
191
185
|
onlyFiles: true,
|
|
186
|
+
ignore: ['node_modules', '.git'], // always ignore node_modules and .git
|
|
192
187
|
});
|
|
193
188
|
|
|
194
189
|
const filteredFiles = files.filter((file) => !ig.ignores(file));
|
|
@@ -279,6 +274,7 @@ const main = defineCommand({
|
|
|
279
274
|
}
|
|
280
275
|
}
|
|
281
276
|
|
|
277
|
+
const packageManager = await detect();
|
|
282
278
|
const res = await fetch(publishUrl, {
|
|
283
279
|
method: "POST",
|
|
284
280
|
headers: {
|
|
@@ -287,6 +283,7 @@ const main = defineCommand({
|
|
|
287
283
|
"sb-key": key,
|
|
288
284
|
"sb-shasums": JSON.stringify(shasums),
|
|
289
285
|
"sb-run-id": GITHUB_RUN_ID,
|
|
286
|
+
"sb-package-manager": packageManager,
|
|
290
287
|
},
|
|
291
288
|
body: formData,
|
|
292
289
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pkg-pr-new",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@jsdevtools/ez-spawn": "^3.0.4",
|
|
20
20
|
"@octokit/action": "^6.1.0",
|
|
21
|
+
"detect-package-manager": "^3.0.2",
|
|
21
22
|
"fast-glob": "^3.3.2",
|
|
22
23
|
"ignore": "^5.3.1",
|
|
23
24
|
"isbinaryfile": "^5.0.2",
|
package/template.ts
CHANGED
|
@@ -28,7 +28,7 @@ npm i ${url}
|
|
|
28
28
|
To use this feature as a maintainer, you can run the following command:
|
|
29
29
|
|
|
30
30
|
\`\`\`sh
|
|
31
|
-
npx pkg-pr-new publish ./packages/A --template
|
|
31
|
+
npx pkg-pr-new publish './packages/A' --template './examples/*'
|
|
32
32
|
\`\`\`
|
|
33
33
|
|
|
34
34
|
## Benefits
|