Skip to content

Commit e6fb06a

Browse files
committed
Cross-platform build commands
1 parent 9b325a5 commit e6fb06a

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
"repository": "github:RedHatter/svelte-devtools",
66
"license": "MIT",
77
"scripts": {
8-
"build:firefox": "TARGET=firefox rollup -c && $npm_execpath run build:icon",
9-
"build:chrome": "TARGET=chrome rollup -c && $npm_execpath run build:icon",
10-
"build:icon": "for size in 16 24 48 96 128; do if [ ! -e dest/icon-$size.png -o src/svelte-logo.svg -nt dest/icon-$size.png ]; then svgexport src/svelte-logo.svg dest/icon-$size.png $size:; fi; done",
8+
"build:firefox": "cross-env TARGET=firefox rollup -c",
9+
"build:chrome": "cross-env TARGET=chrome rollup -c",
10+
"build:icon": "node ./scripts/buildIcons.mjs",
1111
"dev": "http-serve test/public -p 8940 & web-ext run -s dest -u http://127.0.0.1:8940 -u about:debugging && kill $!",
12-
"package": "$npm_execpath run build && web-ext build -s dest"
12+
"package:firefox": "yarpm run build:firefox && web-ext build -s dest",
13+
"package:chrome": "yarpm run build:chrome && web-ext build -s dest"
1314
},
1415
"devDependencies": {
16+
"cross-env": "^7.0.3",
1517
"http-serve": "^1.0.1",
1618
"postcss": "^8.2.2",
1719
"postcss-sorting": "^6.0.0",
@@ -26,7 +28,8 @@
2628
"svelte": "^3.20.1",
2729
"svelte-listener": "git+https://github.com/RedHatter/svelte-listener.git",
2830
"svgexport": "^0.4.1",
29-
"web-ext": "^5.4.1"
31+
"web-ext": "^5.4.1",
32+
"yarpm": "^0.2.1"
3033
},
3134
"engines": {
3235
"node": ">=11.14.0"

scripts/buildIcons.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import svgexport from 'svgexport'
2+
3+
svgexport.render([{
4+
'input' : ['src/svelte-logo.svg'],
5+
'output': [16, 24, 48, 96, 128].map(
6+
size => [`dest/icon-${size}.png`, `${size}:`]
7+
)
8+
}]);

src/background.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ function attachScript(tabId, changed) {
4949
changed.status != 'loading' ||
5050
// #if process.env.TARGET === 'firefox'
5151
!changed.url
52+
// #else
53+
false
5254
// #endif
5355
)
5456
return

0 commit comments

Comments
 (0)