Use require resolve

This commit is contained in:
Rémi de Juvigny 2021-11-04 12:42:37 +01:00
parent 97defacf47
commit ca729a8f68

View File

@ -51,7 +51,9 @@ async function downloadNpmTemplate({ name, version }, parentDir) {
});
// Return the path of the actual template
const exactTemplatePath = path.resolve(parentDir, 'node_modules', name);
const exactTemplatePath = path.dirname(
require.resolve(path.join(name, 'package.json'), { paths: [parentDir] })
);
return exactTemplatePath;
}