penpot/library
Andrey Antukh 283eb0419c ♻️ Refactor time related namespaces
Mainly removes the custom app.util.time namespace
from frontend and backend and normalize all to use
the app.common.time namespace
2025-08-01 11:20:01 +02:00
..
.yarn/patches
playground 🎉 Bump 1.0.7 release of the penpot library 2025-07-04 11:02:36 +02:00
scripts Add correct library version on the metadata 2025-06-01 11:28:42 +02:00
src/lib 🎉 Add options for creating library build context 2025-07-04 11:02:36 +02:00
test 🐛 Fix incorrect decoding of library color 2025-06-06 14:03:52 +02:00
CHANGES.md 🎉 Bump 1.0.7 release of the penpot library 2025-07-04 11:02:36 +02:00
deps.edn 🎉 Bump 1.0.7 release of the penpot library 2025-07-04 11:02:36 +02:00
package.json ♻️ Refactor time related namespaces 2025-08-01 11:20:01 +02:00
README.md Add correct library version on the metadata 2025-06-01 11:28:42 +02:00
shadow-cljs.edn
yarn.lock ♻️ Refactor time related namespaces 2025-08-01 11:20:01 +02:00

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

yarn 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:

yarn npm login

Publish on npm:

yarn 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