Git Product home page Git Product logo

jpm's Introduction

IMPORTANT UPDATE AS OF 2019-11-26: The jpm package is 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.


JPM Dependency Status Build Status

NPM NPM

IMPORTANT UPDATE AS OF 2017-02-07: Firefox is planning to deprecate the type of add-ons that are built by jpm.

Replacing the previous python tool for developing Firefox Add-ons, cfx, jpm is a utility for developing, testing, and packaging add-ons.

Install

Install the latest stable version from NPM:

npm install --global jpm

Alternatively, you can install from the GitHub source to get the latest features or to work on jpm itself. Use npm link to add the jpm global to your path:

git clone https://github.com/mozilla-jetpack/jpm.git
cd jpm
npm install
npm link

Usage

Type jpm --help for all available commands and options or read the documentation linked below.

Documentation

Contributing

Read about how to contribute patches to jpm.

Using Post and Watchpost

Note: this is experimental

Setup

You must have the Extension Auto-Installer installed on a pre-production Firefox and you need to use a profile that sets xpinstall.signatures.required to false (more info). For logging with watchpost, also see Developing without browser restarts.

Usage

Once this has completed, setup a watchpost:

jpm watchpost --post-url http://localhost:8888/

This will watch for changes to the current working directory and post a new xpi to your installed Extension Auto-Installer which will then install the new xpi. To end the process, use the hokey, CTRL + C.

For a simple xpi and post, use:

jpm post --post-url http://localhost:8888/

License

MPL-2.0

jpm's People

Contributors

alexduch avatar asamuzak avatar bobbyrne01 avatar clochix avatar dwlf avatar erikvold avatar fflorent avatar freaktechnik avatar gijsk avatar gozala avatar inbasic avatar janodvarko avatar jc3213 avatar jsantell avatar jsnajdr avatar jxpx777 avatar kewisch avatar kumar303 avatar laurentj avatar mathieuu avatar mossop avatar nikolas avatar nt1m avatar okuryu avatar pdehaan avatar pikachuexe avatar rpl avatar toonetown avatar ufffd avatar wagnerand avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jpm's Issues

Create a node API

This'll probably have several components to it, but a basic API for using this via node should be possible:

var jpm = require("jpm");
jpm.xpi("/path/to/dir").then(function (xpi) {})
jpm.run("/path/to/dir").then(function () {})

Similar to #5 which is having this work in an addon itself, but first got to get the API working and usable before we think about stripping down dependencies for use within an Addon.

Non-explicit xpi's should be created in tmp

If I have a xpi in my working directory, and I call jpm run (or test), this will create a new xpi that overwrites the one I already have in my directory, and then removes it after it's installed, effectively losing my previous xpi.

For cases where a xpi is generated as the byproduct of a task (run/test), then these should be created in a tmp folder, where they are subsequently removed.

JPM should recognize exit code

At the moment we don't have way of exiting firefox with specific exit code (see bug 894697). CFX generates file
into which we write "OK" or "FAIL" before exiting firefox, I think it would be best if
we set ENV variable "JPM_EXIT_CODE" from test runner before exiting firefox,
which JPM could recognize as an exit code, until mentioned bug is fixed.

JPM should validate `package.json/id` and propose update if invalid.

JPM should:

  1. Identify add-on's using package.json/id if it is valid. If not it should
    raise an error and propose updated value. Note that CFX generates
    invalid package.json/id and then normalizes it by adding @jetpack.
  2. If package.json/id isn't present (ideal case) add-on should be identified
    as "@" + package.json/name. That's should be an ID written to an
    install.rdf file. Note that package.json/id should not be added.

Make test runner independent of CFX

Test runner should not depend on allTestModules to be provided by CFX in order
to do it's job. Test runner should just iterate over test files and run tests on it's own.

Support l10n

At the moment CFX handles some localization tasks. JPM does not has that so add-ons with localization are going to fail. It looks like with Bug 935290 it should pretty much work.

JPM should pass `--sdk-path` option

JPM should allow us to run / test add-on with a local SDK modules rather than one shipped with firefox itself. This is not an end user feature, it's an SDK hacker feature
to test changes made to an SDK itself.

jpm --sdk-path /path/to/sdk should generate FF profile with extensions.modules.ADDON-ID.path preference set to /path/to/sdk/lib/, that way bootstrap.js will configure loader such that add-on will load sdk modules from local clone rather than from resource://gre/modules/commonjs/.

