Skip to content

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:

local-dep-diag

The following projects are involved:

  • solution-kulfon (basically any solution created by running lime-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

  1. Navigate to lime-web-components/packages/lime-web-components folder.
  2. Build the project by running npm run build.
  3. Run npm link. This will register local lime-web-components in global node_modules. You can confirm that by running npm 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]
    └── ...
    
  4. Navigate to lime-crm-components root folder.

  5. Run npm link @limetech/lime-web-components.
  6. Done! Now local lime-crm-components should use local lime-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]
    └── ...
  1. Navigate to lime-webclient/frontend/webclient.
  2. Run npm link @limetech/lime-web-components @lundalogik/lime-crm-components.
  3. Navigate to lime-webclient/frontend/admin.
  4. Run again npm link @limetech/lime-web-components @lundalogik/lime-crm-components.
  5. Done! Now webclient and admin modules in local lime-webclient project should use local lime-crm-components and lime-web-components! ✨

3. Linking lime-core to lime-webclient

  1. Navigate to lime-webclient root folder.
  2. Open pyproject.toml.
  3. Modify line with lime-core dependency definition from something like lime-core = {version = "^23.233.0", allow-prereleases = true} to lime-core = {path = "<path_to_local_lime-core>"}.
  4. Save the file.
  5. Run poetry install.
  6. Done! Now lime-webclient should use local version of lime-core! ✨

4. Linking lime-core and lime-webclient to lime-crm

  1. Navigate to lime-crm root folder.
  2. Open pyproject.toml.
  3. Modify line with lime-core dependency definition from something like lime-core = {version = "^23.233.0", allow-prereleases = true} to lime-core = {path = "<path_to_local_lime-core>"}.
  4. Modify line with lime-webclient dependency definition from something like lime-webclient = ">=46.360.2,<47" to lime-webclient = {path = "<path_to_local_lime-webclient>"}.
  5. Save the file.
  6. Run poetry install.
  7. Done! Now lime-crm should use local versions of lime-core and lime-webclient! ✨

5. Linking lime-crm to solution-kulfon

  1. Navigate to solution-kulfon root folder.
  2. Open pyproject.toml.
  3. Modify line with lime-crm dependency definition from something like lime-crm = "^2.322.0" to lime-crm = {path = "<path to local">}.
  4. Save the file.
  5. Run poetry install.
  6. Done! Now solution-kulfon should use local version of lime-crm! ✨

Running solution

Using full setup with solution-kulfon

  1. Navigate to lime-crm-components root folder and run npm start.
  2. In separate terminal navigate to lime-webclient/frontend/webclient and run npm start.
  3. In separate terminal navigate to lime-webclient/frontend/admin and run npm start (if you need the access to the admin page).
  4. In separate terminal navigate to solution-kulfon and run FLASK_ENV=development poetry run flask run or run the server in the debugging mode in VSCode.

Using lime-webclient only

  1. Navigate to lime-crm-components root folder and run npm start.
  2. In separate terminal navigate to lime-webclient/frontend/webclient and run npm start.
  3. In separate terminal navigate to lime-webclient/frontend/admin and run npm start (if you need the access to the admin page).
  4. In separate terminal navigate to lime-webclient and run poetry run flask run or run the server in the debugging mode in VSCode.

General notes

  1. pyproject.toml is versioned file, so make sure to not push changes that relate to linking local Python dependencies.
  2. 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.
  3. Running npm install after linking local JavaScript dependencies will reset them according to a project's package.json, so you will need to link them to a dependant project again.
Back to top