nexus icon indicating copy to clipboard operation
nexus copied to clipboard

typegen generation corrupted with prisma>2.12 (with patch code workaround)

Open simonjoom opened this issue 2 years ago • 0 comments

i found a general issue with nexus and prisma>2.12.

it s relatif to a breaking change, nexus is buggy from here breaking change happened with 2.12.0 https://github.com/prisma/prisma/issues/5573

i replaced some line in the file typegenautoconfig for a workaround

 if (matched) { 
const mymatch=(type)=>{
    return [new RegExp(`\\*\\*${type.name}\\*\\* model`, 'g')];
}
                        const typeReg = mymatch(type); 
                    const matched2 = firstMatch(fileContents,typeReg)
                        if (debug) {
                            if(matched2)
                        utils_1.log(`Matched type - ${typeName} in "${importPath}" - ${alias}.${matched[1]}`);
                        else
                         utils_1.log(`Matched type - ${typeName} in "${importPath}" - ${alias}.Prisma.${matched[1]}`);
                        }
               
                        importsMap[alias] = [importPath, glob];
                        sourceTypeMap[typeName] = (matched2)?`${alias}.${matched[1]}`:`${alias}.Prisma.${matched[1]}`;
                    }.
...

simonjoom avatar May 31 '22 10:05 simonjoom