JPM should also recognize JETPACK_PATH environment variable (although precedence should be given to a CLI arg) to reduce overhead of passing arguments each time.

Support for simple-prefs

At the moment JPM completely ignores prefs. This will break most add-on's so it's no go.
Although fixing Bug 903039 is another way to get there, since it would replace need for options.xul or default/prefs.js.

Validate that add-on has an entry module present.

Given that legacy add-ons used to have lib/main.js instead of ./index.js as entry point
JPM should validate that expected entry point module exists. If for example no main is in
package.json and ./index.js isn't present either JPM should dump warning and maybe
even suggest update to a package.json to assist migrating an add-on.

add-on installable in xpp firefox nightly, but named undefined

Hi, I am willing to do early testing and found I could build
https://github.com/canuckistani/fennec-plus
in cygwin (for real command history as opposed to cmd.exe) with following versions:

me@myPC:~/tmp/mozilla/fennec-plus$ npm -v
1.2.18
me@myPC:~/tmp/mozilla/fennec-plus$ node -v
v0.10.4
me@myPC:~/tmp/mozilla/fennec-plus$ jpm -V
0.0.4
me@myPC:~/tmp/mozilla/fennec-plus$

First

I can install the add-on in Firefox Nightly of today in Windows XP SP3 (even though its functionality is limited to fennec) but the add-on is listed as

undefined 0.1
by undefined

Second

I'd love to build it for fennec.
Is the equivalent of the cfx --force-mobile available in jpm yet?

`jpm` does nothing

Just typing jpm after install does nothing. Maybe it should display the help or something?

Better error reporting

Currently errors thrown in Firefox/Addons go to stdout in the process spawned by jpm, so we'll have to do some clever parsing to determine if it's an error, as this should be logged regardless of verbosity level set.

Test not running all tests?

Create simple addon and run tests:
jpm init && jpm test -b /Applications/Firefox\ Nightly.app

There should be 3 tests run and I only get 1 of 1 tests passed., and it also looks like none of the tests actually get executed

// @erikvold

Invalid install.rdf generation

{
  "name": "toolbar-api",
  "title": "toolbar-api",
  "id": "toolbar-api",
  "main": "./lib/main.js",
  "description": "a toolbar api example",
  "author": "",
  "license": "MPL 2.0",
  "version": "0.1",
}

Generates:

<?xml version="1.0" encoding="utf-8"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
    <Description about="urn:mozilla:install-manifest">
          <em:id>unknown@jetpack</em:id>
          <em:version>undefined</em:version>
          <em:type>2</em:type>
          <em:bootstrap>true</em:bootstrap>
          <em:unpack>false</em:unpack>
          <em:name>Untitled</em:name>
          <em:homepageURL/>
          <em:description/>
          <em:creator/>
          <em:iconURL>icon.png</em:iconURL>
          <em:icon64URL>icon64.png</em:icon64URL>


    </Description>

</RDF>

Expected:

  1. To see an error because of invalid id.

Actual:

  1. Got install.rdf with unknown@jetpack id.
  2. Got install.rdf that has no targetApplication.
  3. Got install.rdf that has name set to Untitled.
  4. Got install.rdf that has version set to undefined.

Ignore compressed files when xpi'ing

It's very easy to xpi up a xpi:

jpm xpi // creates a xpi
jpm run // creates a new xpi, containing previous xpi

This gets heavy and slow fast, so we should ignore compressed files when creating a xpi.

Transition Warnings

When transitioning from cfx to jpm, there are some differences that are no longer supported or done differently. When doing anything in jpm, before any actions are executed, a "health check" will be performed, ensuring that the addon will work with jpm, based off of these changes.

  • ID Check: cfx creates invalid IDs for AOM and makes it valid during a build -- we no longer support this magic and valid IDs are required. If the ID provided is not valid (should pass jsantell/jetpack-id), display a message that this needs changed.
  • Entry Point: cfx does not require a main entry point in the package.json and by default it is lib/main -- for consistency with node, toolkit/loader defaults to index.js if not specified.
    • If a main entry is not specified, and index.js does not exist, alert the user.
    • If a main entry is specified, but the file does not exist, alert the user.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.