feat(cli): check 'cdylib' in crate-type

This commit is contained in:
LongYinan 2020-12-22 15:14:29 +08:00
parent 5f2bea0b97
commit 754462238a
No known key found for this signature in database
GPG key ID: A3FFE134A3E20881

View file

@ -106,6 +106,14 @@ export class BuildCommand extends Command {
} else {
throw new TypeError('No package.name field in Cargo.toml')
}
if (!tomlContent.lib?.['crate-type']?.includes?.('cdylib')) {
throw new TypeError(
`Missing ${chalk.green('create-type = ["cdylib"]')} in ${chalk.green(
'[lib]',
)}`,
)
}
}
debug(`Dylib name: ${chalk.greenBright(dylibName)}`)