Fix prettier formatting
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
-1
@@ -18,7 +18,6 @@ import fs from 'fs-extra';
|
||||
import { resolve as resolvePath } from 'node:path';
|
||||
import { targetPaths } from '@backstage/cli-common';
|
||||
|
||||
|
||||
const DEFAULT_CACHE_BASE_PATH = 'node_modules/.cache/backstage-cli';
|
||||
|
||||
const CACHE_MAX_AGE_MS = 7 * 24 * 3600_000;
|
||||
|
||||
@@ -22,7 +22,6 @@ import { resolve as resolvePath } from 'node:path';
|
||||
import { Project, SourceFile, SyntaxKind, ts, Type } from 'ts-morph';
|
||||
import { targetPaths } from '@backstage/cli-common';
|
||||
|
||||
|
||||
export const createTypeDistProject = async () => {
|
||||
return new Project({
|
||||
tsConfigFilePath: targetPaths.resolveRoot('tsconfig.json'),
|
||||
|
||||
@@ -19,7 +19,6 @@ import yaml from 'yaml';
|
||||
import z from 'zod';
|
||||
import { targetPaths } from '@backstage/cli-common';
|
||||
|
||||
|
||||
const yarnRcSchema = z.object({
|
||||
plugins: z
|
||||
.array(
|
||||
|
||||
@@ -20,7 +20,6 @@ import { resolveLinkedWorkspace } from './resolveLinkedWorkspace';
|
||||
import { findRoleFromCommand } from '../../../lib/role';
|
||||
import { targetPaths } from '@backstage/cli-common';
|
||||
|
||||
|
||||
export async function command(opts: OptionValues): Promise<void> {
|
||||
await startPackage({
|
||||
role: await findRoleFromCommand(opts),
|
||||
|
||||
@@ -19,7 +19,6 @@ import { findTargetPackages } from './start';
|
||||
import { posix } from 'node:path';
|
||||
import { targetPaths } from '@backstage/cli-common';
|
||||
|
||||
|
||||
const mocks = {
|
||||
app: {
|
||||
packageJson: {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
import { targetPaths } from '@backstage/cli-common';
|
||||
|
||||
|
||||
export function hasReactDomClient() {
|
||||
try {
|
||||
require.resolve('react-dom/client', {
|
||||
|
||||
@@ -19,7 +19,6 @@ import { getPackages } from '@manypkg/get-packages';
|
||||
import { rspack } from '@rspack/core';
|
||||
import { targetPaths } from '@backstage/cli-common';
|
||||
|
||||
|
||||
/**
|
||||
* This returns of collection of plugins that links a separate workspace into
|
||||
* the target one. Any packages that are present in the linked workspaces will
|
||||
|
||||
@@ -22,7 +22,6 @@ import PQueue from 'p-queue';
|
||||
import { dirname, join as joinPath, resolve as resolvePath } from 'node:path';
|
||||
import { targetPaths } from '@backstage/cli-common';
|
||||
|
||||
|
||||
const DETECTED_MODULES_MODULE_NAME = '__backstage-autodetected-plugins__';
|
||||
|
||||
interface PackageDetectionConfig {
|
||||
|
||||
@@ -49,7 +49,9 @@ export function resolveBundlingPaths(options: BundlingPathsOptions) {
|
||||
} else {
|
||||
targetHtml = resolvePath(targetDir, `${entry}.html`);
|
||||
if (!fs.pathExistsSync(targetHtml)) {
|
||||
targetHtml = findOwnPaths(__dirname).resolve('templates/serve_index.html');
|
||||
targetHtml = findOwnPaths(__dirname).resolve(
|
||||
'templates/serve_index.html',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -211,7 +211,9 @@ export async function createDistWorkspace(
|
||||
targetDir: pkg.dir,
|
||||
packageJson: pkg.packageJson,
|
||||
outputs: outputs,
|
||||
logPrefix: `${chalk.cyan(relativePath(targetPaths.rootDir, pkg.dir))}: `,
|
||||
logPrefix: `${chalk.cyan(
|
||||
relativePath(targetPaths.rootDir, pkg.dir),
|
||||
)}: `,
|
||||
minify: options.minify,
|
||||
workspacePackages: packages,
|
||||
});
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
import fs from 'fs-extra';
|
||||
import { targetPaths } from '@backstage/cli-common';
|
||||
|
||||
|
||||
export default async function clean() {
|
||||
await fs.remove(targetPaths.resolve('dist'));
|
||||
await fs.remove(targetPaths.resolve('dist-types'));
|
||||
|
||||
@@ -20,7 +20,6 @@ import { PackageGraph } from '@backstage/cli-node';
|
||||
|
||||
import { run, targetPaths } from '@backstage/cli-common';
|
||||
|
||||
|
||||
export async function command(): Promise<void> {
|
||||
const packages = await PackageGraph.listTargetPackages();
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import { relative as relativePath } from 'node:path';
|
||||
import { PackageGraph } from '@backstage/cli-node';
|
||||
import { targetPaths } from '@backstage/cli-common';
|
||||
|
||||
|
||||
export async function command(opts: OptionValues) {
|
||||
const packages = await PackageGraph.listTargetPackages();
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import { getPackages } from '@manypkg/get-packages';
|
||||
import { PackageRoles } from '@backstage/cli-node';
|
||||
import { targetPaths } from '@backstage/cli-common';
|
||||
|
||||
|
||||
export default async () => {
|
||||
const { packages } = await getPackages(targetPaths.dir);
|
||||
|
||||
|
||||
@@ -13,8 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { BACKSTAGE_JSON, bootstrapEnvProxyAgents, targetPaths } from '@backstage/cli-common';
|
||||
|
||||
import {
|
||||
BACKSTAGE_JSON,
|
||||
bootstrapEnvProxyAgents,
|
||||
targetPaths,
|
||||
} from '@backstage/cli-common';
|
||||
|
||||
bootstrapEnvProxyAgents();
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ import fs from 'fs-extra';
|
||||
import path from 'node:path';
|
||||
import { targetPaths } from '@backstage/cli-common';
|
||||
|
||||
|
||||
const TEAM_ID_RE = /^@[-\w]+\/[-\w]+$/;
|
||||
const USER_ID_RE = /^@[-\w]+$/;
|
||||
const EMAIL_RE = /^[^@]+@[-.\w]+\.[-\w]+$/i;
|
||||
|
||||
@@ -19,7 +19,6 @@ import { writeTemplateContents } from './writeTemplateContents';
|
||||
import { createMockDirectory } from '@backstage/backend-test-utils';
|
||||
import { targetPaths } from '@backstage/cli-common';
|
||||
|
||||
|
||||
const baseConfig = {
|
||||
version: '0.1.0',
|
||||
license: 'Apache-2.0',
|
||||
|
||||
@@ -17,14 +17,12 @@
|
||||
import fs from 'fs-extra';
|
||||
import { dirname, resolve as resolvePath } from 'node:path';
|
||||
|
||||
|
||||
import { PortableTemplate, PortableTemplateInput } from '../types';
|
||||
import { ForwardedError, InputError } from '@backstage/errors';
|
||||
import { isMonoRepo as getIsMonoRepo } from '@backstage/cli-node';
|
||||
import { PortableTemplater } from './PortableTemplater';
|
||||
import { isChildPath, targetPaths } from '@backstage/cli-common';
|
||||
|
||||
|
||||
export async function writeTemplateContents(
|
||||
template: PortableTemplate,
|
||||
input: PortableTemplateInput,
|
||||
|
||||
@@ -35,9 +35,7 @@ import { targetPaths } from '@backstage/cli-common';
|
||||
import { logApiReportInstructions } from '../common';
|
||||
import { patchApiReportGeneration } from './patchApiReportGeneration';
|
||||
|
||||
const tmpDir = targetPaths.resolveRoot(
|
||||
'./node_modules/.cache/api-extractor',
|
||||
);
|
||||
const tmpDir = targetPaths.resolveRoot('./node_modules/.cache/api-extractor');
|
||||
|
||||
export async function countApiReportWarnings(reportPath: string) {
|
||||
try {
|
||||
@@ -143,11 +141,7 @@ export async function runApiExtraction({
|
||||
// inspected.
|
||||
const allDistTypesEntryPointPaths = allEntryPoints.map(
|
||||
({ packageDir, distTypesPath }) => {
|
||||
return targetPaths.resolveRoot(
|
||||
'./dist-types',
|
||||
packageDir,
|
||||
distTypesPath,
|
||||
);
|
||||
return targetPaths.resolveRoot('./dist-types', packageDir, distTypesPath);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -173,10 +167,7 @@ export async function runApiExtraction({
|
||||
: allowWarnings;
|
||||
|
||||
const projectFolder = targetPaths.resolveRoot(packageDir);
|
||||
const packageFolder = targetPaths.resolveRoot(
|
||||
'./dist-types',
|
||||
packageDir,
|
||||
);
|
||||
const packageFolder = targetPaths.resolveRoot('./dist-types', packageDir);
|
||||
|
||||
const remainingReportFiles = new Set(
|
||||
fs.readdirSync(projectFolder).filter(
|
||||
|
||||
@@ -38,9 +38,7 @@ type Options = {
|
||||
} & OptionValues;
|
||||
|
||||
export async function buildApiReports(paths: string[] = [], opts: Options) {
|
||||
const tmpDir = targetPaths.resolveRoot(
|
||||
'./node_modules/.cache/api-extractor',
|
||||
);
|
||||
const tmpDir = targetPaths.resolveRoot('./node_modules/.cache/api-extractor');
|
||||
|
||||
const isCiBuild = opts.ci;
|
||||
const isDocsBuild = opts.docs;
|
||||
|
||||
@@ -45,9 +45,7 @@ export async function categorizePackageDirs(packageDirs: string[]) {
|
||||
if (!role) {
|
||||
return; // Ignore packages without roles
|
||||
}
|
||||
if (
|
||||
await fs.pathExists(targetPaths.resolveRoot(dir, 'migrations'))
|
||||
) {
|
||||
if (await fs.pathExists(targetPaths.resolveRoot(dir, 'migrations'))) {
|
||||
sqlPackageDirs.push(dir);
|
||||
}
|
||||
// TODO(Rugvip): Inlined packages are ignored because we can't handle @internal exports
|
||||
|
||||
@@ -150,10 +150,7 @@ export default async function packageDocs(paths: string[] = [], opts: any) {
|
||||
selectedPackageDirs.map(pkg =>
|
||||
limit(async () => {
|
||||
const pkgJson = JSON.parse(
|
||||
await readFile(
|
||||
targetPaths.resolveRoot(pkg, 'package.json'),
|
||||
'utf-8',
|
||||
),
|
||||
await readFile(targetPaths.resolveRoot(pkg, 'package.json'), 'utf-8'),
|
||||
);
|
||||
if (EXCLUDE.includes(pkg) || pkgJson.name.startsWith('@internal/')) {
|
||||
return;
|
||||
@@ -172,10 +169,7 @@ export default async function packageDocs(paths: string[] = [], opts: any) {
|
||||
console.log(`### Processing ${pkg}`);
|
||||
const success = await generateDocJson(pkg);
|
||||
if (success) {
|
||||
await cache.write(
|
||||
pkg,
|
||||
targetPaths.resolveRoot(`dist-types`, pkg),
|
||||
);
|
||||
await cache.write(pkg, targetPaths.resolveRoot(`dist-types`, pkg));
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to generate docs for', pkg);
|
||||
|
||||
@@ -18,7 +18,10 @@ import { findOwnPaths } from '@backstage/cli-common';
|
||||
import fs from 'fs-extra';
|
||||
|
||||
export async function createTemporaryTsConfig(dir: string) {
|
||||
const path = findOwnPaths(__dirname).resolveRoot(dir, 'tsconfig.typedoc.tmp.json');
|
||||
const path = findOwnPaths(__dirname).resolveRoot(
|
||||
dir,
|
||||
'tsconfig.typedoc.tmp.json',
|
||||
);
|
||||
|
||||
process.once('exit', () => {
|
||||
fs.removeSync(path);
|
||||
|
||||
@@ -63,7 +63,9 @@ export async function resolvePackagePaths(
|
||||
if (include) {
|
||||
packages = packages.filter(pkg =>
|
||||
include.some(pattern =>
|
||||
new Minimatch(pattern).match(relativePath(targetPaths.rootDir, pkg.dir)),
|
||||
new Minimatch(pattern).match(
|
||||
relativePath(targetPaths.rootDir, pkg.dir),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user