From b6c2f4fe3dfc57b7c2280cdb5a7310964efb36c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Wollse=CC=81n?= Date: Fri, 2 Mar 2018 11:23:07 +0200 Subject: [PATCH] Npm commands restored (using web-ext) --- docs/DEV.md | 15 +++++++++++++-- package.json | 24 ++++++++++++++---------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/docs/DEV.md b/docs/DEV.md index 1aedc09..0fe4810 100644 --- a/docs/DEV.md +++ b/docs/DEV.md @@ -10,12 +10,23 @@ # install dependencies npm install -## build +## lint npm run lint + +## build npm run build -## build and run +## run npm run firefox + +## run and reload on filechanges +npm run watch + +# run and reload on filechanges, with a variation/branch set by preference +npm run watch -- --pref extensions.button_icon_preference.variation='kittens' + +# run and reload on filechanges, with a variation/branch set by preference, with a specific Firefox installation +npm run watch -- --pref extensions.button_icon_preference.variation='kittens' -f "/Applications/Firefox Nightly.app/Contents/MacOS/firefox-bin" ``` ## Details diff --git a/package.json b/package.json index fcdb376..995eb3f 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,8 @@ "onchange": "^3.2.1", "prettier": "^1.10.2", "selenium-webdriver": "^3.5.0", - "shield-studies-addon-utils": "^4.1.0" + "shield-studies-addon-utils": "^4.1.0", + "web-ext": "^2.4.0" }, "engines": { "node": ">=8.9.0" @@ -49,22 +50,25 @@ "url": "git://github.com/mozilla/shield-studies-addon-template.git" }, "scripts": { - "build": "bash ./bin/xpi.sh", + "build": "npm run web-ext -- build --overwrite-dest --artifacts-dir ./webextension/web-ext-artifacts/", + "bundle-utils": "cp node_modules/shield-studies-addon-utils/dist/StudyUtils.jsm webextension/privileged/shieldUtils/jsm/StudyUtils.jsm", "eslint": "eslint . --ext jsm --ext js --ext json", "eslint-fix": "npm run eslint -- --fix", - "firefox": "export XPI=dist/linked-addon.xpi && npm run build && node run-firefox.js", + "firefox": "npm run watch -- --no-reload", "format": "prettier '**/*.{css,js,json,jsm,md}' --trailing-comma=all --ignore-path=.eslintignore --write", - "harness_test": "export XPI=dist/linked-addon.xpi && mocha test/functional_tests.js --retry 2 --reporter json", + "postformat": "npm run eslint-fix", + "harness_test": "export XPI=./webextension/web-ext-artifacts/button_icon_preference_study_shield_study_example_-2.0.0.zip && mocha test/functional_tests.js --retry 2 --reporter json", "lint": "npm-run-all lint:*", - "lint-build:addons-linter": "# actually a post build test: bin/addonLintTest ' + require('./package.json').name", - "lint:addons-linter": "addons-linter addon/webextension/", + "lint:addons-linter": "addons-linter webextension/", "lint:eslint": "npm run eslint", + "lint:web-ext-lint": "web-ext lint --source-dir ./webextension/", "lint:fixpack": "fixpack", "lint:nsp": "nsp check", - "postformat": "npm run eslint-fix", - "prebuild": "cp node_modules/shield-studies-addon-utils/dist/StudyUtils.jsm addon/", + "prebuild": "npm run bundle-utils", + "prewatch": "npm run bundle-utils", "sign": "echo 'TBD, see: https://bugzilla.mozilla.org/show_bug.cgi?id=1407757'", - "test": "export XPI=dist/linked-addon.xpi && npm run build && mocha test/functional_tests.js --retry 2", - "watch": "onchange 'addon/**' 'package.json' 'template/**' -e addon/install.rdf -e addon/chrome.manifest -e addon/StudyUtils.jsm -- npm run build -- '{{event}} {{changed}} $(date)'" + "test": "export XPI=./webextension/web-ext-artifacts/button_icon_preference_study_shield_study_example_-2.0.0.zip && npm run build && mocha test/functional_tests.js --retry 2", + "watch": "npm run web-ext -- run --browser-console --start-url about:debugging -f nightly", + "web-ext": "web-ext --source-dir ./webextension/ --ignore-files ''" } }