@napi-rs/cli
Version:
Cli tools for napi-rs
75 lines (65 loc) • 1.77 kB
text/typescript
// This file is generated by codegen/index.ts
// Do not edit this file manually
import { Command, Option } from 'clipanion'
export abstract class BaseVersionCommand extends Command {
static paths = [['version']]
static usage = Command.Usage({
description: 'Update version in created npm packages',
})
cwd = Option.String('--cwd', process.cwd(), {
description:
'The working directory of where napi command will be executed in, all other paths options are relative to this path',
})
configPath?: string = Option.String('--config-path,-c', {
description: 'Path to `napi` config json file',
})
packageJsonPath = Option.String('--package-json-path', 'package.json', {
description: 'Path to `package.json`',
})
npmDir = Option.String('--npm-dir', 'npm', {
description: 'Path to the folder where the npm packages put',
})
getOptions() {
return {
cwd: this.cwd,
configPath: this.configPath,
packageJsonPath: this.packageJsonPath,
npmDir: this.npmDir,
}
}
}
/**
* Update version in created npm packages
*/
export interface VersionOptions {
/**
* The working directory of where napi command will be executed in, all other paths options are relative to this path
*
* @default process.cwd()
*/
cwd?: string
/**
* Path to `napi` config json file
*/
configPath?: string
/**
* Path to `package.json`
*
* @default 'package.json'
*/
packageJsonPath?: string
/**
* Path to the folder where the npm packages put
*
* @default 'npm'
*/
npmDir?: string
}
export function applyDefaultVersionOptions(options: VersionOptions) {
return {
cwd: process.cwd(),
packageJsonPath: 'package.json',
npmDir: 'npm',
...options,
}
}