juisy 2.0.0-beta.0 → 2.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli/cli.js +6 -4
- package/bin/cli/cmds/index.js +10 -10
- package/bin/cli/cmds/private/docs/generate-api.js +31 -0
- package/bin/cli/cmds/{docs → private/docs}/index.js +4 -6
- package/bin/cli/cmds/{print-globals.js → public/print-globals.js} +0 -1
- package/bin/cli/index.js +1 -1
- package/bin/scripts/prepare.js +22 -0
- package/dist/DataExporter.d.ts +6 -0
- package/dist/cli/CLIFactory.d.ts +48 -11
- package/dist/cli/Command.d.ts +23 -13
- package/dist/cli/GlobalSettings.schema.json +1 -0
- package/dist/cli/InterfaceUtils.d.ts +8 -2
- package/dist/cli/OutputUtils.d.ts +3 -3
- package/dist/cli/Plugin.d.ts +21 -0
- package/dist/cli/extract-usage.d.ts +7 -1
- package/dist/cli/index.d.ts +18 -6
- package/dist/cli/index.js +1261 -138
- package/dist/cli/plugins/command-handler-injections/augment.d.ts +29 -0
- package/dist/cli/{command-visitors → plugins/command-handler-injections/command-visitors}/command-handler-injections.d.ts +1 -1
- package/dist/cli/plugins/command-handler-injections/index.d.ts +3 -0
- package/dist/cli/plugins/command-meta/augment.d.ts +23 -0
- package/dist/cli/{command-visitors/get-command-meta.d.ts → plugins/command-meta/command-visitors/command-meta.d.ts} +1 -1
- package/dist/cli/plugins/command-meta/index.d.ts +3 -0
- package/dist/cli/plugins/default-command-fallbacks/augment.d.ts +3 -0
- package/dist/cli/plugins/default-command-fallbacks/command-visitors/default-command-fallbacks.d.ts +10 -0
- package/dist/cli/plugins/default-command-fallbacks/index.d.ts +3 -0
- package/dist/cli/plugins/load-env-file/augment.d.ts +9 -0
- package/dist/cli/plugins/load-env-file/index.d.ts +3 -0
- package/dist/cli/plugins/private-commands/augment.d.ts +6 -0
- package/dist/cli/{command-visitors → plugins/private-commands/command-visitors}/private-command.d.ts +1 -1
- package/dist/cli/plugins/private-commands/index.d.ts +3 -0
- package/dist/cli/plugins/register-bump-version-command/cmds/index.d.ts +3 -0
- package/dist/cli/plugins/register-bump-version-command/index.d.ts +3 -0
- package/dist/cli/plugins/register-changelog-command/augment.d.ts +110 -0
- package/dist/cli/plugins/register-changelog-command/cmds/index.d.ts +3 -0
- package/dist/cli/plugins/register-changelog-command/index.d.ts +3 -0
- package/dist/cli/plugins/register-docs-commands/augment.d.ts +18 -0
- package/dist/cli/plugins/register-docs-commands/cmds/generate-api.d.ts +3 -0
- package/dist/cli/plugins/register-docs-commands/cmds/generate-cli.d.ts +3 -0
- package/dist/cli/plugins/register-docs-commands/cmds/generate-readme.d.ts +3 -0
- package/dist/cli/plugins/register-docs-commands/cmds/index.d.ts +3 -0
- package/dist/cli/plugins/register-docs-commands/index.d.ts +3 -0
- package/dist/cli/plugins/register-git-hooks-commands/augment.d.ts +40 -0
- package/dist/cli/plugins/register-git-hooks-commands/cmds/index.d.ts +3 -0
- package/dist/cli/plugins/register-git-hooks-commands/cmds/reset.d.ts +3 -0
- package/dist/cli/plugins/register-git-hooks-commands/cmds/sync.d.ts +3 -0
- package/dist/cli/plugins/register-git-hooks-commands/index.d.ts +3 -0
- package/dist/cli/plugins/register-lint-commands/augment.d.ts +39 -0
- package/dist/cli/plugins/register-lint-commands/cmds/commit.d.ts +3 -0
- package/dist/cli/plugins/register-lint-commands/cmds/default.d.ts +3 -0
- package/dist/cli/plugins/register-lint-commands/cmds/markdown.d.ts +3 -0
- package/dist/cli/plugins/register-lint-commands/cmds/staged.d.ts +3 -0
- package/dist/cli/plugins/register-lint-commands/index.d.ts +3 -0
- package/dist/cli/plugins/register-lint-commands/settings.d.ts +11 -0
- package/dist/cli/plugins/register-lint-commands/types.d.ts +26 -0
- package/dist/cli/plugins/register-release-command/augment.d.ts +9 -0
- package/dist/cli/plugins/register-release-command/cmds/index.d.ts +3 -0
- package/dist/cli/plugins/register-release-command/index.d.ts +3 -0
- package/dist/cli/plugins/register-test-command/cmds/index.d.ts +3 -0
- package/dist/cli/plugins/register-test-command/index.d.ts +3 -0
- package/dist/cli/types.d.ts +73 -44
- package/dist/cli/utils.d.ts +3 -3
- package/dist/eject.d.ts +11 -4
- package/dist/index.d.ts +8 -2
- package/dist/index.js +80 -76
- package/dist/project-globals.d.ts +9 -0
- package/dist/templater/index.d.ts +6 -1
- package/dist/templater/index.js +27 -40
- package/dist/templater/markdown-templater/ReadmeTemplater.d.ts +28 -28
- package/dist/templater/markdown-templater/index.d.ts +3 -0
- package/dist/templater/types.d.ts +6 -0
- package/dist/utils/misc.d.ts +1 -1
- package/package.json +194 -179
- package/README.md +0 -211
- package/bin/cli/cmds/changelog.js +0 -41
- package/bin/cli/cmds/docs/generate-api.js +0 -22
- package/bin/cli/cmds/docs/generate-cli.js +0 -11
- package/bin/cli/cmds/docs/generate-readme.js +0 -11
- package/bin/cli/cmds/eject.js +0 -28
- package/bin/cli/cmds/git-hooks/index.js +0 -20
- package/bin/cli/cmds/git-hooks/reset.js +0 -48
- package/bin/cli/cmds/git-hooks/sync.js +0 -19
- package/bin/cli/cmds/release.js +0 -231
- package/bin/cli/lib/docs/generate-api-doc.js +0 -78
- package/bin/cli/lib/version/update-version.js +0 -52
- package/bin/scripts/commit-msg.js +0 -32
- package/bin/scripts/pre-commit.js +0 -24
- package/dist/cli/command-visitors/index.d.ts +0 -9
- package/src/index.js +0 -507
- package/template/CHANGELOG.md +0 -0
- package/template/bin/cli/cli.js +0 -27
- package/template/bin/cli/cmds/changelog.js +0 -71
- package/template/bin/cli/cmds/docs.js +0 -30
- package/template/bin/cli/cmds/docs_cmds/generate-api.js +0 -75
- package/template/bin/cli/cmds/docs_cmds/generate-readme.js +0 -51
- package/template/bin/cli/cmds/git-hooks.js +0 -30
- package/template/bin/cli/cmds/git_hooks_cmds/reset.js +0 -76
- package/template/bin/cli/cmds/git_hooks_cmds/sync.js +0 -44
- package/template/bin/cli/cmds/release.js +0 -219
- package/template/bin/cli/index.js +0 -7
- package/template/bin/cli/lib/docs/generate-api-doc.js +0 -33
- package/template/bin/cli/lib/release/generate-release-note.js +0 -3
- package/template/bin/cli/lib/version/update-version.js +0 -51
- package/template/bin/scripts/commit-msg.js +0 -42
- package/template/bin/scripts/pre-commit.js +0 -32
- package/template/docs/api/docs.config.js +0 -10
- package/template/docs/readme/config.js +0 -22
- package/template/docs/readme/readme.js +0 -70
- package/template/docs/readme/template.md +0 -53
- /package/bin/cli/cmds/{docs → private/docs}/lint.js +0 -0
- /package/bin/cli/cmds/{test.js → private/test.js} +0 -0
- /package/bin/cli/cmds/{squeeze.js → public/squeeze.js} +0 -0
package/bin/cli/cli.js
CHANGED
|
@@ -6,8 +6,8 @@ const { $style } = CLI.OutputUtils
|
|
|
6
6
|
|
|
7
7
|
function getBanner () {
|
|
8
8
|
let str = ''
|
|
9
|
-
const title = '
|
|
10
|
-
const length = title.length
|
|
9
|
+
const title = 'juisy'
|
|
10
|
+
const length = title.length
|
|
11
11
|
str += $style.cyan('-'.repeat(length) + '\n')
|
|
12
12
|
str += $style.cyan(title + '\n')
|
|
13
13
|
str += $style.cyan('-'.repeat(length) + '\n')
|
|
@@ -15,9 +15,11 @@ function getBanner () {
|
|
|
15
15
|
return str
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export default CLIFactory(cli => cli
|
|
18
|
+
export default await CLIFactory(cli => cli
|
|
19
19
|
.scriptName('juisy')
|
|
20
20
|
.usage(`${getBanner()}\nUsage: $0 <command> [<options>]`)
|
|
21
|
+
.disableDefaultCommand('docs generate:api')
|
|
22
|
+
.globalCommandVisitorOptions('private-command-visitor', { envKey: '__JUISY_CLI_ENV__' })
|
|
21
23
|
.command(commands)
|
|
22
|
-
.demandCommand(1, ('Command is missing. See help to learn more.').red)
|
|
24
|
+
// .demandCommand(1, ('Command is missing. See help to learn more.').red)
|
|
23
25
|
)
|
package/bin/cli/cmds/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
// Private commands
|
|
2
|
+
import docs from './private/docs/index.js'
|
|
3
|
+
// import test from './private/test.js'
|
|
4
|
+
// Public commands
|
|
5
|
+
import printGlobals from './public/print-globals.js'
|
|
6
|
+
import squeeze from './public/squeeze.js'
|
|
7
7
|
|
|
8
8
|
export const commands = [
|
|
9
|
+
// Private
|
|
9
10
|
docs,
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
// test,
|
|
12
|
+
// Public
|
|
12
13
|
printGlobals,
|
|
13
|
-
squeeze
|
|
14
|
-
test
|
|
14
|
+
squeeze
|
|
15
15
|
]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import { pathToFileURL } from 'node:url'
|
|
3
|
+
|
|
4
|
+
/** @type {import('#juisy/cli').Command} */
|
|
5
|
+
export default new CLI.Command({
|
|
6
|
+
command: 'generate:api',
|
|
7
|
+
describe: 'Generate API docs from source code',
|
|
8
|
+
builder (cli) {
|
|
9
|
+
cli
|
|
10
|
+
},
|
|
11
|
+
async handler (argv) {
|
|
12
|
+
// Utils
|
|
13
|
+
const { $style, step, substep } = CLI.OutputUtils
|
|
14
|
+
const { run } = CLI.InterfaceUtils
|
|
15
|
+
|
|
16
|
+
const config = (await import(pathToFileURL(path.resolve('./docs/api/docs.config.js')).toString())).default
|
|
17
|
+
// Process options
|
|
18
|
+
const typedocConfigPath = config.typedoc.configPath
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Generate api documentation
|
|
22
|
+
*/
|
|
23
|
+
step('Generating API documentation')
|
|
24
|
+
|
|
25
|
+
// Run typedoc command
|
|
26
|
+
await run('typedoc', [ '--options', typedocConfigPath ], { stdio: 'pipe' })
|
|
27
|
+
|
|
28
|
+
substep($style.green('✔ Successfuly generated'), { last: true })
|
|
29
|
+
this.log() // blank line
|
|
30
|
+
}
|
|
31
|
+
})
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import generateAPI from './generate-api.js'
|
|
2
|
-
import generateCLI from './generate-cli.js'
|
|
3
|
-
import generateReadme from './generate-readme.js'
|
|
4
2
|
|
|
5
3
|
/** @type {import('#juisy/cli').Command} */
|
|
6
4
|
export default new CLI.Command({
|
|
@@ -12,11 +10,11 @@ export default new CLI.Command({
|
|
|
12
10
|
builder (cli) {
|
|
13
11
|
return cli
|
|
14
12
|
.command([
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Default command are automatically injected here...
|
|
15
|
+
*/
|
|
16
|
+
generateAPI
|
|
18
17
|
])
|
|
19
|
-
.demandCommand(1, 'Command is missing. See help to learn more.')
|
|
20
18
|
},
|
|
21
19
|
handler (argv) {}
|
|
22
20
|
})
|
package/bin/cli/index.js
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import run from 'execa'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Prepare script
|
|
5
|
+
*/
|
|
6
|
+
;(async function () {
|
|
7
|
+
console.log('Prepare packages/juisy')
|
|
8
|
+
|
|
9
|
+
// Copy env file
|
|
10
|
+
try {
|
|
11
|
+
await run('npx', [ 'cpy', '.env.example', '.', '--rename', '.env', '--no-overwrite' ], { stdio: 'inherit' })
|
|
12
|
+
} catch (e) {
|
|
13
|
+
console.error('✖ env file already exists. Ignoring step...')
|
|
14
|
+
console.log() // blank line
|
|
15
|
+
}
|
|
16
|
+
// Build juisy because we depend on CLI tools
|
|
17
|
+
await run('pnpm', [ 'build' ], { stdio: 'inherit' })
|
|
18
|
+
|
|
19
|
+
// Everything is okay
|
|
20
|
+
console.log('✔ Prepare script passed')
|
|
21
|
+
console.log() // blank line
|
|
22
|
+
})()
|
package/dist/DataExporter.d.ts
CHANGED
|
@@ -2,7 +2,13 @@ import { default as yaml } from 'yaml';
|
|
|
2
2
|
import { Json2CsvOptions } from 'json-2-csv';
|
|
3
3
|
import { Options as XMLoptions } from 'jstoxml';
|
|
4
4
|
declare const SUPPORTED_FORMATS: readonly ["json", "yaml", "csv", "xml"];
|
|
5
|
+
/**
|
|
6
|
+
* @group Types
|
|
7
|
+
*/
|
|
5
8
|
export type DataExporterFormat = typeof SUPPORTED_FORMATS[number];
|
|
9
|
+
/**
|
|
10
|
+
* @group Types
|
|
11
|
+
*/
|
|
6
12
|
export type ExportOptions<F extends DataExporterFormat> = F extends 'json' ? Parameters<typeof jsonExporter>[1] : F extends 'yaml' ? Parameters<typeof yamlExporter>[1] : F extends 'csv' ? Parameters<typeof csvExporter>[1] : F extends 'xml' ? Parameters<typeof xmlExporter>[1] : {};
|
|
7
13
|
/**
|
|
8
14
|
* JSON exporter
|
package/dist/cli/CLIFactory.d.ts
CHANGED
|
@@ -1,19 +1,56 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Plugin } from './Plugin';
|
|
2
|
+
import { CLIFactoryOptions, CLIEngine, CLIBuilder, DefaultCommandObject } from './types';
|
|
3
|
+
declare function defineDefaultCommand(command: DefaultCommandObject): void;
|
|
2
4
|
/**
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
export declare const getDefaultCommand: (fullSignature: string) => DefaultCommandObject | undefined;
|
|
8
|
+
type DefineSettingsOptions = {
|
|
9
|
+
/**
|
|
10
|
+
* Must return an object like:
|
|
11
|
+
* ```
|
|
12
|
+
* {
|
|
13
|
+
* 'lint': (settings) => {
|
|
14
|
+
* // ...
|
|
15
|
+
* return settings
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
resolve?(settings: any): any;
|
|
21
|
+
};
|
|
22
|
+
declare function defineSettings(target: string, settings: any, options?: DefineSettingsOptions): void;
|
|
23
|
+
/**
|
|
24
|
+
* @group Types
|
|
25
|
+
*/
|
|
26
|
+
export type PluginAPI = {
|
|
27
|
+
defineDefaultCommand: typeof defineDefaultCommand;
|
|
28
|
+
defineSettings: typeof defineSettings;
|
|
29
|
+
engine: CLIEngine;
|
|
30
|
+
builder: CLIBuilder;
|
|
31
|
+
factoryOptions: CLIFactoryOptions;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Creates a CLI factory. If `options.settingsPath` is not provided, it will try to find:
|
|
35
|
+
*
|
|
36
|
+
* - `dev.config.{ts,js,json}`
|
|
37
|
+
* - `cli.config.{ts,js,json}`
|
|
38
|
+
* - `.clirc.{ts,js,json}`
|
|
39
|
+
*
|
|
40
|
+
* @param builder - The CLI builder function
|
|
41
|
+
* @param options - The options object
|
|
42
|
+
* @param options.settingsPath - The path to CLI config file
|
|
5
43
|
* @returns A function that takes optional argv as first parameter
|
|
6
44
|
* @example
|
|
7
|
-
* import { CLIFactory } from '
|
|
45
|
+
* import { CLIFactory } from 'juisy/cli'
|
|
8
46
|
*
|
|
9
|
-
* const cli = CLIFactory(cli => cli
|
|
47
|
+
* const cli = await CLIFactory(cli => cli
|
|
10
48
|
* .scriptName('my-juicy-cli')
|
|
11
49
|
* .usage('Usage: $0 <command> [<options>]')
|
|
12
50
|
* )
|
|
13
|
-
*
|
|
14
|
-
* const argv = process.argv.slice(2)
|
|
15
|
-
*
|
|
16
|
-
* // Parse argv
|
|
17
|
-
* cli().parse(argv)
|
|
18
51
|
*/
|
|
19
|
-
export declare function CLIFactory(builder: CLIBuilder): (argv
|
|
52
|
+
export declare function CLIFactory(builder: CLIBuilder, options?: CLIFactoryOptions): Promise<(argv?: typeof process.argv) => CLIEngine>;
|
|
53
|
+
export declare namespace CLIFactory {
|
|
54
|
+
var use: (plugin: Plugin) => void;
|
|
55
|
+
}
|
|
56
|
+
export {};
|
package/dist/cli/Command.d.ts
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CommandObject } from './types';
|
|
2
|
+
type CommandOptions = {
|
|
3
|
+
command: CommandObject['command'];
|
|
4
|
+
aliases?: CommandObject['aliases'];
|
|
5
|
+
describe?: CommandObject['describe'];
|
|
6
|
+
deprecated?: CommandObject['deprecated'];
|
|
7
|
+
builder?: CommandObject['builder'];
|
|
8
|
+
handler?: CommandObject['handler'];
|
|
9
|
+
middlewares?: CommandObject['middlewares'];
|
|
10
|
+
meta?: CommandObject['meta'];
|
|
11
|
+
};
|
|
2
12
|
/**
|
|
3
|
-
* Class to wrap command definition (
|
|
13
|
+
* Class to wrap command definition (CommandObject)
|
|
4
14
|
*/
|
|
5
|
-
export declare class Command implements
|
|
15
|
+
export declare class Command implements CommandObject {
|
|
6
16
|
/**
|
|
7
|
-
* Creates a Command instance from object (
|
|
8
|
-
* @param {
|
|
17
|
+
* Creates a Command instance from object (CommandObject)
|
|
18
|
+
* @param {CommandObject} commandObject - The command definition object
|
|
9
19
|
*/
|
|
10
|
-
constructor(commandObject:
|
|
11
|
-
builder?: CommandModule['builder'];
|
|
12
|
-
});
|
|
20
|
+
constructor(commandObject: CommandOptions);
|
|
13
21
|
/**
|
|
14
22
|
* The command
|
|
15
23
|
*/
|
|
@@ -29,7 +37,7 @@ export declare class Command implements CommandModule {
|
|
|
29
37
|
/**
|
|
30
38
|
* Command meta
|
|
31
39
|
*/
|
|
32
|
-
meta:
|
|
40
|
+
meta: Partial<import('./types').CommandMeta> | undefined;
|
|
33
41
|
/**
|
|
34
42
|
* Command builder
|
|
35
43
|
*/
|
|
@@ -37,8 +45,10 @@ export declare class Command implements CommandModule {
|
|
|
37
45
|
/**
|
|
38
46
|
* Command handler
|
|
39
47
|
*/
|
|
40
|
-
handler:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
handler: import('./types').CommandHandler | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Command middlewares
|
|
51
|
+
*/
|
|
52
|
+
middlewares: import('yargs').MiddlewareFunction[] | undefined;
|
|
44
53
|
}
|
|
54
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema":"http://json-schema.org/draft-07/schema#","$ref":"#/definitions/GlobalSettings","definitions":{"GlobalSettings":{"type":"object","properties":{"release":{"$ref":"#/definitions/UserProvidedConfigSetting%3CReleaseIt.Config%3E","description":"Release configuration"}}},"UserProvidedConfigSetting<ReleaseIt.Config>":{"anyOf":[{"type":"object","properties":{"config":{"type":"string","description":"The configuration file path"}},"required":["config"]},{"type":"object","properties":{}}],"description":"Provide a configuration object or an object with only \"config\" property","examples":[{"config":"path/to/config/file"}]}}}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ExecaError } from 'execa';
|
|
2
2
|
import { default as _prompts } from 'prompts';
|
|
3
|
+
/**
|
|
4
|
+
* Command execution error thrown by execa
|
|
5
|
+
*/
|
|
6
|
+
export interface RunError extends ExecaError {
|
|
7
|
+
}
|
|
3
8
|
export declare class InterfaceUtils {
|
|
4
9
|
/**
|
|
5
10
|
* Get root directory path
|
|
@@ -13,13 +18,14 @@ export declare class InterfaceUtils {
|
|
|
13
18
|
* @param {string[]} args - Same as execa second arg
|
|
14
19
|
* @param {object} [opts] - Options
|
|
15
20
|
* @returns {Promise<object>} The `execa` Promise
|
|
21
|
+
* @throws {RunError}
|
|
16
22
|
* @description
|
|
17
23
|
* Run command (child_process). See also `execa` package documentation
|
|
18
24
|
* @example
|
|
19
25
|
* const { run } = require('@hperchec/juisy').utils
|
|
20
26
|
* await run('npm', [ 'run', 'test' ], { stdio: 'inherit' })
|
|
21
27
|
*/
|
|
22
|
-
static run(bin: string, args: string[], opts?: {}): execa.ExecaChildProcess<string>;
|
|
28
|
+
static run(bin: string, args: string[], opts?: {}): import('execa').ExecaChildProcess<string>;
|
|
23
29
|
/**
|
|
24
30
|
* @alias utils.abort
|
|
25
31
|
* @param {number} [code] - Code for process.exit() (default: 0)
|
|
@@ -19,7 +19,7 @@ export declare class OutputUtils {
|
|
|
19
19
|
Color: ("black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright") | ("bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgGrey" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright");
|
|
20
20
|
ForegroundColor: "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright";
|
|
21
21
|
BackgroundColor: "bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgGrey" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright";
|
|
22
|
-
Modifiers: "bold" | "reset" | "dim" | "italic" | "underline" | "inverse" | "
|
|
22
|
+
Modifiers: "bold" | "hidden" | "reset" | "dim" | "italic" | "underline" | "inverse" | "strikethrough" | "visible";
|
|
23
23
|
stderr: chalk.Chalk & {
|
|
24
24
|
supportsColor: chalk.ColorSupport | false;
|
|
25
25
|
};
|
|
@@ -68,7 +68,7 @@ export declare class OutputUtils {
|
|
|
68
68
|
static warn(msg: string): void;
|
|
69
69
|
/**
|
|
70
70
|
* @param msg - The message to display
|
|
71
|
-
* @param
|
|
71
|
+
* @param err - If provided, throw the error
|
|
72
72
|
* @description
|
|
73
73
|
* Display error message. Throws `err` if provided.
|
|
74
74
|
* @example
|
|
@@ -76,7 +76,7 @@ export declare class OutputUtils {
|
|
|
76
76
|
* error('No configuration file') // => '[31m⨉ ERROR: No configuration file[0m'
|
|
77
77
|
* error('No configuration file', error) // => Log and throws error
|
|
78
78
|
*/
|
|
79
|
-
static error(msg: string, err?:
|
|
79
|
+
static error(msg: string, err?: Error): void;
|
|
80
80
|
/**
|
|
81
81
|
* Log step title
|
|
82
82
|
* @param msg - The message to display
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PluginAPI } from './CLIFactory';
|
|
2
|
+
type PluginObject = {
|
|
3
|
+
beforeCreate?: Plugin['beforeCreate'];
|
|
4
|
+
created?: Plugin['created'];
|
|
5
|
+
};
|
|
6
|
+
export declare class Plugin {
|
|
7
|
+
constructor(name: string, pluginObject: PluginObject);
|
|
8
|
+
/**
|
|
9
|
+
* The plugin unique name
|
|
10
|
+
*/
|
|
11
|
+
name: string;
|
|
12
|
+
/**
|
|
13
|
+
* The beforeCreate hook (can be async)
|
|
14
|
+
*/
|
|
15
|
+
beforeCreate: (context: Pick<PluginAPI, 'defineDefaultCommand' | 'defineSettings' | 'builder' | 'factoryOptions'>) => Promise<any> | any;
|
|
16
|
+
/**
|
|
17
|
+
* The created hook (must be sync)
|
|
18
|
+
*/
|
|
19
|
+
created: (context: Pick<PluginAPI, 'engine' | 'builder' | 'factoryOptions'>) => any;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { CLIEngine } from './types';
|
|
2
2
|
import { CLIFactory } from './CLIFactory';
|
|
3
|
+
/**
|
|
4
|
+
* @group Types
|
|
5
|
+
*/
|
|
3
6
|
export type CommandDoclet = {
|
|
4
7
|
/**
|
|
5
8
|
* The command
|
|
@@ -31,6 +34,9 @@ export type CommandDoclet = {
|
|
|
31
34
|
*/
|
|
32
35
|
children: Record<string, ExtractedUsage> | undefined;
|
|
33
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* @group Types
|
|
39
|
+
*/
|
|
34
40
|
export type ExtractedUsage = {
|
|
35
41
|
/**
|
|
36
42
|
* Same as yargs instance `getDemandedCommands` method
|
|
@@ -69,4 +75,4 @@ export type ExtractedUsage = {
|
|
|
69
75
|
deprecated: boolean;
|
|
70
76
|
}>;
|
|
71
77
|
};
|
|
72
|
-
export declare function extractUsage(factory: ReturnType<typeof CLIFactory
|
|
78
|
+
export declare function extractUsage(factory: Awaited<ReturnType<typeof CLIFactory>>, recursive?: boolean, args?: string[], locale?: string): Promise<CommandDoclet>;
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -2,12 +2,6 @@ import { hideBin } from 'yargs/helpers';
|
|
|
2
2
|
import { Command } from './Command';
|
|
3
3
|
import { InterfaceUtils } from './InterfaceUtils';
|
|
4
4
|
import { OutputUtils } from './OutputUtils';
|
|
5
|
-
export * from './CLIFactory';
|
|
6
|
-
export * from './Command';
|
|
7
|
-
export * from './InterfaceUtils';
|
|
8
|
-
export * from './OutputUtils';
|
|
9
|
-
export { extractUsage } from './extract-usage';
|
|
10
|
-
export type * from './types';
|
|
11
5
|
declare global {
|
|
12
6
|
var CLI: {
|
|
13
7
|
helpers: {
|
|
@@ -18,3 +12,21 @@ declare global {
|
|
|
18
12
|
OutputUtils: typeof OutputUtils;
|
|
19
13
|
};
|
|
20
14
|
}
|
|
15
|
+
export { CLIFactory } from './CLIFactory';
|
|
16
|
+
export * from './Command';
|
|
17
|
+
export * from './InterfaceUtils';
|
|
18
|
+
export * from './OutputUtils';
|
|
19
|
+
export { extractUsage } from './extract-usage';
|
|
20
|
+
export type * from './CLIFactory';
|
|
21
|
+
export type * from './extract-usage';
|
|
22
|
+
export type * from './types';
|
|
23
|
+
export type * from './plugins/load-env-file/augment';
|
|
24
|
+
export type * from './plugins/register-changelog-command/augment';
|
|
25
|
+
export type * from './plugins/register-docs-commands/augment';
|
|
26
|
+
export type * from './plugins/register-git-hooks-commands/augment';
|
|
27
|
+
export type * from './plugins/register-lint-commands/augment';
|
|
28
|
+
export type * from './plugins/register-release-command/augment';
|
|
29
|
+
export type * from './plugins/default-command-fallbacks/augment';
|
|
30
|
+
export type * from './plugins/command-handler-injections/augment';
|
|
31
|
+
export type * from './plugins/command-meta/augment';
|
|
32
|
+
export type * from './plugins/private-commands/augment';
|