juisy 2.0.0-beta.9 → 2.0.1

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 (30) hide show
  1. package/LICENSE +661 -0
  2. package/bin/cli/cmds/index.js +1 -3
  3. package/bin/cli/cmds/public/print-globals.js +1 -1
  4. package/bin/cli/index.js +1 -1
  5. package/dist/cli/CLIFactory.d.ts +2 -0
  6. package/dist/cli/Command.d.ts +46 -6
  7. package/dist/cli/GlobalSettings.schema.json +1 -1
  8. package/dist/cli/InterfaceUtils.d.ts +17 -13
  9. package/dist/cli/OutputUtils.d.ts +1 -12
  10. package/dist/cli/index.d.ts +1 -1
  11. package/dist/cli/index.js +504 -456
  12. package/dist/cli/plugins/register-bump-version-command/cmds/index.d.ts +14 -2
  13. package/dist/cli/plugins/register-lint-commands/augment.d.ts +2 -3
  14. package/dist/cli/plugins/register-lint-commands/settings.d.ts +1 -1
  15. package/dist/cli/plugins/register-release-command/augment.d.ts +2 -2
  16. package/dist/cli/types.d.ts +6 -2
  17. package/dist/cli/utils.d.ts +1 -10
  18. package/dist/eject.d.ts +2 -0
  19. package/dist/index.js +8 -3
  20. package/dist/project-globals.d.ts +7 -26
  21. package/dist/templater/index.js +2 -2
  22. package/dist/vite/plugins/inject-css-variables/index.d.ts +23 -0
  23. package/dist/vite/plugins/inject-css-variables/index.js +60 -0
  24. package/dist/vite/plugins/inject-project-globals/index.d.ts +19 -0
  25. package/dist/vite/plugins/inject-project-globals/index.js +58 -0
  26. package/package.json +198 -190
  27. package/bin/cli/cmds/public/squeeze.js +0 -269
  28. package/dist/cli/plugins/command-handler-injections/augment.d.ts +0 -29
  29. package/dist/cli/plugins/command-handler-injections/command-visitors/command-handler-injections.d.ts +0 -10
  30. package/dist/cli/plugins/command-handler-injections/index.d.ts +0 -3
