pkg-pr-new 0.0.15 → 0.0.17
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 +20 -10
- package/index.ts +17 -6
- package/package.json +2 -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 {
|
|
@@ -141,13 +142,19 @@ const main = defineCommand({
|
|
|
141
142
|
await verifyCompactMode(pJson.name);
|
|
142
143
|
}
|
|
143
144
|
|
|
144
|
-
|
|
145
|
-
pJson.name,
|
|
146
|
-
new URL(
|
|
145
|
+
const depUrl = new URL(
|
|
147
146
|
`/${owner}/${repo}/${pJson.name}@${abbreviatedSha}`,
|
|
148
147
|
apiUrl,
|
|
149
|
-
).href
|
|
148
|
+
).href
|
|
149
|
+
deps.set(
|
|
150
|
+
pJson.name,
|
|
151
|
+
depUrl,
|
|
150
152
|
);
|
|
153
|
+
|
|
154
|
+
const resource = await fetch(depUrl)
|
|
155
|
+
if (resource.ok) {
|
|
156
|
+
console.warn(`${pJson.name}@${abbreviatedSha} was already published on ${depUrl}`)
|
|
157
|
+
}
|
|
151
158
|
}
|
|
152
159
|
|
|
153
160
|
for (const templateDir of templates) {
|
|
@@ -169,8 +176,9 @@ const main = defineCommand({
|
|
|
169
176
|
const restore = await writeDeps(templateDir, deps);
|
|
170
177
|
|
|
171
178
|
const gitignorePath = path.join(templateDir, ".gitignore");
|
|
172
|
-
const ig = ignore()
|
|
173
|
-
|
|
179
|
+
const ig = ignore()
|
|
180
|
+
.add("node_modules")
|
|
181
|
+
.add(".git");
|
|
174
182
|
|
|
175
183
|
if (fsSync.existsSync(gitignorePath)) {
|
|
176
184
|
const gitignoreContent = await fs.readFile(gitignorePath, "utf8");
|
|
@@ -181,6 +189,7 @@ const main = defineCommand({
|
|
|
181
189
|
cwd: templateDir,
|
|
182
190
|
dot: true,
|
|
183
191
|
onlyFiles: true,
|
|
192
|
+
ignore: ['node_modules', '.git'], // always ignore node_modules and .git
|
|
184
193
|
});
|
|
185
194
|
|
|
186
195
|
const filteredFiles = files.filter((file) => !ig.ignores(file));
|
|
@@ -271,6 +280,7 @@ const main = defineCommand({
|
|
|
271
280
|
}
|
|
272
281
|
}
|
|
273
282
|
|
|
283
|
+
const packageManager = await detect();
|
|
274
284
|
const res = await fetch(publishUrl, {
|
|
275
285
|
method: "POST",
|
|
276
286
|
headers: {
|
|
@@ -279,6 +289,7 @@ const main = defineCommand({
|
|
|
279
289
|
"sb-key": key,
|
|
280
290
|
"sb-shasums": JSON.stringify(shasums),
|
|
281
291
|
"sb-run-id": GITHUB_RUN_ID,
|
|
292
|
+
"sb-package-manager": packageManager,
|
|
282
293
|
},
|
|
283
294
|
body: formData,
|
|
284
295
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pkg-pr-new",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
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",
|