pkg-pr-new 0.0.40 → 0.0.42

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.
Files changed (3) hide show
  1. package/dist/index.js +12 -5
  2. package/index.ts +11 -4
  3. package/package.json +1 -1
package/index.ts CHANGED
@@ -95,6 +95,11 @@ const main = defineCommand({
95
95
  enum: ["npm", "bun", "pnpm", "yarn"],
96
96
  default: "npm",
97
97
  },
98
+ bin: {
99
+ type: "boolean",
100
+ description:
101
+ "Set to true if your package is a binary application and you would like to show an execute command instead of an install command.",
102
+ },
98
103
  },
99
104
  run: async ({ args }) => {
100
105
  const paths =
@@ -125,7 +130,7 @@ const main = defineCommand({
125
130
 
126
131
  const isPeerDepsEnabled = !!args.peerDeps;
127
132
  const isOnlyTemplates = !!args["only-templates"];
128
-
133
+ const isBinaryApplication = !!args.bin;
129
134
  const comment: Comment = args.comment as Comment;
130
135
  const selectedPackageManager = args.packageManager as
131
136
  | "npm"
@@ -216,8 +221,9 @@ const main = defineCommand({
216
221
  await verifyCompactMode(pJson.name);
217
222
  }
218
223
 
224
+ const formattedSha = isCompact ? abbreviateCommitHash(sha) : sha;
219
225
  const depUrl = new URL(
220
- `/${owner}/${repo}/${pJson.name}@${sha}`,
226
+ `/${owner}/${repo}/${pJson.name}@${formattedSha}`,
221
227
  apiUrl,
222
228
  ).href;
223
229
  deps.set(pJson.name, depUrl);
@@ -226,7 +232,7 @@ const main = defineCommand({
226
232
  const resource = await fetch(depUrl);
227
233
  if (resource.ok) {
228
234
  console.warn(
229
- `${pJson.name}@${abbreviateCommitHash(sha)} was already published on ${depUrl}`,
235
+ `${pJson.name}@${formattedSha} was already published on ${depUrl}`,
230
236
  );
231
237
  }
232
238
 
@@ -309,7 +315,7 @@ const main = defineCommand({
309
315
 
310
316
  const noDefaultTemplate = args.template === false;
311
317
 
312
- if (!noDefaultTemplate) {
318
+ if (!noDefaultTemplate && templates.length === 0) {
313
319
  const project = createDefaultTemplate(
314
320
  Object.fromEntries(deps.entries()),
315
321
  );
@@ -485,6 +491,7 @@ const main = defineCommand({
485
491
  "sb-key": key,
486
492
  "sb-shasums": JSON.stringify(shasums),
487
493
  "sb-run-id": GITHUB_RUN_ID,
494
+ "sb-bin": `${isBinaryApplication}`,
488
495
  "sb-package-manager": selectedPackageManager,
489
496
  "sb-only-templates": `${isOnlyTemplates}`,
490
497
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pkg-pr-new",
3
- "version": "0.0.40",
3
+ "version": "0.0.42",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",