Pass releaseManifest to versionFinder
Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
"@backstage/config": "^0.1.13",
|
||||
"@backstage/config-loader": "^0.9.3",
|
||||
"@backstage/errors": "^0.2.0",
|
||||
"@backstage/release-manifest": "^0.0.1",
|
||||
"@backstage/types": "^0.1.1",
|
||||
"@hot-loader/react-dom": "^16.13.0",
|
||||
"@manypkg/get-packages": "^1.1.3",
|
||||
|
||||
@@ -344,7 +344,10 @@ export function registerCommands(program: CommanderStatic) {
|
||||
.option(
|
||||
'--release-line <main|next>',
|
||||
'Bump to the latest version of a specific release line',
|
||||
'main',
|
||||
)
|
||||
.option(
|
||||
'--backstage-release <version>',
|
||||
'Bump to a specific Backstage release',
|
||||
)
|
||||
.description('Bump Backstage packages to the latest versions')
|
||||
.action(lazy(() => import('./versions/bump').then(m => m.default)));
|
||||
|
||||
@@ -27,10 +27,16 @@ import {
|
||||
mapDependencies,
|
||||
fetchPackageInfo,
|
||||
Lockfile,
|
||||
YarnInfoInspectData,
|
||||
} from '../../lib/versioning';
|
||||
import { forbiddenDuplicatesFilter } from './lint';
|
||||
import { BACKSTAGE_JSON } from '@backstage/cli-common';
|
||||
import { runParallelWorkers } from '../../lib/parallel';
|
||||
import {
|
||||
getByReleaseLine,
|
||||
getByVersion,
|
||||
ReleaseManifest,
|
||||
} from '@backstage/release-manifest';
|
||||
|
||||
const DEP_TYPES = [
|
||||
'dependencies',
|
||||
@@ -60,7 +66,22 @@ export default async (cmd: Command) => {
|
||||
console.log(`Using custom pattern glob ${pattern}`);
|
||||
}
|
||||
|
||||
const findTargetVersion = createVersionFinder(cmd.releaseLine);
|
||||
if (cmd.releaseLine && cmd.backstageRelease) {
|
||||
throw new Error(
|
||||
'Cannot specify both --release-line and --backstage-release',
|
||||
);
|
||||
}
|
||||
|
||||
let releaseManifest;
|
||||
if (cmd.backstageRelease) {
|
||||
releaseManifest = await getByVersion({ version: cmd.backstageRelease });
|
||||
} else if (cmd.releaseLine) {
|
||||
releaseManifest = await getByReleaseLine({ releaseLine: cmd.releaseLine });
|
||||
}
|
||||
const findTargetVersion = createVersionFinder({
|
||||
releaseLine: cmd.releaseLine,
|
||||
releaseManifest,
|
||||
});
|
||||
|
||||
// First we discover all Backstage dependencies within our own repo
|
||||
const dependencyMap = await mapDependencies(paths.targetDir, pattern);
|
||||
@@ -284,14 +305,22 @@ export default async (cmd: Command) => {
|
||||
}
|
||||
};
|
||||
|
||||
export function createVersionFinder(
|
||||
releaseLine = 'latest',
|
||||
packageInfoFetcher = fetchPackageInfo,
|
||||
) {
|
||||
export function createVersionFinder(options: {
|
||||
releaseLine?: string;
|
||||
packageInfoFetcher?: () => Promise<YarnInfoInspectData>;
|
||||
releaseManifest?: ReleaseManifest;
|
||||
}) {
|
||||
const {
|
||||
releaseLine = 'latest',
|
||||
packageInfoFetcher = fetchPackageInfo,
|
||||
releaseManifest,
|
||||
} = options;
|
||||
// The main release line is just an alias for latest
|
||||
const distTag = releaseLine === 'main' ? 'latest' : releaseLine;
|
||||
const found = new Map<string, string>();
|
||||
|
||||
const releasePackages = new Map(
|
||||
releaseManifest?.packages.map(p => [p.name, p.version]),
|
||||
);
|
||||
return async function findTargetVersion(name: string) {
|
||||
const existing = found.get(name);
|
||||
if (existing) {
|
||||
@@ -299,6 +328,11 @@ export function createVersionFinder(
|
||||
}
|
||||
|
||||
console.log(`Checking for updates of ${name}`);
|
||||
const manifestVersion = releasePackages.get(name);
|
||||
if (manifestVersion) {
|
||||
return manifestVersion;
|
||||
}
|
||||
|
||||
const info = await packageInfoFetcher(name);
|
||||
const latestVersion = info['dist-tags'].latest;
|
||||
if (!latestVersion) {
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
app-defaults=1.0.0
|
||||
backend-common=1.0.0
|
||||
backend-tasks=1.0.0
|
||||
backend-test-utils=1.0.0
|
||||
catalog-client=1.0.0
|
||||
catalog-model=1.0.0
|
||||
cli-common=1.0.0
|
||||
cli=1.0.0
|
||||
codemods=1.0.0
|
||||
config-loader=1.0.0
|
||||
config=1.0.0
|
||||
core-app-api=1.0.0
|
||||
core-components=1.0.0
|
||||
core-plugin-api=1.0.0
|
||||
create-app=1.0.0
|
||||
dev-utils=1.0.0
|
||||
errors=1.0.0
|
||||
integration-react=1.0.0
|
||||
integration=1.0.0
|
||||
plugin-airbrake=1.0.0
|
||||
plugin-allure=1.0.0
|
||||
plugin-analytics-module-ga=1.0.0
|
||||
plugin-apache-airflow=1.0.0
|
||||
plugin-api-docs=1.0.0
|
||||
plugin-app-backend=1.0.0
|
||||
plugin-auth-backend=1.0.0
|
||||
plugin-azure-devops-backend=1.0.0
|
||||
plugin-azure-devops-common=1.0.0
|
||||
plugin-azure-devops=1.0.0
|
||||
plugin-badges-backend=1.0.0
|
||||
plugin-badges=1.0.0
|
||||
plugin-bazaar-backend=1.0.0
|
||||
plugin-bazaar=1.0.0
|
||||
plugin-bitrise=1.0.0
|
||||
plugin-catalog-backend-module-ldap=1.0.0
|
||||
plugin-catalog-backend-module-msgraph=1.0.0
|
||||
plugin-catalog-backend=1.0.0
|
||||
plugin-catalog-common=1.0.0
|
||||
plugin-catalog-graph=1.0.0
|
||||
plugin-catalog-graphql=1.0.0
|
||||
plugin-catalog-import=1.0.0
|
||||
plugin-catalog-react=1.0.0
|
||||
plugin-catalog=1.0.0
|
||||
plugin-circleci=1.0.0
|
||||
plugin-cloudbuild=1.0.0
|
||||
plugin-code-coverage-backend=1.0.0
|
||||
plugin-code-coverage=1.0.0
|
||||
plugin-config-schema=1.0.0
|
||||
plugin-cost-insights=1.0.0
|
||||
plugin-explore-react=1.0.0
|
||||
plugin-explore=1.0.0
|
||||
plugin-firehydrant=1.0.0
|
||||
plugin-fossa=1.0.0
|
||||
plugin-gcp-projects=1.0.0
|
||||
plugin-git-release-manager=1.0.0
|
||||
plugin-github-actions=1.0.0
|
||||
plugin-github-deployments=1.0.0
|
||||
plugin-gitops-profiles=1.0.0
|
||||
plugin-gocd=1.0.0
|
||||
plugin-graphiql=1.0.0
|
||||
plugin-graphql-backend=1.0.0
|
||||
plugin-home=1.0.0
|
||||
plugin-ilert=1.0.0
|
||||
plugin-jenkins-backend=1.0.0
|
||||
plugin-jenkins=1.0.0
|
||||
plugin-kafka-backend=1.0.0
|
||||
plugin-kafka=1.0.0
|
||||
plugin-kubernetes-backend=1.0.0
|
||||
plugin-kubernetes-common=1.0.0
|
||||
plugin-kubernetes=1.0.0
|
||||
plugin-lighthouse=1.0.0
|
||||
plugin-newrelic-dashboard=1.0.0
|
||||
plugin-newrelic=1.0.0
|
||||
plugin-org=1.0.0
|
||||
plugin-pagerduty=1.0.0
|
||||
plugin-permission-backend=1.0.0
|
||||
plugin-permission-common=1.0.0
|
||||
plugin-permission-node=1.0.0
|
||||
plugin-permission-react=1.0.0
|
||||
plugin-proxy-backend=1.0.0
|
||||
plugin-rollbar-backend=1.0.0
|
||||
plugin-rollbar=1.0.0
|
||||
plugin-scaffolder-backend-module-cookiecutter=1.0.0
|
||||
plugin-scaffolder-backend-module-rails=1.0.0
|
||||
plugin-scaffolder-backend-module-yeoman=1.0.0
|
||||
plugin-scaffolder-backend=1.0.0
|
||||
plugin-scaffolder-common=1.0.0
|
||||
plugin-scaffolder=1.0.0
|
||||
plugin-search-backend-module-elasticsearch=1.0.0
|
||||
plugin-search-backend-module-pg=1.0.0
|
||||
plugin-search-backend-node=1.0.0
|
||||
plugin-search-backend=1.0.0
|
||||
plugin-search=1.0.0
|
||||
plugin-sentry=1.0.0
|
||||
plugin-shortcuts=1.0.0
|
||||
plugin-sonarqube=1.0.0
|
||||
plugin-splunk-on-call=1.0.0
|
||||
plugin-tech-insights-backend-module-jsonfc=1.0.0
|
||||
plugin-tech-insights-backend=1.0.0
|
||||
plugin-tech-insights-common=1.0.0
|
||||
plugin-tech-insights-node=1.0.0
|
||||
plugin-tech-insights=1.0.0
|
||||
plugin-tech-radar=1.0.0
|
||||
plugin-techdocs-backend=1.0.0
|
||||
plugin-techdocs=1.0.0
|
||||
plugin-todo-backend=1.0.0
|
||||
plugin-todo=1.0.0
|
||||
plugin-user-settings=1.0.0
|
||||
plugin-xcmetrics=1.0.0
|
||||
search-common=1.0.0
|
||||
techdocs-common=1.0.0
|
||||
test-utils=1.0.0
|
||||
theme=1.0.0
|
||||
types=1.0.0
|
||||
version-bridge=1.0.0
|
||||
Reference in New Issue
Block a user