juisy 2.2.0 → 3.0.0-beta.0

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.
Files changed (59) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +85 -0
  3. package/bin/cli/cli.js +3 -0
  4. package/bin/cli/cmds/index.js +2 -4
  5. package/bin/scripts/prepare.js +22 -22
  6. package/dist/DataExporter.d.ts +9 -4
  7. package/dist/bootstrap.d.ts +6 -0
  8. package/dist/bootstrap.js +21 -0
  9. package/dist/cli/CLIFactory.d.ts +1 -0
  10. package/dist/cli/Command.d.ts +23 -2
  11. package/dist/cli/GlobalSettings.schema.json +1 -1
  12. package/dist/cli/InterfaceUtils.d.ts +14 -12
  13. package/dist/cli/OutputUtils.d.ts +30 -16
  14. package/dist/cli/Plugin.d.ts +9 -0
  15. package/dist/cli/extract-usage.d.ts +8 -0
  16. package/dist/cli/index.d.ts +1 -0
  17. package/dist/cli/index.js +210 -122
  18. package/dist/cli/plugins/command-meta/augment.d.ts +1 -4
  19. package/dist/cli/plugins/command-meta/index.d.ts +4 -0
  20. package/dist/cli/plugins/default-command-fallbacks/augment.d.ts +1 -1
  21. package/dist/cli/plugins/default-command-fallbacks/command-visitors/default-command-fallbacks.d.ts +1 -1
  22. package/dist/cli/plugins/default-command-fallbacks/index.d.ts +4 -0
  23. package/dist/cli/plugins/load-env-file/augment.d.ts +1 -1
  24. package/dist/cli/plugins/load-env-file/index.d.ts +4 -0
  25. package/dist/cli/plugins/private-commands/augment.d.ts +8 -0
  26. package/dist/cli/plugins/private-commands/command-visitors/private-command.d.ts +7 -3
  27. package/dist/cli/plugins/private-commands/index.d.ts +4 -0
  28. package/dist/cli/plugins/register-bump-version-command/index.d.ts +4 -0
  29. package/dist/cli/plugins/register-changelog-command/index.d.ts +4 -0
  30. package/dist/cli/plugins/register-docs-commands/index.d.ts +4 -0
  31. package/dist/cli/plugins/register-git-hooks-commands/index.d.ts +4 -0
  32. package/dist/cli/plugins/register-lint-commands/index.d.ts +4 -0
  33. package/dist/cli/plugins/register-lint-commands/settings.d.ts +2 -0
  34. package/dist/cli/plugins/register-lint-commands/types.d.ts +5 -9
  35. package/dist/cli/plugins/register-release-command/index.d.ts +4 -0
  36. package/dist/cli/plugins/register-test-command/index.d.ts +4 -0
  37. package/dist/cli/types.d.ts +9 -1
  38. package/dist/cli/utils.d.ts +3 -4
  39. package/dist/eject.d.ts +1 -0
  40. package/dist/extensions.d.ts +26 -0
  41. package/dist/extensions.js +44 -0
  42. package/dist/get-package-info.d.ts +1 -0
  43. package/dist/index.d.ts +5 -5
  44. package/dist/index.js +23 -128
  45. package/dist/project-globals.d.ts +6 -2
  46. package/dist/shims/shims.d.ts +1440 -0
  47. package/dist/templater/index.d.ts +4 -1
  48. package/dist/templater/index.js +43 -24
  49. package/dist/templater/markdown-templater/ReadmeTemplater.d.ts +12 -12
  50. package/dist/templater/markdown-templater/index.d.ts +10 -1
  51. package/package.json +43 -49
  52. package/bin/cli/cmds/private/docs/generate-api.js +0 -31
  53. package/bin/cli/cmds/private/docs/index.js +0 -20
  54. package/bin/cli/cmds/private/test.js +0 -33
  55. package/dist/utils/misc.d.ts +0 -84
  56. package/dist/vite/plugins/inject-css-variables/index.d.ts +0 -23
  57. package/dist/vite/plugins/inject-css-variables/index.js +0 -60
  58. package/dist/vite/plugins/inject-project-globals/index.d.ts +0 -19
  59. package/dist/vite/plugins/inject-project-globals/index.js +0 -58
package/LICENSE CHANGED
@@ -630,7 +630,7 @@ state the exclusion of warranty; and each file should have at least
630
630
  the "copyright" line and a pointer to where the full notice is found.
631
631
 
