Open andersea opened 6 years ago
I have found the cause of this.
The error occurs in lib/definitely-typed.ts
.
export default function writeDefinitelyTypedPackage(
indexDtsContent: string, packageName: string, overwrite: boolean): void {
const packageDir = joinPaths("types", packageName);
// Check for overwrite
if (!overwrite) {
if (existsSync(packageDir)) {
console.log(`Directory ${packageDir} already exists and -overwrite was not specified; exiting.`);
process.exit(2);
}
}
if (!existsSync(packageDir)) {
- mkdirSync(packageDir);
}
run(indexDtsContent, packageName, packageDir).catch(e => {
console.error(e);
process.exit(1);
});
}
The code expects dts-gen to be run from the DefinitelyTyped root directory, so it expects that the types directory already exists, when it doesn't, mkdir fails because it can't create nested directory structures.
I don't think this is the best assumption to make. From my perspective, trying to create my first type definition file and just testing things out, I probably do not want to mess with the entire DefinitelyTyped repository yet. I just want a directory with the necessary files created.
For now, I can work around this by creating the types directory manually and running the command from the directory above.
Anyone know a workaround? I'm trying to make my first types package for a pre-existing lib and cannot for the life of me figure out how to get it to work: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/30238
Also I'm not going to start installing packages globally just so I can make typings that I don't even need but am just wanting to make for other people. Is this really necessary?
I am doing this. I have same concern as @kylegoetz . Any suggestions , how do I do it for the local node_modules directory ?
Hi. I am trying to generate typings for Node-RED.
I get a crash. Here is the printout -