webxdc-dev
Advanced tools
Comparing version 0.0.1 to 0.1.2
{ | ||
"name": "webxdc-dev", | ||
"version": "0.0.1", | ||
"version": "0.1.2", | ||
"description": "A dev tool for Webxdc", | ||
@@ -5,0 +5,0 @@ "scripts": { |
119
README.md
# webxdc-dev | ||
**Very early draft of the code** | ||
webxdc-dev is a development tool for [webxdc](https://webxdc.org). It allows | ||
you to open multiple independent instances of a webxdc application in different | ||
browser tabs or windows. The purpose is to help you test and debug webxdc | ||
projects, including communication between differences instances of the same | ||
application. | ||
A dev tool for Webxdc. It allows you to open multiple independent instances of | ||
a Webxdc application in different browser tabs or windows. Each Webxdc | ||
application has a different port number so they don't share anything, including | ||
localstorage. | ||
Each webxdc application has a different port number so they don't share | ||
anything, including `localstorage`. | ||
Messages sent using `sendUpdate` are automatically distributed to all other | ||
instances of the application. This allows you to simulate a multi-user | ||
application. | ||
Messages sent using the [Webxdc | ||
API](https://docs.webxdc.org/spec.html#webxdc-api) `sendUpdate` function are | ||
automatically distributed to all other instances of the application. This | ||
allows you to simulate multiple users using the same application. | ||
## How to use | ||
## Installation | ||
For now, you can clone this repository and run: | ||
There are two ways to install this package. | ||
```sh | ||
### Global installation | ||
You can install the tool globally. This works with any webxdc project: | ||
```shell | ||
npm install -g webxdc-dev | ||
``` | ||
To now run webxdc projects with the dev tool, do the following: | ||
```shell | ||
webxdc-dev run /path/to/webxdc/project | ||
``` | ||
### With `package.json` | ||
If your project has a `package.json`, you can also install `webxdc-dev` locally | ||
as a dev dependency: | ||
```shell | ||
npm install -D webxdc-dev | ||
``` | ||
and integrate it into a `package.json` `scripts` section to run the current | ||
project: | ||
```json | ||
{ | ||
"scripts": { | ||
"webxdc-dev": "webxdc-dev run ." | ||
} | ||
} | ||
``` | ||
You can then run this script using: | ||
```shell | ||
npm run webxdc-dev | ||
``` | ||
## Usage | ||
When you `webxdc-dev`, it opens a browser window with the webxdc-dev UI. You | ||
can click on webxdc application instances to open them in new tab. You can | ||
also add new instances. | ||
## Development | ||
You can run `webxdc-dev` in development mode so that both frontend and backend | ||
are automatically recompiled when you change code. For frontend and simulator | ||
changes you need to reload your browser windows to see the effect. When you | ||
make a backend change, the entire server is restarted and a new browser window | ||
is opened. | ||
```shell | ||
npm run dev -- run /path/to/xdc | ||
``` | ||
Production and development mode have differences: in production mode no | ||
recompilation takes place. Before release, you should test the command-line | ||
script in production mode. You can do this as follows: | ||
```shell | ||
npm run build | ||
@@ -24,9 +89,23 @@ ``` | ||
```sh | ||
```shell | ||
npm run cli -- run /path/to/xdc | ||
``` | ||
to run an Webxdc directory. There's a UI on port 3000 that lets you open | ||
instances in new tabs. You can also add a new instance using this UI. | ||
### Making a release | ||
You can create a new npm release automatically by doing the following on the | ||
`main` branch: | ||
```shell | ||
npm version patch # or minor, major, etc | ||
git push --follow-tags | ||
``` | ||
[`npm version`](https://docs.npmjs.com/cli/v8/commands/npm-version) updates the | ||
version number automatically. You then need to push using `--follow-tags` | ||
(**NOT** `--tags``). | ||
The release process is done through a github action defined in | ||
`.workflows/publish.yml` which publishes to the npm registry automatically. | ||
## Architecture | ||
@@ -45,13 +124,1 @@ | ||
The backend is compiled with TypeScript directly. The simulator and frontend are bundled using webpack using the babel loader (with the typescript preset). | ||
## Development | ||
You can run `webxdc-dev` in development mode so that both frontend and backend | ||
are automatically recompiled when you change code. For frontend and simulator | ||
changes you need to reload your browser windows to see the effect. When you | ||
make a backend change, the entire server is restarted and a new browser window | ||
is opened. | ||
```sh | ||
npm run dev -- run /path/to/xdc | ||
``` |
41967
33
123