beachball 3.0.0-alpha.4 → 3.0.0-alpha.6
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/README.md +14 -12
- package/dist/NOTICE.txt +540 -0
- package/dist/github-app-token.mjs +6003 -0
- package/lib/bump/bumpInMemory.d.ts.map +1 -1
- package/lib/bump/bumpInMemory.js +1 -0
- package/lib/bump/bumpInMemory.js.map +1 -1
- package/lib/bump/performBump.d.ts.map +1 -1
- package/lib/bump/performBump.js +2 -3
- package/lib/bump/performBump.js.map +1 -1
- package/lib/changefile/writeChangeFiles.d.ts +1 -1
- package/lib/changefile/writeChangeFiles.d.ts.map +1 -1
- package/lib/changefile/writeChangeFiles.js +2 -2
- package/lib/changefile/writeChangeFiles.js.map +1 -1
- package/lib/changelog/getPackageChangelogs.d.ts.map +1 -1
- package/lib/changelog/getPackageChangelogs.js +7 -17
- package/lib/changelog/getPackageChangelogs.js.map +1 -1
- package/lib/changelog/writeChangelog.js +2 -3
- package/lib/changelog/writeChangelog.js.map +1 -1
- package/lib/cli.js +20 -37
- package/lib/cli.js.map +1 -1
- package/lib/commands/bump.d.ts +0 -2
- package/lib/commands/bump.d.ts.map +1 -1
- package/lib/commands/bump.js +4 -3
- package/lib/commands/bump.js.map +1 -1
- package/lib/commands/canary.d.ts +0 -2
- package/lib/commands/canary.d.ts.map +1 -1
- package/lib/commands/canary.js +4 -3
- package/lib/commands/canary.js.map +1 -1
- package/lib/commands/change.d.ts +0 -2
- package/lib/commands/change.d.ts.map +1 -1
- package/lib/commands/change.js +8 -4
- package/lib/commands/change.js.map +1 -1
- package/lib/commands/configGet.d.ts.map +1 -1
- package/lib/commands/configGet.js +4 -2
- package/lib/commands/configGet.js.map +1 -1
- package/lib/commands/migrate.d.ts.map +1 -1
- package/lib/commands/migrate.js +40 -0
- package/lib/commands/migrate.js.map +1 -1
- package/lib/commands/publish.d.ts +0 -2
- package/lib/commands/publish.d.ts.map +1 -1
- package/lib/commands/publish.js +4 -3
- package/lib/commands/publish.js.map +1 -1
- package/lib/commands/sync.d.ts +0 -2
- package/lib/commands/sync.d.ts.map +1 -1
- package/lib/commands/sync.js +5 -6
- package/lib/commands/sync.js.map +1 -1
- package/lib/env.d.ts +1 -0
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +2 -1
- package/lib/env.js.map +1 -1
- package/lib/githubAuth/appTokenBin.d.ts +2 -0
- package/lib/githubAuth/appTokenBin.d.ts.map +1 -0
- package/lib/githubAuth/appTokenBin.js +13 -0
- package/lib/githubAuth/appTokenBin.js.map +1 -0
- package/lib/githubAuth/appTokenCli.d.ts +15 -0
- package/lib/githubAuth/appTokenCli.d.ts.map +1 -0
- package/lib/githubAuth/appTokenCli.js +88 -0
- package/lib/githubAuth/appTokenCli.js.map +1 -0
- package/lib/githubAuth/createAppTokenHelper.d.ts +7 -0
- package/lib/githubAuth/createAppTokenHelper.d.ts.map +1 -0
- package/lib/githubAuth/createAppTokenHelper.js +93 -0
- package/lib/githubAuth/createAppTokenHelper.js.map +1 -0
- package/lib/githubAuth/requestHelpers.d.ts +11 -0
- package/lib/githubAuth/requestHelpers.d.ts.map +1 -0
- package/lib/githubAuth/requestHelpers.js +64 -0
- package/lib/githubAuth/requestHelpers.js.map +1 -0
- package/lib/githubAuth/revokeAppToken.d.ts +6 -0
- package/lib/githubAuth/revokeAppToken.d.ts.map +1 -0
- package/lib/githubAuth/revokeAppToken.js +15 -0
- package/lib/githubAuth/revokeAppToken.js.map +1 -0
- package/lib/githubAuth/signWithAzureCli.d.ts +14 -0
- package/lib/githubAuth/signWithAzureCli.d.ts.map +1 -0
- package/lib/githubAuth/signWithAzureCli.js +64 -0
- package/lib/githubAuth/signWithAzureCli.js.map +1 -0
- package/lib/githubAuth/types.d.ts +62 -0
- package/lib/githubAuth/types.d.ts.map +1 -0
- package/lib/githubAuth/types.js +3 -0
- package/lib/githubAuth/types.js.map +1 -0
- package/lib/githubAuth/validationHelpers.d.ts +20 -0
- package/lib/githubAuth/validationHelpers.d.ts.map +1 -0
- package/lib/githubAuth/validationHelpers.js +98 -0
- package/lib/githubAuth/validationHelpers.js.map +1 -0
- package/lib/monorepo/createCommandContext.d.ts +4 -10
- package/lib/monorepo/createCommandContext.d.ts.map +1 -1
- package/lib/monorepo/createCommandContext.js +15 -11
- package/lib/monorepo/createCommandContext.js.map +1 -1
- package/lib/monorepo/getPackageGroups.d.ts.map +1 -1
- package/lib/monorepo/getPackageGroups.js +1 -1
- package/lib/monorepo/getPackageGroups.js.map +1 -1
- package/lib/monorepo/getPackageInfos.d.ts +1 -3
- package/lib/monorepo/getPackageInfos.d.ts.map +1 -1
- package/lib/monorepo/getPackageInfos.js +13 -8
- package/lib/monorepo/getPackageInfos.js.map +1 -1
- package/lib/monorepo/getScopedPackages.d.ts.map +1 -1
- package/lib/monorepo/getScopedPackages.js +3 -2
- package/lib/monorepo/getScopedPackages.js.map +1 -1
- package/lib/monorepo/isPathIncluded.d.ts +9 -7
- package/lib/monorepo/isPathIncluded.d.ts.map +1 -1
- package/lib/monorepo/isPathIncluded.js +4 -14
- package/lib/monorepo/isPathIncluded.js.map +1 -1
- package/lib/options/BeachballCommand.d.ts +49 -0
- package/lib/options/BeachballCommand.d.ts.map +1 -0
- package/lib/options/BeachballCommand.js +115 -0
- package/lib/options/BeachballCommand.js.map +1 -0
- package/lib/options/BeachballHelp.d.ts +66 -0
- package/lib/options/BeachballHelp.d.ts.map +1 -0
- package/lib/options/BeachballHelp.js +217 -0
- package/lib/options/BeachballHelp.js.map +1 -0
- package/lib/options/BeachballOption.d.ts +54 -0
- package/lib/options/BeachballOption.d.ts.map +1 -0
- package/lib/options/BeachballOption.js +99 -0
- package/lib/options/BeachballOption.js.map +1 -0
- package/lib/options/commandDefinitions.d.ts +24 -0
- package/lib/options/commandDefinitions.d.ts.map +1 -0
- package/lib/options/commandDefinitions.js +43 -0
- package/lib/options/commandDefinitions.js.map +1 -0
- package/lib/options/getCliOptions.d.ts +27 -4
- package/lib/options/getCliOptions.d.ts.map +1 -1
- package/lib/options/getCliOptions.js +48 -137
- package/lib/options/getCliOptions.js.map +1 -1
- package/lib/options/getDefaultOptions.d.ts.map +1 -1
- package/lib/options/getDefaultOptions.js +0 -1
- package/lib/options/getDefaultOptions.js.map +1 -1
- package/lib/options/getOptions.d.ts +3 -8
- package/lib/options/getOptions.d.ts.map +1 -1
- package/lib/options/getOptions.js +1 -15
- package/lib/options/getOptions.js.map +1 -1
- package/lib/options/getPackageInfosWithOptions.d.ts +0 -2
- package/lib/options/getPackageInfosWithOptions.d.ts.map +1 -1
- package/lib/options/getPackageInfosWithOptions.js +8 -6
- package/lib/options/getPackageInfosWithOptions.js.map +1 -1
- package/lib/options/optionDefinitions.d.ts +67 -0
- package/lib/options/optionDefinitions.d.ts.map +1 -0
- package/lib/options/optionDefinitions.js +209 -0
- package/lib/options/optionDefinitions.js.map +1 -0
- package/lib/publish/bumpAndPush.d.ts.map +1 -1
- package/lib/publish/bumpAndPush.js +9 -3
- package/lib/publish/bumpAndPush.js.map +1 -1
- package/lib/types/BeachballOptions.d.ts +24 -7
- package/lib/types/BeachballOptions.d.ts.map +1 -1
- package/lib/types/BumpInfo.d.ts +2 -0
- package/lib/types/BumpInfo.d.ts.map +1 -1
- package/lib/types/ChangeLog.d.ts +4 -8
- package/lib/types/ChangeLog.d.ts.map +1 -1
- package/lib/types/ChangelogOptions.d.ts +2 -4
- package/lib/types/ChangelogOptions.d.ts.map +1 -1
- package/lib/validation/isValidAuthType.d.ts +2 -0
- package/lib/validation/isValidAuthType.d.ts.map +1 -1
- package/lib/validation/isValidAuthType.js +3 -2
- package/lib/validation/isValidAuthType.js.map +1 -1
- package/lib/validation/isValidChangelogOptions.d.ts.map +1 -1
- package/lib/validation/isValidChangelogOptions.js +22 -4
- package/lib/validation/isValidChangelogOptions.js.map +1 -1
- package/lib/validation/isValidGroupOptions.d.ts.map +1 -1
- package/lib/validation/isValidGroupOptions.js +9 -0
- package/lib/validation/isValidGroupOptions.js.map +1 -1
- package/lib/validation/validate.d.ts +1 -3
- package/lib/validation/validate.d.ts.map +1 -1
- package/lib/validation/validate.js +17 -7
- package/lib/validation/validate.js.map +1 -1
- package/package.json +7 -5
- package/lib/bump/gatherBumpInfo.d.ts +0 -8
- package/lib/bump/gatherBumpInfo.d.ts.map +0 -1
- package/lib/bump/gatherBumpInfo.js +0 -13
- package/lib/bump/gatherBumpInfo.js.map +0 -1
- package/lib/git/tempGetDefaultRemoteBranch.d.ts +0 -39
- package/lib/git/tempGetDefaultRemoteBranch.d.ts.map +0 -1
- package/lib/git/tempGetDefaultRemoteBranch.js +0 -72
- package/lib/git/tempGetDefaultRemoteBranch.js.map +0 -1
- package/lib/help.d.ts +0 -3
- package/lib/help.d.ts.map +0 -1
- package/lib/help.js +0 -103
- package/lib/help.js.map +0 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.allCommandNames = exports.commandDefinitions = void 0;
|
|
4
|
+
const changeExtra = 'Considers committed and staged changes, but not unstaged or untracked changes.';
|
|
5
|
+
exports.commandDefinitions = {
|
|
6
|
+
change: {
|
|
7
|
+
desc: 'Create change file(s) for this branch if needed',
|
|
8
|
+
extraDesc: changeExtra +
|
|
9
|
+
'\n\nBy default, an interactive prompt is used to choose the type and message for each changed package. ' +
|
|
10
|
+
'Use --message and --type (and optionally --package) to skip the prompt. ' +
|
|
11
|
+
'For help choosing a change type, see https://microsoft.github.io/beachball/concepts/change-types',
|
|
12
|
+
isDefault: true,
|
|
13
|
+
},
|
|
14
|
+
check: { desc: 'Check whether change file(s) are needed for this branch', extraDesc: changeExtra },
|
|
15
|
+
publish: { desc: 'Bump, publish to npm registry, and push updates back to the target branch' },
|
|
16
|
+
bump: { desc: "Bump versions and generate changelogs, but don't commit or publish" },
|
|
17
|
+
sync: {
|
|
18
|
+
desc: 'Synchronize package versions from the registry with local package.json versions',
|
|
19
|
+
},
|
|
20
|
+
config: {
|
|
21
|
+
desc: 'Get or list config settings (requires a sub-command)',
|
|
22
|
+
subcommands: {
|
|
23
|
+
get: {
|
|
24
|
+
desc: 'Get the value of a config setting (with any overrides)',
|
|
25
|
+
args: { '<name>': 'beachball config setting name' },
|
|
26
|
+
},
|
|
27
|
+
list: { desc: 'List all config settings (with any overrides)' },
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
migrate: { desc: 'Help to migrate from beachball v2' },
|
|
31
|
+
canary: { desc: 'Publish prerelease versions of changed or all packages without committing' },
|
|
32
|
+
init: {
|
|
33
|
+
desc: 'Initialize a new beachball config file in the current directory',
|
|
34
|
+
hidden: true,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
const extraCommandNames = Object.keys({
|
|
38
|
+
'config get': true,
|
|
39
|
+
'config list': true,
|
|
40
|
+
});
|
|
41
|
+
/** All command names including nested */
|
|
42
|
+
exports.allCommandNames = [...Object.keys(exports.commandDefinitions), ...extraCommandNames];
|
|
43
|
+
//# sourceMappingURL=commandDefinitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandDefinitions.js","sourceRoot":"","sources":["../../src/options/commandDefinitions.ts"],"names":[],"mappings":";;;AAwBA,MAAM,WAAW,GAAG,gFAAgF,CAAC;AAExF,QAAA,kBAAkB,GAA+C;IAC5E,MAAM,EAAE;QACN,IAAI,EAAE,iDAAiD;QACvD,SAAS,EACP,WAAW;YACX,yGAAyG;YACzG,0EAA0E;YAC1E,kGAAkG;QACpG,SAAS,EAAE,IAAI;KAChB;IACD,KAAK,EAAE,EAAE,IAAI,EAAE,yDAAyD,EAAE,SAAS,EAAE,WAAW,EAAE;IAClG,OAAO,EAAE,EAAE,IAAI,EAAE,2EAA2E,EAAE;IAC9F,IAAI,EAAE,EAAE,IAAI,EAAE,oEAAoE,EAAE;IACpF,IAAI,EAAE;QACJ,IAAI,EAAE,iFAAiF;KACxF;IACD,MAAM,EAAE;QACN,IAAI,EAAE,sDAAsD;QAC5D,WAAW,EAAE;YACX,GAAG,EAAE;gBACH,IAAI,EAAE,wDAAwD;gBAC9D,IAAI,EAAE,EAAE,QAAQ,EAAE,+BAA+B,EAAE;aACpD;YACD,IAAI,EAAE,EAAE,IAAI,EAAE,+CAA+C,EAAE;SAChE;KACF;IACD,OAAO,EAAE,EAAE,IAAI,EAAE,mCAAmC,EAAE;IACtD,MAAM,EAAE,EAAE,IAAI,EAAE,2EAA2E,EAAE;IAC7F,IAAI,EAAE;QACJ,IAAI,EAAE,iEAAiE;QACvE,MAAM,EAAE,IAAI;KACb;CACF,CAAC;AAEF,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC;IACpC,YAAY,EAAE,IAAI;IAClB,aAAa,EAAE,IAAI;CAC0C,CAAC,CAAC;AAEjE,yCAAyC;AAC5B,QAAA,eAAe,GAAG,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,0BAAkB,CAAC,EAAE,GAAG,iBAAiB,CAA2B,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { OutputConfiguration } from 'commander';
|
|
1
2
|
import type { CliOptions, ParsedOptions } from '../types/BeachballOptions';
|
|
2
|
-
export interface
|
|
3
|
+
export interface ProgramContext {
|
|
3
4
|
/** Complete argv (node and script path aren't used but elements must be present) */
|
|
4
5
|
argv: string[];
|
|
5
6
|
/**
|
|
@@ -16,13 +17,35 @@ export interface ProcessInfo {
|
|
|
16
17
|
env: NodeJS.ProcessEnv | {
|
|
17
18
|
NPM_TOKEN?: string;
|
|
18
19
|
};
|
|
20
|
+
/** Beachball version (optional in tests) */
|
|
21
|
+
version?: string;
|
|
22
|
+
/** Output options override (mainly for testing) */
|
|
23
|
+
outputOptions?: OutputConfiguration;
|
|
19
24
|
}
|
|
20
25
|
/**
|
|
21
26
|
* Gets CLI options. Also gets the `NPM_TOKEN` environment variable if present.
|
|
27
|
+
*
|
|
28
|
+
* In v3, parsing was migrated from `yargs-parser` to `commander`. Implementation notes:
|
|
29
|
+
* - Each beachball command is registered as a commander subcommand, but currently `cli.ts` still
|
|
30
|
+
* handles the actual command dispatching (switch on `options.command`).
|
|
31
|
+
* - The `config` command has commander `get <name>` / `list` subcommands.
|
|
32
|
+
* - Every option is declared on both the parent command and each subcommand (so options can be
|
|
33
|
+
* specified either before or after the command name), following yargs behavior.
|
|
34
|
+
* - Descriptions/help are handled through commander's built-in help system.
|
|
35
|
+
* - `--help` and `--version` flags are handled by commander (it will print the info and exit).
|
|
36
|
+
* - In Jest, commander is configured to throw on error rather than calling `process.exit()`,
|
|
37
|
+
* and `outputOptions` (logging) use no-op functions by default.
|
|
38
|
+
*
|
|
39
|
+
* Some yargs-parser behaviors are preserved by custom logic in `BeachballOption`/`BeachballCommand`:
|
|
40
|
+
* - camelCase flags (e.g. `--gitTags`) in addition to dashed flags (e.g. `--git-tags`)
|
|
41
|
+
* - extra long-flag aliases (e.g. `--config` for `--config-path`)
|
|
42
|
+
* - boolean options automatically get a negated `--no-` form
|
|
43
|
+
*
|
|
44
|
+
* Other yargs-parser behaviors are NOT preserved:
|
|
45
|
+
* - arbitrary unknown options are errors
|
|
46
|
+
* - boolean options do not accept a value (e.g. `--verbose true` is an error)
|
|
22
47
|
*/
|
|
23
|
-
export declare function getCliOptions(
|
|
24
|
-
/** @deprecated Pass full process info */
|
|
25
|
-
export declare function getCliOptions(argv: string[]): ParsedOptions['cliOptions'];
|
|
48
|
+
export declare function getCliOptions(programContext: ProgramContext): ParsedOptions['cliOptions'];
|
|
26
49
|
/**
|
|
27
50
|
* Resolves `rawOptions.branch` if provided to ensure it includes the remote name.
|
|
28
51
|
* If no branch is provided, returns the default branch.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCliOptions.d.ts","sourceRoot":"","sources":["../../src/options/getCliOptions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getCliOptions.d.ts","sourceRoot":"","sources":["../../src/options/getCliOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAIrD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAK3E,MAAM,WAAW,cAAc;IAC7B,oFAAoF;IACpF,IAAI,EAAE,MAAM,EAAE,CAAC;IACf;;;;;OAKG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,aAAa,CAAC,EAAE,mBAAmB,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,aAAa,CAAC,cAAc,EAAE,cAAc,GAAG,aAAa,CAAC,YAAY,CAAC,CAyDzF;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAUpH"}
|
|
@@ -1,171 +1,82 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getCliOptions = getCliOptions;
|
|
7
4
|
exports.resolveBranchOption = resolveBranchOption;
|
|
8
5
|
const workspace_tools_1 = require("workspace-tools");
|
|
9
|
-
const yargs_parser_1 = __importDefault(require("yargs-parser"));
|
|
10
6
|
const env_1 = require("../env");
|
|
11
7
|
const getRemoteBranch_1 = require("../git/getRemoteBranch");
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
];
|
|
51
|
-
/** Type hack to verify that an array includes all keys of a type */
|
|
52
|
-
const allKeysOfType = () => (
|
|
53
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
|
-
...x) => x;
|
|
55
|
-
// Verify that all the known CLI options have types specified, to ensure correct parsing.
|
|
56
|
-
//
|
|
57
|
-
// NOTE: If a prop is missing, this will have a somewhat misleading error:
|
|
58
|
-
// Argument of type '"disallowedChangeTypes"' is not assignable to parameter of type '"tag" | "version"'
|
|
59
|
-
//
|
|
60
|
-
// To fix, add the missing names after "parameter of type" ("tag" and "version" in this example)
|
|
61
|
-
// to the appropriate array above.
|
|
62
|
-
const knownOptions = allKeysOfType()(...arrayOptions, ...booleanOptions, ...numberOptions, ...stringOptions,
|
|
63
|
-
// these options are filled in below, not respected from the command line
|
|
64
|
-
'path', 'command', '_extraPositionalArgs');
|
|
65
|
-
const parserOptions = {
|
|
66
|
-
configuration: {
|
|
67
|
-
'boolean-negation': true,
|
|
68
|
-
'camel-case-expansion': true,
|
|
69
|
-
'dot-notation': false,
|
|
70
|
-
'duplicate-arguments-array': true,
|
|
71
|
-
'flatten-duplicate-arrays': true,
|
|
72
|
-
'greedy-arrays': true, // for now; we might want to change this to false in the future
|
|
73
|
-
'parse-numbers': true,
|
|
74
|
-
'parse-positional-numbers': false,
|
|
75
|
-
'short-option-groups': false,
|
|
76
|
-
'strip-aliased': true,
|
|
77
|
-
'strip-dashed': true,
|
|
78
|
-
},
|
|
79
|
-
// spread to get rid of readonly...
|
|
80
|
-
array: [...arrayOptions],
|
|
81
|
-
boolean: [...booleanOptions],
|
|
82
|
-
number: [...numberOptions],
|
|
83
|
-
string: [...stringOptions],
|
|
84
|
-
alias: {
|
|
85
|
-
authType: ['a'],
|
|
86
|
-
branch: ['b'],
|
|
87
|
-
configPath: ['c', 'config'],
|
|
88
|
-
forceVersions: ['force'],
|
|
89
|
-
fromRef: ['since'],
|
|
90
|
-
help: ['h', '?'],
|
|
91
|
-
message: ['m'],
|
|
92
|
-
package: ['p'],
|
|
93
|
-
registry: ['r'],
|
|
94
|
-
tag: ['t'],
|
|
95
|
-
token: ['n'],
|
|
96
|
-
version: ['v'],
|
|
97
|
-
yes: ['y'],
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
function getCliOptions(processOrArgv) {
|
|
101
|
-
const processInfo = Array.isArray(processOrArgv)
|
|
102
|
-
? // eslint-disable-next-line no-restricted-properties -- legacy API
|
|
103
|
-
{ argv: processOrArgv, cwd: env_1.env.isJest ? '' : process.cwd(), env: process.env }
|
|
104
|
-
: processOrArgv;
|
|
105
|
-
// Be careful not to mutate the input argv
|
|
106
|
-
const trimmedArgv = processInfo.argv.slice(2);
|
|
107
|
-
const args = (0, yargs_parser_1.default)(trimmedArgv, parserOptions);
|
|
108
|
-
const { _: positionalArgs, ...options } = args;
|
|
109
|
-
let cwd = processInfo.cwd;
|
|
8
|
+
const BeachballCommand_1 = require("./BeachballCommand");
|
|
9
|
+
const optionDefinitions_1 = require("./optionDefinitions");
|
|
10
|
+
const commandDefinitions_1 = require("./commandDefinitions");
|
|
11
|
+
/**
|
|
12
|
+
* Gets CLI options. Also gets the `NPM_TOKEN` environment variable if present.
|
|
13
|
+
*
|
|
14
|
+
* In v3, parsing was migrated from `yargs-parser` to `commander`. Implementation notes:
|
|
15
|
+
* - Each beachball command is registered as a commander subcommand, but currently `cli.ts` still
|
|
16
|
+
* handles the actual command dispatching (switch on `options.command`).
|
|
17
|
+
* - The `config` command has commander `get <name>` / `list` subcommands.
|
|
18
|
+
* - Every option is declared on both the parent command and each subcommand (so options can be
|
|
19
|
+
* specified either before or after the command name), following yargs behavior.
|
|
20
|
+
* - Descriptions/help are handled through commander's built-in help system.
|
|
21
|
+
* - `--help` and `--version` flags are handled by commander (it will print the info and exit).
|
|
22
|
+
* - In Jest, commander is configured to throw on error rather than calling `process.exit()`,
|
|
23
|
+
* and `outputOptions` (logging) use no-op functions by default.
|
|
24
|
+
*
|
|
25
|
+
* Some yargs-parser behaviors are preserved by custom logic in `BeachballOption`/`BeachballCommand`:
|
|
26
|
+
* - camelCase flags (e.g. `--gitTags`) in addition to dashed flags (e.g. `--git-tags`)
|
|
27
|
+
* - extra long-flag aliases (e.g. `--config` for `--config-path`)
|
|
28
|
+
* - boolean options automatically get a negated `--no-` form
|
|
29
|
+
*
|
|
30
|
+
* Other yargs-parser behaviors are NOT preserved:
|
|
31
|
+
* - arbitrary unknown options are errors
|
|
32
|
+
* - boolean options do not accept a value (e.g. `--verbose true` is an error)
|
|
33
|
+
*/
|
|
34
|
+
function getCliOptions(programContext) {
|
|
35
|
+
let { cwd } = programContext;
|
|
36
|
+
const program = BeachballCommand_1.BeachballCommand.initProgram({
|
|
37
|
+
name: 'beachball',
|
|
38
|
+
desc: 'the sunniest version bumping tool',
|
|
39
|
+
options: optionDefinitions_1.optionDefinitions,
|
|
40
|
+
commands: commandDefinitions_1.commandDefinitions,
|
|
41
|
+
version: programContext.version,
|
|
42
|
+
outputOptions: programContext.outputOptions,
|
|
43
|
+
});
|
|
44
|
+
// For --help or --version, this will print the info and exit
|
|
45
|
+
const { command, options, extraArgs: extraPositionalArgs } = program.beachballParse(programContext.argv);
|
|
110
46
|
try {
|
|
111
47
|
// If a non-empty cwd is provided, find the project root from there.
|
|
112
48
|
// Empty means this is a test without a filesystem.
|
|
113
49
|
if (cwd && !env_1.env.isJest) {
|
|
114
|
-
cwd = (0, workspace_tools_1.findProjectRoot)(
|
|
50
|
+
cwd = (0, workspace_tools_1.findProjectRoot)(cwd);
|
|
115
51
|
}
|
|
116
52
|
}
|
|
117
53
|
catch {
|
|
118
54
|
// use the provided cwd
|
|
119
55
|
}
|
|
120
|
-
if (positionalArgs.length > 1 && String(positionalArgs[0]) !== 'config') {
|
|
121
|
-
throw new Error(`Only one positional argument (the command) is allowed. Received: ${positionalArgs.join(' ')}`);
|
|
122
|
-
}
|
|
123
56
|
const cliOptions = {
|
|
124
57
|
...options,
|
|
125
|
-
command
|
|
58
|
+
command,
|
|
126
59
|
path: cwd,
|
|
127
60
|
};
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const extraPositionalArgs = positionalArgs.length > 1 ? positionalArgs.slice(1).map(String) : undefined;
|
|
131
|
-
if (args.branch) {
|
|
132
|
-
cliOptions.branch = resolveBranchOption(args, cwd);
|
|
61
|
+
if (cliOptions.branch) {
|
|
62
|
+
cliOptions.branch = resolveBranchOption(cliOptions, cwd);
|
|
133
63
|
}
|
|
134
64
|
if (cliOptions.command === 'canary') {
|
|
135
65
|
cliOptions.tag = cliOptions.canaryName || 'canary';
|
|
136
66
|
}
|
|
137
67
|
for (const key of Object.keys(cliOptions)) {
|
|
138
|
-
|
|
139
|
-
if (value === undefined) {
|
|
68
|
+
if (cliOptions[key] === undefined) {
|
|
140
69
|
delete cliOptions[key];
|
|
141
70
|
}
|
|
142
|
-
else if (typeof value === 'number' && isNaN(value)) {
|
|
143
|
-
throw new Error(`Non-numeric value passed for numeric option "${key}"`);
|
|
144
|
-
}
|
|
145
|
-
else if (knownOptions.includes(key)) {
|
|
146
|
-
if (Array.isArray(value) && !arrayOptions.includes(key)) {
|
|
147
|
-
throw new Error(`Option "${key}" only accepts a single value. Received: ${value.join(' ')}`);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
else if (value === 'true') {
|
|
151
|
-
// For unknown arguments like --foo=true or --bar=false, yargs will handle the value as a string.
|
|
152
|
-
// Convert it to a boolean to avoid subtle bugs.
|
|
153
|
-
// eslint-disable-next-line
|
|
154
|
-
cliOptions[key] = true;
|
|
155
|
-
}
|
|
156
|
-
else if (value === 'false') {
|
|
157
|
-
// eslint-disable-next-line
|
|
158
|
-
cliOptions[key] = false;
|
|
159
|
-
}
|
|
160
71
|
}
|
|
161
|
-
//
|
|
162
|
-
if (extraPositionalArgs) {
|
|
72
|
+
// Save extra positional args for commands that support subcommands (e.g. 'config get <name>').
|
|
73
|
+
if (extraPositionalArgs.length) {
|
|
163
74
|
cliOptions._extraPositionalArgs = extraPositionalArgs;
|
|
164
75
|
}
|
|
165
76
|
// If both --token and NPM_TOKEN are provided, prefer the CLI token (could go either way, but
|
|
166
77
|
// this is safer for compatibility in case anyone was already using that env name another way)
|
|
167
|
-
if (
|
|
168
|
-
cliOptions.token =
|
|
78
|
+
if (programContext.env.NPM_TOKEN && cliOptions.token === undefined) {
|
|
79
|
+
cliOptions.token = programContext.env.NPM_TOKEN;
|
|
169
80
|
}
|
|
170
81
|
return cliOptions;
|
|
171
82
|
}
|
|
@@ -174,7 +85,7 @@ function getCliOptions(processOrArgv) {
|
|
|
174
85
|
* If no branch is provided, returns the default branch.
|
|
175
86
|
*/
|
|
176
87
|
function resolveBranchOption(rawOptions, cwd) {
|
|
177
|
-
const branchResult = (0,
|
|
88
|
+
const branchResult = (0, workspace_tools_1.resolveRemoteAndBranch)({
|
|
178
89
|
branch: rawOptions.branch,
|
|
179
90
|
cwd,
|
|
180
91
|
verbose: rawOptions.verbose,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCliOptions.js","sourceRoot":"","sources":["../../src/options/getCliOptions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getCliOptions.js","sourceRoot":"","sources":["../../src/options/getCliOptions.ts"],"names":[],"mappings":";;AAqDA,sCAyDC;AAMD,kDAUC;AA7HD,qDAA0E;AAC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AAyB,EAAE,CAAC;QAClE,IAAI,UAAU,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YAClC,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IAED,+FAA+F;IAC/F,IAAI,mBAAmB,CAAC,MAAM,EAAE,CAAC;QAC/B,UAAU,CAAC,oBAAoB,GAAG,mBAAmB,CAAC;IACxD,CAAC;IAED,6FAA6F;IAC7F,8FAA8F;IAC9F,IAAI,cAAc,CAAC,GAAG,CAAC,SAAS,IAAI,UAAU,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QACnE,UAAU,CAAC,KAAK,GAAG,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC;IAClD,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,UAA2D,EAAE,GAAW;IAC1G,MAAM,YAAY,GAAG,IAAA,wCAAsB,EAAC;QAC1C,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,GAAG;QACH,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,MAAM,EAAE,IAAI;KACb,CAAC,CAAC;IACH,IAAA,mCAAiB,EAAC,YAAY,EAAE,GAAG,CAAC,CAAC;IAErC,OAAO,GAAG,YAAY,CAAC,MAAM,IAAI,YAAY,CAAC,YAAY,EAAE,CAAC;AAC/D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDefaultOptions.d.ts","sourceRoot":"","sources":["../../src/options/getDefaultOptions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,gBAAgB,
|
|
1
|
+
{"version":3,"file":"getDefaultOptions.d.ts","sourceRoot":"","sources":["../../src/options/getDefaultOptions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,gBAAgB,CAkCpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDefaultOptions.js","sourceRoot":"","sources":["../../src/options/getDefaultOptions.ts"],"names":[],"mappings":";;AAMA,
|
|
1
|
+
{"version":3,"file":"getDefaultOptions.js","sourceRoot":"","sources":["../../src/options/getDefaultOptions.ts"],"names":[],"mappings":";;AAMA,8CAkCC;AAxCD,gCAA6B;AAG7B;;GAEG;AACH,SAAgB,iBAAiB;IAC/B,OAAO;QACL,MAAM,EAAE,YAAY;QACpB,GAAG,EAAE,KAAK;QACV,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,eAAe;QACvB,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI;QACd,UAAU,EAAE,SAAS;QACrB,UAAU,EAAE,gDAAgD;QAC5D,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE,QAAQ;QACjB,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,CAAC;QACd,aAAa,EAAE,QAAQ;QACvB,KAAK,EAAE,SAAS;QAChB,qBAAqB,EAAE,IAAI;QAC3B,KAAK,EAAE,IAAI;QACX,iBAAiB,EAAE,IAAI;QACvB,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,SAAS;QACrB,OAAO,EAAE,EAAE;QACX,kBAAkB,EAAE,SAAG,CAAC,cAAc;QACtC,IAAI,EAAE,EAAE;QACR,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,6BAA6B;QACvC,OAAO,EAAE,CAAC;QACV,KAAK,EAAE,IAAI;QACX,GAAG,EAAE,EAAE;QACP,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,IAAI;QACV,GAAG,EAAE,SAAG,CAAC,IAAI;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { type
|
|
3
|
-
/**
|
|
4
|
-
* Gets all repo level options (default + root options + cli options)
|
|
5
|
-
* @deprecated Use `getParsedOptions`
|
|
6
|
-
*/
|
|
7
|
-
export declare function getOptions(argv: string[]): BeachballOptions;
|
|
1
|
+
import type { ParsedOptions, RepoOptions } from '../types/BeachballOptions';
|
|
2
|
+
import { type ProgramContext } from './getCliOptions';
|
|
8
3
|
/**
|
|
9
4
|
* Get merged and unmerged options, for reuse by `getPackageInfos`.
|
|
10
5
|
* @param testRepoOptions Repo options for testing purposes
|
|
11
6
|
*/
|
|
12
|
-
export declare function
|
|
7
|
+
export declare function getOptions(params: ProgramContext & {
|
|
13
8
|
testRepoOptions?: Partial<RepoOptions>;
|
|
14
9
|
}): ParsedOptions;
|
|
15
10
|
//# sourceMappingURL=getOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOptions.d.ts","sourceRoot":"","sources":["../../src/options/getOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"getOptions.d.ts","sourceRoot":"","sources":["../../src/options/getOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,aAAa,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC9F,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIrE;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG;IAAE,eAAe,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;CAAE,GAAG,aAAa,CAS7G"}
|
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getOptions = getOptions;
|
|
4
|
-
exports.getParsedOptions = getParsedOptions;
|
|
5
4
|
const getCliOptions_1 = require("./getCliOptions");
|
|
6
5
|
const getRepoOptions_1 = require("./getRepoOptions");
|
|
7
6
|
const getDefaultOptions_1 = require("./getDefaultOptions");
|
|
8
|
-
/**
|
|
9
|
-
* Gets all repo level options (default + root options + cli options)
|
|
10
|
-
* @deprecated Use `getParsedOptions`
|
|
11
|
-
*/
|
|
12
|
-
function getOptions(argv) {
|
|
13
|
-
// eslint-disable-next-line no-restricted-properties -- deprecated API
|
|
14
|
-
const cliOptions = (0, getCliOptions_1.getCliOptions)({ argv, cwd: process.cwd(), env: process.env });
|
|
15
|
-
return mergeRepoOptions({
|
|
16
|
-
repoOptions: (0, getRepoOptions_1.getRepoOptions)(cliOptions),
|
|
17
|
-
cliOptions,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
7
|
/**
|
|
21
8
|
* Get merged and unmerged options, for reuse by `getPackageInfos`.
|
|
22
9
|
* @param testRepoOptions Repo options for testing purposes
|
|
23
10
|
*/
|
|
24
|
-
|
|
25
|
-
function getParsedOptions(params) {
|
|
11
|
+
function getOptions(params) {
|
|
26
12
|
const { testRepoOptions, ...processInfo } = params;
|
|
27
13
|
const cliOptions = (0, getCliOptions_1.getCliOptions)(processInfo);
|
|
28
14
|
const repoOptions = testRepoOptions || (0, getRepoOptions_1.getRepoOptions)(cliOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOptions.js","sourceRoot":"","sources":["../../src/options/getOptions.ts"],"names":[],"mappings":";;AASA,
|
|
1
|
+
{"version":3,"file":"getOptions.js","sourceRoot":"","sources":["../../src/options/getOptions.ts"],"names":[],"mappings":";;AASA,gCASC;AAjBD,mDAAqE;AACrE,qDAAkD;AAClD,2DAAwD;AAExD;;;GAGG;AACH,SAAgB,UAAU,CAAC,MAAmE;IAC5F,MAAM,EAAE,eAAe,EAAE,GAAG,WAAW,EAAE,GAAG,MAAM,CAAC;IACnD,MAAM,UAAU,GAAG,IAAA,6BAAa,EAAC,WAAW,CAAC,CAAC;IAC9C,MAAM,WAAW,GAAG,eAAe,IAAI,IAAA,+BAAc,EAAC,UAAU,CAAC,CAAC;IAClE,OAAO;QACL,UAAU;QACV,WAAW;QACX,OAAO,EAAE,gBAAgB,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;KACvD,CAAC;AACJ,CAAC;AAED,mDAAmD;AACnD,SAAS,gBAAgB,CACvB,MAAiF;IAEjF,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAC3C,iCAAiC;IACjC,+FAA+F;IAC/F,OAAO;QACL,GAAG,IAAA,qCAAiB,GAAE;QACtB,GAAG,WAAW;QACd,GAAG,UAAU;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -10,6 +10,4 @@ import { type PackageInfos } from '../types/PackageInfo';
|
|
|
10
10
|
* Use this to force adding the getter for testing its behavior.
|
|
11
11
|
*/
|
|
12
12
|
export declare function getPackageInfosWithOptions(wsPackageInfos: WSPackageInfo[], cliOptions: Partial<CliOptions> | null, enableCombinedOptionsForTests?: boolean): PackageInfos;
|
|
13
|
-
/** @deprecated Provide the pre-parsed options */
|
|
14
|
-
export declare function getPackageInfosWithOptions(wsPackageInfos: WSPackageInfo[]): PackageInfos;
|
|
15
13
|
//# sourceMappingURL=getPackageInfosWithOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPackageInfosWithOptions.d.ts","sourceRoot":"","sources":["../../src/options/getPackageInfosWithOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"getPackageInfosWithOptions.d.ts","sourceRoot":"","sources":["../../src/options/getPackageInfosWithOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5E,OAAO,EAA4C,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEnG;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,aAAa,EAAE,EAC/B,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,EACtC,6BAA6B,CAAC,EAAE,OAAO,GACtC,YAAY,CAoCd"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getPackageInfosWithOptions = getPackageInfosWithOptions;
|
|
4
|
-
const getCliOptions_1 = require("./getCliOptions");
|
|
5
4
|
const env_1 = require("../env");
|
|
6
5
|
const PackageInfo_1 = require("../types/PackageInfo");
|
|
6
|
+
/**
|
|
7
|
+
* Fill in options to convert `workspace-tools` `PackageInfos` to the format used in this repo,
|
|
8
|
+
* including any package-specific options merged with CLI overrides.
|
|
9
|
+
* @param cliOptions Parsed CLI options. Can be null in tests to indicate no CLI options.
|
|
10
|
+
* @param enableCombinedOptionsForTests For testing only: usually in tests, the combinedOptions
|
|
11
|
+
* getter is not added to prevent jest exceptions when checking equality of objects.
|
|
12
|
+
* Use this to force adding the getter for testing its behavior.
|
|
13
|
+
*/
|
|
7
14
|
function getPackageInfosWithOptions(wsPackageInfos, cliOptions, enableCombinedOptionsForTests) {
|
|
8
|
-
if (cliOptions === undefined) {
|
|
9
|
-
// Don't use options from process.argv or the beachball repo in tests
|
|
10
|
-
// eslint-disable-next-line @ms-cloudpack/no-deprecated
|
|
11
|
-
cliOptions = env_1.env.isJest ? null : (0, getCliOptions_1.getCliOptions)(process.argv);
|
|
12
|
-
}
|
|
13
15
|
const packageInfos = {};
|
|
14
16
|
for (const packageJson of wsPackageInfos) {
|
|
15
17
|
const newPackageInfo = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPackageInfosWithOptions.js","sourceRoot":"","sources":["../../src/options/getPackageInfosWithOptions.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"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,CAAC;IAClD,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC;IAC9B,GAAG,EAAE,IAAI;IACT,aAAa,EAAE,IAAI;IACnB,qBAAqB,EAAE,IAAI;IAC3B,OAAO,EAAE,IAAI;IACb,aAAa,EAAE,IAAI;CACyB,CAA6B,CAAC;AAE5E;;;GAGG;AACH,SAAS,mBAAmB,CAC1B,cAA0C,EAC1C,UAAsC;IAEtC,IAAI,CAAC,cAAc;QAAE,OAAO,SAAS,CAAC;IAEtC,MAAM,aAAa,GAAG,EAAoB,CAAC;IAC3C,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QAC9B,0EAA0E;QAC1E,qDAAqD;QACrD,IAAI,cAAc,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YACtC,iEAAiE;YACjE,yEAAyE;YACzE,2BAA2B;YAC1B,aAAqB,CAAC,GAAG,CAAC,GAAI,UAAkB,EAAE,CAAC,GAAG,CAAC,IAAI,cAAc,CAAC,GAAG,CAAC,CAAC;YAChF,UAAU,GAAG,IAAI,CAAC;QACpB,CAAC;IACH,CAAC;IACD,OAAO,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC;AAChD,CAAC;AAED;;;GAGG;AACH,SAAS,yBAAyB;IAChC,MAAM,IAAI,KAAK,CACb,uEAAuE;QACrE,gFAAgF,CACnF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { CliOptions } from '../types/BeachballOptions';
|
|
2
|
+
import type { CommandName } from './commandDefinitions';
|
|
3
|
+
export type OptionDefinitions = Partial<Record<keyof CliOptions, OptionDefinition>>;
|
|
4
|
+
export type OptionType = 'string' | 'number' | 'boolean' | 'array';
|
|
5
|
+
/**
|
|
6
|
+
* Help group names for options (pass to `option.helpGroup()`).
|
|
7
|
+
* The order of keys determines section order in help output.
|
|
8
|
+
*/
|
|
9
|
+
export declare const optionGroups: {
|
|
10
|
+
/** Primary options for a command (membership is command-specific) */
|
|
11
|
+
primary: string;
|
|
12
|
+
/** Git options for detecting which packages changed */
|
|
13
|
+
detection: string;
|
|
14
|
+
/** Options for filtering/selecting which packages to operate on */
|
|
15
|
+
filtering: string;
|
|
16
|
+
/** Options controlling change file validation */
|
|
17
|
+
validation: string;
|
|
18
|
+
/** Options controlling how versions are bumped */
|
|
19
|
+
versioning: string;
|
|
20
|
+
npm: string;
|
|
21
|
+
/** Less commonly used options */
|
|
22
|
+
advanced: string;
|
|
23
|
+
/** Non-logging options shared between all/most commands */
|
|
24
|
+
common: string;
|
|
25
|
+
};
|
|
26
|
+
export type OptionGroup = keyof typeof optionGroups;
|
|
27
|
+
/** Definition of a single CLI option, used to build its commander `Option`. */
|
|
28
|
+
export interface OptionDefinition {
|
|
29
|
+
/** Option description for help */
|
|
30
|
+
desc: string | ((subcommand: string | undefined) => string);
|
|
31
|
+
/** Help group for the option (single or command-specific). */
|
|
32
|
+
group: OptionGroup | ((subcommand: string | undefined) => OptionGroup);
|
|
33
|
+
/**
|
|
34
|
+
* Only show the option in help for the specified commands.
|
|
35
|
+
* Use `defaultCommands` for options that apply to all the "full" commands.
|
|
36
|
+
*/
|
|
37
|
+
commands: readonly CommandName[] | ((subcommand: string | undefined) => boolean);
|
|
38
|
+
/** Single-character short flag (without dash), e.g. `b` for `--branch`. */
|
|
39
|
+
short?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Extra long-flag alias (without dashes), e.g. `config` for the `configPath` option. When set,
|
|
42
|
+
* the alias is shown in help *instead of* the canonical dashed name, but the value is still
|
|
43
|
+
* stored under the canonical name, and the canonical name is also accepted as a CLI option.
|
|
44
|
+
*/
|
|
45
|
+
alias?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Value type. `'array'` is currently always a string array.
|
|
48
|
+
* `'boolean'` values get a negated `--no-` form automatically when added via `BeachballCommand`.
|
|
49
|
+
* @default 'string'
|
|
50
|
+
*/
|
|
51
|
+
type?: OptionType;
|
|
52
|
+
/** Valid choices, such as for `disallowedChangeTypes` (string or array options only). */
|
|
53
|
+
choices?: readonly string[];
|
|
54
|
+
/** Conflicting option names */
|
|
55
|
+
conflicts?: readonly (keyof CliOptions)[];
|
|
56
|
+
/** Custom argument parser/validator */
|
|
57
|
+
parse?: (value: unknown, previous: unknown) => unknown;
|
|
58
|
+
}
|
|
59
|
+
type OptionNoCommands = Omit<OptionDefinition, 'commands'> & Partial<OptionDefinition>;
|
|
60
|
+
type OptionNoCommandsGroup = Omit<OptionDefinition, 'commands' | 'group'> & Partial<OptionDefinition>;
|
|
61
|
+
/** Add `group` and/or `commands` to a subset of options */
|
|
62
|
+
export declare function makeOptions<K extends keyof CliOptions>(group: OptionGroup, commands: OptionDefinition['commands'], opts: Record<K, OptionNoCommandsGroup>): Record<K, OptionDefinition>;
|
|
63
|
+
export declare function makeOptions<K extends keyof CliOptions>(commands: OptionDefinition['commands'], opts: Record<K, OptionNoCommands>): Record<K, OptionDefinition>;
|
|
64
|
+
/** All CLI options. */
|
|
65
|
+
export declare const optionDefinitions: Record<Exclude<keyof CliOptions, 'path' | 'command' | '_extraPositionalArgs'>, OptionDefinition>;
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=optionDefinitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optionDefinitions.d.ts","sourceRoot":"","sources":["../../src/options/optionDefinitions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAEpF,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QA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