Skip to content

Commit

Permalink
Small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
mkg20001 committed Apr 7, 2018
1 parent e346d22 commit 536fcbe
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ Try the js-ipfs cli in your browser!

First prepare the shims and cli by running `bash prepare.sh`

Now run `npm run watch` to watch the assets and re-build the bundle on every change
Now run `npm start` to watch the assets and re-build the bundle on every change

That's it!
4 changes: 2 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash

npx webpack
npm run build
rm -rf deploy
mkdir deploy
cp -r dist index.html deploy
mkdir -p deploy/node_modules/xterm/dist
cp node_modules/xterm/dist/xterm.css deploy/node_modules/xterm/dist/xterm.css
HASH=$(ipfs add -Qr deploy)
LINK="/ipfs/$HASH"
ipfs-dnslink-update cloudflare ipfs-cli.mkg20001.io "$LINK"
ipfs-dnslink-update cf ipfs-cli.mkg20001.io "$LINK"
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "webpack --watch"
"start": "webpack-dev-server --open --config webpack.dev.js",
"build": "webpack --config webpack.prod.js"
},
"keywords": [
"ipfs",
Expand All @@ -18,6 +19,7 @@
"dependencies": {
"bash-parser": "^0.5.0",
"browserfs": "^2.0.0",
"colors": "^1.2.1",
"ipfs": "^0.28.2",
"jquery": "^3.3.1",
"pull-pushable": "^2.2.0",
Expand All @@ -26,6 +28,8 @@
"stream-to-pull-stream": "^1.7.2",
"webpack": "^4.5.0",
"webpack-cli": "^2.0.14",
"webpack-dev-server": "^3.1.2",
"webpack-merge": "^4.1.2",
"xterm": "^3.2.0",
"yargs": "^11.0.0"
}
Expand Down
7 changes: 7 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const term = new Terminal({
}
})

require('colors')

console.log(term)

Object.keys(console).forEach(k => {
Expand Down Expand Up @@ -48,3 +50,8 @@ BrowserFS.configure({
term.launch()
})
})

window.onerror = function(message, source, lineno, colno, error) {
console.error(message)
console.error(error.stack.red.bold)
}
3 changes: 2 additions & 1 deletion webpack.config.js → webpack.common.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const webpack = require('webpack')

module.exports = {
Expand Down Expand Up @@ -39,6 +41,5 @@ module.exports = {
process: false,
Buffer: false
},
mode: 'development',
entry: './src'
}
11 changes: 11 additions & 0 deletions webpack.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict'

const merge = require('webpack-merge')
const common = require('./webpack.common.js')

module.exports = merge(common, {
devtool: 'inline-source-map',
devServer: {
contentBase: './'
}
})
11 changes: 11 additions & 0 deletions webpack.prod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict'

const merge = require('webpack-merge')
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
const common = require('./webpack.common.js')

module.exports = merge(common, {
plugins: [
new UglifyJSPlugin()
]
})

0 comments on commit 536fcbe

Please sign in to comment.