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

feat: Improve DX when developing against another repo #831

Merged
merged 7 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
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.
pawelgrimm marked this conversation as resolved.
Show resolved Hide resolved

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:
pawelgrimm marked this conversation as resolved.
Show resolved Hide resolved

```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
```
````
pawelgrimm marked this conversation as resolved.
Show resolved Hide resolved

**Note:** This will **not** update the docs. In case you want to update the docs you need to run:

Expand Down
Loading
Loading