Skip to content
This repository has been archived by the owner on Nov 27, 2019. It is now read-only.

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

License

Notifications You must be signed in to change notification settings

mozilla-jetpack/jetpack-validation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IMPORTANT UPDATE AS OF 2019-11-26: The jpm package and its libraries are no longer maintained as Firefox no longer supports add-ons built with jpm. If you're building a new add-on, consider a WebExtension instead and check out the web-ext tool which has all the same features as jpm. Here are some resources to help you migrate a legacy jpm built add-on.


jetpack-validation

Build Status Build Status

Validate a directory with a manifest for Firefox Add-ons using the Jetpack/Add-on SDK and 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-id to ensure a proper ID for AMO. Manifest must contain either an id field, adhering to Mozilla's Add-on manifest rules as either a GUID or a domain (in the case of jetpack addons converted from the cfx tool), or just a valid name field, which works as identification in jpm addons, and is compatable with npm's naming scheme.
  • main: Ensures that the main entry 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.js file in the root.
  • title: Ensures that the manifest contains either a title property to be displayed when using the addon, and falls back to the more strict name property.
  • name: Validates that the name property is a valid name for use with npm.
  • version: Validates that the version property is in proper semver format, for use with npm, as Mozilla's toolkit version format is much less strict.

License

MIT License, Copyright (c) 2014 Jordan Santell

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published