Mono-repo for all the components of the swap-ease project. A project that enables people to arbitrage trade NFT tokens using insightful data.
// TODO: Maybe we can have the scatter plot switch between native and USD prices // TODO: Follow this for alias resolutions ilearnio/module-alias#74
All components use environment variable files. Each README within a component specifies which ENV variables are needed. Go to each component listed below and make sure to create the necessary .env variable file for each.
Current components:
-
/services:/add-collection/gql-service/sale-ingestor
-
/clients:/swap-ease
This mono-repo is managed by npm workspaces. All we need to do to install dependencies:
// In root folder
npm install
All packages and components need to be built, so run:
// In root folder
npm run build
This will run the build command within every Typescript component, starting with the packages and then the components.
For information about setting up the cluster-collection service, start here
Here is the current list of local packages used:
-
libraries:data: A package containing common data patterns and models used across different components within the swap-ease mono-repo.utils: A package containing common utilities used across different components within the swap-ease mono-repo.
If a new package is needed, we can add one using these instructions:
- Under
/librariescreate a new folder for the package
mkdir new_package
- Step into the new folder and initialize a new
package.jsonfile:
npm init
- Install these devDependencies in
new_package:
npm install ts-node tsup npm-run-all prettier rimraf typescript
- Add these scripts within
package.json:
"scripts": {
"clean": "rimraf ./dist",
"format": "npx prettier --write src",
"build": "npm-run-all clean format && tsc && tsup"
}- Create a
tsconfig.jsonfile:
// Ensure that `outDir` is set to `dist`
// You can copy one of the existing tsconfig.json files from the other packages.
// OR
tsc --init
- Create a
tsup.config.tsfile and copy these contents into the file:
import { defineConfig } from 'tsup';
export default defineConfig({
entry: ['src/index.ts'],
format: ['cjs', 'esm'], // Build for commonJS and ESmodules
dts: true, // Generate declaration file (.d.ts)
splitting: false,
sourcemap: true,
clean: true,
});- Finally, create
/srcand/src/index.tsand everything should be setup
We have some components that use our local packages as dependencies. For example, /libraries/data is a dependency in /services/add-collection, /services/gql-service, and /services/sale-ingestor.
If we have a local package under /libraries titled new_package, we can add it to /services/component like so:
npm install ./libraries/new_package -w ./services/component