Skip to content

Commit

Permalink
WIP webpack full build
Browse files Browse the repository at this point in the history
  • Loading branch information
fazo96 committed Jan 18, 2018
1 parent 7c78546 commit e345b2e
Show file tree
Hide file tree
Showing 10 changed files with 292 additions and 148 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ language: node_js
node_js:
- "8"

script: npm run test
script:
- npm run lint
- npm run build
- npm run test

before_script:
- export DISPLAY=:99.0
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ If you are in development mode, you can pass an option `mock: true` when initial

### In the Browser

You can require/import this module from the browser through Webpack. Check out [this example](https://github.com/ipfs/js-ipfs/tree/master/examples/browser-webpack) for the additional configuration needed by js-ipfs.
You can require/import this module from the browser through Webpack, look at the Webpack configuration of this project to figure out what you need.
By default webpack will load the prebuilt minified library to avoid issues in front-end projects.

If you don't have webpack, we also have a prebuilt minified version of the library that you can include in a `<script>` tag. Check out the [examples](https://github.com/ChluNetwork/chlu-ipfs-support/blob/master/examples).
If you don't have webpack and want to load this in another way, we also have a prebuilt minified version of the library that you can include in a `<script>` tag.
Check out the [examples](https://github.com/ChluNetwork/chlu-ipfs-support/blob/master/examples).

Keep in mind that the prebuilt minified library includes every dependency, and also works as a commonjs or amd module.

### In Electron

Expand Down
22 changes: 10 additions & 12 deletions bin/chlu-service-node.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
#!/usr/bin/env node
const ChluIPFS = require('../src/index.js');
const ChluIPFS = require('../dist/ChluIPFS.min.js');

let serviceNode = null;

async function main(){
function main(){
console.log('Starting Chlu IPFS Service Node');
serviceNode = new ChluIPFS({ type: ChluIPFS.types.service });
await serviceNode.start();
return serviceNode.start();
}

main().then(() => console.log('Service Node Started'));

process.on('SIGINT', async function() {
process.on('SIGINT', function() {
console.log('Stopping gracefully');
try {
if (serviceNode) {
await serviceNode.stop();
}
process.exit(0);
} catch(exception) {
process.exit(1);
}
serviceNode.stop()
.then(() => process.exit(0))
.catch(exception => {
console.log(exception.message);
process.exit(1);
});
});
2 changes: 1 addition & 1 deletion dist/ChluIPFS.min.js

Large diffs are not rendered by default.

9 changes: 0 additions & 9 deletions examples/customer.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@
<title>ChluIPFS Customer Example</title>
</head>
<body>

<!-- ChluIPFS requires ipfs-js and orbit-db but does not include them in the prebuilt browser script -->
<!-- we can easily include them before loading ChluIPFS thanks to the unpkg CDN -->

<!-- Currently using non minified version of IPFS due to this issue https://github.com/ipfs/js-ipfs/issues/1136 -->
<!-- IPFS -->
<script src="https://unpkg.com/[email protected]/dist/index.js"></script>
<!-- OrbitDB -->
<script src="https://unpkg.com/[email protected]/dist/orbitdb.min.js"></script>
<script src="../dist/ChluIPFS.min.js"></script>
<script>
// Utility function to output strings to the web page
Expand Down
3 changes: 0 additions & 3 deletions examples/serviceNode.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
<title>ChluIPFS Service Node Example</title>
</head>
<body>
<!-- Currently using non minified version of IPFS due to https://github.com/ipfs/js-ipfs/issues/1136 -->
<script src="https://unpkg.com/[email protected]/dist/index.js"></script>
<script src="https://unpkg.com/[email protected]/dist/orbitdb.min.js"></script>
<script src="../dist/ChluIPFS.min.js"></script>
<script>

Expand Down
Loading

0 comments on commit e345b2e

Please sign in to comment.