Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prebuilt module for webpack #19

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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