Share plugin scaffold shell quoting helper

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-05-12 12:16:51 -05:00
1 parent 9a2379eedd
commit 88696ded9a
3 files changed
+11 -9

No files matched your search

+9 -3
View File
@@ -8,9 +8,15 @@ const mocks = vi.hoisted(() => ({
scaffoldPluginProject: vi.fn((options: { outputDir: string }) => options.outputDir),
}));
vi.mock("@paperclipai/create-paperclip-plugin", () => ({
scaffoldPluginProject: mocks.scaffoldPluginProject,
}));
vi.mock("@paperclipai/create-paperclip-plugin", async () => {
const actual = await vi.importActual<typeof import("@paperclipai/create-paperclip-plugin")>(
"@paperclipai/create-paperclip-plugin",
);
return {
...actual,
scaffoldPluginProject: mocks.scaffoldPluginProject,
};
});
import {
buildPluginInstallRequest,
+1 -5
View File
@@ -3,6 +3,7 @@ import { existsSync } from "node:fs";
import { Command, Option } from "commander";
import {
scaffoldPluginProject,
shellQuote,
type ScaffoldPluginOptions,
} from "@paperclipai/create-paperclip-plugin";
import pc from "picocolors";
@@ -169,11 +170,6 @@ function packageToDirName(pluginName: string): string {
return pluginName.replace(/^@[^/]+\//, "");
}
function shellQuote(value: string): string {
if (/^[A-Za-z0-9_/:=.,@%+-]+$/.test(value)) return value;
return `'${value.replace(/'/g, "'\"'\"'")}'`;
}
export function buildPluginInitScaffoldOptions(
packageName: string,
opts: PluginInitOptions,
@@ -62,7 +62,7 @@ function toPosixPath(value: string): string {
return value.split(path.sep).join("/");
}
function shellQuote(value: string): string {
export function shellQuote(value: string): string {
if (/^[A-Za-z0-9_/:=.,@%+-]+$/.test(value)) return value;
return `'${value.replace(/'/g, "'\"'\"'")}'`;
}