npm run build
# or more verbosely
./node_modules/webpack/bin/webpack.js
./node_modules/webpack/bin/webpack.js --progress --colors --watch &
# will need restart if you add new files
Test / Explore
npm build
npm run open deploy/en-US/repair/index.html # will actually run recipes, for now.
open console mode in devtools
heartbeat
profit.
Goals
Users
give good value
don’t download or run things stupidly
New Recipes
not gross
don’t repeat yourself (currently unmet)
Building
install doesn’t need anything too wierd. gem, pip, npm
Deploying
easy for ops
12 Steps
end result a set of static files
Testing
possible to test all recipes
easy to test single recipes in isolation
Proposed plan:
Build using webpack
this fails on the individual recipe debug
fails on ‘DRY’ (unless GRL gets smarter at node)
Hey, Build a new Recipe
Write
git clone and fork
make a recipe in recipes
copy always.js
or make a directory
remember that your paths to common and such are relative.
it’s okay to require new node packages, but these will be reviewed.
Test All The Things
Automated
tests in /tests/recipes/<yourplace> to mirror your structure.
run tests `npm run test:unit –karmafiles=”test/**/*.js”
attempt 100% code coverage
Iterative
(tbd, will involve opening page to localhost:5000 with special args).
it.todo, it.only and npm run test:unit --karmafiles="test/path/yourfile.js" are your friends.
(when complete, remove the ‘leak’)
Iterative (style 2)
Pack it to include all dependencies.
npm run webpack -- test/recipes/always recipe.packed.js
Include it in an html page.
Debug as you will.
Test the runner
// parse the query string as JSON => args to modules.
http://localhost:8000/?{"phonehome":{"testing":true},"runner":{"alwaysRun":true},"personinfo":{"updateChannel":%20"nightly",%20"locale":%20"en-US"}}/
Interesting things are in window.heartbeat or heartbeat
runs once per session, about 5 minutes after startup.
because of issue #212, people who clear localStorage won’t see heartbeat things. This includes users of some addons, and those with some privacy sensitive settings.
Self-Repair Server
Modeled on UI Tour
setup
build
Test / Explore
npm buildheartbeatGoals
Users
New Recipes
Building
gem,pip,npmDeploying
Testing
Proposed plan:
Build using webpack
Hey, Build a new Recipe
Write
git clone and fork
make a recipe in recipes
always.jsremember that your paths to
commonand such are relative.it’s okay to
requirenewnodepackages, but these will be reviewed.Test All The Things
Automated
/tests/recipes/<yourplace>to mirror your structure.Iterative
(tbd, will involve opening page to
localhost:5000with special args).‘leak’ the object to test into
windowscope.window.yourthing = module.exportsIn
karmadebug page (http://localhost:9876/debug.html), it should then be available on the command line to play with.it.todo,it.onlyandnpm run test:unit --karmafiles="test/path/yourfile.js"are your friends.(when complete, remove the ‘leak’)
Iterative (style 2)
Include it in an
htmlpage.Debug as you will.
Test the runner
Interesting things are in
window.heartbeatorheartbeatDeploy
Make a pull-request against Mozilla/self-repair-server.
WARNING Even if you have privileges, please do not push to that repo directly. Pull-requests
Hints and Gotchas
Remember that things in
setTimeoutare hard to catch.shouldRunmethods need to be robust to this, or they will break the runner.Catching a reject in your promise chain:
Recipes and locales
All locales are built at once, and put in
deploy/%locale%Debug the live server
Issues / Bugs
For now, github issues at https://github.com/mozilla/self-repair-server/issues
Population