penpot/library
Andrey Antukh e7029f2182 Make automatic workflows not dependent on yarn 2025-12-01 08:17:52 +01:00
..
.yarn/patches ♻️ Move library to its own directory 2025-05-20 13:05:52 +02:00
docs 📚 Add variants doc for SDK (#7351) 2025-09-21 22:15:27 +02:00
playground 🎉 Bump 1.0.7 release of the penpot library 2025-07-04 11:02:36 +02:00
scripts Make automatic workflows not dependent on yarn 2025-12-01 08:17:52 +01:00
src/lib 🎉 Add addTokensLib method to the library 2025-11-14 11:15:26 +01:00
test 🐛 Fix validation issues with dtcg-node schema 2025-11-14 11:15:26 +01:00
CHANGES.md 📎 Set version 1.1.0 final to sdk/library 2025-11-19 13:04:29 +01:00
README.md ⬆️ Update yarn requirement on library module 2025-11-14 11:15:26 +01:00
deps.edn ⬆️ Update shadow-cljs dependency on sdk 2025-10-06 11:53:50 +02:00
package.json 🔧 Add general improvements to integration tests 2025-11-19 18:23:44 +01:00
shadow-cljs.edn Prepare library to be published on npm 2025-05-27 10:55:49 +02:00
yarn.lock ⬆️ Update npm deps on library 2025-11-14 11:15:26 +01:00

README.md

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:

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