fix: Fixes broken windows tests (#607)
This commit is contained in:
parent
f60938079a
commit
6e06f8f3c6
|
@ -177,21 +177,23 @@ export class TypegenPrinter {
|
|||
)
|
||||
}
|
||||
|
||||
if (isNodeModule(rootTypePath)) {
|
||||
if (path.isAbsolute(rootTypePath)) {
|
||||
if (!fs.existsSync(rootTypePath)) {
|
||||
throw new Error(`Root typing path ${rootTypePath} for the type ${typeName} does not exist`)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
require.resolve(rootTypePath)
|
||||
} catch (e) {
|
||||
throw new Error(`Module ${rootTypePath} for the type ${typeName} does not exist`)
|
||||
}
|
||||
} else if (!fs.existsSync(rootTypePath)) {
|
||||
throw new Error(`Root typing path ${rootTypePath} for the type ${typeName} does not exist`)
|
||||
}
|
||||
|
||||
const importPath = isNodeModule(rootTypePath)
|
||||
? rootTypePath
|
||||
: relativePathTo(rootTypePath, outputPath)
|
||||
const importPath = path.isAbsolute(rootTypePath)
|
||||
? relativePathTo(rootTypePath, outputPath)
|
||||
.replace(/(\.d)?\.ts/, '')
|
||||
.replace(/\\+/g, '/')
|
||||
: rootTypePath
|
||||
|
||||
importMap[importPath] = importMap[importPath] || new Set()
|
||||
importMap[importPath].add(rootType.alias ? `${rootType.name} as ${rootType.alias}` : rootType.name)
|
||||
|
|
Loading…
Reference in New Issue