diff --git a/cli/src/build.ts b/cli/src/build.ts index e1f6ee4d..6ac79586 100644 --- a/cli/src/build.ts +++ b/cli/src/build.ts @@ -110,6 +110,10 @@ export class BuildCommand extends Command { )} file, relative to cwd`, }) + noDtsHeader = Option.Boolean('--no-dts-header', false, { + description: `Don't generate ${chalk.green('.d.ts')} header`, + }) + project = Option.String('-p', { description: `Bypass to ${chalk.green('cargo -p')}`, }) @@ -497,6 +501,7 @@ export class BuildCommand extends Command { const idents = await processIntermediateTypeFile( intermediateTypeFile, dtsFilePath, + this.noDtsHeader, ) await writeJsBinding( binaryName, @@ -545,6 +550,7 @@ interface TypeDef { async function processIntermediateTypeFile( source: string, target: string, + noDtsHeader: boolean, ): Promise { const idents: string[] = [] if (!existsSync(source)) { @@ -654,7 +660,9 @@ async function processIntermediateTypeFile( return acc + `export namespace ${mod} {\n${convertDefs(defs, true)}}\n` }, '') - const dtsHeader = `/* tslint:disable */ + const dtsHeader = noDtsHeader + ? '' + : `/* tslint:disable */ /* eslint-disable */ /* auto-generated by NAPI-RS */\n