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

package.json-schema

v0.2.0

Published

JSON Schema for node/npm package.json

Downloads

151

Readme

package.json-schema

Build Status NPM version

JSON Schema for node/npm package.json

There are a few sub-schemas defined at the following JSON Pointers:

| uri | description | :-- | :-- | lib://package.json#/definitions/structure | describes the structure but specifies no required fields. | lib://package.json#/definitions/minimal | require minimum fields (name, version etc) for node + npm. | lib://package.json#/definitions/standard | common fields, recommended for FOSS.

The root schema linked to lib://package.json#/definitions/standard.

The JSON Schema is draft v4.

Usage

The schema are JSON files are located in the /v# folders in the repo.

npm

Most convenient way is to access is as a module:

$ npm install package.json-schema

Get the schema object (lazy)

var schema = require('package.json-schema').get();

Use the schema in any standard compliant JSON Schema validator, for example using tv4:

var res = tv4.validateResult(myObject, schema);
if (!res.valid) {
	// nooo..

If a projects uses grunt it could run grunt-tv4 in the test suite, a git hook or npm prepublish script:

grunt.initConfig({
    tv4: {
        packjson: {
            options: {
                root: function() {
				    // lazy load when task is actually run
    				return require('package.json-schema').get();
	    		}
            }
            src: ['./package.json']
        }
    }
})

local

Copy the JSON files from the repo and save in your project.

remote

Ideally I'd put the JSON Schema on their own domain and use valid URIs and $ref-erences. But it could be bigger and add other schemas, extract the common types and setup a library of interdependent definitions.. maybe one day.

Contributing

This is an ongoing project and contributions are very welcome. Especially fixes to tighten the schema and of course all interesting test cases.

Note combining values into micro-encoding strings is discouraged (because it makes it necessary complicated for tools to parse).

Also I'm game if anyone wants to cooperate on other similar schema's (bower etc), and maybe setup a github organisation which could also serve the http uris on github.io.

License

Copyright (c) 2013 by Bart van der Schoor.

Licensed under the [MIT License](https://raw.github.com/Bartvds/package.json-schema /master/LICENSE-MIT.txt).

Bitdeli Badge