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

@lxcat/schema

v0.1.0

Published

Schema and validator for LXCat

Downloads

2

Readme

@lxcat/schema

Package with JSON schemas, validator and Typescript types of LXCat documents.

LXCat is an open-access website for collecting, displaying, and downloading electron and ion scattering cross sections for modeling low temperature plasmas.

The validation is multi-step, first the input is checked against a JSON schema and then the quantum numbers of the members of the input reactions are checked.

Installation

npm install @lxcat/schema

Usage

To get Typescript type for a LXCat Cross Section Set

import type { CrossSectionSetRaw } from '@lxcat/schema/dist/css/input

To get JSON schema for a LXCat Cross Section Set

import schema from "@lxcat/schema/dist/css/CrossSectionSetRaw.schema.json";

(your tsconfig should be confgured for JSON imports)

To validate a LXCat Cross Section Set document

import { Validator } from '@lxcat/schema/dist/css/validate'

const validator = new Validator()

// Some JSON document to validate
const doc = ...

if (validator.validate(doc)) {
    // is valid
    // doc is now of type CrossSectionSetRaw which can be imported with
} else {
    console.log(validator.errors)
    // List of validation errors in format of https://ajv.js.org/api.html#validation-errors
}

Contributing

Install dependencies

cd ../..
npm run install -w packages/schema
cd packages/schema

Generate JSON schemas

The JSON schemas (src/**/*.schema.json files) can be generated with

npm run json

Whenever the types from which the schemas are derived are changed then this command should be run.

Tests

See code contributor doc.

API documentation

API documentation can be generated using typedoc with

npx typedoc --entryPointStrategy expand src

A docs/index.html should have been written.

Publishing

To publish @lxcat/schema to npmjs.com perform the following steps:

  1. Set version in packages/schema/package.json with npm workspace @lxcat/schema version <patch|minor|major>
  2. Commit and push changes to main branch
  3. Change to packages/schema/ directory
  4. Make sure you are logged in on npm by checking with npm whoami --scope lxcat and optionally login in with npm login --scope lxcat --publish
  5. Make sure npm run dev is not running
  6. Clean dist/ with npm run clean
  7. Publish with npm publish --otp <otp code>
  8. Create git tag for version with git tag @lxcat/schema@<value at packages/schema/package.json:version> and git push origin --tags