@scopethis/lead-core
v2.3.38
Published
## Contents - [Lead Mappa core](#lead-mappa-core) - [Contents](#contents) - [What's this repo for?](#whats-this-repo-for) - [How do I get going?](#how-do-i-get-going) - [What about the frontend?](#what-about-the-frontend) - [What's the code styl
Downloads
59
Readme
Lead Mappa core
Contents
What's this repo for?
The source files in this repo act as the central module of functionality for the Lead Mappa Platform.
Code is organised around core elements (Domains). For example, a lead, a user, or a job. Each domain contains "adapters" that perform a single task, such as "update profile" or "assign lead".
There are no controllers. Just adapters that attempt to follow the Clean Architecture code style.
How do I get going?
To get going do the following:
The following will spin up a dockerised version of the database
- Local Supabase[Postgresql setup]
- Install Docker
- Install Supabase cli globally
cd supabase
supabase start
supabase reset
will undo any changes not captured in migration
The following will download and install the dependencies and then start the test watchers.
- Source code setup
npm install
npm run dev
❗🙀 Please note that when Supabase starts for the first time, it will provide keys that need to be placed in the appropriate env files. Subsequent start and stop commands will not change the keys. However, upgrading Supabase or asking Docker to download again will renew the keys.
What about the frontend?
The source files for the frontend and server are held in another repo. However, to ensure data integrity, with regard to testing, it makes sense to duplicate the migrations folder and start another instance of Supabase.
If you use "supabase-integration/supabase" as the directory name it will automatically be ignored by Git. You can then cd supabase-integration/supabase
and run supabase start
. Anything done in that folder will not be committed. So you can configure it differently to suit the frontend:
- config.toml: Change the port numbers (a must)
- config.toml: Change the project-id to "supabase-integration" (a must)
- seed.sql: Add whatever data is required to start
What's the code style?
None yet, however, there is an overall architecture that is being followed, so please stick to that. Dependency Injection is being used throughout, but this is done in a consistent manner so should be easy to follow.
Conventional commits are being used, and a linter is in place, which is triggered by commit hooks, so please follow that, or your commits will be rejected by the linter.
How do I release a version?
This package is consumed as an NPM library. So we have to build before we release:
npm run build
to test the code and compile everything- Commit this build to git
npm run release:[patch|minor|major]
to tag, create a release and publish to NPM.
How can I actually use the package?
The test files are a good place to start to understand how the package can be used. As well as this, each domain should have a README file detailing how it's used. The basic pattern of use is shown below
npm install @scopethis/lead-core
...
// commonjs
const container = require('@scopethis/lead-core').default
const result = container('DomainAdapter', data)
// ES6 - NOT PUBLISHED. Only used in this repo
import container from '../../src'
const result = await container('DomainAdapter', data)
// Where 'DomainAdpater' is the resolved functionality
// And data is the structured option passed to it