Skip to content

Commit

Permalink
feat: bundle the new WebUI
Browse files Browse the repository at this point in the history
This is an initial stab at bundling.

This PoC is very crude: we just do regular
build in `node_modules/`  and copy artifacts.

Refinements will be introduced in following commits.
  • Loading branch information
lidel committed Sep 24, 2018
1 parent 83f224c commit 59ce947
Show file tree
Hide file tree
Showing 4 changed files with 4,242 additions and 180 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ yarn-error.log
crowdin.yml
.*~
add-on/dist
add-on/webui/
add-on/ui-kit/
coverage
.nyc_output
add-on/ui-kit/**/*
add-on/manifest.json
5 changes: 2 additions & 3 deletions add-on/src/popup/browser-action/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,8 @@ module.exports = (state, emitter) => {

emitter.on('openWebUi', async () => {
try {
const options = await browser.storage.local.get('ipfsApiUrl')
const apiUrl = options['ipfsApiUrl']
await browser.tabs.create({ url: apiUrl + '/webui/' })
// Open bundled version of WebUI
await browser.tabs.create({ url: '/webui/index.html' })
window.close()
} catch (error) {
console.error(`Unable Open Web UI due to ${error}`)
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"clean:build": "shx rm -rf build/*",
"clean:dist": "shx rm -rf add-on/dist",
"clean:ui-kit": "shx rm -rf add-on/ui-kit",
"clean:webui": "shx rm -rf add-on/webui",
"build": "run-s clean build:*",
"build:copy": "run-s build:copy:*",
"build:copy:src": "shx mkdir -p add-on/dist && shx cp -R add-on/src/* add-on/dist",
Expand All @@ -21,6 +22,9 @@
"build:copy:ui-kit:ipfs-css:css": "shx mkdir -p add-on/ui-kit && shx cp node_modules/ipfs-css/ipfs.css add-on/ui-kit",
"build:copy:ui-kit:ipfs-css:fonts": "shx mkdir -p add-on/ui-kit/fonts && shx cp node_modules/ipfs-css/fonts/* add-on/ui-kit/fonts",
"build:copy:ui-kit:tachyons": "shx mkdir -p add-on/ui-kit && shx cp node_modules/tachyons/css/tachyons.css add-on/ui-kit",
"build:webui": "run-s build:webui:*",
"build:webui:build": "cd node_modules/ipfs-webui/ && npx [email protected] install --no-lockfile --non-interactive && npx [email protected] build ; cd ../../",
"build:webui:copy": "shx mkdir -p add-on/webui && shx cp -r node_modules/ipfs-webui/build/* add-on/webui/",
"build:js": "run-p build:js:*",
"build:js:webpack": "webpack -p",
"build:minimize-dist": "shx rm -rf add-on/dist/lib add-on/dist/contentScripts/ add-on/dist/bundles/ipfsProxyContentScriptPayload.bundle.js",
Expand Down Expand Up @@ -102,6 +106,7 @@
"ipfs-css": "0.8.0",
"ipfs-http-response": "0.1.4",
"ipfs-postmsg-proxy": "3.1.1",
"ipfs-webui": "https://github.com/ipfs/webui/tarball/87d4d0d2d295d8813919bbc61e75e2cc57c33e82/webui.tar.gz",
"is-ipfs": "0.4.2",
"is-svg": "3.0.0",
"lru-cache": "4.1.3",
Expand Down
Loading

0 comments on commit 59ce947

Please sign in to comment.