feat(cli): add build option to not include the header in dts file (#1140)
* Add build option to not include the header in dts file * Fix lint
This commit is contained in:
parent
4f422b6625
commit
c39060984d
1 changed files with 9 additions and 1 deletions
|
@ -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<string[]> {
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue