forked from mozilla/activity-stream
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathyamscripts.yml
152 lines (124 loc) · 7.04 KB
/
yamscripts.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# This file compiles to package.json scripts.
# When you add or modify anything, you *MUST* run:
# npm run yamscripts
# to compile your changes.
scripts:
# once: Build/serve the assets and run the add-on
once: =>bundle && =>firefox
clean: rimraf data/content/* && rimraf data/locales/* && mkdirp data/content && rimraf dist/*
changelog: conventional-changelog -i CHANGELOG.md -s
copyTestImages: cpx "node_modules/tippy-top-sites/images/**/*" data/content/favicons/images
# bundle: Bundle assets for production
bundle:
pre: =>clean && =>copyTestImages
static: cpx "content-src/static/**/*" data/content
# TODO: make the number of locales configurable. pontoon-to-json has an option for this
locales: pontoon-to-json --src locales --dest data/locales
svgo: svgo -q -f data/content/img/
webpack: NODE_ENV=production webpack
webpackAddon: webpack --config webpack.addon.config.js
css: node-sass content-src/main.scss -o data/content
html: node ./bin/generate-html.js > data/content/activity-streams.html
post: du -hs ./data/content/*
# bundlestats: Display bundle stats
bundlestats: NODE_ENV=production webpack --json | webpack-bundle-size-analyzer
# export: Export a mozilla-central-unpacked `package` of the add-on assuming
# `mozilla-central` shares the same parent directory as this one
export:
pre: =>clean && =>package
clean: rimraf ../mozilla-central/browser/extensions/activity-stream
# Copy over an explicit list of files for mozilla-central building/testing
# NB: This will be a superset of files that get packaged with moz.build
copy: cpx "dist/mozilla-central/{addon/**,bootstrap.js,common/**,data/**,experiments.json,install.rdf.in,moz.build,package.json}" ../mozilla-central/browser/extensions/activity-stream
copytests: if [ "$SYMLINK_TESTS" != "true" ]; then cpx "test/functional/mochitest/**" ../mozilla-central/browser/extensions/activity-stream/test/functional/mochitest; fi
linktests: if [ "$SYMLINK_TESTS" = "true" ]; then ln -s ../../../../activity-stream/test ../mozilla-central/browser/extensions/activity-stream/test; fi
# Run the activity-stream mochitests. Right now, a-s is turned off in
# m-c, so we have to locally force them on with the --set-pref. In m-c,
# the tests are skipped, and the --extra-mozinfo-json is used to force them
# to run locally too.
mochitest: (cd ../mozilla-central && ./mach mochitest --setpref browser.newtabpage.activity-stream.enabled=true --extra-mozinfo-json=$PWD/browser/extensions/activity-stream/test/mozinfo.json browser/extensions/activity-stream/test/functional/mochitest )
# Run the activity-stream mochitests with the browser toolbox debugger.
# Often handy in combination with adding a "debugger" statement in your
# mochitest somewhere. See the comment for the mochitest target for more
# details about how this is implemented.
mochitest-debug: (cd ../mozilla-central && ./mach mochitest --jsdebugger --setpref browser.newtabpage.activity-stream.enabled=true --extra-mozinfo-json=$PWD/browser/extensions/activity-stream/test/mozinfo.json browser/extensions/activity-stream/test/functional/mochitest )
# buildmc: Export the bootstraped add-on to mozilla central
buildmc:
pre: =>export:clean
webpack: webpack --config webpack.system-addon.config.js
css: node-sass system-addon/content-src/activity-stream.scss -o system-addon/data/content
# Copy over all of the mozilla-central directory except content-src
copy: cpx "system-addon/{bootstrap.js,install.rdf.in,jar.mn,moz.build,README.md,{common,data,lib,test,vendor}/**/{,.}*}" ../mozilla-central/browser/extensions/activity-stream
# startmc: Start developing the bootstrapped add-on
startmc:
_parallel: true
pre: =>prebuildmc
copy: =>buildmc:copy -- -w
webpack: =>buildmc:webpack -- -w
css: =>buildmc:css && =>buildmc:css -- -w
# importmc: Import changes from mc to github repo
importmc: cpx "../mozilla-central/browser/extensions/activity-stream/**/*" system-addon/
testmc:
bundle: =>buildmc:webpack
unit: karma start karma.mc.config.js || (cat logs/coverage/system-addon/text.txt && exit 2)
post: cat logs/coverage/system-addon/text-summary.txt
tddmc: karma start karma.mc.config.js --tdd
# start: Start watching/compiling assets,
start:
_parallel: true
pre: =>clean && =>copyTestImages
static: =>bundle:static -- -w
locales: =>bundle:locales -- -w
webpack: webpack -w
webpackAddon: =>bundle:webpackAddon -- -w
css: =>bundle:css && =>bundle:css -- -w
html: =>bundle:html -- --baseUrl http://localhost:1963/ --csp off
server: live-server data/content --port=1963 --no-browser
eslint: =>lint:eslint -- -w
# firefox: Launch addon with jpm run
firefox: =>bundle:webpackAddon && jpm run -b nightly --prefs ./dev-prefs.json
# lint: Run eslint and sass-lint
lint:
eslint: esw --ext=.js,.jsm,.json . .storybook
sasslint: sass-lint -v -q
# strings-export: Copy newest en-US strings to strings repository
strings-export: node ./bin/strings-export.js ../activity-stream-l10n
# strings-import: Update strings repository and replace local strings
strings-import: node ./bin/strings-import.js ../activity-stream-l10n
# test: Run all tests once
test:
pre: =>bundle && =>copyTestImages
lint: =>lint
checkbinary: echo "JPM_FIREFOX_BINARY: ${JPM_FIREFOX_BINARY}"
# test:jpm: Run jpm tests
jpm: jpm test -b ${JPM_FIREFOX_BINARY:-"nightly"} --prefs ./test-prefs.json -v -f "^(?!.*benchmark)"
# test:karma: Run content tests only
karma: NODE_ENV=test karma start
mc: =>testmc
post: cat logs/reports/coverage/text-summary.txt
benchmark-with: =>bundle && JSGC_DISABLE_POISONING=1 jpm test -b ${JPM_FIREFOX_BINARY:-"nightly"} --prefs ./benchmark-prefs.json
# benchmark: Run all benchmarks
benchmark: =>benchmark-with -- -f ".*benchmark.js"
# tdd: Run content tests continuously
tdd: =>test:karma -- --no-single-run --browsers Chrome
# package: Build add-on
# Add a SUPPORTED_LOCALES variable to your environment as a comma separated list to include certain locales.
# e.g. SUPPORTED_LOCALES=en-US,fr
package:
dist: =>bundle && jpm xpi && mv activity-streams.xpi dist/activity-streams-$npm_package_version.xpi
mozilla-central:
unpack: decompress dist/activity-streams-$npm_package_version.xpi -o dist/mozilla-central
copy: cpx "moz.build" dist/mozilla-central
installRdf: node ./bin/convert-install-rdf.js dist/mozilla-central
# This is for ci
travis: =>test
# This is just to make sure we don't make commits with failing tests
# or uncompiled yamscripts.yml. Run automatically with husky.
prepush: =>test:lint && =>yamscripts
# Build a local react-storybook containing local stories for
# development. Expects "npm run start" to be running in another
# window to get CSS changes noticed.
storybook: start-storybook -p 9001 -s ./data/content
# build-storybook: used by storybooks.io service to build a static copy for
# automatic storybook building in github PRs
build-storybook: =>bundle && STORYBOOK_STATIC=true build-storybook -s ./data/content -o ./.static-storybook