@janooma/commons
v0.6.0
Published
Common constants, types and utilities shared across Janooma applications
Maintainers
Readme
@janooma/commons
Shared constants, types, and utilities for all Janooma applications.
Installation
npm install @janooma/commonsUsage
Application registry
import {
getApplicationName,
getApplication,
APPLICATIONS,
APP_ID_ADMIN,
APP_ID_SELLER,
APP_ID_SHOP,
} from '@janooma/commons';
// Get canonical display name (PROD name)
getApplicationName(1); // → "Janooma Administration"
getApplicationName(2); // → "Janooma Sellers"
getApplicationName(3); // → "Janooma"
// Get full application config for a specific environment
getApplication(1, 'LOCAL');
// → { id: 1, app_name: "Janooma Administration", login_redirect_url: "http://localhost:7001/...", ... }
getApplication(1, 'PROD');
// → { id: 1, app_name: "Janooma Administration", login_redirect_url: "https://admin.janooma.com/...", ... }Types
import type { Application, ApplicationEnvironment } from '@janooma/commons';
const app: Application = getApplication(1, 'PROD')!;
const env: ApplicationEnvironment = 'LOCAL'; // 'LOCAL' | 'DEV' | 'UAT' | 'PROD'Application IDs
| Constant | ID | Description |
|------------------|----|---------------------------|
| APP_ID_ADMIN | 1 | Janooma Administration |
| APP_ID_SELLER | 2 | Janooma Sellers |
| APP_ID_SHOP | 3 | Janooma (Shop) |
Registered Environments
LOCAL— local developmentDEV— development environmentUAT— user-acceptance testingPROD— production
Building
npm run buildPublishing
npm publish --access publicLocal development (npm link)
# In the commons repo:
cd commons
npm install
npm run build
npm link
# In consumer repos:
cd admin-react
npm link @janooma/commons
cd admin-api
npm link @janooma/commons