@@ -14,7 +14,7 @@ export default new CLI.Command({
14
14
  cli.option('t', {
15
15
  alias: 'target',
16
16
  type: 'string',
17
- describe: 'The target file exporting project globals (fallback to ./globals.config.js)'
17
+ describe: 'The target file exporting project globals (fallback to ./project.globals.js)'
18
18
  })
19
19
  return cli
20
20
  },
package/bin/cli/index.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  'use strict'
4
4
 
@@ -52,5 +52,7 @@ export type PluginAPI = {
52
52
  export declare function CLIFactory(builder: CLIBuilder, options?: CLIFactoryOptions): Promise<(argv?: typeof process.argv) => CLIEngine>;
53
53
  export declare namespace CLIFactory {
54
54
  var use: (plugin: Plugin) => void;
55
+ var removePlugin: (name: string) => void;
56
+ var getRegisteredPlugins: () => Plugin[];
55
57
  }
56
58
  export {};
@@ -1,11 +1,12 @@
1
- import { CommandObject } from './types';
1
+ import { OutputUtils } from './OutputUtils';
2
+ import { CLIEngine, CommandObject, CommandHandlerArgs } from './types';
2
3
  type CommandOptions = {
3
4
  command: CommandObject['command'];
4
5
  aliases?: CommandObject['aliases'];
5
6
  describe?: CommandObject['describe'];
6
7
  deprecated?: CommandObject['deprecated'];
7
- builder?: CommandObject['builder'];
8
- handler?: CommandObject['handler'];
8
+ builder?: Command['builder'];
9
+ handler?: Command['handler'];
9
10
  middlewares?: CommandObject['middlewares'];
10
11
  meta?: CommandObject['meta'];
11
12
  };
@@ -17,7 +18,7 @@ export declare class Command implements CommandObject {
17
18
  * Creates a Command instance from object (CommandObject)
18
19
  * @param {CommandObject} commandObject - The command definition object
19
20
  */
20
- constructor(commandObject: CommandOptions);
21
+ constructor(commandObject?: CommandOptions);
21
22
  /**
22
23
  * The command
23
24
  */
@@ -41,14 +42,53 @@ export declare class Command implements CommandObject {
41
42
  /**
42
43
  * Command builder
43
44
  */
44
- builder: (cli: import('./types').CLIEngine) => import('./types').CLIEngine | PromiseLike<import('./types').CLIEngine>;
45
+ builder(cli: CLIEngine): CLIEngine | PromiseLike<CLIEngine>;
45
46
  /**
46
47
  * Command handler
47
48
  */
48
- handler: import('./types').CommandHandler | undefined;
49
+ handler(this: Command, argv: CommandHandlerArgs): void | Promise<void>;
49
50
  /**
50
51
  * Command middlewares
51
52
  */
52
53
  middlewares: import('yargs').MiddlewareFunction[] | undefined;
54
+ /**
55
+ * Log a message in the console output. Uses OutputUtils.log method.
56
+ * @param msg The message to log. Can be empty to log blank line
57
+ * @param options The options to pass to OutputUtils.log second argument
58
+ */
59
+ log(msg?: string, options?: Parameters<typeof OutputUtils.log>[1]): void;
60
+ /**
61
+ * Get the process.argv without bin
62
+ * @returns An array of command line arguments
63
+ */
64
+ getProcessArgv(): string[];
65
+ /**
66
+ * Get Command instance as plain object
67
+ * @returns The command definition object to pass to yargs
68
+ */
69
+ toObject(): {
70
+ command: string | readonly string[] | undefined;
71
+ aliases: string | readonly string[] | undefined;
72
+ describe: string | false | undefined;
73
+ deprecated: string | boolean | undefined;
74
+ meta: Partial<import('./types').CommandMeta> | undefined;
75
+ builder: (cli: CLIEngine) => CLIEngine | PromiseLike<CLIEngine>;
76
+ handler: (argv: CommandHandlerArgs) => void | Promise<void>;
77
+ middlewares: import('yargs').MiddlewareFunction[] | undefined;
78
+ };
79
+ /**
80
+ * Getters
81
+ */
82
+ /**
83
+ * Get the CLI engine
84
+ */
85
+ get engine(): CLIEngine;
86
+ /**
87
+ * Static properties
88
+ */
89
+ /**
90
+ * The CLI engine. Will be set by createEngine method
91
+ */
92
+ static engine: CLIEngine;
53
93
  }
54
94
  export {};
@@ -1 +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
+ {"$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,4 +1,4 @@
1
- import { ExecaError } from 'execa';
1
+ import { ResultPromise as ExecaResultPromise, ExecaError, Options as ExecaOptions } from 'execa';
2
2
  import { default as _prompts } from 'prompts';
3
3
  /**
4
4
  * Command execution error thrown by execa
@@ -9,45 +9,49 @@ export declare class InterfaceUtils {
9
9
  /**
10
10
  * Get root directory path
11
11
  * @example
12
- * import { CLIUtils: { rootDir } } from '@hperchec/juisy'
12
+ * const { rootDir } = InterfaceUtils
13
13
  * console.log(rootDir) // => 'path/to/your/root/dir'
14
14
  */
15
15
  static rootDir: string;
16
16
  /**
17
- * @param {string} bin - Command
18
- * @param {string[]} args - Same as execa second arg
19
- * @param {object} [opts] - Options
20
- * @returns {Promise<object>} The `execa` Promise
17
+ * @param bin - Command
18
+ * @param args - Same as execa second arg
19
+ * @param opts - Options
20
+ * @returns The `execa` Promise
21
21
  * @throws {RunError}
22
22
  * @description
23
23
  * Run command (child_process). See also `execa` package documentation
24
24
  * @example
25
- * const { run } = require('@hperchec/juisy').utils
25
+ * const { run } = InterfaceUtils
26
+ * await run('npm run test')
27
+ * // With options
28
+ * await run('npm run test', { stdio: 'inherit' })
29
+ * // Old way
26
30
  * await run('npm', [ 'run', 'test' ], { stdio: 'inherit' })
27
31
  */
28
- static run(bin: string, args: string[], opts?: {}): import('execa').ExecaChildProcess<string>;
32
+ static run(command: string, opts?: ExecaOptions): ExecaResultPromise;
33
+ static run(bin: string, args: string[], opts?: ExecaOptions): ExecaResultPromise;
29
34
  /**
30
- * @alias utils.abort
31
35
  * @param {number} [code] - Code for process.exit() (default: 0)
32
36
  * @returns {void}
33
37
  * @description
34
38
  * Exit process
35
39
  * @example
36
- * const { abort } = require('@hperchec/juisy').utils
40
+ * const { abort } = InterfaceUtils
37
41
  * abort() // => exit process with code 0
38
42
  * abort(1) // => error code
39
43
  */
40
44
  static abort(code?: number): void;
41
45
  /**
42
- * @alias utils.confirm
43
- * @param {prompts.PromptObject} question - A prompt question object (see https://gitlab.com/hperchec/juisy/-/blob/main/documentation/utils.md#utilspromptsargs-object)
46
+ * @param question - A prompt question object
47
+ * @param options - A prompt options object
44
48
  * @returns {Promise<boolean>} - True if confirmed
45
49
  * @description
46
50
  * Demand confirmation with prompts native util. If not confirmed, it will automatically abort the script.
47
51
  * @example
48
52
  * confirm({ message: 'Confirm to continue' }) // Deny it will abort the script
49
53
  */
50
- static confirm(question: _prompts.PromptObject): Promise<true | undefined>;
54
+ static confirm(question: _prompts.PromptObject, options?: _prompts.Options): Promise<true | undefined>;
51
55
  /**
52
56
  * See `prompts` package documentation
53
57
  * @example
@@ -1,4 +1,3 @@
1
- import { default as chalk } from 'chalk';
2
1
  import { default as indent } from 'indent-string';
3
2
  import { default as _stripAnsi } from 'strip-ansi';
4
3
  export declare class OutputUtils {
@@ -13,17 +12,7 @@ export declare class OutputUtils {
13
12
  * const { $style } = OutputUtils
14
13
  * console.log($style.green('Green text!')) // => '[32mGreen text![0m'
15
14
  */
16
- static $style: chalk.Chalk & chalk.ChalkFunction & {
17
- supportsColor: chalk.ColorSupport | false;
18
- Level: chalk.Level;
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
- ForegroundColor: "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright";
21
- BackgroundColor: "bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgGrey" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright";
22
- Modifiers: "bold" | "hidden" | "reset" | "dim" | "italic" | "underline" | "inverse" | "strikethrough" | "visible";
23
- stderr: chalk.Chalk & {
24
- supportsColor: chalk.ColorSupport | false;
25
- };
26
- };
15
+ static $style: import('chalk').ChalkInstance;
27
16
  /**
28
17
  * Format a message for console output
29
18
  * @param msg - The message to format
@@ -13,6 +13,7 @@ declare global {
13
13
  };
14
14
  }
15
15
  export { CLIFactory } from './CLIFactory';
16
+ export { Plugin } from './Plugin';
16
17
  export * from './Command';
17
18
  export * from './InterfaceUtils';
18
19
  export * from './OutputUtils';
@@ -27,6 +28,5 @@ export type * from './plugins/register-git-hooks-commands/augment';
27
28
  export type * from './plugins/register-lint-commands/augment';
28
29
  export type * from './plugins/register-release-command/augment';
29
30
  export type * from './plugins/default-command-fallbacks/augment';
30
- export type * from './plugins/command-handler-injections/augment';
31
31
  export type * from './plugins/command-meta/augment';
32
32
  export type * from './plugins/private-commands/augment';