beachball
Advanced tools
Comparing version 2.50.0 to 2.50.1
@@ -12,5 +12,5 @@ import type prompts from 'prompts'; | ||
packageGroups: PackageGroups; | ||
options: Pick<BeachballOptions, 'message' | 'type'>; | ||
options: Pick<BeachballOptions, 'message' | 'type' | 'changeFilePrompt'>; | ||
recentMessages: string[]; | ||
}): prompts.PromptObject[] | undefined; | ||
//# sourceMappingURL=getQuestionsForPackage.d.ts.map |
@@ -14,4 +14,3 @@ "use strict"; | ||
function getQuestionsForPackage(params) { | ||
const { pkg, packageInfos, options, recentMessages } = params; | ||
const packageInfo = packageInfos[pkg]; | ||
const { pkg, options, recentMessages } = params; | ||
const changeTypePrompt = getChangeTypePrompt(params); | ||
@@ -25,3 +24,3 @@ if (!changeTypePrompt) { | ||
}; | ||
const questions = packageInfo.combinedOptions.changeFilePrompt?.changePrompt?.(defaultPrompt, pkg) || Object.values(defaultPrompt); | ||
const questions = options.changeFilePrompt?.changePrompt?.(defaultPrompt, pkg) || Object.values(defaultPrompt); | ||
return questions.filter((q) => !!q); | ||
@@ -28,0 +27,0 @@ } |
@@ -19,3 +19,3 @@ import prompts from 'prompts'; | ||
email: string | null; | ||
options: Pick<BeachballOptions, 'message' | 'type' | 'dependentChangeType'>; | ||
options: Pick<BeachballOptions, 'message' | 'type' | 'dependentChangeType' | 'changeFilePrompt'>; | ||
}): Promise<ChangeFileInfo[] | undefined>; | ||
@@ -22,0 +22,0 @@ /** |
101
lib/help.js
@@ -11,50 +11,77 @@ "use strict"; | ||
showVersion(); | ||
console.log(`Prerequisites: | ||
console.log(`Usage: | ||
git and a remote named "origin" | ||
beachball [command] [options] | ||
Usage: | ||
Examples: | ||
beachball [command] [options] | ||
$ beachball | ||
$ beachball check | ||
$ beachball publish -r http://localhost:4873 -t beta -b beta | ||
Commands: | ||
change (default) - a tool to help create change files in the change/ folder | ||
check - checks whether a change file is needed for this branch | ||
bump - bumps versions as well as generating changelogs | ||
publish - bumps, publishes to npm registry (optionally does dist-tags), and pushes changelogs back into the default branch | ||
sync - synchronizes published versions of packages from a registry, makes local package.json changes to match what is published | ||
change (default) - create change files in the change/ folder | ||
check - checks whether a change file is needed for this branch | ||
bump - bumps versions as well as generating changelogs | ||
publish - bumps, publishes to npm registry (optionally does dist-tags), and | ||
pushes changelogs back into the default branch | ||
sync - synchronize published versions of packages from the registry with | ||
local package.json versions | ||
Options: | ||
Options supported by all commands: | ||
--registry, -r - registry, defaults to https://registry.npmjs.org | ||
--tag, -t - for the publish command: dist-tag for npm publishes | ||
- for the sync command: will use specified tag to set the version | ||
--branch, -b - target branch from origin (default: as configured in 'git config init.defaultBranch') | ||
--message, -m - for the publish command: custom publish message for the checkin (default: applying package updates); | ||
for the change command: description of the change | ||
--no-push - skip pushing changes back to git remote origin | ||
--no-publish - skip publishing to the npm registry | ||
--no-bump - skip both bumping versions and pushing changes back to git remote origin when publishing; | ||
--no-commit - for the change command: stage change files only without autocommitting them | ||
--help, -?, -h - this very help message | ||
--yes, -y - skips the prompts for publish | ||
--package, -p - manually specify a package to create a change file; creates a change file regardless of diffs | ||
--changehint - give your developers a customized hint message when they forget to add a change file | ||
--changeDir - name of the directory to store change files (default: change) | ||
--since - for the bump command: allows to specify the range of change files used to bump packages by using git refs (branch name, commit SHA, etc); | ||
for the publish command: bumps and publishes packages based on the specified range of the change files. | ||
--keep-change-files - for the bump and publish commands: when specified, both bump and publish commands do not delete the change files on the disk. | ||
--force - force the sync command to skip the version comparison and use the version in the registry as is. | ||
--dependent-change-type - for the change command: override the default dependent-change-type that will end-up in the change file. | ||
--disallow-deleted-change-files - for the check command: verifies that no change files were deleted between head and target branch. | ||
--prerelease-prefix - for the bump and publish commands: specify a prerelease prefix for packages that will receive a prerelease bump. | ||
--verbose - prints additional information to the console | ||
--branch, -b - target branch from remote (default: git config init.defaultBranch) | ||
--change-dir - name of the directory to store change files (default: change) | ||
--config-path, -c - custom beachball config path (default: cosmiconfig standard paths) | ||
--no-fetch - skip fetching from the remote before determining changes | ||
--scope - only consider package paths matching this pattern | ||
(can be specified multiple times; supports negations) | ||
--since - consider changes or change files since this git ref (branch name, commit SHA) | ||
--verbose - prints additional information to the console | ||
Examples: | ||
'change' options: | ||
$ beachball | ||
$ beachball check | ||
$ beachball publish -r http://localhost:4873 -t beta -b beta | ||
--message, -m - description for all changed packages (instead of prompting) | ||
--type - type of change: minor, patch, none, ... (instead of prompting) | ||
--package, -p - force creating a change file for this package, regardless of diffs | ||
(can be specified multiple times) | ||
--all - generate change files for all packages | ||
--dependent-change-type - use this change type for dependent packages (default patch) | ||
--no-commit - stage change files only | ||
'check' options: | ||
--changehint - give your developers a customized hint message when they | ||
forget to add a change file | ||
--disallow-deleted-change-files - verifies that no change files were deleted between head and | ||
target branch. | ||
'bump' options: | ||
--keep-change-files - don't delete the change files from disk after bumping | ||
--prerelease-prefix - prerelease prefix for packages that will receive a prerelease bump | ||
'publish' options: | ||
Also supports all 'bump' options. | ||
--auth-type - npm auth type: 'authtoken' or 'password' | ||
--message, -m - commit message (default: "applying package updates") | ||
--no-bump - skip both bumping versions and pushing changes back to git remote | ||
--no-git-tags - don't create git tags for each published package version | ||
--no-publish - skip publishing to the npm registry | ||
--no-push - skip committing changes and pushing them back to the git remote | ||
--registry, -r - registry (default https://registry.npmjs.org) | ||
--retries - number of retries for npm publishes (default: 3) | ||
--tag, -t - dist-tag for npm publishes (default: "latest") | ||
--token - npm token or password | ||
--yes, -y - skip the confirmation prompts | ||
'sync' options: | ||
--registry, -r - registry (default https://registry.npmjs.org) | ||
--tag, -t - sync to the specified npm dist-tag (default: 'latest') | ||
--force - use the version from the registry even if it's older than local | ||
`); | ||
@@ -61,0 +88,0 @@ } |
@@ -10,3 +10,3 @@ "use strict"; | ||
const workspace_tools_1 = require("workspace-tools"); | ||
const infoFromPackageJson_1 = require("./infoFromPackageJson"); | ||
const getPackageInfosWithOptions_1 = require("../options/getPackageInfosWithOptions"); | ||
/** | ||
@@ -19,6 +19,10 @@ * Get a mapping from package name to package info for all packages in the workspace | ||
const packageRoot = (0, workspace_tools_1.findPackageRoot)(cwd); | ||
return ((projectRoot && getPackageInfosFromWorkspace(projectRoot)) || | ||
(projectRoot && getPackageInfosFromNonWorkspaceMonorepo(projectRoot)) || | ||
(packageRoot && getPackageInfosFromSingleRepo(packageRoot)) || | ||
{}); | ||
let wsPackageInfos; | ||
if (projectRoot) { | ||
wsPackageInfos = getPackageInfosFromWorkspace(projectRoot) || getPackageInfosFromNonWorkspaceMonorepo(projectRoot); | ||
} | ||
if (!wsPackageInfos && packageRoot) { | ||
wsPackageInfos = [readWsPackageInfo(path_1.default.join(packageRoot, 'package.json'))]; | ||
} | ||
return wsPackageInfos ? (0, getPackageInfosWithOptions_1.getPackageInfosWithOptions)(wsPackageInfos) : {}; | ||
} | ||
@@ -30,3 +34,3 @@ exports.getPackageInfos = getPackageInfos; | ||
// first try using the workspace provided packages (if available) | ||
workspacePackages = (0, workspace_tools_1.getWorkspaces)(projectRoot); | ||
workspacePackages = (0, workspace_tools_1.getWorkspaces)(projectRoot).map(pkg => pkg.packageJson); | ||
} | ||
@@ -36,17 +40,3 @@ catch { | ||
} | ||
if (!workspacePackages?.length) { | ||
return; | ||
} | ||
const packageInfos = {}; | ||
for (const { path: packagePath, packageJson } of workspacePackages) { | ||
const packageJsonPath = path_1.default.join(packagePath, 'package.json'); | ||
try { | ||
packageInfos[packageJson.name] = (0, infoFromPackageJson_1.infoFromPackageJson)(packageJson, packageJsonPath); | ||
} | ||
catch (e) { | ||
// Pass, the package.json is invalid | ||
console.warn(`Problem processing ${packageJsonPath}: ${e}`); | ||
} | ||
} | ||
return packageInfos; | ||
return workspacePackages?.length ? workspacePackages : undefined; | ||
} | ||
@@ -58,15 +48,14 @@ function getPackageInfosFromNonWorkspaceMonorepo(projectRoot) { | ||
} | ||
const packageInfos = {}; | ||
const wsPackageInfos = {}; | ||
let hasError = false; | ||
for (const packageJsonPath of packageJsonFiles) { | ||
for (const file of packageJsonFiles) { | ||
try { | ||
const packageJsonFullPath = path_1.default.join(projectRoot, packageJsonPath); | ||
const packageJson = fs_extra_1.default.readJSONSync(packageJsonFullPath); | ||
if (!packageInfos[packageJson.name]) { | ||
packageInfos[packageJson.name] = (0, infoFromPackageJson_1.infoFromPackageJson)(packageJson, packageJsonFullPath); | ||
const packageJson = readWsPackageInfo(path_1.default.join(projectRoot, file)); | ||
if (!wsPackageInfos[packageJson.name]) { | ||
wsPackageInfos[packageJson.name] = packageJson; | ||
} | ||
else { | ||
console.error(`ERROR: Two packages have the same name "${packageJson.name}". Please rename one of these packages:\n` + | ||
`- ${path_1.default.relative(projectRoot, packageInfos[packageJson.name].packageJsonPath)}\n` + | ||
`- ${packageJsonPath}`); | ||
`- ${path_1.default.relative(projectRoot, wsPackageInfos[packageJson.name].packageJsonPath)}\n` + | ||
`- ${path_1.default.relative(projectRoot, packageJson.packageJsonPath)}`); | ||
// Keep going so we can log all the errors | ||
@@ -78,3 +67,3 @@ hasError = true; | ||
// Pass, the package.json is invalid | ||
console.warn(`Problem processing ${packageJsonPath}: ${e}`); | ||
console.warn(`Problem processing ${file}: ${e}`); | ||
} | ||
@@ -85,11 +74,12 @@ } | ||
} | ||
return packageInfos; | ||
return Object.values(wsPackageInfos); | ||
} | ||
function getPackageInfosFromSingleRepo(packageRoot) { | ||
const packageInfos = {}; | ||
const packageJsonFullPath = path_1.default.resolve(packageRoot, 'package.json'); | ||
const packageJson = fs_extra_1.default.readJSONSync(packageJsonFullPath); | ||
packageInfos[packageJson.name] = (0, infoFromPackageJson_1.infoFromPackageJson)(packageJson, packageJsonFullPath); | ||
return packageInfos; | ||
function readWsPackageInfo(packageJsonPath) { | ||
return { | ||
// this is actually the properties of WSPackageInfo except the packageJsonPath, but using omit | ||
// messes things up due to the index signature... | ||
...fs_extra_1.default.readJSONSync(packageJsonPath), | ||
packageJsonPath, | ||
}; | ||
} | ||
//# sourceMappingURL=getPackageInfos.js.map |
@@ -12,2 +12,3 @@ "use strict"; | ||
const cliOptions = (0, getCliOptions_1.getCliOptions)(argv); | ||
// TODO: proper recursive merging | ||
return { ...(0, getDefaultOptions_1.getDefaultOptions)(), ...(0, getRepoOptions_1.getRepoOptions)(cliOptions), ...cliOptions }; | ||
@@ -14,0 +15,0 @@ } |
@@ -18,3 +18,9 @@ import type { AuthType } from './Auth'; | ||
disallowDeletedChangeFiles?: boolean; | ||
/** | ||
* For sync: use the version from the registry even if it's older than local. | ||
*/ | ||
forceVersions?: boolean; | ||
/** | ||
* Consider change files since this git ref (branch name, commit SHA, etc). | ||
*/ | ||
fromRef?: string; | ||
@@ -60,3 +66,3 @@ help?: boolean; | ||
/** | ||
* Bump dependent packages during publish (bump A if A depends on B) | ||
* Bump dependent packages during publish: e.g. if B is bumped, and A depends on B, also bump A. | ||
* @default true | ||
@@ -73,3 +79,3 @@ */ | ||
/** | ||
* Name of the directory of the change files | ||
* Directory where change files are stored (relative to repo root). | ||
* @default 'change' | ||
@@ -109,3 +115,6 @@ */ | ||
hooks?: HooksOptions; | ||
/** Ignore changes in these files (minimatch patterns; negations not supported) */ | ||
/** | ||
* Ignore changes in these files (minimatch patterns; negations not supported). | ||
* Patterns are relative to the repo root and must use forward slashes. | ||
*/ | ||
ignorePatterns?: string[]; | ||
@@ -146,3 +155,11 @@ /** For the `change` command, change message. For the `publish` command, commit message. */ | ||
retries: number; | ||
/** Filters paths that beachball uses to find packages */ | ||
/** | ||
* Only apply commands to package paths matching these minimatch patterns. | ||
* Patterns are relative to the monorepo root and must use forward slashes. | ||
* | ||
* Negations are supported: e.g. `['packages/foo/*', '!packages/foo/bar']` | ||
* | ||
* Note that if you have multiple sets of packages with different scopes, | ||
* `groupChanges` is not supported. | ||
*/ | ||
scope?: string[] | null; | ||
@@ -166,3 +183,2 @@ /** | ||
defaultNpmTag: string; | ||
changeFilePrompt?: ChangeFilePromptOptions; | ||
/** | ||
@@ -178,9 +194,14 @@ * Disable publishing a particular package. | ||
export interface VersionGroupOptions { | ||
/** name of the version group */ | ||
name: string; | ||
/** | ||
* minimatch pattern (or array of minimatch) to detect which packages should be included in this group. | ||
* If `true`, include all packages except those excluded by `exclude`. | ||
* minimatch pattern(s) for package paths to include in this group. | ||
* Patterns are relative to the repo root and must use forward slashes. | ||
* If `true`, include all packages except those matching `exclude`. | ||
*/ | ||
include: string | string[] | true; | ||
/** | ||
* minimatch pattern (or array of minimatch) to detect which packages should be excluded in this group. | ||
* minimatch pattern(s) for package paths to exclude from this group. | ||
* Patterns are relative to the repo root and must use forward slashes. | ||
* | ||
* Currently this must use **negated patterns only**: e.g. if you want to exclude `packages/foo`, | ||
@@ -191,4 +212,2 @@ * you must specify `exclude` as `!packages/foo`. (This will be fixed in a future major version.) | ||
disallowedChangeTypes: ChangeType[] | null; | ||
/** name of the version group */ | ||
name: string; | ||
} | ||
@@ -195,0 +214,0 @@ export interface HooksOptions { |
@@ -61,8 +61,11 @@ import type { ChangelogJson, PackageChangelog, ChangelogEntry } from './ChangeLog'; | ||
/** | ||
* minimatch pattern (or array of minimatch) to detect which packages should be included in this group. | ||
* If `true`, include all packages except those excluded by `exclude`. | ||
* minimatch pattern(s) for package paths to include in this group. | ||
* Patterns are relative to the repo root and must use forward slashes. | ||
* If `true`, include all packages except those matching `exclude`. | ||
*/ | ||
include: string | string[] | true; | ||
/** | ||
* minimatch pattern (or array of minimatch) to detect which packages should be excluded in this group. | ||
* minimatch pattern(s) for package paths to exclude from this group. | ||
* Patterns are relative to the repo root and must use forward slashes. | ||
* | ||
* Currently this must use **negated patterns only**: e.g. if you want to exclude `packages/foo`, | ||
@@ -69,0 +72,0 @@ * you must specify `exclude` as `!packages/foo`. (This will be fixed in a future major version.) |
@@ -42,5 +42,5 @@ import type { PackageOptions, BeachballOptions } from './BeachballOptions'; | ||
private: boolean; | ||
/** options that are combined from the root configuration */ | ||
/** merged default, repo, package, and CLI options */ | ||
combinedOptions: PackageOptions; | ||
/** options that are SPECIFIC to the package from its configuration file (might be nothing) */ | ||
/** options that are SPECIFIC to the package from the `beachball` key in its package.json (might be nothing) */ | ||
packageOptions: Partial<PackageOptions>; | ||
@@ -47,0 +47,0 @@ } |
{ | ||
"name": "beachball", | ||
"version": "2.50.0", | ||
"version": "2.50.1", | ||
"description": "The Sunniest Semantic Version Bumper", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
5191
408471
356