632
632
  juisy
633
- Copyright (C) 2024 Hervé Perchec <contact@herve-perchec.fr>
633
+ Copyright (C) 2022 - Present Hervé Perchec <contact@herve-perchec.fr>
634
634
 
635
635
  This program is free software: you can redistribute it and/or modify
636
636
  it under the terms of the GNU Affero General Public License as published
package/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # Juisy
2
+
3
+ ![presentation](resources/images/presentation-banner.jpg)
4
+
5
+ <!-- markdownlint-disable line-length -->
6
+
7
+ ![author](https://img.shields.io/static/v1?label=\&message=Author:\&color=black)
8
+ [![herve-perchec](http://herve-perchec.com/badge.svg)](http://herve-perchec.com/)
9
+
10
+ [![release](https://img.shields.io/gitlab/v/release/hperchec/juisy?include_prereleases\&logo=gitlab\&sort=semver)](https://gitlab.com/hperchec/juisy/-/releases)
11
+ [![pipeline-status](https://gitlab.com/hperchec/juisy/badges/v3.0.0-beta.0/pipeline.svg)](https://gitlab.com/hperchec/juisy/commits/v3.0.0-beta.0)
12
+ [![package](https://img.shields.io/npm/v/juisy?logo=npm)](https://www.npmjs.com/package/juisy)
13
+ [![downloads](https://img.shields.io/npm/dw/juisy?logo=npm)](https://www.npmjs.com/package/juisy)
14
+ [![issues](https://img.shields.io/gitlab/issues/open/hperchec/juisy?gitlab_url=https%3A%2F%2Fgitlab.com)](https://gitlab.com/hperchec/juisy/issues)
15
+ ![license](https://img.shields.io/gitlab/license/hperchec/juisy?gitlab_url=https%3A%2F%2Fgitlab.com)
16
+
17
+ <!-- markdownlint-enable line-length -->
18
+
19
+ ## Table of contents
20
+
21
+ * [What is juisy?](#what-is-juisy)
22
+ * [❗ Requirements](#-requirements)
23
+ * [🚀 Get started](#-get-started)
24
+ * [📙 Documentation](#-documentation)
25
+ * [🤝 Contribute](#-contribute)
26
+ * [✍ Author](#-author)
27
+ * [📄 License](#-license)
28
+ * [🧬 Changelog](#-changelog)
29
+
30
+ ## What is juisy?
31
+
32
+ **Juisy** (a play on words for "JS", "easy" and "juicy") is on top of your **JavaScript** (or **TypeScript**) project.
33
+
34
+ It runs on [NodeJS](https://nodejs.org/en) ([ESM](https://nodejs.org/api/esm.html) only) and comes with useful features listed below.
35
+
36
+ * 🧬 Project globals: share project variables to Node and/or runtime environment
37
+ * 📕 Generate your project documentation and README file with templaters
38
+ * 🕵️‍♂️ Lint your code with [ESLint](https://eslint.org/). Automatic linting with [lint-staged](https://www.npmjs.com/package/lint-staged) at pre-commit git hook
39
+ * 🦾 Respect [Conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) with [commitlint](https://commitlint.js.org/) at commit-msg git hook
40
+ * 🔧 Use your own **C**ommand **L**ine **I**nterface
41
+ * 📦 Combine with any of your favorite bundlers like [Vite](https://vite.dev/), [RollUp](https://rollupjs.org/), [ESBuild](https://esbuild.github.io/), [Webpack](https://webpack.js.org/)...
42
+ * and [much more](https://gitlab.com/hperchec/juisy#readme)...
43
+
44
+ ## ❗ Requirements
45
+
46
+ * Node `>=18.20.8`
47
+ * npm `>=10.8.2`
48
+
49
+ ## 🚀 Get started
50
+
51
+ Create a new project with **Juisy**:
52
+
53
+ ```sh
54
+ npm create juisy
55
+ ```
56
+
57
+ ## 📙 Documentation
58
+
59
+ See [online documentation](https://gitlab.com/hperchec/juisy#readme) to learn more!
60
+
61
+ ## 🤝 Contribute
62
+
63
+ See the [CONTRIBUTING.md](./CONTRIBUTING.md) file.
64
+
65
+ ## ✍ Author
66
+
67
+ [Hervé Perchec](https://gitlab.com/herveperchec)
68
+
69
+ ## 📄 License
70
+
71
+ GPL-3.0-only
72
+
73
+ ## 🧬 Changelog
74
+
75
+ See all changes to this project in the [CHANGELOG.md](./CHANGELOG.md) file.
76
+
77
+ ***
78
+
79
+ Made with ❤ by [Hervé Perchec](https://gitlab.com/herveperchec)
80
+
81
+ ***
82
+
83
+ <!-- markdownlint-disable-next-line line-length -->
84
+
85
+ *README.md - this file was auto generated with [juisy](https://www.npmjs.com/package/juisy) README templater. Don't edit it.*
package/bin/cli/cli.js CHANGED
@@ -1,7 +1,10 @@
1
1
  import { CLIFactory } from '#juisy/cli'
2
+ import bootstrap from '../../dist/bootstrap.js'
2
3
 
3
4
  import { commands } from './cmds/index.js'
4
5
 
6
+ await bootstrap()
7
+
5
8
  const { $style } = CLI.OutputUtils
6
9
 
7
10
  function getBanner () {
@@ -1,13 +1,11 @@
1
1
  // Private commands
2
- import docs from './private/docs/index.js'
3
- // import test from './private/test.js'
2
+ // ...
4
3
  // Public commands
5
4
  import printGlobals from './public/print-globals.js'
6
5
 
7
6
  export const commands = [
8
7
  // Private
9
- docs,
10
- // test,
8
+ // ...
11
9
  // Public
12
10
  printGlobals
13
11
  ]
@@ -1,22 +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
- })()
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) { // eslint-disable-line no-unused-vars
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
+ })()
@@ -17,7 +17,8 @@ export type ExportOptions<F extends DataExporterFormat> = F extends 'json' ? Par
17
17
  * @returns The data as JSON string
18
18
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
19
19
  */
20
- declare const jsonExporter: (data: any, options?: {
20
+ declare const jsonExporter: (data: any, // eslint-disable-line @typescript-eslint/no-explicit-any
21
+ options?: {
21
22
  replacer?: Parameters<typeof JSON.stringify>[1];
22
23
  space?: Parameters<typeof JSON.stringify>[2];
23
24
  }) => string;
@@ -29,7 +30,8 @@ declare const jsonExporter: (data: any, options?: {
29
30
  * @see https://www.npmjs.com/package/yaml
30
31
  * @see https://eemeli.org/yaml/#yaml
31
32
  */
32
- declare const yamlExporter: (data: any, options?: {
33
+ declare const yamlExporter: (data: any, // eslint-disable-line @typescript-eslint/no-explicit-any
34
+ options?: {
33
35
  replacer?: Parameters<typeof yaml.stringify>[1];
34
36
  exporter?: Parameters<typeof yaml.stringify>[2];
35
37
  }) => string;
@@ -41,7 +43,8 @@ declare const yamlExporter: (data: any, options?: {
41
43
  * @see https://www.npmjs.com/package/json-2-csv
42
44
  * @see https://mrodrig.github.io/json-2-csv/
43
45
  */
44
- declare const csvExporter: (data: any, options: Json2CsvOptions) => string;
46
+ declare const csvExporter: (data: any, // eslint-disable-line @typescript-eslint/no-explicit-any
47
+ options: Json2CsvOptions) => string;
45
48
  /**
46
49
  * XML exporter
47
50
  * @param data - The data object
@@ -50,9 +53,11 @@ declare const csvExporter: (data: any, options: Json2CsvOptions) => string;
50
53
  * @see https://www.npmjs.com/package/jstoxml
51
54
  * @see https://github.com/davidcalhoun/jstoxml
52
55
  */
53
- declare const xmlExporter: (data: any, options: XMLoptions) => string;
56
+ declare const xmlExporter: (data: any, // eslint-disable-line @typescript-eslint/no-explicit-any
57
+ options: XMLoptions) => string;
54
58
  /**
55
59
  * Universal data exporter
60
+ * @group None
56
61
  */
57
62
  export declare class DataExporter {
58
63
  /**
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @internal
3
+ * @privateRemarks
4
+ * Internal usage only
5
+ */
6
+ export default function bootstrap(importMeta?: ImportMeta): Promise<void>;
@@ -0,0 +1,21 @@
1
+ /*!
2
+ * juisy v3.0.0-beta.0
3
+ * Copyright © 2022-Present Hervé Perchec
4
+ */
5
+
6
+ import { loadExtensions } from './extensions.js';
7
+
8
+ let isAlreadyBootstrapped = false;
9
+ async function bootstrap(importMeta = import.meta) {
10
+ if (!isAlreadyBootstrapped) {
11
+ if (process.env.JUISY_ENABLE_EXTENSIONS === void 0) {
12
+ process.env.JUISY_ENABLE_EXTENSIONS = "true";
13
+ }
14
+ if (process.env.JUISY_ENABLE_EXTENSIONS === "true") {
15
+ await loadExtensions();
16
+ }
17
+ isAlreadyBootstrapped = true;
18
+ }
19
+ }
20
+
21
+ export { bootstrap as default };
@@ -41,6 +41,7 @@ export type PluginAPI = {
41
41
  * @param options - The options object
42
42
  * @param options.settingsPath - The path to CLI config file
43
43
  * @returns A function that takes optional argv as first parameter
44
+ * @group None
44
45
  * @example
45
46
  * import { CLIFactory } from 'juisy/cli'
46
47
  *
@@ -12,11 +12,13 @@ type CommandOptions = {
12
12
  };
13
13
  /**
14
14
  * Class to wrap command definition (CommandObject)
15
+ * See {@link juisy-templater.ReadmeTemplater#generate}
16
+ * @group None
15
17
  */
16
18
  export declare class Command implements CommandObject {
17
19
  /**
18
20
  * Creates a Command instance from object (CommandObject)
19
- * @param {CommandObject} commandObject - The command definition object
21
+ * @param commandObject - The command definition object
20
22
  */
21
23
  constructor(commandObject?: CommandOptions);
22
24
  /**
@@ -62,6 +64,10 @@ export declare class Command implements CommandObject {
62
64
  * @returns An array of command line arguments
63
65
  */
64
66
  getProcessArgv(): string[];
67
+ /**
68
+ * Get the command signature as string
69
+ */
70
+ getSignature(): string;
65
71
  /**
66
72
  * Get Command instance as plain object
67
73
  * @returns The command definition object to pass to yargs
@@ -86,9 +92,24 @@ export declare class Command implements CommandObject {
86
92
  /**
87
93
  * Static properties
88
94
  */
95
+ /**
96
+ * The CLI engine
97
+ * @ignore
98
+ */
99
+ private static _engine;
89
100
  /**
90
101
  * The CLI engine. Will be set by createEngine method
91
102
  */
92
- static engine: CLIEngine;
103
+ static get engine(): CLIEngine;
104
+ /**
105
+ * Set the CLI engine
106
+ * @param engine - The CLI engine
107
+ */
108
+ static setEngine(engine: CLIEngine): void;
109
+ /**
110
+ * Get the command signature as string
111
+ * @param cmdObj - Can be an instance of Command or a command object
112
+ */
113
+ static getSignature(cmdObj: Command | CommandOptions): string;
93
114
  }
94
115
  export {};
@@ -1 +1 @@
1
- {"$schema":"http://json-schema.org/draft-07/schema#","$ref":"#/definitions/GlobalSettings","definitions":{"GlobalSettings":{"type":"object","properties":{"release":{"$ref":"#/definitions/UserProvidedConfigSetting%3CConfig%3E","description":"Release configuration"}}},"UserProvidedConfigSetting<Config>":{"anyOf":[{"type":"object","properties":{"config":{"type":"string","description":"The configuration file path"}},"required":["config"]},{"type":"object","properties":{"hooks":{"$ref":"#/definitions/Hooks"},"plugins":{"type":"object","additionalProperties":{"type":"object"}},"git":{"type":"object","properties":{"changelog":{"type":"string","default":"git log --pretty=format:\"* %s (%h)\" ${from}...${to}"},"requireCleanWorkingDir":{"type":"boolean","default":true},"requireBranch":{"type":"boolean","enum":[false],"default":false},"requireUpstream":{"type":"boolean","default":true},"requireCommits":{"type":"boolean","default":false},"requireCommitsFail":{"type":"boolean","default":true},"commitsPath":{"type":"string","default":""},"addUntrackedFiles":{"type":"boolean","default":false},"commit":{"type":"boolean","default":true},"commitMessage":{"type":"string","default":"Release ${version}"},"commitArgs":{"type":"array","items":{}},"tag":{"type":"boolean","default":true},"tagExclude":{"default":null},"tagName":{"default":null},"tagMatch":{"default":null},"getLatestTagFromAllRefs":{"type":"boolean","default":false},"tagAnnotation":{"type":"string","default":"Release ${version}"},"tagArgs":{"type":"array","items":{}},"push":{"type":"boolean","default":true},"pushArgs":{"type":"array","items":{"type":"string"},"default":["--follow-tags"]},"pushRepo":{"type":"string","default":""}}},"npm":{"type":"object","properties":{"publish":{"type":"boolean","default":true},"publishPath":{"type":"string","default":"."},"publishArgs":{"type":"array","items":{}},"tag":{"default":null},"otp":{"default":null},"ignoreVersion":{"type":"boolean","default":false},"allowSameVersion":{"type":"boolean","default":false},"versionArgs":{"type":"array","items":{}},"skipChecks":{"type":"boolean","default":false},"timeout":{"type":"number","default":10}}},"github":{"type":"object","properties":{"release":{"type":"boolean","default":false},"releaseName":{"type":"string","default":"Release ${version}"},"releaseNotes":{"default":null},"autoGenerate":{"type":"boolean","default":false},"preRelease":{"type":"boolean","default":false},"draft":{"type":"boolean","default":false},"tokenRef":{"type":"string","default":"GITHUB_TOKEN"},"assets":{"default":null},"host":{"default":null},"timeout":{"type":"number","default":0},"proxy":{"default":null},"makeLatest":{"anyOf":[{"type":"boolean"},{"type":"string","const":"legacy"}],"default":"true\n'legacy' - Github determines the latest release based on the release creation date and higher semantic version.\nSee https://docs.github.com/en/rest/releases/releases?apiVersion=latest#create-a-release"},"discussionCategoryName":{"type":["boolean","string"],"default":false},"skipChecks":{"type":"boolean","default":false},"web":{"type":"boolean","default":false},"comments":{"type":"object","properties":{"submit":{"type":"boolean","default":false},"issue":{"type":"string","default":":rocket?: _This issue has been resolved in v${version}. See [${releaseName}](${releaseUrl}) for release notes._"},"pr":{"type":"string","default":":rocket?: _This pull request is included in v${version}. See [${releaseName}](${releaseUrl}) for release notes._"}}}}},"gitlab":{"type":"object","properties":{"release":{"type":"boolean","default":false},"releaseName":{"type":"string","default":"Release ${version}"},"releaseNotes":{"default":null},"milestones":{"type":"array","items":{}},"tokenRef":{"type":"string","default":"GITLAB_TOKEN"},"tokenHeader":{"type":"string","default":"Private-Token"},"certificateAuthorityFile":{"default":null},"secure":{"type":"boolean","default":null},"assets":{"default":null},"useIdsForUrls":{"type":"boolean","default":false},"useGenericPackageRepositoryForAssets":{"type":"boolean","default":false},"genericPackageRepositoryName":{"type":"string","default":"release-it"},"origin":{"default":null},"skipChecks":{"type":"boolean","default":false}}}}}],"description":"Provide a configuration object or an object with only \"config\" property","examples":[{"config":"path/to/config/file"}]},"Hooks":{"type":"object","properties":{"before:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:version:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:version:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:version:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:version:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:version:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:version:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:git:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:git:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:git:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:git:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:git:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:git:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:npm:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:npm:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:npm:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:npm:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:npm:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:npm:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:github:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:github:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:github:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:github:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:github:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:github:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:gitlab:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:gitlab:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:gitlab:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:gitlab:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:gitlab:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:gitlab:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}}}}}
1
+ {"$schema":"http://json-schema.org/draft-07/schema#","$ref":"#/definitions/GlobalSettings","definitions":{"GlobalSettings":{"type":"object","properties":{"release":{"$ref":"#/definitions/UserProvidedConfigSetting%3CConfig%3E","description":"Release configuration"}}},"UserProvidedConfigSetting<Config>":{"anyOf":[{"type":"object","properties":{"config":{"type":"string","description":"The configuration file path"}},"required":["config"]},{"type":"object","properties":{"hooks":{"$ref":"#/definitions/Hooks"},"plugins":{"type":"object","additionalProperties":{"type":"object"}},"git":{"type":"object","properties":{"changelog":{"type":"string","default":"git log --pretty=format:\"* %s (%h)\" ${from}...${to}"},"requireCleanWorkingDir":{"type":"boolean","default":true},"requireBranch":{"anyOf":[{"type":"string"},{"type":"boolean","const":false}],"default":false},"requireUpstream":{"type":"boolean","default":true},"requireCommits":{"type":"boolean","default":false},"requireCommitsFail":{"type":"boolean","default":true},"commitsPath":{"type":"string","default":""},"addUntrackedFiles":{"type":"boolean","default":false},"commit":{"type":"boolean","default":true},"commitMessage":{"type":"string","default":"Release ${version}"},"commitArgs":{"type":"array","items":{}},"tag":{"type":"boolean","default":true},"tagExclude":{"default":null},"tagName":{"default":null},"tagMatch":{"default":null},"getLatestTagFromAllRefs":{"type":"boolean","default":false},"tagAnnotation":{"type":"string","default":"Release ${version}"},"tagArgs":{"type":"array","items":{}},"push":{"type":"boolean","default":true},"pushArgs":{"type":"array","items":{"type":"string"},"default":["--follow-tags"]},"pushRepo":{"type":"string","default":""}}},"npm":{"type":"object","properties":{"publish":{"type":"boolean","default":true},"publishPath":{"type":"string","default":"."},"publishArgs":{"type":"array","items":{}},"tag":{"default":null},"otp":{"default":null},"ignoreVersion":{"type":"boolean","default":false},"allowSameVersion":{"type":"boolean","default":false},"versionArgs":{"type":"array","items":{}},"skipChecks":{"type":"boolean","default":false},"timeout":{"type":"number","default":10}}},"github":{"type":"object","properties":{"release":{"type":"boolean","default":false},"releaseName":{"type":"string","default":"Release ${version}"},"releaseNotes":{"default":null},"autoGenerate":{"type":"boolean","default":false},"preRelease":{"type":"boolean","default":false},"draft":{"type":"boolean","default":false},"tokenRef":{"type":"string","default":"GITHUB_TOKEN"},"assets":{"default":null},"host":{"default":null},"timeout":{"type":"number","default":0},"proxy":{"default":null},"makeLatest":{"anyOf":[{"type":"boolean"},{"type":"string","const":"legacy"}],"default":"true\n'legacy' - Github determines the latest release based on the release creation date and higher semantic version.\nSee https://docs.github.com/en/rest/releases/releases?apiVersion=latest#create-a-release"},"discussionCategoryName":{"type":["boolean","string"],"default":false},"skipChecks":{"type":"boolean","default":false},"web":{"type":"boolean","default":false},"comments":{"type":"object","properties":{"submit":{"type":"boolean","default":false},"issue":{"type":"string","default":":rocket?: _This issue has been resolved in v${version}. See [${releaseName}](${releaseUrl}) for release notes._"},"pr":{"type":"string","default":":rocket?: _This pull request is included in v${version}. See [${releaseName}](${releaseUrl}) for release notes._"}}}}},"gitlab":{"type":"object","properties":{"release":{"type":"boolean","default":false},"releaseName":{"type":"string","default":"Release ${version}"},"releaseNotes":{"default":null},"milestones":{"type":"array","items":{}},"tokenRef":{"type":"string","default":"GITLAB_TOKEN"},"tokenHeader":{"type":"string","default":"Private-Token"},"certificateAuthorityFile":{"default":null},"secure":{"type":"boolean","default":null},"assets":{"default":null},"useIdsForUrls":{"type":"boolean","default":false},"useGenericPackageRepositoryForAssets":{"type":"boolean","default":false},"genericPackageRepositoryName":{"type":"string","default":"release-it"},"origin":{"default":null},"skipChecks":{"type":"boolean","default":false}}}}}],"description":"Provide a configuration object or an object with only \"config\" property","examples":[{"config":"path/to/config/file"}]},"Hooks":{"type":"object","properties":{"before:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:version:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:version:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:version:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:version:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:version:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:version:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:git:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:git:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:git:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:git:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:git:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:git:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:npm:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:npm:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:npm:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:npm:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:npm:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:npm:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:github:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:github:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:github:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:github:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:github:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:github:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:gitlab:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:gitlab:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"before:gitlab:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:gitlab:init":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:gitlab:bump":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"after:gitlab:release":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}}}}}
@@ -2,25 +2,29 @@ import { ResultPromise as ExecaResultPromise, ExecaError, Options as ExecaOption
2
2
  import { default as _prompts } from 'prompts';
3
3
  /**
4
4
  * Command execution error thrown by execa
5
+ * @group Types
5
6
  */
6
7
  export interface RunError extends ExecaError {
7
8
  }
9
+ /**
10
+ * CLI - interface utils
11
+ * @group None
12
+ */
8
13
  export declare class InterfaceUtils {
9
14
  /**
10
15
  * Get root directory path
11
16
  * @example
12
17
  * const { rootDir } = InterfaceUtils
13
- * console.log(rootDir) // => 'path/to/your/root/dir'
18
+ * console.log(rootDir) // 'path/to/your/root/dir'
14
19
  */
15
20
  static rootDir: string;
16
21
  /**
22
+ * Run command (child_process). See also `execa` package documentation
17
23
  * @param bin - Command
18
24
  * @param args - Same as execa second arg
19
25
  * @param opts - Options
20
26
  * @returns The `execa` Promise
21
27
  * @throws {RunError}
22
- * @description
23
- * Run command (child_process). See also `execa` package documentation
24
28
  * @example
25
29
  * const { run } = InterfaceUtils
26
30
  * await run('npm run test')
@@ -29,26 +33,24 @@ export declare class InterfaceUtils {
29
33
  * // Old way
30
34
  * await run('npm', [ 'run', 'test' ], { stdio: 'inherit' })
31
35
  */
32
- static run(command: string, opts?: ExecaOptions): ExecaResultPromise;
36
+ static run(bin: string, args?: string[] | ExecaOptions, opts?: ExecaOptions): ExecaResultPromise;
37
+ static run(bin: string, opts?: ExecaOptions): ExecaResultPromise;
33
38
  static run(bin: string, args: string[], opts?: ExecaOptions): ExecaResultPromise;
34
39
  /**
35
- * @param {number} [code] - Code for process.exit() (default: 0)
36
- * @returns {void}
37
- * @description
38
40
  * Exit process
41
+ * @param code - Code for process.exit() (default: 0)
39
42
  * @example
40
43
  * const { abort } = InterfaceUtils
41
- * abort() // => exit process with code 0
42
- * abort(1) // => error code
44
+ * abort() // exit process with code 0
45
+ * abort(1) // error code
43
46
  */
44
47
  static abort(code?: number): void;
45
48
  /**
49
+ * Demand confirmation with prompts native util. If not confirmed, it will automatically abort the script.
46
50
  * @param question - A prompt question object
47
51
  * @param options - A prompt options object
48
- * @returns {Promise<boolean>} - True if confirmed
49
- * @description
50
- * Demand confirmation with prompts native util. If not confirmed, it will automatically abort the script.
51
52
  * @example
53
+ * const { confirm } = InterfaceUtils
52
54
  * confirm({ message: 'Confirm to continue' }) // Deny it will abort the script
53
55
  */
54
56
  static confirm(question: _prompts.PromptObject, options?: _prompts.Options): Promise<true | undefined>;
@@ -1,18 +1,37 @@
1
1
  import { default as indent } from 'indent-string';
2
2
  import { default as _stripAnsi } from 'strip-ansi';
3
+ import { LoggerInstance } from './types';
4
+ /**
5
+ * CLI - Output utils
6
+ * @group None
7
+ */
3
8
  export declare class OutputUtils {
4
9
  /**
5
10
  * To automatically increment step index
6
11
  * @ignore
7
12
  */
8
13
  private static stepsCache;
14
+ /**
15
+ * The logger instance
16
+ * @ignore
17
+ */
18
+ private static _loggerInstance;
9
19
  /**
10
20
  * Use `chalk` package to style output in console/stdout
11
21
  * @example
12
- * const { $style } = OutputUtils
13
- * console.log($style.green('Green text!')) // => '[32mGreen text![0m'
22
+ * const { $style, log } = OutputUtils
23
+ * log($style.green('Green text!')) // => '[32mGreen text![0m'
14
24
  */
15
25
  static $style: import('chalk').ChalkInstance;
26
+ /**
27
+ * Set logger instance
28
+ * @param loggerInstance - The logger instance to set
29
+ */
30
+ static setLoggerInstance(loggerInstance: LoggerInstance): void;
31
+ /**
32
+ * Get the logger instance
33
+ */
34
+ static getLoggerInstance(): LoggerInstance;
16
35
  /**
17
36
  * Format a message for console output
18
37
  * @param msg - The message to format
@@ -30,12 +49,11 @@ export declare class OutputUtils {
30
49
  indentChar?: string;
31
50
  }): string;
32
51
  /**
52
+ * Log message in console
33
53
  * @param msg - The message
34
54
  * @param options - (Optional) Options object
35
55
  * @param options.indent - How many repeat indent (see `indent-string` package)
36
56
  * @param options.indentChar - Indent character(s). If `options.indent` not provided, will be repeated only 1 time
37
- * @description
38
- * Log message in console
39
57
  * @example
40
58
  * const { log } = OutputUtils
41
59
  * log() // => blank line
@@ -43,9 +61,7 @@ export declare class OutputUtils {
43
61
  * log('To do:', { indent: 2 }) // => ' To do:'
44
62
  */
45
63
  static log(msg?: string, options?: Parameters<typeof this.formatOutputMessage>[1] & {
46
- loggerInstance?: {
47
- log: Function;
48
- };
64
+ loggerInstance?: LoggerInstance;
49
65
  }): void;
50
66
  /**
51
67
  * Display warning message
@@ -56,12 +72,11 @@ export declare class OutputUtils {
56
72
  */
57
73
  static warn(msg: string): void;
58
74
  /**
75
+ * Display error message. Throws `err` if provided.
59
76
  * @param msg - The message to display
60
77
  * @param err - If provided, throw the error
61
- * @description
62
- * Display error message. Throws `err` if provided.
63
78
  * @example
64
- * const { error } = require('@hperchec/juisy').utils
79
+ * const { error } = OutputUtils
65
80
  * error('No configuration file') // => '[31m⨉ ERROR: No configuration file[0m'
66
81
  * error('No configuration file', error) // => Log and throws error
67
82
  */
@@ -72,6 +87,7 @@ export declare class OutputUtils {
72
87
  * @param options - Options object
73
88
  * @param options.index - Custom index. If `null`, no index prepended to string
74
89
  * @example
90
+ * const { step } = OutputUtils
75
91
  * step('Important step') // => '● 1 - Important step'
76
92
  * step('Very important step') // => '● 2 - Very important step'
77
93
  */
@@ -84,7 +100,7 @@ export declare class OutputUtils {
84
100
  * @param options - Options object
85
101
  * @param options.last - Defines if it is the last substep
86
102
  * @example
87
- * const { substep } = require('@hperchec/juisy').utils
103
+ * const { substep } = OutputUtils
88
104
  * substep('Awesome substep') // => '├ Awesome substep'
89
105
  * substep('Last substep', { last: true }) // => '└ Last substep'
90
106
  */
@@ -92,13 +108,11 @@ export declare class OutputUtils {
92
108
  last?: boolean;
93
109
  }): void;
94
110
  /**
95
- * @param {string} message - Message to display
96
- * @param {Function} fct - The function to execute
97
- * @returns {Promise<void>}
98
- * @description
99
111
  * Wait function: display loading during 'fct' execution
112
+ * @param message - Message to display
113
+ * @param fct - The function to execute
100
114
  * @example
101
- * const { wait } = require('@hperchec/juisy').utils
115
+ * const { wait } = OutputUtils
102
116
  * await wait('Waiting', async () => {
103
117
  * // Do async logic
104
118
  * })
@@ -3,7 +3,16 @@ type PluginObject = {
3
3
  beforeCreate?: Plugin['beforeCreate'];
4
4
  created?: Plugin['created'];
5
5
  };
6
+ /**
7
+ * CLI - Plugin class
8
+ * @group None
9
+ */
6
10
  export declare class Plugin {
11
+ /**
12
+ * Creates a Plugin instance
13
+ * @param name - The unique name
14
+ * @param pluginObject - The plugin object
15
+ */
7
16
  constructor(name: string, pluginObject: PluginObject);
8
17
  /**
9
18
  * The plugin unique name
@@ -75,4 +75,12 @@ export type ExtractedUsage = {
75
75
  deprecated: boolean;
76
76
  }>;
77
77
  };
78
+ /**
79
+ * Extract command usage to create a command doclet from.
80
+ * @group None
81
+ * @param factory - The result of CLIFactory()
82
+ * @param recursive - Recursively extract child commands
83
+ * @param args - The args to pass (default: [''])
84
+ * @param locale - The locale (default: 'en')
85
+ */
78
86
  export declare function extractUsage(factory: Awaited<ReturnType<typeof CLIFactory>>, recursive?: boolean, args?: string[], locale?: string): Promise<CommandDoclet>;
@@ -30,3 +30,4 @@ export type * from './plugins/register-release-command/augment';
30
30
  export type * from './plugins/default-command-fallbacks/augment';
31
31
  export type * from './plugins/command-meta/augment';
32
32
  export type * from './plugins/private-commands/augment';
33
+ export type * from '../shims/shims';