-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added developer.md for setting up development environment (#5230)
- Added a few scripts to facilitate using npm link - Editted rollup.config.js to allow to a quicker cut down dev build
- Loading branch information
Showing
3 changed files
with
92 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
## Local Development | ||
|
||
This document intends to establish a series of steps to take in order to set up a local environment for developing on the primereact components with live reload, quick builds, and incremental builds. | ||
|
||
## Instructions | ||
|
||
You must have a local copy of this repository somewhere on your machine. From that repository. Before starting, make sure that the version for your `primereact/package.json` is a [valid semantic version](https://docs.npmjs.com/about-semantic-versioning) and does not contain a suffix such as `-SNAPSHOT`. | ||
|
||
Once that is done, you will run: | ||
|
||
```shell | ||
~/primereact/ $ npm run build:lib:dev | ||
``` | ||
|
||
This will alter the bundler to only emit non-minified esm modules. The aliasing plugin has also been disabled for components. Once everything has been bundled (this can take a few minutes) you should keep this command running. It will allow for incremental builds as you develop in the `primereact/` directory. It will be finished when the terminal displays: `[20xx-xx-xx 00:00:00] waiting for changes...`. | ||
|
||
You will now `cd` into the `primereact/dist` directory and run: | ||
|
||
```shell | ||
~/primereact/dist/ $ npm link | ||
``` | ||
|
||
This will create a symlink in your global npm scope so that other local packages will rely on this version of primereact when built. You can verify that the package is linked by running this from the `primereact` directory. | ||
|
||
```shell | ||
~/primereact/ $ npm ls -g --depth=0 --link=true | ||
|
||
/opt/homebrew/lib | ||
└── [email protected] -> ./../../../Users/${user}/primereact/dist # <-- this must be in the dist/ dir !!! | ||
``` | ||
|
||
**Reminder! the XX.X.XX version must be a valid [valid semantic version](https://docs.npmjs.com/about-semantic-versioning) that you are using in your local project** | ||
|
||
### Now change your directory to your local project you are developing on! | ||
|
||
```shell | ||
~/primereact/dist/ $ cd ~/my-cool-project | ||
~/my-cool-project/ $ | ||
``` | ||
|
||
The goal now is to link your primereact dependency to the symlink that we configured earlier: | ||
|
||
```shell | ||
~/my-cool-project/ $ npm link primereact | ||
``` | ||
|
||
As long at the dependencies version that you symlinked satisfies the version that is specified in `my-cool-project/package.json` then the link should have worked. | ||
|
||
You can validate that by running: | ||
|
||
```shell | ||
~/my-cool-project/ $ npm ls --link=true | ||
|
||
[email protected] /Users/${user}/my-cool-project | ||
└── primereact@npm:[email protected] -> ./../../primereact/dist # <-- this must be in the dist/ dir !!! | ||
``` | ||
|
||
### Congratulations! | ||
|
||
You can now live develop in the `primereact/` directory and your changes should be represented in your `my-cool-project/` build. (Assuming you are running vite or another bundler for `my-cool-project`) | ||
|
||
### Cleanup | ||
|
||
Once done, you can cleanup with: | ||
|
||
```shell | ||
~/primereact/ $ npm unlink | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters