How to use the web-ext.default.cmd function in web-ext

To help you get started, we’ve selected a few web-ext examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kumabook / bebop / index.js View on Github external
const webpack = require('webpack');
const webExt  = require('web-ext').default;
const config  = require('./webpack.config');

const compiler = webpack(config);
const watching = compiler.watch({ aggregateTimeout: 1000 }, (err) => {
  /* eslint-disable no-console */
  if (err) {
    console.log('\nFailed to webpack build');
  } else {
    console.log('\nweback built');
  }
});

webExt.cmd.run({
  firefox:        process.env.FIREFOX_BINARY,
  sourceDir:      process.cwd(),
  ignoreFiles:    process.env.IGNORE_FILES.split(' ').concat('**/*~'),
  browserConsole: true,
  firefoxProfile: process.env.FIREFOX_PROFILE,
}, {
  shouldExitProgram: false,
}).then(runner => runner.registerCleanup(() => watching.close()));
github treosh / exthouse / src / utils / measure-firefox.js View on Github external
exports.measureFirefox = async function(url, ext) {
  let extensionRunners
  let browser

  if (ext.path) {
    // @todo wait for https://github.com/sindresorhus/get-port/pull/28 and than use range for 6000 port
    const CDPPort = await getPort()

    extensionRunners = await webExt.cmd.run(
      {
        sourceDir: ext.path,
        // comment if connect to default FF
        firefox: PP_FF.executablePath(),
        args: [`-juggler=${CDPPort}`]
      },
      {
        // These are non CLI related options for each function.
        // You need to specify this one so that your NodeJS application
        // can continue running after web-ext is finished.
        shouldExitProgram: false
      }
    )

    const browserWSEndpoint = `ws://127.0.0.1:${CDPPort}`
    browser = await PP_FF.connect({
github cliqz-oss / browser-core / tests / runners / launchers / firefox-web-ext.js View on Github external
firefox: firefoxPath,
      noReload: true,
      sourceDir,
      artifactsDir: sourceDir,
      startUrl: getOptionsUrl(),
      keepProfileChanges,
      firefoxProfile,
      pref: {
        ...prefsFromTalos,
        'lightweightThemes.selectedThemeID': 'firefox-compact-light@mozilla.org',
        'browser.link.open_newwindow': 3,
        'dom.min_background_timeout_value': 50,
        ...this.prefs,
      },
    };
    const runner = await webExt.cmd.run(options, {
      getValidatedManifest() {
        return {
          name: '',
          version: '',
        };
      },
    });
    this.firefox = runner.firefox;
    this.reloadAllExtensions = runner.reloadAllExtensions.bind(runner);
  }
github sneakypete81 / updatescanner / scripts / lib / web-ext.js View on Github external
exports.sign = function(addonId, apiKey, apiSecret) {
  console.log('Running "web-ext sign"...');
  return webExt.cmd.sign({
    sourceDir: 'src',
    artifactsDir: 'dist',
    id: addonId,
    apiKey: apiKey,
    apiSecret: apiSecret,
    channel: 'unlisted',
  });
};
github sneakypete81 / updatescanner / scripts / lib / web-ext.js View on Github external
exports.lint = function() {
  console.log('Running web-ext lint...');
  return webExt.cmd.lint({
    sourceDir: 'src',
  }, {
    shouldExitProgram: false,
  });
};
github sneakypete81 / updatescanner / scripts / lib / web-ext.js View on Github external
exports.run = function() {
  console.log('Running "web-ext run"...');
  return webExt.cmd.run({
    sourceDir: path.resolve('src'),
    pref: 'javascript.options.strict=false',
  });
};
github sneakypete81 / updatescanner / scripts / lib / web-ext.js View on Github external
exports.build = function() {
  console.log('Running "web-ext build"...');
  return webExt.cmd.build({
    sourceDir: 'src',
    artifactsDir: 'dist',
    overwriteDest: true,
  });
};
github danhumphrey / page-modeller / gulpfile.js View on Github external
function launchFirefox(cb) {

    webext.cmd
      .run(
        {
          sourceDir: distPath,
          startUrl: pkg.homepage
        },
        {
          shouldExitProgram: false
        }
      )
      .catch(onError);

    logUpdate(
      `Firefox should now be open with the ${pkg.name} extension loaded.`
    );
    cb();
  }
github soapdog / patchfox / gulpfile.js View on Github external
function webExtensionRun() {
    let dir = process.cwd();
    webExt.util.logger.consoleStream.makeVerbose();
    webExt.cmd.run({ sourceDir: path.join(dir, "debug") }, { shouldExitProgram: true })
        .then((runner) => extensionRunner = runner);
}
github Shywim / github-repo-size / gulpfile.js View on Github external
function webextRun() {
  return webExt.cmd.run({
    sourceDir: paths.build.webext
  }, {
    shouldExitProgram: false,
    noInput: true
  })
}

web-ext

A command line tool to help build, run, and test web extensions

MPL-2.0
Latest version published 29 days ago

Package Health Score

83 / 100
Full package analysis