Move single-consumer lib files into the build module

Moved `entryPoints.ts` and `role.ts` (+ test) from the shared `src/lib/`
directory into `src/modules/build/lib/`, since the build module is their
only consumer. This is part of making CLI modules independent of each
other and of shared code outside the modules.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2026-02-20 18:44:26 +01:00
parent ddd774d3db
commit bba2e496a6
10 changed files with 13 additions and 8 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Internal refactor to improve module independence.
@@ -17,7 +17,7 @@
import { OptionValues } from 'commander';
import fs from 'fs-extra';
import { buildPackage, Output } from '../../../lib/builder';
import { findRoleFromCommand } from '../../../../../lib/role';
import { findRoleFromCommand } from '../../../lib/role';
import {
BackstagePackageJson,
PackageGraph,
@@ -17,7 +17,7 @@
import { OptionValues } from 'commander';
import { startPackage } from './startPackage';
import { resolveLinkedWorkspace } from './resolveLinkedWorkspace';
import { findRoleFromCommand } from '../../../../../lib/role';
import { findRoleFromCommand } from '../../../lib/role';
import { paths } from '../../../../../lib/paths';
export async function command(opts: OptionValues): Promise<void> {
@@ -41,7 +41,7 @@ import { forwardFileImports, cssEntryPoints } from './plugins';
import { BuildOptions, Output } from './types';
import { paths } from '../../../../lib/paths';
import { BackstagePackageJson } from '@backstage/cli-node';
import { readEntryPoints } from '../../../../lib/entryPoints';
import { readEntryPoints } from '../entryPoints';
const SCRIPT_EXTS = ['.js', '.jsx', '.ts', '.tsx'];
@@ -29,7 +29,7 @@ import {
OutputChunk,
HasModuleSideEffects,
} from 'rollup';
import { EntryPoint } from '../../../../lib/entryPoints';
import { EntryPoint } from '../entryPoints';
type ForwardFileImportsOptions = {
include: Array<string | RegExp> | string | RegExp | null;
@@ -16,7 +16,7 @@
import { ModuleFederationRemoteOptions } from './types';
import { BackstagePackageJson } from '@backstage/cli-node';
import { readEntryPoints } from '../../../../lib/entryPoints';
import { readEntryPoints } from '../entryPoints';
import {
createTypeDistProject,
getEntryPointDefaultFeatureType,
@@ -18,7 +18,7 @@ import fs from 'fs-extra';
import npmPackList from 'npm-packlist';
import { resolve as resolvePath, posix as posixPath } from 'node:path';
import { BackstagePackageJson } from '@backstage/cli-node';
import { readEntryPoints } from '../../../../lib/entryPoints';
import { readEntryPoints } from '../entryPoints';
import { getEntryPointDefaultFeatureType } from '../../../../lib/typeDistProject';
import { Project } from 'ts-morph';
@@ -20,7 +20,7 @@ import { findRoleFromCommand } from './role';
const mockDir = createMockDirectory();
jest.mock('./paths', () => ({
jest.mock('../../../lib/paths', () => ({
paths: {
resolveTarget(filename: string) {
return mockDir.resolve(filename);
@@ -16,7 +16,7 @@
import fs from 'fs-extra';
import { OptionValues } from 'commander';
import { paths } from './paths';
import { paths } from '../../../lib/paths';
import { PackageRoles, PackageRole } from '@backstage/cli-node';
export async function findRoleFromCommand(