Merge branch 'master' into package-workspaces

Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>

# Conflicts:
#	packages/cli-node/src/pacman/yarn/Yarn.test.ts
#	packages/cli-node/src/pacman/yarn/Yarn.ts
This commit is contained in:
Gabriel Dugny
2026-02-25 09:11:36 +01:00
624 changed files with 10070 additions and 1926 deletions
+9
View File
@@ -1,5 +1,14 @@
# @backstage/create-app
## 0.7.10-next.0
### Patch Changes
- 70fc178: Migrated from deprecated `findPaths` to `targetPaths` and `findOwnPaths` from `@backstage/cli-common`.
- de62a9d: Upgraded `commander` dependency from `^12.0.0` to `^14.0.3` across all CLI packages.
- Updated dependencies
- @backstage/cli-common@0.2.0-next.0
## 0.7.9
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@backstage/create-app",
"version": "0.7.9",
"version": "0.7.10-next.0",
"description": "A CLI that helps you create your own Backstage app",
"backstage": {
"role": "cli"
+10 -20
View File
@@ -19,12 +19,17 @@ import path from 'node:path';
import { Command } from 'commander';
import * as tasks from './lib/tasks';
import createApp from './createApp';
import { findPaths } from '@backstage/cli-common';
import { findOwnPaths, targetPaths } from '@backstage/cli-common';
import { tmpdir } from 'node:os';
import { createMockDirectory } from '@backstage/backend-test-utils';
import { overrideTargetPaths } from '@backstage/cli-common/testUtils';
jest.mock('./lib/tasks');
const MOCK_TARGET_DIR = '/mock/target-dir';
const MOCK_TARGET_ROOT = '/mock/target-root';
overrideTargetPaths({ dir: MOCK_TARGET_DIR, rootDir: MOCK_TARGET_ROOT });
// By mocking this the filesystem mocks won't mess with reading all of the package.jsons
jest.mock('./lib/versions', () => ({
packageVersions: { root: '1.0.0' },
@@ -64,12 +69,7 @@ describe('command entrypoint', () => {
expect(tryInitGitRepositoryMock).toHaveBeenCalled();
expect(templatingMock).toHaveBeenCalled();
expect(templatingMock.mock.lastCall?.[0]).toEqual(
findPaths(__dirname).resolveTarget(
'packages',
'create-app',
'templates',
'default-app',
),
findOwnPaths(__dirname).resolve('templates/default-app'),
);
expect(templatingMock.mock.lastCall?.[1]).toContain(
path.join(tmpdir(), 'MyApp'),
@@ -85,12 +85,7 @@ describe('command entrypoint', () => {
expect(tryInitGitRepositoryMock).toHaveBeenCalled();
expect(templatingMock).toHaveBeenCalled();
expect(templatingMock.mock.lastCall?.[0]).toEqual(
findPaths(__dirname).resolveTarget(
'packages',
'create-app',
'templates',
'default-app',
),
findOwnPaths(__dirname).resolve('templates/default-app'),
);
expect(templatingMock.mock.lastCall?.[1]).toEqual('myDirectory');
expect(buildAppMock).toHaveBeenCalled();
@@ -103,12 +98,7 @@ describe('command entrypoint', () => {
expect(tryInitGitRepositoryMock).toHaveBeenCalled();
expect(templatingMock).toHaveBeenCalled();
expect(templatingMock.mock.lastCall?.[0]).toEqual(
findPaths(__dirname).resolveTarget(
'packages',
'create-app',
'templates',
'next-app',
),
findOwnPaths(__dirname).resolve('templates/next-app'),
);
expect(templatingMock.mock.lastCall?.[1]).toContain(
path.join(tmpdir(), 'MyApp'),
@@ -127,7 +117,7 @@ describe('command entrypoint', () => {
expect(tryInitGitRepositoryMock).toHaveBeenCalled();
expect(templatingMock).toHaveBeenCalled();
expect(templatingMock.mock.lastCall?.[0]).toEqual(
findPaths(__dirname).resolveTarget('templateDirectory'),
targetPaths.resolve('templateDirectory'),
);
expect(templatingMock.mock.lastCall?.[1]).toEqual('myDirectory');
expect(buildAppMock).toHaveBeenCalled();
+9 -9
View File
@@ -18,7 +18,7 @@ import chalk from 'chalk';
import { OptionValues } from 'commander';
import inquirer, { Answers } from 'inquirer';
import { resolve as resolvePath } from 'node:path';
import { findPaths } from '@backstage/cli-common';
import { targetPaths, findOwnPaths } from '@backstage/cli-common';
import os from 'node:os';
import fs from 'fs-extra';
import {
@@ -36,8 +36,6 @@ import {
const DEFAULT_BRANCH = 'master';
export default async (opts: OptionValues): Promise<void> => {
/* eslint-disable-next-line no-restricted-syntax */
const paths = findPaths(__dirname);
const answers: Answers = await inquirer.prompt([
{
type: 'input',
@@ -66,20 +64,22 @@ export default async (opts: OptionValues): Promise<void> => {
]);
// Pick the built-in template based on the --next flag
/* eslint-disable-next-line no-restricted-syntax */
const ownPaths = findOwnPaths(__dirname);
const builtInTemplate = opts.next
? paths.resolveOwn('templates/next-app')
: paths.resolveOwn('templates/default-app');
? ownPaths.resolve('templates/next-app')
: ownPaths.resolve('templates/default-app');
// Use `--template-path` argument as template when specified. Otherwise, use the default template.
const templateDir = opts.templatePath
? paths.resolveTarget(opts.templatePath)
? targetPaths.resolve(opts.templatePath)
: builtInTemplate;
// Use `--path` argument as application directory when specified, otherwise
// create a directory using `answers.name`
const appDir = opts.path
? resolvePath(paths.targetDir, opts.path)
: resolvePath(paths.targetDir, answers.name);
? resolvePath(targetPaths.dir, opts.path)
: resolvePath(targetPaths.dir, answers.name);
Task.log();
Task.log('Creating the app...');
@@ -102,7 +102,7 @@ export default async (opts: OptionValues): Promise<void> => {
// Template to temporary location, and then move files
Task.section('Checking if the directory is available');
await checkAppExistsTask(paths.targetDir, answers.name);
await checkAppExistsTask(targetPaths.dir, answers.name);
Task.section('Creating a temporary app directory');
const tempDir = await fs.mkdtemp(resolvePath(os.tmpdir(), answers.name));