mirror of
https://github.com/penpot/penpot.git
synced 2026-09-14 07:59:36 +00:00
Run `corepack use pnpm@next-12` (resolved to 12.3.4) on every directory with a package.json: the repo root, the 11 module workspaces, and all submodules. Every packageManager field now carries the same pinned version and hash; the root and backend move off 11.20.0. Fix the composable-test-suite workspace config (esbuild allowBuilds placeholder left by pnpm 12) so its install passes, and add the missing packageManager fields to frontend/packages/ui and mcp/packages/plugin, since corepack only updates existing fields. Document the canonical update procedure in .serena/memories/workflow/updating-pnpm.md. AI-assisted-by: omen-alpha
Penpot Library
A library that exposes a limited set of Penpot's features for programmatic use. Currently, it provides methods to build Penpot files in memory and export them as .penpot files (ZIP archives containing all the necessary data to import them into a Penpot application).
User Guide
How to install
pnpm add @penpot/library
Example of use
import * as penpot from "@penpot/library";
import { createWriteStream } from 'fs';
import { Writable } from "stream";
const context = penpot.createBuildContext();
context.addFile({name: "Test File 1"});
context.addPage({name: "Foo Page"});
context.addBoard({
name: "Foo Board",
x: 0,
y: 0,
width: 500,
height: 300,
});
context.closeBoard();
context.closeFile();
// Create a file stream to write the zip to
const output = createWriteStream('sample-stream.zip');
// Wrap Node's stream in a WHATWG WritableStream
const writable = Writable.toWeb(output);
await penpot.exportStream(context, writable);
Developer Guide
How to publish
Build the library:
./scripts/build
Login on npm:
npm login
Publish on npm:
npm publish --access public
License
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright (c) KALEIDOS INC Sucursal en España SL