Merge pull request #29776 from backstage/rugvip/move

cli: move less common libs into modules
This commit is contained in:
Patrik Oldsberg
2025-05-07 15:23:03 +02:00
committed by GitHub
23 changed files with 18 additions and 16 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Internal refactor to move things closer to home
@@ -15,7 +15,7 @@
*/
import * as runObj from '../run';
import * as yarn from '../yarn';
import * as yarn from './yarn';
import { fetchPackageInfo, mapDependencies } from './packages';
import { NotFoundError } from '../errors';
import { createMockDirectory } from '@backstage/backend-test-utils';
@@ -27,7 +27,7 @@ jest.mock('../run', () => {
};
});
jest.mock('../yarn', () => {
jest.mock('./yarn', () => {
return {
detectYarnVersion: jest.fn(),
};
+1 -1
View File
@@ -17,7 +17,7 @@
import { minimatch } from 'minimatch';
import { getPackages } from '@manypkg/get-packages';
import { NotFoundError } from '../errors';
import { detectYarnVersion } from '../yarn';
import { detectYarnVersion } from './yarn';
import { execFile } from '../run';
const DEP_TYPES = [
@@ -21,7 +21,7 @@ import { PackageGraph, PackageRoles } from '@backstage/cli-node';
import { paths } from '../../../../../lib/paths';
import { buildFrontend } from '../../../lib/buildFrontend';
import { buildBackend } from '../../../lib/buildBackend';
import { isValidUrl } from '../../../../../lib/urls';
import { isValidUrl } from '../../../lib/urls';
import chalk from 'chalk';
export async function command(opts: OptionValues): Promise<void> {
@@ -20,7 +20,7 @@ import {
} from '../../../../modules/build/lib/packager/productionPack';
import { paths } from '../../../../lib/paths';
import fs from 'fs-extra';
import { publishPreflightCheck } from '../../../../lib/publishing';
import { publishPreflightCheck } from '../../lib/publishing';
import { createTypeDistProject } from '../../../../lib/typeDistProject';
export const pre = async () => {
@@ -25,7 +25,7 @@ import { OptionValues } from 'commander';
import fs from 'fs-extra';
import { resolve as resolvePath, posix, relative as relativePath } from 'path';
import { paths } from '../../../../lib/paths';
import { publishPreflightCheck } from '../../../../lib/publishing';
import { publishPreflightCheck } from '../../lib/publishing';
/**
* A mutable object representing a package.json file with potential fixes.
@@ -16,7 +16,7 @@
import fs from 'fs-extra';
import path from 'path';
import { paths } from '../paths';
import { paths } from '../../../../lib/paths';
const TEAM_ID_RE = /^@[-\w]+\/[-\w]+$/;
const USER_ID_RE = /^@[-\w]+$/;
@@ -15,8 +15,8 @@
*/
import { assertError } from '@backstage/errors';
import { addCodeownersEntry } from '../../../../lib/codeowners';
import { Task } from '../../../../lib/tasks';
import { addCodeownersEntry } from '../codeowners';
import { Task } from '../tasks';
import {
PortableTemplate,
PortableTemplateConfig,
@@ -17,7 +17,7 @@ import fs from 'fs-extra';
import upperFirst from 'lodash/upperFirst';
import camelCase from 'lodash/camelCase';
import { paths } from '../../../../lib/paths';
import { Task } from '../../../../lib/tasks';
import { Task } from '../tasks';
import { PortableTemplateInput } from '../types';
export async function installNewPackage(input: PortableTemplateInput) {
@@ -15,10 +15,7 @@
*/
import inquirer, { DistinctQuestion } from 'inquirer';
import {
getCodeownersFilePath,
parseOwnerIds,
} from '../../../../lib/codeowners';
import { getCodeownersFilePath, parseOwnerIds } from '../codeowners';
import { paths } from '../../../../lib/paths';
import {
PortableTemplateConfig,
@@ -17,7 +17,7 @@
import fs from 'fs-extra';
import { resolve as resolvePath } from 'path';
import { paths } from '../../../../../lib/paths';
import { runBackend } from '../../../../../lib/runner';
import { runBackend } from '../../../lib/runner';
interface StartBackendOptions {
targetDir: string;
@@ -21,7 +21,7 @@ import { IpcServer, ServerDataStore } from '../ipc';
import debounce from 'lodash/debounce';
import { fileURLToPath } from 'url';
import { isAbsolute as isAbsolutePath } from 'path';
import { paths } from '../paths';
import { paths } from '../../../../lib/paths';
import spawn from 'cross-spawn';
const loaderArgs = [