Catalog npm
Back to packageRELEASE DETAILS

0.4.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": "378129524190f46e5f6408586cd99d5336d511e1",
  "integrity": "sha512-0c2gOILf6nCZDBI2ztdoQdpctMyup2o8gc7cAY3REU2L1D59fis2BU5wr9aThbg9TsWz4jKQB7lFF/a8P8447g==",
  "tarball": "https://registry.npmjs.org/18xx-schemas/-/18xx-schemas-0.4.0.tgz",
  "fileCount": 14,
  "unpackedSize": 32530,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJerLYXCRA9TVsSAnZWagAAQbUQAIB+8z1YBcZEfPcoUIVR\nNDUh/7UTkXVlUS9qRww8oBQ6im7HVgMlmzy1XPW1aTNwLB5Sc0yygWpfsUmK\nbOMc7J4Cp6Qv67i9aaxfdCI/hmzg/WklB7RJkN2iEgpistC/G2XM0VSmFqKS\nAR40AhrrTapFmFTaTzscXTUivvyOT5sEuM53+9SDDDotCtMO1CDEi/eP2vuQ\nzaAgDBecF7KjOkwTojW+IbfYnk3UM0eB5Q2ZwQY2h23Dk7dvJWLe4WR6cJsp\n7c8x65gdUHq0lJMV7qgu0wlYwX8Wr5vvtHSEjMiPrTi0y2dp8y029R3iXhq2\nuJwCfRPtsXzl2FubuB/0jdsmv7N5Q1C02GivIXHjwQDfI03uB+ADfPjuhBH8\nG7Ph4LOBreyRRyj+dpn1qS13gs5oYxM2DAFbwzh01Fr3C8YAkCIBQcti+9dS\n0iJsCJPxPL08BkJUrC4oYgmS63CSLOUoIimCKkSzRfTlEftxoAOtTGDxYK1G\nbuhtjDq8zKKuZvaRgGR076wsMTUKvgZVSNIrbjsbhVlj5ztXvf7dDMADFTiW\nniN0mo2Oycwdu2KfG8hHM3ZZF910wkq8mgiSCWNMf0rQQP+attbVnzFX+1ub\npIhWKPPNgToR0lYMk+pi1q6yPG1JY/fcHkSIdmx62YjdR8LplpoKZpKSDCO9\nIryA\r\n=T/Ow\r\n-----END PGP SIGNATURE-----\r\n",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEUCIGXYXruckp9A4gCILrRJ+bTPhffW7yhTE85CWzrFRrdEAiEA2iVanFr6Bpv77K+quGNX4b4JXsrUS8BwazExPa8RbJg="
    }
  ]
}

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:c2cae946daa075971433db9d6e35b7f7ad5ae17e56c7e4d244c396ec8676e6f0

Other collected versions

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