diff --git a/automation/capitanodoc/utils.ts b/automation/capitanodoc/utils.ts index 8108d263..28875bb4 100644 --- a/automation/capitanodoc/utils.ts +++ b/automation/capitanodoc/utils.ts @@ -15,41 +15,9 @@ * limitations under the License. */ -import type { OptionDefinition } from 'capitano'; -import * as ent from 'ent'; import * as fs from 'fs'; import * as readline from 'readline'; -export function getOptionPrefix(signature: string) { - if (signature.length > 1) { - return '--'; - } else { - return '-'; - } -} - -export function getOptionSignature(signature: string) { - return `${getOptionPrefix(signature)}${signature}`; -} - -export function parseCapitanoOption(option: OptionDefinition): string { - let result = getOptionSignature(option.signature); - - if (Array.isArray(option.alias)) { - for (const alias of option.alias) { - result += `, ${getOptionSignature(alias)}`; - } - } else if (typeof option.alias === 'string') { - result += `, ${getOptionSignature(option.alias)}`; - } - - if (option.parameter) { - result += ` <${option.parameter}>`; - } - - return ent.encode(result); -} - export class MarkdownFileParser { constructor(public mdFilePath: string) {} diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 4c759753..89f9ec09 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1331,9 +1331,9 @@ } }, "node_modules/@babel/traverse/node_modules/@babel/generator": { - "version": "7.24.9", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.9.tgz", - "integrity": "sha512-G8v3jRg+z8IwY1jHFxvCNhOPYPterE4XljNgdGTYfSTtzzwjIswIzIaSPSLs3R7yFuqnqNeay5rjICfqVr+/6A==", + "version": "7.24.10", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.10.tgz", + "integrity": "sha512-o9HBZL1G2129luEUlG1hB4N/nlYNWHnpwlND9eOMclRqqu1YDy2sSYVCFUZwl8I1Gxh+QSRrP2vD7EpUmFVXxg==", "dev": true, "dependencies": { "@babel/types": "^7.24.9", diff --git a/typings/capitano/index.d.ts b/typings/capitano/index.d.ts deleted file mode 100644 index 07e67ccd..00000000 --- a/typings/capitano/index.d.ts +++ /dev/null @@ -1,99 +0,0 @@ -/** - * @license - * Copyright 2019 Balena Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -declare module 'capitano' { - export function parse(argv: string[]): Cli; - - export interface Cli { - command: string; - options: object; - global: { - help?: boolean; - }; - } - - export interface OptionDefinition { - signature: string; - description?: string; - parameter?: string; - // eslint-disable-next-line id-denylist - boolean?: boolean; - required?: string; - alias?: string | string[]; - } - - export interface CommandDefinition<P = object, O = object> { - signature: string; - description?: string; - help?: string; - options?: Partial<OptionDefinition[]>; - permission?: string; // This should be 'user' but without full typescript we cannot enforce it - root?: boolean; - primary?: boolean; - hidden?: boolean; - action(params: P, options: Partial<O>, done: () => void): void; - } - - export interface Command { - signature: Signature; - options: Option[]; - isWildcard(): boolean; - // You can pass whatever you want into a capitano command and it gets added as a prop - [key: string]: any; - } - - export interface Signature { - hasParameters(): boolean; - hasVariadicParameters(): boolean; - isWildcard(): boolean; - allowsStdin(): boolean; - } - - export interface Option { - signature: Signature; - alias: string | string[]; - // eslint-disable-next-line id-denylist - boolean: boolean; - parameter: string; - required: boolean | string; - } - - export function command<P, O>(command: CommandDefinition<P, O>): void; - - export const state: { - getMatchCommand: ( - signature: string, - callback: (e: Error, cmd: Command) => void, - ) => void; - commands: Command[]; - globalOptions: OptionDefinition[]; - }; - - export function run( - command: string | string[], - callback: (err: Error | null, result: any) => void, - ): void; - export function execute( - args: any, - callback: (err?: Error, result: any) => void, - ): void; - export function globalOption(option: OptionDefinition): void; - export function permission( - permissionName: string, - callback: (done: () => void) => void, - ): void; -} diff --git a/typings/nplugm/index.d.ts b/typings/nplugm/index.d.ts deleted file mode 100644 index 05a32edb..00000000 --- a/typings/nplugm/index.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * @license - * Copyright 2019 Balena Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -declare module 'nplugm' { - import Bluebird = require('bluebird'); - export function list(regexp: RegExp): Bluebird<string[]>; -} diff --git a/typings/president/index.d.ts b/typings/president/index.d.ts deleted file mode 100644 index 0de6567f..00000000 --- a/typings/president/index.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @license - * Copyright 2019 Balena Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -declare module 'president' { - export function execute( - command: string[], - callback: (err: Error) => void, - ): void; -}