This guide explains how to link local dependencies into a Lime CRM solution.
Info
Linking local dependencies is super helpful when you're developing your solution,. It's useful when doing end-to-end testing, debugging, and before making commits / PRs / releases.
The diagram below presents a convenient setup for most developers in Lime CRM:
The following projects are involved:
solution-kulfon
(basically any solution created by runninglime-project new solution
)lime-crm
lime-core
lime-webclient
lime-crm-components
lime-web-components
Prerequisite¶
Ensure all projects are cloned and installed according to instructions which can be found in relevant repositories.
Setup¶
Setup consists of few steps that depend on each other. Linking all local dependencies is optional and you can skip linking any of npm module / Python package. In such case you need to do this consequently, so if you decide to not link e.g. local lime-web-components
then you should not attach this module in lime-crm-components
and lime-webclient
, to have consistent setup. Also you can skip steps 4 and 5 if you are not using any "solution" and want to run lime-webclient
directly.
1. Linking lime-web-components
to lime-crm-components
¶
- Navigate to
lime-web-components/packages/lime-web-components
folder. - Build the project by running
npm run build
. -
Run
npm link
. This will register locallime-web-components
in globalnode_modules
. You can confirm that by runningnpm list --global
. It should look similarly to:/home/kulfon/.nvm/versions/node/v16.10.0/lib ├── @limetech/[email protected] -> ./../../../../../Projects/src/lime-web-components/packages/lime-web-components ├── [email protected] ├── [email protected] └── ...
-
Navigate to
lime-crm-components
root folder. - Run
npm link @limetech/lime-web-components
. - Done! Now local
lime-crm-components
should use locallime-web-components
! ✨
2. Linking lime-web-components
and lime-crm-components
to lime-webclient
¶
Assuming lime-web-components
is already installed in global node_modules
:
1. Navigate to lime-crm-components
root folder.
2. Run npm link
. This will register local lime-crm-components
in global node_modules
. You can confirm that by running npm list --global
.
/home/kulfon/.nvm/versions/node/v16.10.0/lib
├── @limetech/[email protected] -> ./../../../../../Projects/src/lime-web-components/packages/lime-web-components
├── @lundalogik/[email protected] -> ./../../../../../Projects/src/lime-crm-components
├── [email protected]
├── [email protected]
└── ...
- Navigate to
lime-webclient/frontend/webclient
. - Run
npm link @limetech/lime-web-components @lundalogik/lime-crm-components
. - Navigate to
lime-webclient/frontend/admin
. - Run again
npm link @limetech/lime-web-components @lundalogik/lime-crm-components
. - Done! Now
webclient
andadmin
modules in locallime-webclient
project should use locallime-crm-components
andlime-web-components
! ✨
3. Linking lime-core
to lime-webclient
¶
- Navigate to
lime-webclient
root folder. - Open
pyproject.toml
. - Modify line with
lime-core
dependency definition from something likelime-core = {version = "^23.233.0", allow-prereleases = true}
tolime-core = {path = "<path_to_local_lime-core>"}
. - Save the file.
- Run
poetry install
. - Done! Now
lime-webclient
should use local version oflime-core
! ✨
4. Linking lime-core
and lime-webclient
to lime-crm
¶
- Navigate to
lime-crm
root folder. - Open
pyproject.toml
. - Modify line with
lime-core
dependency definition from something likelime-core = {version = "^23.233.0", allow-prereleases = true}
tolime-core = {path = "<path_to_local_lime-core>"}
. - Modify line with
lime-webclient
dependency definition from something likelime-webclient = ">=46.360.2,<47"
tolime-webclient = {path = "<path_to_local_lime-webclient>"}
. - Save the file.
- Run
poetry install
. - Done! Now
lime-crm
should use local versions oflime-core
andlime-webclient
! ✨
5. Linking lime-crm
to solution-kulfon
¶
- Navigate to
solution-kulfon
root folder. - Open
pyproject.toml
. - Modify line with
lime-crm
dependency definition from something likelime-crm = "^2.322.0"
tolime-crm = {path = "<path to local">}
. - Save the file.
- Run
poetry install
. - Done! Now
solution-kulfon
should use local version oflime-crm
! ✨
Running solution¶
Using full setup with solution-kulfon
¶
- Navigate to
lime-crm-components
root folder and runnpm start
. - In separate terminal navigate to
lime-webclient/frontend/webclient
and runnpm start
. - In separate terminal navigate to
lime-webclient/frontend/admin
and runnpm start
(if you need the access to the admin page). - In separate terminal navigate to
solution-kulfon
and runFLASK_ENV=development poetry run flask run
or run the server in the debugging mode in VSCode.
Using lime-webclient
only¶
- Navigate to
lime-crm-components
root folder and runnpm start
. - In separate terminal navigate to
lime-webclient/frontend/webclient
and runnpm start
. - In separate terminal navigate to
lime-webclient/frontend/admin
and runnpm start
(if you need the access to the admin page). - In separate terminal navigate to
lime-webclient
and runpoetry run flask run
or run the server in the debugging mode in VSCode.
General notes¶
pyproject.toml
is versioned file, so make sure to not push changes that relate to linking local Python dependencies.- Alternative way of linking local Python dependencies is running
poetry add <path_to_dependency>
. If you already have the remote package in your venv-folder you might have to remove it manually first. - Running
npm install
after linking local JavaScript dependencies will reset them according to a project'spackage.json
, so you will need to link them to a dependant project again.