Skip to content

Commit

Permalink
feat: You can now use web-ext programatically, e.g. webExt.cmd.run()
Browse files Browse the repository at this point in the history
  • Loading branch information
kumar303 committed Aug 3, 2017
1 parent e48ac75 commit fbba629
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
4 changes: 3 additions & 1 deletion bin/web-ext
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env node

var webExt = require('../dist/web-ext').default;
var path = require('path');
var absolutePackageDir = path.join(path.resolve(__dirname), '..');
require('../dist/web-ext').main(absolutePackageDir);

webExt.main(absolutePackageDir);
3 changes: 2 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* @flow */
import {main} from './program';
import cmd from './cmd';

export {main};
export default {main, cmd};
21 changes: 21 additions & 0 deletions tests/unit/test.web-ext.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* @flow */
import {describe, it} from 'mocha';
import {assert} from 'chai';

import webExt from '../../src/main';
import build from '../../src/cmd/build';
import run from '../../src/cmd/run';
import {main} from '../../src/program';


describe('webExt', () => {
it('exposes main', () => {
assert.equal(webExt.main, main);
});

it('exposes commands', () => {
// This just checks a sample of commands.
assert.equal(webExt.cmd.run, run);
assert.equal(webExt.cmd.build, build);
});
});

0 comments on commit fbba629

Please sign in to comment.