Flickr4Java
Flickr4Java copied to clipboard
How to run .ts file inside a turbo repo?
I have a turbo-repo project. My goal is to run "index.ts" file located in "./apps/backend/src/migrations/dbMigrations/index.ts". I've tried to run from "backend" folder with:
1, "ts-node --project tsconfig.json ./src/migrations/dbCollections/index.ts" but I receive:
TypeError: Unknown file extension ".ts" for ...\apps\backend\src\migrations\dbCollections\index.ts
- "node --loader ts-node/esm ./src/migrations/dbCollections/index.ts" but I receive:
triggerUncaughtException(
Waiting for the debugger to disconnect...
Error: ERR_UNSUPPORTED_DIR_IMPORT: ...index.ts
I import methods/objects from other ".ts" files. So maybe that's why I receive this error.
- "npx tsx .\src\migrations\dbCollections\index.ts" but I receive:
import { checkWrapperFieldMetadata } from "@monorepo/code-generator";
^
SyntaxError: The requested module '@monorepo/code-generator' does not provide an export named 'checkWrapperFieldMetadata'
I use imports from packages that I've wrote myself for the app.
Btw, my tsconfig.json looks like this:
{
"extends": "../../packages/tsconfig/base.json",
"compilerOptions": {
"moduleResolution": "Node",
"target": "es2016",
"module": "ESNext",
"experimentalDecorators": true,
"types": ["node", "express", "vite/client"],
}
}
The base.json looks like this:
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Default",
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"incremental": false,
"isolatedModules": true,
"lib": ["es2022", "DOM", "DOM.Iterable"],
"module": "NodeNext",
"moduleDetection": "force",
"moduleResolution": "NodeNext",
"noUncheckedIndexedAccess": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "ES2022"
}
}
I ran out of solutions. Can you help me please?
I want to be able to run any ".ts" from my turbo-repo regardless of what "imports" are inside the file.