diff --git a/README.md b/README.md index dd1457d7..0dc376ca 100644 --- a/README.md +++ b/README.md @@ -103,20 +103,20 @@ pnpm exec pkg-pr-new publish './artifacts/*.tgz' Quick reference: -| Flag | Description | -| --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | -| `--comment=update\|create\|off` | How PR comments are posted (default: `update`) | -| `--commentWithSha` | Use commit SHA URLs instead of PR number URLs in comments | -| `--commentWithDev` | Add the `-D` flag to install commands in comments | -| `--packageManager=npm\|pnpm\|yarn\|bun` | Package manager(s) shown in comments; accepts comma-separated values | -| `--only-templates` | Show only templates in comments | -| `--template './examples/*'` | Generate StackBlitz templates for the given directories (experimental) | -| `--no-template` | Disable the default template | -| `--no-compact` | Force long-form URLs instead of compact URLs | -| `--bin` | Show `npx` instead of `npm i` in comments | -| `--previewVersion` | Rewrite package versions to `0.0.0-preview-` before packing | -| `--pnpm` / `--yarn` / `--bun` | Use `pnpm pack`, `yarn pack`, or `bun pm pack` instead of `npm pack` | -| `--json ` | Write publish metadata to a JSON file (see [Custom GitHub Messages and Comments](#custom-github-messages-and-comments)) | +| Flag | Description | +| ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `--comment=update\|create\|off` | How PR comments are posted (default: `update`) | +| `--commentWithSha` | Use commit SHA URLs instead of PR number URLs in comments | +| `--commentWithDev` | Add the `-D` flag to install commands in comments | +| `--packageManager=npm\|pnpm\|yarn\|bun\|upm\|nub` | Package manager(s) shown in comments; accepts comma-separated values | +| `--only-templates` | Show only templates in comments | +| `--template './examples/*'` | Generate StackBlitz templates for the given directories (experimental) | +| `--no-template` | Disable the default template | +| `--no-compact` | Force long-form URLs instead of compact URLs | +| `--bin` | Show `npx` instead of `npm i` in comments | +| `--previewVersion` | Rewrite package versions to `0.0.0-preview-` before packing | +| `--pnpm` / `--yarn` / `--bun` | Use `pnpm pack`, `yarn pack`, or `bun pm pack` instead of `npm pack` | +| `--json ` | Write publish metadata to a JSON file (see [Custom GitHub Messages and Comments](#custom-github-messages-and-comments)) | #### Comment Options @@ -180,7 +180,7 @@ npm i https://pkg.pr.new/tinybench@123 **`--packageManager`** -To customize which package manager is reflected in the comments, use the `--packageManager=XYZ` flag. XYZ can be one of the following: npm (default), pnpm, yarn, or bun. Multiple valid values can also be configured at the same time, such as `--packageManager=ABC,XYZ`. +To customize which package manager is reflected in the comments, use the `--packageManager=XYZ` flag. XYZ can be one of the following: npm (default), pnpm, yarn, bun, upm, or nub. Multiple valid values can also be configured at the same time, such as `--packageManager=ABC,XYZ`. **`--only-templates`** diff --git a/packages/app/server/utils/markdown.ts b/packages/app/server/utils/markdown.ts index bc803e95..9753b8e4 100644 --- a/packages/app/server/utils/markdown.ts +++ b/packages/app/server/utils/markdown.ts @@ -7,6 +7,8 @@ const installCommands: Record = { pnpm: "pnpm add", yarn: "yarn add", bun: "bun add", + upm: "upm add", + nub: "nub add", }; const binCommands: Record = { @@ -14,6 +16,8 @@ const binCommands: Record = { pnpm: "pnpm dlx", yarn: "npx", bun: "bunx", + upm: "upx", + nub: "nubx", }; const isMoreThanFourPackages = ( packages: string[], diff --git a/packages/cli/index.ts b/packages/cli/index.ts index b06c3a83..7708bbfc 100644 --- a/packages/cli/index.ts +++ b/packages/cli/index.ts @@ -7,7 +7,7 @@ import { hash } from "ohash"; import ezSpawn from "@jsdevtools/ez-spawn"; import { defineCommand, runMain } from "citty"; import { getPackageManifest, type PackageManifest } from "query-registry"; -import type { Comment } from "@pkg-pr-new/utils"; +import type { Comment, PackageManager } from "@pkg-pr-new/utils"; import { abbreviateCommitHash, extractOwnerAndRepo, @@ -113,8 +113,8 @@ const main = defineCommand({ packageManager: { type: "string", description: - "Specify the package manager to use (npm, bun, pnpm, yarn). Comma-separated values are supported.", - enum: ["npm", "bun", "pnpm", "yarn"], + "Specify the package manager to use (npm, bun, pnpm, yarn, upm, nub). Comma-separated values are supported.", + enum: ["npm", "bun", "pnpm", "yarn", "upm", "nub"], default: "npm", }, bin: { @@ -219,23 +219,28 @@ const main = defineCommand({ ...new Set( (args.packageManager as string) .split(",") - .filter((s) => s.trim()) as Array< - "npm" | "bun" | "pnpm" | "yarn" - >, + .filter((s) => s.trim()) as PackageManager[], ), ]; - const packageManagers = ["npm", "bun", "pnpm", "yarn"]; + const packageManagers: PackageManager[] = [ + "npm", + "bun", + "pnpm", + "yarn", + "upm", + "nub", + ]; if (!selectedPackageManager.length) { console.error( - `Unsupported package manager: ${args.packageManager}. Supported managers are npm, bun, pnpm, yarn.`, + `Unsupported package manager: ${args.packageManager}. Supported managers are npm, bun, pnpm, yarn, upm, nub.`, ); process.exit(1); } for (let i = 0; i < selectedPackageManager.length; i++) { if (!packageManagers.includes(selectedPackageManager[i])) { console.error( - `Unsupported package manager: ${selectedPackageManager[i]}. Supported managers are npm, bun, pnpm, yarn.`, + `Unsupported package manager: ${selectedPackageManager[i]}. Supported managers are npm, bun, pnpm, yarn, upm, nub.`, ); process.exit(1); } diff --git a/packages/cli/template.ts b/packages/cli/template.ts index 2cd30ebf..b5237710 100644 --- a/packages/cli/template.ts +++ b/packages/cli/template.ts @@ -1,9 +1,10 @@ +import type { PackageManager } from "@pkg-pr-new/utils"; import { installCommands } from "@pkg-pr-new/utils"; function generateShellCommand( url: string, isCommentWithDev: boolean, - selectedPackageManager: ("npm" | "yarn" | "pnpm" | "bun")[], + selectedPackageManager: PackageManager[], ) { return selectedPackageManager .map( @@ -16,7 +17,7 @@ function generateShellCommand( export const createDefaultTemplate = ( dependencies: Record, isCommentWithDev: boolean, - selectedPackageManager: ("npm" | "yarn" | "pnpm" | "bun")[], + selectedPackageManager: PackageManager[], ) => ({ "index.js": "", "README.md": ` diff --git a/packages/utils/index.ts b/packages/utils/index.ts index 833eb4c4..f453bbf4 100644 --- a/packages/utils/index.ts +++ b/packages/utils/index.ts @@ -52,13 +52,15 @@ export function isPullRequest(ref: string) { } export type Comment = "off" | "create" | "update"; -export type PackageManager = "npm" | "pnpm" | "yarn" | "bun"; +export type PackageManager = "npm" | "pnpm" | "yarn" | "bun" | "upm" | "nub"; export const installCommands: Record = { npm: "npm i", pnpm: "pnpm add", yarn: "yarn add", bun: "bun add", + upm: "upm add", + nub: "nub add", }; const whitelist =