Skip to content

Commit

Permalink
docs(readme): update dev instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
germanferrero committed Sep 6, 2021
1 parent 303f596 commit 9f010fd
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 15 deletions.
1 change: 0 additions & 1 deletion .env

This file was deleted.

30 changes: 19 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,35 @@ npm install


## Development Workflow
Read the ["How to contribute and code of conduct"](CONTRIBUTING.md) documentation

**Start a live-reload development server:**

### Start a live-reload development server
```
WEB_PATH="/" npm run dev
npm run dev
```

This will serve the LiMe App with hot reloading. By default it will proxy every backend request to http://10.13.0.1, the default ip address for LibreMesh nodes.

**Generate a production build in `./build`:**
If you already have a LibreMesh router reachable at any given IP address, let's say 10.5.0.9, you can use it as a backend with:

```
WEB_PATH="/" npm run build --production
env NODE_HOST=10.5.0.9 npm run dev
```

> You can now deploy the contents of the `build` directory to production on github pages!
>
> Fork and `npm run deploy`
If you want, you can also setup a virtual LibreMesh node following [lime-packages: TESTING.md](https://github.com/libremesh/lime-packages/blob/master/TESTING.md#development-with-qemu-virtual-machine), which will be available at http://10.13.0.1 by default.

### Generate a production build
```
npm run build:production
```
Now you can copy the bundles to the router:

## Router Installation
```
ssh [email protected] "rm -rf /www/app/*" && scp -r ./build/* [email protected]:/www/app
```

In order to install the software in the node, the node must have several ubus packages installed ( see https://github.com/libremesh/lime-packages).
### Run tests
```
npm run tests
```

For develop you can run `WEB_PATH='/app' npm run build --production` and then copy the build folder to the /www/app directory of the node and go.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"colors": "^1.4.0",
"commitizen": "^4.0.0",
"commitlint": "^8.0.0",
"dotenv": "^8.0.0",
"enzyme": "^3.10.0",
"enzyme-adapter-preact-pure": "^2.0.0",
"eslint": "^6.0.0",
Expand Down
19 changes: 17 additions & 2 deletions preact.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,24 @@ let path = require('path');
**/
export default function (config, env, helpers) {
// Basepath of lime-app in the router: http://thisnode.info/app/
config.output.publicPath = process.env.WEB_PATH || '';
// This hack let us use less-modules at plugins/containers directories too
const { source } = env;
const { source, isProd } = env;
config.output.publicPath = isProd ? '/app/' : '';

const host = process.env.NODE_HOST || '10.13.0.1';
config.devServer = {
...config.devServer,
proxy: [
{
path: '/ubus',
target: `http://${host}/`
},
{
path: '/cgi-bin/**',
target: `http://${host}/`
}
]
}
const loaderRules = helpers.getLoadersByName(config, 'css-loader');
loaderRules.forEach(({ rule }) => {
if (rule.include) {
Expand Down

0 comments on commit 9f010fd

Please sign in to comment.