Skip to content
logiskyPublic

About

Official LogiSheets crafts registry

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

LogiSheets crafts

The craft registry for LogiSheets. Every craft's source lives here; CI builds it, packs it into a .craft package, and publishes it to GitHub Pages:

https://logisky.github.io/crafts/index.json
https://logisky.github.io/crafts/packages/<craftId>/<craftId>-<version>.craft

The LogiSheets app installs these at runtime, from that index: each distribution installs its picks on first start, and the craft panel's Browse tab offers the rest and their updates. Nothing here is bundled into the app.

How to write a craft: writing-a-craft.md.

Layout

packages/<craft>/        one craft per directory (package.json, index.html, tools.ts, src/)
packages/<name>-core/    shared code a craft imports by relative path; not a craft itself
scripts/registry.mjs     pack / verify / publish
.github/workflows/       check.yml (every PR), publish.yml (main)

A directory is a craft if it has an index.html or a tools.ts.

Develop

yarn install
yarn check            # craftsmith check, every craft
yarn test             # unit tests (four-elements runs against the real engine from npm)
yarn build            # vite build + craftsmith build, every craft
yarn registry pack    # → out/<id>-<version>.craft

To try your build in a LogiSheets dev server (checkout assumed at ../LogiSheets), point the app at a local copy of the site:

mkdir -p site && yarn registry publish site
cp -R site ../LogiSheets/public/registry-test
# then in the app's devtools console:
#   localStorage.setItem('logisheets.craftRegistry', 'http://localhost:4200/registry-test')

Browse then lists your build. Or install a package by hand from the craft panel (gear button, Manage crafts → Install from file…).

Publishing rules

  • Source only. Contributions are source; CI builds the package. A .craft is never accepted in a PR, so what is published is what was reviewed.
  • Versions are immutable. craftsmith pack is deterministic, so an unchanged craft packs to the same sha256 and is skipped. Change anything that ends up in the package and you must bump version in its package.json — the PR check fails otherwise, and so would publishing.
  • craftId is forever. It is how the app keys a craft's saved state and block ownership. Kebab-case, at most 32 characters.
  • label may be one string or {"en": …, "zh-CN": …}.
  • "craftUnlisted": true publishes a craft but keeps it out of the app's Browse list outside dev builds (the debugger uses it).
  • Need a newer host API than 1? Set "craftHostApi" in package.json; older apps then refuse the package instead of running it broken.
  • "craftRequires": ["dataConnections"] names host capabilities the craft cannot run without. Say what you NEED, not where you run: a host that lacks one shows the craft as unavailable and refuses to install it, and the craft starts working there the day that host gains it. Still check for the API at runtime (window.dataConnections): a workbook can carry your saved state to a host where you are not installed.

The index

index.json is generated by yarn registry publish — never edit it.

{
  "schemaVersion": 1,
  "crafts": [{
    "craftId": "sudoku",
    "label": "Sudoku",
    "labels": {"en": "Sudoku", "zh-CN": "数独"},
    "description": "…",
    "publisher": "…",          // free text, not verified
    "hasUi": true,
    "unlisted": true,          // only when the package sets craftUnlisted
    "tools": ["new_sudoku", …], // AI tools the craft gives Watson
    "latest": "0.1.0",
    "versions": [{
      "version": "0.1.0",
      "hostApi": 1,
      "requires": ["dataConnections"], // only when the package sets craftRequires
      "url": "packages/sudoku/sudoku-0.1.0.craft",   // relative to index.json
      "sha256": "…",           // the app checks every download against this
      "size": 14042,
      "publishedAt": "…"
    }]
  }]
}

How publishing works

publish.yml runs on every push to main: build, pack, check out the gh-pages branch, copy in the versions it does not have yet, rewrite index.json, push. gh-pages only ever grows, so every published version stays downloadable. GitHub Pages serves that branch (Settings → Pages → Deploy from a branch → gh-pages, /).

About

Official LogiSheets crafts registry

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages