Skip to content
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.

Commit

Permalink
Added minimal boilerplate to be able to launch examples/small-study
Browse files Browse the repository at this point in the history
  • Loading branch information
motin committed Apr 10, 2018
1 parent 7c91dc2 commit 9826722
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 0 deletions.
22 changes: 22 additions & 0 deletions examples/small-study/bin/bundle-shield-studies-addon-utils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

# fail on any error
set -o errexit

# always run from the repository root directory
script_path=`dirname $0`
cd "$script_path/../../../"

# paths
WEBEXTAPIS_PATH="webExtensionApis"
ADDON_SRC_PATH="examples/small-study/src"

# bundle the study web extension experiment
mkdir -p $ADDON_SRC_PATH/privileged/study
cp $WEBEXTAPIS_PATH/study/api.js $ADDON_SRC_PATH/privileged/study/api.js
cp $WEBEXTAPIS_PATH/study/schema.json $ADDON_SRC_PATH/privileged/study/schema.json

# bundle the prefs web extension experiment
mkdir -p $ADDON_SRC_PATH/privileged/prefs
cp $WEBEXTAPIS_PATH/prefs/api.js $ADDON_SRC_PATH/privileged/prefs/api.js
cp $WEBEXTAPIS_PATH/prefs/schema.json $ADDON_SRC_PATH/privileged/prefs/schema.json
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions examples/small-study/src/privileged/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ignore APIs that are bundled from shield-studies-addon-utils
study/
prefs/
19 changes: 19 additions & 0 deletions examples/small-study/web-ext-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* eslint-env node */

const defaultConfig = {
// Global options:
sourceDir: "./src/",
artifactsDir: "./dist/",
ignoreFiles: [".DS_Store"],
// Command options:
build: {
overwriteDest: true,
},
run: {
firefox: "nightly",
browserConsole: true,
startUrl: ["about:debugging"],
},
};

module.exports = defaultConfig;
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@
"postformat": "npm run eslint-fix && fixpack",
"prebuild": "npm run lint",
"prepack": "fixpack && npm run build",
"presmall-study:run": "npm run build && npm run small-study:bundle-utils",
"pretest": "npm run build && npm run test-addon:bundle-utils && npm run test-addon:build",
"pretest-addon:run": "npm run pretest",
"small-study:build": "cd examples/small-study && web-ext build",
"small-study:bundle-utils": "examples/small-study/bin/bundle-shield-studies-addon-utils.sh",
"small-study:run": "cd examples/small-study && web-ext run --no-reload",
"test": "FIREFOX_BINARY=${FIREFOX_BINARY:-firefox} ADDON_ZIP=examples/test-addon/dist/shield_utils_test_add-on-1.0.0.zip mocha examples/test-addon/test/functional/ --bail",
"test-addon:build": "cd examples/test-addon && web-ext build",
"test-addon:bundle-utils": "examples/test-addon/bin/bundle-shield-studies-addon-utils.sh",
Expand Down

0 comments on commit 9826722

Please sign in to comment.