Skip to content

Commit

Permalink
feat: Improve DX when developing against another repo (#831)
Browse files Browse the repository at this point in the history
* feat: Add new start:yalc script

* chore: Exclude tests and build dirs from declarations

* chore: Don't emit types from base tsconfig

* fix: Make sure declarations are updated correctly with tsdx watch

There is an issue with some tsdx dependencies (the rollup typescript plugin)
that causes ts declarations to not be rebuilt when running tsdx.

See rollup/plugins#418

* fix: Specify CSS extract file

* doc: Update doc for developing w/ Reactist

* fix: Remove vestigial sentence and fix backticks
  • Loading branch information
pawelgrimm authored Jul 24, 2024
1 parent ca0c3ec commit c71e151
Show file tree
Hide file tree
Showing 6 changed files with 244 additions and 170 deletions.
51 changes: 35 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,36 +88,55 @@ 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.

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
```

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',
},
}
```

# re-install reactist from npm (-E avoids updating the version / package-lock.json)
npm install -E @doist/reactist
Then, to develop against Reactist, just run:

```sh
npm run dev:reactist
```

## Development tips and tricks
Expand Down
Loading

0 comments on commit c71e151

Please sign in to comment.