Giter Site home page Giter Site logo

typst-community / typst.js Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 1.0 129 KB

๐Ÿ“ฆ Typst for JavaScript

Home Page: https://typst.community/typst.js

License: Apache License 2.0

JavaScript 25.51% TypeScript 62.75% Shell 11.74%
cli cli-wrapper javascript latex markdown nodejs tex typst

typst.js's People

Contributors

dependabot[bot] avatar jcbhmr avatar sweep-ai[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jcbhmr

typst.js's Issues

Versioning scheme convention

Right now I'm trying to match versions with the latest Typst version (currently 0.10.0 -- current npm package is [email protected])
https://github.com/typst/typst/releases
https://www.npmjs.com/package/typst?activeTab=versions

note that there's a X.Y.Z-N where N goes up. idk if that's the "right" way to do it or not? are there other projects that do it better/differently? is there a convention to this? basically I want a four-part semver specific not a three part specifier lol.

Sidenote: should the first 0.11.0 release be [email protected] or [email protected] or [email protected] ?

Enable GitHub Pages

@huwaireb can you enable GitHub Pages on this repository and set it to publish from the GitHub Actions source? I dont have permissions to do that. Thx! ๐Ÿ™

The future of this project

Hello again ๐Ÿ‘‹,

I'm curious in regards to your plans for typst.js @jcbhmr. From my understanding, currently it's only a wrapper around the typst binary distributed in npm. Are there any plans to go any further for e.g JS bindings? Like what is done by the typst.ts project. Or do your goals end here?

GitHub Pages improperly configured

@huwaireb Instead of using typst-community.github.io CNAME'ed to typst.community so that typst.community/typst.js/ points to https://github.com/typst-community/typst.js, typst.community is CNAME-linked to https://github.com/typst-community/typst.community only lol

Make this work just like jcbhmr.me does with https://jcbhmr.me/ghmd.css/ <=> https://github.com/jcbhmr/ghmd.css pls thx ๐Ÿ™

site is live https://typst-community.github.io/typst.js/
but not https://typst.community/typst.js/

use optionalDependencies instead of postinstall script

old title: publish npm package with binaries embedded in it instead of using postinstall script

basically:

.
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ main.ts
โ”œโ”€โ”€ dist/
โ”‚   โ”œโ”€โ”€ main.js
โ”‚   โ””โ”€โ”€ main.d.ts
โ”œโ”€โ”€ bin/
โ”‚   โ”œโ”€โ”€ typst.win32-x64.exe
โ”‚   โ”œโ”€โ”€ typst.darwin-x64
โ”‚   โ”œโ”€โ”€ typst.darwin-arm64
โ”‚   โ”œโ”€โ”€ typst.linux-x64
โ”‚   โ””โ”€โ”€ typst.linux-arm64
โ””โ”€โ”€ package.json

then main.ts/js would run: typst.${process.platform}-${process.arch} exe instead of downloading it and then running it. basically skip the download step.

why this might be good:

  • no lag for 5s while postinstall or main ensureInstalled() downloads and extracts the binary
  • could work better offline?

the main win is startup/install time. that's it. HOWEVER this would add considerable size to the published npm package...

28M     typst-aarch64-apple-darwin/typst
28M     typst-aarch64-unknown-linux-musl/typst
29M     typst-armv7-unknown-linux-musleabi/typst
30M     typst-x86_64-apple-darwin/typst
32M     typst-x86_64-pc-windows-msvc/typst.exe
32M     typst-x86_64-unknown-linux-musl/typst

total ~178M ish

alternative:

do what https://napi.rs/ does by default and splinter off things into optionalDependencies that only work on a single OS/CPU combo: https://napi.rs/docs/deep-dive/release#3-the-native-addon-for-different-platforms-is-distributed-through-different-npm-packages

ex:

// for Windows Intel/AMD x86-64
{
  "name": "@node-rs/bcrypt-win32-x64",
  "version": "0.5.0",
  "os": ["win32"],
  "cpu": ["x64"]
}
// for macOS ARM64
{
  "name": "@node-rs/bcrypt-darwin-arm64",
  "version": "0.5.0",
  "os": ["darwin"],
  "cpu": ["arm64"]
}

there appears to be a project that is designed to tackle this issue actually and it uses this second approach!

https://github.com/christophwitzko/npm-binary-releaser
image


after writing all that text and seeing how large the binaries are when spread across 6x architectures (almost 200mb! when a single platform is only 30mb!) i think the best way to avoid postinstall and speed up install is to use npm-binary-releaser or similar

Improve readme

This project should lean on "check out the official typst cli readme" but should also provide info on the JS-api and install instructions to use npm install typst --save-dev or npm install typst --global or whatever

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.