Skip to content

Commit

Permalink
fix: user app without tsconfig.json
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Dec 10, 2023
1 parent 9362a50 commit 7d3b0d0
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions telefunc/node/server/shield/codegen/generateShield.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ function getProject(telefuncFilePath: string, telefuncFileCode: string, appRootD
strict: true
}
})

assert(!project.getSourceFile(telefuncFilePath))
project.createSourceFile(
telefuncFilePath,
telefuncFileCode,
// We need `overwrite` because `telefuncFilePath` already exists on the filesystem
{ overwrite: true }
)
} else {
project = projects[key] = new Project({
tsConfigFilePath,
Expand All @@ -75,10 +67,19 @@ function getProject(telefuncFilePath: string, telefuncFileCode: string, appRootD
// This source file is used for evaluating the template literal types' values
project.createSourceFile(typeToShieldFilePath, getTypeToShieldSrc())
}

const project = projects[key]!
objectAssign(project, { tsConfigFilePath })

if (!tsConfigFilePath) {
assert(!project.getSourceFile(telefuncFilePath))
project.createSourceFile(
telefuncFilePath,
telefuncFileCode,
// We need `overwrite` because `telefuncFilePath` already exists on the filesystem
{ overwrite: true }
)
}

const shieldGenFilePath = path.join(
path.dirname(telefuncFilePath),
`__telefunc_shieldGen_${path.basename(telefuncFilePath)}`
Expand Down

0 comments on commit 7d3b0d0

Please sign in to comment.