Skip to content

Commit

Permalink
doc: Update doc for developing w/ Reactist
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelgrimm committed Jul 22, 2024
1 parent 051bae5 commit c42efd6
Showing 1 changed file with 36 additions and 16 deletions.
52 changes: 36 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,45 +88,65 @@ This boots up a development server with hot reloading on http://localhost:6006.

## Inside your application

For the second development mode you can leverage `npm link`. First run:
For the second development mode you can leverage `npm start:yalc`. First, make sure you have `yalc` installed globally:

```shell
npm install -g yalc
```

Then, in the reactist repository run:

```sh
npm run start
npm run start:yalc
```

this will update the build artifacts whenever you change something.
this will publish Reactist to `yalc` and watch for changes.

In your real application you need to first delete the current _@doist/reactist_ dependency and then link to your local one.
In your host application you can then link to your local Reactist version:

```sh
cd ~/your-app
# delete current reactist dependency
rm -rf ./node_modules/@doist/reactist

# link local reactist version
npm link ../reactist
yalc add @doist/reactist
```

The relative path to reactist may need to be changed to match your local environment.
In your real application you need to first delete the current _@doist/reactist_ dependency and then link to your local one.

To undo the changes and switch back to the reactist version from npm do the following:
To undo the changes and switch back to the reactist version from npm, do the following:

```sh
cd ~/your-app
# first remove linked reactist dependency
rm -rf ./node_modules/@doist/reactist
# restore the original reactist version
yalc remove @doist/reactist
# re-install reactist from npm
npm install
```

# re-install reactist from npm (-E avoids updating the version / package-lock.json)
npm install -E @doist/reactist
For convenience, you can add a `dev:reactist` script in your host application to automate the process of adding and removing the local Reactist version:

```json5
{
// ...
scripts: {
// ...
'predev:reactist': 'yalc add @doist/reactist',
'dev:reactist': 'npm run dev', // or whatever your development script is
'postdev:reactist': 'yalc remove @doist/reactist && npm i',
},
}
```

Then, to develop against Reactist, just run `npm run dev:reactist`.

````sh


## Development tips and tricks

Independent of the development you operate in to produce a new build (e.g. before submitting a PR) run:

```sh
npm run build
```
````
**Note:** This will **not** update the docs. In case you want to update the docs you need to run:
Expand Down

0 comments on commit c42efd6

Please sign in to comment.