use postinstall hooks to perform deps cleanup

master
Friedel Ziegelmayer 2016-09-13 11:13:35 +02:00
parent 46fd1a7c25
commit f030f934c3
5 changed files with 39 additions and 28 deletions

View File

@ -15,7 +15,11 @@ module.exports = function (grunt) {
cache: [".tmp"],
dist: ["dist"],
osx: ["dist/Orbit-darwin-x64"],
linux: ["dist/Orbit-linux-x64"]
linux: ["dist/Orbit-linux-x64"],
npm: [
'node_modules/ipfs/node_modules/ipfs-api',
'node_modules/ipfsd-ctl/node_modules/ipfs-api'
]
},
electron: {

View File

@ -18,34 +18,33 @@ Currently only the Electron app works.
- python 2 (for building, some native modules need it, node-fibers perhaps?)
#### Get the source code
```
git clone https://github.com/haadcode/orbit.git
cd orbit/
```sh
> git clone https://github.com/haadcode/orbit.git
> cd orbit
```
#### Install dependencies
```
npm install
rm -rf node_modules/ipfs/node_modules/ipfs-api/
rm -rf node_modules/ipfsd-ctl/node_modules/ipfs-api/
cd client/
npm install
rm -rf node_modules/ipfs-api
rm -rf node_modules/ipfs/node_modules/ipfs-api/
```sh
> npm install
> cd client
> npm install
```
##### Build Client
```
cd client/
npm run build
```sh
> cd client
> npm run build
```
##### Run Electron App
*Run this is in project's root directory, not in `client/`.*
```
npm run electron
```sh
> npm run electron
```
The application executable is in `dist/`.
@ -54,19 +53,21 @@ The application executable is in `dist/`.
#### Run Tests
```
npm test
```sh
> npm test
```
#### Electron App Development
First, start the desktop app in developer mode:
```
npm run dev:electron
```sh
> npm run dev:electron
```
Then, start the UI development environment:
```
cd client/
npm run dev
```sh
> cd client/
> npm run dev
```

View File

@ -120,7 +120,11 @@ module.exports = function (grunt) {
'<%= pkg.dist %>'
]
}]
}
},
npm: [
'node_modules/ipfs-api',
'node_modules/ipfs/node_modules/ipfs-api'
]
}
});
@ -137,7 +141,7 @@ module.exports = function (grunt) {
grunt.registerTask('test', ['karma']);
grunt.registerTask('build', ['clean', 'copy', 'webpack']);
grunt.registerTask('build', ['clean:dist', 'copy', 'webpack']);
grunt.registerTask('default', []);
};

View File

@ -85,6 +85,7 @@
"build": "./node_modules/.bin/grunt build",
"publish": "ipfs add -r dist/",
"stats": "./node_modules/.bin/webpack --json > stats.json",
"start": "cd dist && ../node_modules/.bin/http-server -c-1 -p 8081 & open http://localhost:8081/index.html & wait"
"start": "cd dist && ../node_modules/.bin/http-server -c-1 -p 8081 & open http://localhost:8081/index.html & wait",
"postinstall": "./node_modules/.bin/grunt clean:npm"
}
}

View File

@ -34,7 +34,8 @@
"build": "./node_modules/.bin/grunt build",
"dev:electron": "ENV=dev API_ORIGIN=* IPFS_EXEC=/$GOPATH/bin/ipfs ./node_modules/.bin/electron .",
"electron": "./node_modules/.bin/electron .",
"start": "cd client/dist && ../../node_modules/.bin/http-server -c-1 -p 8081 & open http://localhost:8081/index.html & wait"
"start": "cd client/dist && ../../node_modules/.bin/http-server -c-1 -p 8081 & open http://localhost:8081/index.html & wait",
"postinstall": "./node_modules/.bin/grunt clean:npm"
},
"repository": {
"type": "git",