diff --git a/packages/cli-core/src/package-manager-controller/npm_package_manager_controller.ts b/packages/cli-core/src/package-manager-controller/npm_package_manager_controller.ts index 3268ea0a5a..fcfe703825 100644 --- a/packages/cli-core/src/package-manager-controller/npm_package_manager_controller.ts +++ b/packages/cli-core/src/package-manager-controller/npm_package_manager_controller.ts @@ -3,7 +3,7 @@ import _fsp from 'fs/promises'; import { execa as _execa } from 'execa'; import * as _path from 'path'; import { executeWithDebugLogger as _executeWithDebugLogger } from './execute_with_logger.js'; -import { PackageManagerControllerBase } from './package_manager_controller.js'; +import { PackageManagerControllerBase } from './package_manager_controller_base.js'; /** * NpmPackageManagerController is an abstraction around npm commands that are needed to initialize a project and install dependencies diff --git a/packages/cli-core/src/package-manager-controller/package_manager_controller.ts b/packages/cli-core/src/package-manager-controller/package_manager_controller_base.ts similarity index 100% rename from packages/cli-core/src/package-manager-controller/package_manager_controller.ts rename to packages/cli-core/src/package-manager-controller/package_manager_controller_base.ts diff --git a/packages/cli-core/src/package-manager-controller/package_manager_controller_factory.test.ts b/packages/cli-core/src/package-manager-controller/package_manager_controller_factory.test.ts index ce1b952f59..df54ced2c8 100644 --- a/packages/cli-core/src/package-manager-controller/package_manager_controller_factory.test.ts +++ b/packages/cli-core/src/package-manager-controller/package_manager_controller_factory.test.ts @@ -1,7 +1,7 @@ import { describe, it } from 'node:test'; import assert from 'assert'; import { PackageManagerControllerFactory } from './package_manager_controller_factory.js'; -import { PackageManagerControllerBase } from './package_manager_controller.js'; +import { PackageManagerControllerBase } from './package_manager_controller_base.js'; import { NpmPackageManagerController } from './npm_package_manager_controller.js'; void describe('packageManagerControllerFactory', () => { diff --git a/packages/cli-core/src/package-manager-controller/pnpm_package_manager_controller.ts b/packages/cli-core/src/package-manager-controller/pnpm_package_manager_controller.ts index d6cd0749c7..9899b2359f 100644 --- a/packages/cli-core/src/package-manager-controller/pnpm_package_manager_controller.ts +++ b/packages/cli-core/src/package-manager-controller/pnpm_package_manager_controller.ts @@ -3,7 +3,7 @@ import * as _path from 'path'; import { existsSync as _existsSync } from 'fs'; import { execa as _execa } from 'execa'; import { executeWithDebugLogger as _executeWithDebugLogger } from './execute_with_logger.js'; -import { PackageManagerControllerBase } from './package_manager_controller.js'; +import { PackageManagerControllerBase } from './package_manager_controller_base.js'; /** * PnpmPackageManagerController is an abstraction around pnpm commands that are needed to initialize a project and install dependencies diff --git a/packages/cli-core/src/package-manager-controller/yarn_classic_package_manager_controller.ts b/packages/cli-core/src/package-manager-controller/yarn_classic_package_manager_controller.ts index 532ae4dde4..b8b31ce65e 100644 --- a/packages/cli-core/src/package-manager-controller/yarn_classic_package_manager_controller.ts +++ b/packages/cli-core/src/package-manager-controller/yarn_classic_package_manager_controller.ts @@ -3,7 +3,7 @@ import _fsp from 'fs/promises'; import { execa as _execa } from 'execa'; import * as _path from 'path'; import { executeWithDebugLogger as _executeWithDebugLogger } from './execute_with_logger.js'; -import { PackageManagerControllerBase } from './package_manager_controller.js'; +import { PackageManagerControllerBase } from './package_manager_controller_base.js'; /** * YarnClassicPackageManagerController is an abstraction around yarn classic commands that are needed to initialize a project and install dependencies diff --git a/packages/cli-core/src/package-manager-controller/yarn_modern_package_manager_controller.ts b/packages/cli-core/src/package-manager-controller/yarn_modern_package_manager_controller.ts index b3b3ec322b..3089ba422d 100644 --- a/packages/cli-core/src/package-manager-controller/yarn_modern_package_manager_controller.ts +++ b/packages/cli-core/src/package-manager-controller/yarn_modern_package_manager_controller.ts @@ -5,7 +5,7 @@ import * as _path from 'path'; import { LogLevel } from '@aws-amplify/cli-core'; import { printer } from '../printer.js'; import { executeWithDebugLogger as _executeWithDebugLogger } from './execute_with_logger.js'; -import { PackageManagerControllerBase } from './package_manager_controller.js'; +import { PackageManagerControllerBase } from './package_manager_controller_base.js'; import { DependencyType } from './package_manager_controller_factory.js'; /** diff --git a/packages/create-amplify/src/amplify_project_creator.ts b/packages/create-amplify/src/amplify_project_creator.ts index f74668ab43..cdda237b04 100644 --- a/packages/create-amplify/src/amplify_project_creator.ts +++ b/packages/create-amplify/src/amplify_project_creator.ts @@ -1,4 +1,5 @@ import { LogLevel } from '@aws-amplify/cli-core'; +import { PackageManagerController } from '@aws-amplify/plugin-types'; import { ProjectRootValidator } from './project_root_validator.js'; import { GitIgnoreInitializer } from './gitignore_initializer.js'; import { InitialProjectFileGenerator } from './initial_project_file_generator.js'; @@ -26,7 +27,7 @@ export class AmplifyProjectCreator { * Delegates out to other classes that handle parts of the getting started experience */ constructor( - private readonly packageManagerController: any, + private readonly packageManagerController: PackageManagerController, private readonly projectRootValidator: ProjectRootValidator, private readonly gitIgnoreInitializer: GitIgnoreInitializer, private readonly initialProjectFileGenerator: InitialProjectFileGenerator @@ -71,19 +72,14 @@ export class AmplifyProjectCreator { process.cwd() === this.packageManagerController.projectRoot ? '' : `Navigate to your project directory using -'cd .${ - this.packageManagerController.projectRoot.replace( - process.cwd(), - '' - ) as string - }'. +'cd .${this.packageManagerController.projectRoot.replace(process.cwd(), '')}'. Then get started with the following commands: `; printer.log( `Welcome to AWS Amplify! ${cdPreamble} -${this.packageManagerController.getWelcomeMessage() as string}` +${this.packageManagerController.getWelcomeMessage()}` ); printer.log( diff --git a/packages/plugin-types/API.md b/packages/plugin-types/API.md index 9a97a38c50..e6d43ee131 100644 --- a/packages/plugin-types/API.md +++ b/packages/plugin-types/API.md @@ -141,6 +141,7 @@ export type MainStackNameResolver = { // @public (undocumented) export type PackageManagerController = { + projectRoot: string; getWelcomeMessage: () => string; initializeProject: () => Promise; initializeTsConfig: (targetDir: string) => Promise; diff --git a/packages/plugin-types/src/package_manager_controller.ts b/packages/plugin-types/src/package_manager_controller.ts index df99b1426c..a51525e595 100644 --- a/packages/plugin-types/src/package_manager_controller.ts +++ b/packages/plugin-types/src/package_manager_controller.ts @@ -8,6 +8,7 @@ import { type ExecaChildProcess } from 'execa'; export type DependencyType = 'dev' | 'prod'; export type PackageManagerController = { + projectRoot: string; getWelcomeMessage: () => string; initializeProject: () => Promise; initializeTsConfig: (targetDir: string) => Promise;