diff --git a/package.json b/package.json index e169b46f..a24e7b1c 100644 --- a/package.json +++ b/package.json @@ -4,13 +4,14 @@ "packageManager": "pnpm@9.1.0", "scripts": { "xcode": "xed ./apps/mobile/metro-now", - "build": "pnpm --recursive --parallel run build", "dev": "pnpm --recursive --parallel run dev", + "prebuild": "pnpm run -r --filter @metro-now/constants build", + "build": "pnpm --recursive --parallel run build", "backend:build": "pnpm run -r --filter @metro-now/backend build", "backend:dev": "pnpm run -r --filter @metro-now/backend dev", "web:dev": "pnpm run -r --filter @metro-now/web dev", "precommit": "pnpm format", - "format": "pnpm -r format && pnpm exec prettier . --write", + "format": "pnpm --recursive --parallel format && pnpm exec prettier . --write", "format:check": "pnpm -r format:check && pnpm exec prettier . --check", "docker:up:dev": "docker compose up postgres redis-stack", "docker:up": "docker compose up -d --build", diff --git a/packages/constants/.gitignore b/packages/constants/.gitignore new file mode 100644 index 00000000..53c37a16 --- /dev/null +++ b/packages/constants/.gitignore @@ -0,0 +1 @@ +dist \ No newline at end of file diff --git a/packages/constants/package.json b/packages/constants/package.json index 6cbb53d1..f55a07f3 100644 --- a/packages/constants/package.json +++ b/packages/constants/package.json @@ -1,4 +1,20 @@ { "name": "@metro-now/constants", - "packageManager": "pnpm@9.1.0" + "packageManager": "pnpm@9.1.0", + "files": [ + "dist" + ], + "types": "./dist/esm/src/index.d.ts", + "exports": { + "require": "./dist/cjs/src/index.js", + "import": "./dist/esm/src/index.js" + }, + "scripts": { + "build": "pnpm run --parallel --filter @metro-now/constants \"/(build:cjs|build:esm)/\"", + "build:cjs": "tsc --project tsconfig.cjs.json", + "build:esm": "tsc --project tsconfig.esm.json" + }, + "devDependencies": { + "typescript": "^5" + } } diff --git a/packages/constants/index.ts b/packages/constants/src/index.ts similarity index 81% rename from packages/constants/index.ts rename to packages/constants/src/index.ts index b598f06c..4a752be8 100644 --- a/packages/constants/index.ts +++ b/packages/constants/src/index.ts @@ -5,11 +5,11 @@ export { SWAGGER_JSON_URL, SWAGGER_PATH, SWAGGER_URL, -} from "./src/api"; +} from "./api"; export { API_URL, APPSTORE_URL, HOMEPAGE_URL, SOURCE_CODE_URL, -} from "./src/external"; +} from "./external"; diff --git a/packages/constants/tsconfig.cjs.json b/packages/constants/tsconfig.cjs.json new file mode 100644 index 00000000..ec3353b3 --- /dev/null +++ b/packages/constants/tsconfig.cjs.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "CommonJS", + "outDir": "./dist/cjs/" + } +} diff --git a/packages/constants/tsconfig.esm.json b/packages/constants/tsconfig.esm.json new file mode 100644 index 00000000..cc19e14d --- /dev/null +++ b/packages/constants/tsconfig.esm.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "ESNext", + "outDir": "./dist/esm/" + } +} diff --git a/packages/constants/tsconfig.json b/packages/constants/tsconfig.json new file mode 100644 index 00000000..bee35f68 --- /dev/null +++ b/packages/constants/tsconfig.json @@ -0,0 +1,18 @@ +{ + "include": ["src/**/*"], + "compilerOptions": { + "moduleResolution": "Node", + "target": "ES2022", + "declaration": true, + "removeComments": true, + "allowSyntheticDefaultImports": true, + "incremental": true, + "composite": true, + + "strict": true, + "strictPropertyInitialization": false, + + "outDir": "dist", + "baseUrl": "." + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 09011a9e..e67bb567 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -212,7 +212,11 @@ importers: specifier: ^5 version: 5.6.2 - packages/constants: {} + packages/constants: + devDependencies: + typescript: + specifier: ^5 + version: 5.6.2 packages: