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:
@@ -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(
|
||||
Reference in New Issue
Block a user