Catalog npm
Back to packageRELEASE DETAILS

0.2.0

npm

18xx-schemas

Schema files for 18xx-maker game and tile files

Published1 May 2020
Direct dependencies8
Transitive dependenciesNot calculated

README

Current package documentation

18xx-schemas

This repository contains the game and tile schemas that 18xx-maker uses for it's game files.

CLI Usage

Install this package gives you a 18xx-schemas binary that takes in any number of globs and validates each file it can find. If a file doesn't exist it just ignores it. It then pretty prints the validation output using ansi colors on the terminal.

# Validate some files
18xx-schemas games/*.json tiles/**/*.json config.json

# Display all options
18xx-schemas -h

# Output version
18xx-schemas -v

Be warned that if you pass a json that doesn't conform to any of the 18xx-maker json schemas it will be validated against the tiles schema.

Programatic Usage

You can use this package in your javascript to validate game files using two functions:

const validate = require("18xx-schemas");

// If you have some json you can validate it directly:
const json = require("18Awesome.json");
let result = validate(json);

// If you want to include data in the result you can optionally pass the file used:
result = validate(json, "18Awesome.json");

// Or you can use a helper which will load the json from a file:
result = validate.file("18Awesome.json");

// In either case you get a result object that looks like:
// {
//   valid: true if validation succeeded (boolean)
//   id: the schema id of the schema used to validate this file (string)
//   file: the filename of the file loaded (not available on validate unless you pass it in) (string)
//   error: error message if we had trouble reading the passed in file (only on validate.file) (string)
//   validationErrors: error object from ajv which has all validation errors in it (object)
// }

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 8

Native requirements
8 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
ajv
Environment
{
  "local_name": "ajv",
  "alias": false,
  "peer_metadata": null
}
^6.12.2runtime
chalk
Environment
{
  "local_name": "chalk",
  "alias": false,
  "peer_metadata": null
}
^4.0.0runtime
commander
Environment
{
  "local_name": "commander",
  "alias": false,
  "peer_metadata": null
}
^5.1.0runtime
glob
Environment
{
  "local_name": "glob",
  "alias": false,
  "peer_metadata": null
}
^7.1.6runtime
ajv-cli
Environment
{
  "local_name": "ajv-cli",
  "alias": false,
  "peer_metadata": null
}
^3.1.0development
husky
Environment
{
  "local_name": "husky",
  "alias": false,
  "peer_metadata": null
}
>=4development
lint-staged
Environment
{
  "local_name": "lint-staged",
  "alias": false,
  "peer_metadata": null
}
>=10development
prettier
Environment
{
  "local_name": "prettier",
  "alias": false,
  "peer_metadata": null
}
^2.0.5development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "1cb593d908cf6a2dcc1104df30c090759555f937",
  "integrity": "sha512-mc6y1Yh/0mvq5SVN/bVboEOFqL2K/B8kmO4KNZEu8+YfTWcdyDB2H54pgMwiNbzWI7EQAQdYW0yXU7bXHe0zKA==",
  "tarball": "https://registry.npmjs.org/18xx-schemas/-/18xx-schemas-0.2.0.tgz",
  "fileCount": 11,
  "unpackedSize": 18203,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeq9WFCRA9TVsSAnZWagAAUFAQAIc21/7rZj4LrOKaKB6o\ns2MXqTavg9VgD7pztFy0yqVZ/LSZayPE7F4fcKkriFz2PLD5UWRRmOKRd4Jq\n7x+X4L3GLnBF4F8Cp9I2f3w/wmyUzYaoK4t1TDvMzDSgaxsWo5eJCNGov1k0\nrlKrqnhTu5WxDJxhg31zeNbN23aL/nYPJfs3wlmU1LIzHk/2QAHWQEEudTO7\nxeUakptHoQmgwROEfP38sya0LBD45+QkvrvJzo2e4zNLde+dfUmfF/1W68VM\n+TCveU3NktXbAt9K6HKlAkNGwswp+b6ehALkADCHb9KSliKJfiphuTqt8A4M\noMhqS6O0l2gJqjn2B2Mxs/tpaJVarOFZ2maPo25CTOy6CxGHpIuXdTzeEtpT\nQoERFjCMdUDmsd+E/zVUllufnGOwTLt80lPH+8F7WuLt/QvOatXne/mTHbev\n7bSSS79EC/cGzYSV6Wwceh9Fq0hUNWNS8s4V9T1fs5+jvTdAyjPsyl1Mpw27\no1ABVb7EJByyZDZn14TOxyLxH/aNyg8riM5nD+sQCKNVAWQ+GzRZuquxETmR\nRXWPteZjRfAbprtd8101bHOvfN6tXi3l0ZxH8J9rRO7dNMxtqpwQ7k0ZiLK7\n0Hf3To60DI57Wivw4iKGrBqHtwNFJxaLJNq9NhTwUTPPG8Xk849H2POm2OVX\ncOP2\r\n=SZVs\r\n-----END PGP SIGNATURE-----\r\n",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEQCIAfA3jAZJamMUq2u7atsdRx8myy5dLEMmaSRdOyBk/e4AiB2irthKh5lrFCW4XZqTv03P3oIWgsz+Nr7bDeQ/axZoA=="
    }
  ]
}

Repository

PENDING
18xx-maker/18xx-schemas

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 18:22 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:484c95edbb3ac4d7817809d7555e061d6d2653add87dd2c96cfc0fc8fb1a23ca

Other collected versions

0.4.12 May0.4.01 May0.3.01 May0.1.01 May0.0.11 MayView all collected versions →