jetpack-validation

Validate a directory with a manifest for Firefox Addons using Jetpack and jpm

jetpack-validation

Validate a directory with a manifest for Firefox Add-ons using the Jetpack/Add-on SDKand jpm.

Install

npm install jetpack-validate --save

Usage

The main export takes a path to a directory and returns an object containing properties that have error messages as values. Some should be showstoppers (invalid ID) and some should just be used as warnings (invalid semver version, only for use with npm).

var validate = require("jetpack-validation");

var errors = validate("/path/to/my/addon");

if (Object.keys(errors).length) {
  Object.keys(errors).forEach(function (key) {
    console.error("Found " + key + " error: " + errors[key]);
  });
} else {
  console.log("No errors found!");
}

Validations

  • id: Uses jetpack-idto ensure a proper ID for AMO. Manifest must contain either an idfield, adhering to Mozilla's Add-on manifest rulesas either a GUID or a domain (in the case of jetpack addons converted from the cfx tool), or just a valid namefield, which works as identification in jpmaddons, and is compatable with npm's naming scheme.
  • main: Ensures that the mainentry in the manifest refers to a file that exists, or resolves to a file that exists (using node loading rules), or that there is an index.jsfile in the root.
  • title: Ensures that the manifest contains either a titleproperty to be displayed when using the addon, and falls back to the more strict nameproperty.
  • name: Validates that the nameproperty is a valid name for use with npm.
  • version: Validates that the versionproperty is in proper semverformat, for use with npm, as Mozilla's toolkit version formatis much less strict.

License

MIT License, Copyright (c) 2014 Jordan Santell

HomePage

https://github.com/mozilla-jetpack/jetpack-validation

Repository

https://github.com/mozilla-jetpack/jetpack-validation


上一篇:jpm-core
下一篇:计算机基础--http的基础整理和巩固

相关推荐

官方社区

扫码加入 JavaScript 社区