mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-23 00:53:38 +02:00
Accept an isolated public plugin install in release fixtures
Match the product plugin installer dependency isolation and validate compiled public package metadata before installing it through the API. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
b080895310
commit
327f6df095
3 files changed
+6
-3
No files matched your search
@@ -27,6 +27,8 @@ describe("ordinary installed release smoke", () => {
|
||||
for (const file of ["manifest.js", "worker.js"]) writeFileSync(path.join(plugin, "dist", file), "");
|
||||
writeFileSync(path.join(plugin, "package.json"), JSON.stringify(manifest));
|
||||
expect(installedReleaseDaytonaPlugin(cli)).toBe(plugin);
|
||||
expect(installedReleaseDaytonaPlugin(cli, plugin)).toBe(plugin);
|
||||
expect(() => installedReleaseDaytonaPlugin(cli, "relative/plugin")).toThrow("absolute");
|
||||
writeFileSync(path.join(plugin, "package.json"), JSON.stringify({ ...manifest, exports: { ".": "./src/index.ts" } }));
|
||||
expect(() => installedReleaseDaytonaPlugin(cli)).toThrow("public compiled Daytona");
|
||||
writeFileSync(path.join(plugin, "package.json"), JSON.stringify(manifest));
|
||||
|
||||
@@ -15,9 +15,10 @@ export function installedReleaseLaunch(cliPath: string) {
|
||||
}
|
||||
|
||||
/** Install the public plugin from the same consumer, without a workspace loader. */
|
||||
export function installedReleaseDaytonaPlugin(cliPath: string): string {
|
||||
export function installedReleaseDaytonaPlugin(cliPath: string, installedPluginPath?: string): string {
|
||||
const cli = installedReleaseLaunch(cliPath);
|
||||
const plugin = realpathSync(path.join(path.dirname(cli.cwd), "@paperclipai/plugin-daytona"));
|
||||
if (installedPluginPath && !path.isAbsolute(installedPluginPath)) throw new Error("Installed Daytona plugin path must be absolute");
|
||||
const plugin = realpathSync(installedPluginPath ?? path.join(path.dirname(cli.cwd), "@paperclipai/plugin-daytona"));
|
||||
const manifest = JSON.parse(readFileSync(path.join(plugin, "package.json"), "utf8"));
|
||||
if (manifest.name !== "@paperclipai/plugin-daytona" ||
|
||||
manifest.paperclipPlugin?.manifest !== "./dist/manifest.js" ||
|
||||
|
||||
@@ -117,7 +117,7 @@ export async function setupLiveFixtures(input: {
|
||||
async setup() {
|
||||
return api.post<PluginRecord>("/api/plugins/install", {
|
||||
packageName: process.env.PAPERCLIP_RUNNER_E2E_INSTALLED_CLI
|
||||
? installedReleaseDaytonaPlugin(process.env.PAPERCLIP_RUNNER_E2E_INSTALLED_CLI)
|
||||
? installedReleaseDaytonaPlugin(process.env.PAPERCLIP_RUNNER_E2E_INSTALLED_CLI, process.env.PAPERCLIP_RUNNER_E2E_INSTALLED_DAYTONA_PLUGIN)
|
||||
: path.resolve(
|
||||
import.meta.dirname,
|
||||
"../../packages/plugins/sandbox-providers/daytona",
|
||||
|
||||
Reference in new issue
Block a user