npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@lottiefiles/lottie-types

v1.5.0

Published

Representation of the Lottie JSON Schema in Typescript

Downloads

962

Readme

lottie-types

Representation of the Lottie JSON Schema in Typescript.

The schema types have been built based on lottie-docs/schema and inspired by lottie-jsonschema with a few differences: firstly, some additional informative type comments have been added through testing the schema types with real Lottie data; secondly, the types constructed in a way to avoid duplications.

Instead of writing the schema types manually, generating it automatically was considered but wasn't successful, for reason that most of the tools such as quicktype, json-schema-to-typescript and transform don't work well with huge JSON-schema structures with many nested layers and don't support json-schema/draft/2020-12 features such as conditionals, prefixItems, and some def reference scenarios.

The schema definitions have been synced with https://github.com/marcusstenbeck/lottie-types as well.

Todo

  • test with many Lottie JSON files
  • open source it

Development

The following steps will get you setup to contribute changes to this repo:

  1. Fork this repo.

  2. Clone your forked repo: git clone https://github.com/LottieFiles/lottie-types

  3. Run yarn to install dependencies.

  4. Please sync any schema changes with lottie-docs

  5. You should follow our Commit-Message-Standardization

  6. You should add changesets running yarn changelog for any change to your codebase. You must ensure Changesets are included when making a Pull Request to merge to main branches. Please refer to our creating-changesets docs.

  7. Create a PR from feature-branch to main

  8. After merging to main the Github action will create another PR for only version bumping and changelog, which you have to merge manually.

  9. After the mannual merge the package will be released.

  10. Create a git tag manually and run git push --follow-tags to make it available in Github.

Comands

| Command | Description | | ---------------------- | ------------------------------------------------------------------ | | yarn clean | Deletes index.d.ts file | | yarn test | Run tests (wip) | | yarn format:prettier | Format the code using prettier | | yarn build | Bundles all declaration type files into a single file index.d.ts | | yarn changelog | Add a changeset changelog entry | | yarn changelog:check | Check pending changesets | | yarn release:version | Update all the workspace projects versions using changesets | | yarn release:publish | Publish the packages to the package repository |

Tests

There was an attempt to create run-time validations for testing many real Lottie file examples, so we could prove the structure of this Lottie schema types, but it wasn't successful because the Lottie format is huge and has recursive types which leads the tools to hiccup and reach the TSError 7056 or don't work at all. The libraries I've tested so far live in these branches:

  • mf/zod (doesn't throw TSError 7056 while using Zod Type Inference, but still, Layer and Asset validation parsers don't work)
  • mf/zod-schema (throws TSError 7056)
  • mf/superstruct (throws TSError 7056)
  • mf/ajv (works but wasn't fully tested because it has been built mainly around JSON schema and doesn't provide full error information)

Thus, we are considering building an Abstract Syntax Tree :)

Documentation

License

  • once the schema is completed we are planning to open source it to https://github.com/DefinitelyTyped/DefinitelyTyped/

MIT © LottieFiles