bde148f286
* wip * some extra fixes * stuff kinda works? * need to figure out mocks * need to figure out mocks * fix db listener * gqlgen fix * minor gqlgen watch adjustment * lint fixes * delete old codegen file * converting migrations to ESM * getModuleDIrectory * vitest sort of works * added back ts-vitest * resolve gql double load * fixing test timeout configs * TSC lint fix * fix automate tests * moar debugging * debugging * more debugging * codegen update * server works * yargs migrated * chore(server): getting rid of global mocks for Server ESM (#5046) * got rid of email mock * got rid of comment mocks * got rid of multi region mocks * got rid of stripe mock * admin override mock updated * removed final mock * fixing import.meta.resolve calls * another import.meta.resolve fix * added requested test * nyc ESM fix * removed unneeded deps + linting * yarn lock forgot to commit * tryna fix flakyness * email capture util fix * sendEmail fix * fix TSX check * sender transporter fix + CR comments * merge main fix * test fixx * circleci fix * gqlgen bigint fix * error formatter fix * more error formatting improvements * esmloader added to Dockerfile * more dockerfile fixes * bg jobs fix
17 lines
665 B
JavaScript
17 lines
665 B
JavaScript
import path from 'node:path'
|
|
import { fileURLToPath } from 'url'
|
|
|
|
// Conditionally change appRoot and packageRoot according to whether we're running from /dist/ or not (ts-node)
|
|
const isTsNode =
|
|
!!process[Symbol.for('ts-node.register.instance')] ||
|
|
process.env.VITEST === 'true' ||
|
|
(process._preload_modules || []).some((m) => m.match(/node_modules\/tsx\//)) // tsx running
|
|
|
|
const __filename = fileURLToPath(import.meta.url)
|
|
const __dirname = path.dirname(__filename)
|
|
|
|
const packageRoot = __dirname // we know this file is located in the package root
|
|
const appRoot = isTsNode ? packageRoot : path.resolve(packageRoot, 'dist')
|
|
|
|
export { appRoot, packageRoot }
|