pkg-pr-new 0.0.58 → 0.0.60
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 +28 -5
- package/environments.ts +2 -0
- package/index.ts +24 -4
- package/package.json +1 -1
package/environments.ts
CHANGED
|
@@ -30,6 +30,8 @@ declare global {
|
|
|
30
30
|
GITHUB_JOB: string;
|
|
31
31
|
// A unique number for each attempt of a particular workflow run in a repository. This number begins at 1 for the workflow run's first attempt, and increments with each re-run. For example, 3.
|
|
32
32
|
GITHUB_RUN_ATTEMPT: string;
|
|
33
|
+
// A file to set action outputs
|
|
34
|
+
GITHUB_OUTPUT: string;
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
}
|
package/index.ts
CHANGED
|
@@ -74,6 +74,10 @@ const main = defineCommand({
|
|
|
74
74
|
type: "boolean",
|
|
75
75
|
description: "use `yarn pack` instead of `npm pack --json`",
|
|
76
76
|
},
|
|
77
|
+
bun: {
|
|
78
|
+
type: "boolean",
|
|
79
|
+
description: "use `bun pm pack` instead of `npm pack --json`",
|
|
80
|
+
},
|
|
77
81
|
template: {
|
|
78
82
|
type: "string",
|
|
79
83
|
description:
|
|
@@ -131,6 +135,8 @@ const main = defineCommand({
|
|
|
131
135
|
packMethod = "pnpm";
|
|
132
136
|
} else if (args.yarn) {
|
|
133
137
|
packMethod = "yarn";
|
|
138
|
+
} else if (args.bun) {
|
|
139
|
+
packMethod = "bun";
|
|
134
140
|
}
|
|
135
141
|
|
|
136
142
|
const isPeerDepsEnabled = !!args.peerDeps;
|
|
@@ -164,6 +170,7 @@ const main = defineCommand({
|
|
|
164
170
|
GITHUB_RUN_ID,
|
|
165
171
|
GITHUB_RUN_ATTEMPT,
|
|
166
172
|
GITHUB_ACTOR_ID,
|
|
173
|
+
GITHUB_OUTPUT,
|
|
167
174
|
} = process.env;
|
|
168
175
|
|
|
169
176
|
const [owner, repo] = GITHUB_REPOSITORY.split("/");
|
|
@@ -193,6 +200,7 @@ const main = defineCommand({
|
|
|
193
200
|
}
|
|
194
201
|
|
|
195
202
|
const { sha } = await checkResponse.json();
|
|
203
|
+
const formattedSha = isCompact ? abbreviateCommitHash(sha) : sha;
|
|
196
204
|
|
|
197
205
|
const deps: Map<string, string> = new Map(); // pkg.pr.new versions of the package
|
|
198
206
|
const realDeps: Map<string, string> | null = isPeerDepsEnabled
|
|
@@ -225,8 +233,6 @@ const main = defineCommand({
|
|
|
225
233
|
if (isCompact) {
|
|
226
234
|
await verifyCompactMode(pJson.name);
|
|
227
235
|
}
|
|
228
|
-
|
|
229
|
-
const formattedSha = isCompact ? abbreviateCommitHash(sha) : sha;
|
|
230
236
|
const longDepUrl = new URL(
|
|
231
237
|
`/${owner}/${repo}/${pJson.name}@${formattedSha}`,
|
|
232
238
|
apiUrl,
|
|
@@ -552,6 +558,18 @@ const main = defineCommand({
|
|
|
552
558
|
await fs.writeFile(jsonFilePath, output);
|
|
553
559
|
console.warn(`metadata written to ${jsonFilePath}`);
|
|
554
560
|
}
|
|
561
|
+
|
|
562
|
+
await fs.appendFile(GITHUB_OUTPUT, `sha=${formattedSha}\n`, "utf8");
|
|
563
|
+
await fs.appendFile(
|
|
564
|
+
GITHUB_OUTPUT,
|
|
565
|
+
`urls=${outputMetadata.packages.map((pkg) => pkg.url).join(" ")}\n`,
|
|
566
|
+
"utf8",
|
|
567
|
+
);
|
|
568
|
+
await fs.appendFile(
|
|
569
|
+
GITHUB_OUTPUT,
|
|
570
|
+
`packages=${outputMetadata.packages.map((pkg) => `${pkg.name}@${pkg.url}`).join(" ")}\n`,
|
|
571
|
+
"utf8",
|
|
572
|
+
);
|
|
555
573
|
},
|
|
556
574
|
};
|
|
557
575
|
},
|
|
@@ -570,13 +588,15 @@ runMain(main)
|
|
|
570
588
|
.then(() => process.exit(0))
|
|
571
589
|
.catch(() => process.exit(1));
|
|
572
590
|
|
|
573
|
-
type PackMethod = "npm" | "pnpm" | "yarn";
|
|
591
|
+
type PackMethod = "npm" | "pnpm" | "yarn" | "bun";
|
|
574
592
|
|
|
575
593
|
async function resolveTarball(pm: PackMethod, p: string, pJson: PackageJson) {
|
|
576
594
|
let cmd = `${pm} pack`;
|
|
577
595
|
let filename = `${pJson.name!.replace("/", "-")}-${pJson.version}.tgz`;
|
|
578
596
|
if (pm === "yarn") {
|
|
579
597
|
cmd += ` --filename ${filename}`;
|
|
598
|
+
} else if (pm === "bun") {
|
|
599
|
+
cmd = `bun pm pack --filename ${filename}`;
|
|
580
600
|
}
|
|
581
601
|
const { stdout } = await ezSpawn.async(cmd, {
|
|
582
602
|
stdio: "overlapped",
|
|
@@ -584,7 +604,7 @@ async function resolveTarball(pm: PackMethod, p: string, pJson: PackageJson) {
|
|
|
584
604
|
});
|
|
585
605
|
const lines = stdout.split("\n").filter(Boolean);
|
|
586
606
|
|
|
587
|
-
if (pm !== "yarn") {
|
|
607
|
+
if (pm !== "yarn" && pm !== "bun") {
|
|
588
608
|
filename = lines[lines.length - 1].trim();
|
|
589
609
|
}
|
|
590
610
|
|