@trm-market-pulse/shared-types
v1.0.14
Published
Shared types, enums, and interfaces for Tracker projects
Readme
@trm-market-pulse/shared-types
Shared types, enums, and interfaces for Tracker projects.
How to publish a new version?
npm publish --access public --scope=@trm-market-pulseInstallation
This is a private package. You can install it using one of the following methods:
Option 1: Install from Git Repository (Recommended for Serverless Functions)
If you have a private Git repository (GitHub, GitLab, Bitbucket), you can install directly from it:
# Using npm
npm install git+https://github.com/your-org/shared-types.git
# Using pnpm
pnpm add git+https://github.com/your-org/shared-types.git
# Using yarn
yarn add git+https://github.com/your-org/shared-types.git
# For a specific branch or tag
pnpm add git+https://github.com/your-org/shared-types.git#branch-name
pnpm add git+https://github.com/your-org/shared-types.git#v1.0.0For serverless functions, this is the recommended approach as it works seamlessly during deployment.
Option 2: Install from Private npm Registry
If you're using a private npm registry (GitHub Packages, npm Enterprise, etc.):
Publish the package to your registry:
npm publish --registry=https://npm.pkg.github.comConfigure authentication in your
.npmrcor serverless environment:@trm-market-pulse:registry=https://npm.pkg.github.com //npm.pkg.github.com/:_authToken=YOUR_TOKENInstall the package:
npm install @trm-market-pulse/shared-types
Option 3: Install from Local Path (Development)
For local development, you can link the package:
# In the shared-types package directory
pnpm link
# In your project directory
pnpm link @trm-market-pulse/shared-typesUsage
// Import everything
import {
Currencies,
RateSource,
IUser,
ITrmRate,
BaseError,
BusinessError
} from '@trm-market-pulse/shared-types';
// Or import specific modules
import { Currencies } from '@trm-market-pulse/shared-types';
import { IUser } from '@trm-market-pulse/shared-types';Development
Building
pnpm install
pnpm buildThis will compile TypeScript files to the dist directory.
Publishing
Before publishing, make sure to:
- Update the version in
package.json - Build the package:
pnpm build - Publish to your registry or push to Git
Structure
enums/- TypeScript enumserrors/- Custom error classesinterfaces/entities/- Entity interfacesinterfaces/general/- General utility interfacesinterfaces/repositories/- Repository interfacesinterfaces/services/- Service interfaces
Serverless Functions Setup
For serverless functions (AWS Lambda, Vercel, etc.), ensure your deployment configuration can access the Git repository:
AWS Lambda / Serverless Framework
Add to your serverless.yml:
package:
patterns:
- '!node_modules/**'
- 'node_modules/@trm-market-pulse/shared-types/**'Vercel
Vercel automatically installs dependencies from Git during build. Make sure your repository is accessible and the build has the necessary permissions.
Environment Variables
If using a private npm registry, set these in your serverless environment:
NPM_TOKEN- Your npm authentication tokenNPM_REGISTRY- Your private registry URL (if different from default)