From c2c1c86845c407c8b5ff72fdd56be8772d292d99 Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Fri, 13 Sep 2024 15:36:48 +0200 Subject: [PATCH] remove deprecated --npm flag --- __e2e__/init.test.ts | 38 ------------------------- docs/commands.md | 7 ----- docs/init.md | 2 +- packages/cli/src/commands/init/index.ts | 6 +--- packages/cli/src/commands/init/init.ts | 11 ------- 5 files changed, 2 insertions(+), 62 deletions(-) diff --git a/__e2e__/init.test.ts b/__e2e__/init.test.ts index 3ce6beff9..655c5a486 100644 --- a/__e2e__/init.test.ts +++ b/__e2e__/init.test.ts @@ -155,44 +155,6 @@ test('init skips installation of dependencies with --skip-install', () => { ); }); -test('init uses npm as the package manager with --npm', () => { - createCustomTemplateFiles(); - - const {stdout} = runCLI(DIR, [ - 'init', - '--template', - templatePath, - PROJECT_NAME, - '--npm', - '--install-pods', - 'false', - ]); - - expect(stdout).toContain('Run instructions'); - - // make sure we don't leave garbage - expect(fs.readdirSync(DIR)).toContain('custom'); - - const initDirPath = path.join(DIR, PROJECT_NAME); - - // Remove yarn specific files and node_modules - const filteredFiles = customTemplateCopiedFiles.filter( - (file) => - !['yarn.lock', 'node_modules', '.yarnrc.yml', '.yarn'].includes(file), - ); - - // Add package-lock.json - const customTemplateCopiedFilesForNpm = [ - ...filteredFiles, - 'package-lock.json', - ]; - - // Assert for existence - customTemplateCopiedFilesForNpm.forEach((file) => { - expect(fs.existsSync(path.join(initDirPath, file))).toBe(true); - }); -}); - // react-native-macos stopped shipping `template.config.js` for 0.75, so this test is disabled. in future releases we should re-enable once `template.config.js` will be there again. test.skip('init --platform-name should work for out of tree platform', () => { createCustomTemplateFiles(); diff --git a/docs/commands.md b/docs/commands.md index e3574d59e..38baf13de 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -100,13 +100,6 @@ Skip dependencies installation Determine if CocoaPods should be installed when initializing a project. If set to `true` it will install pods, if set to `false`, it will skip the step entirely. If not used, prompt will be displayed -#### `--npm` - -> [!WARNING] -> `--npm` is deprecated and will be removed in the future. Please use `--pm npm` instead. - -Force use of npm during initialization - #### `--pm ` Use specific package manager to initialize the project. Available options: `yarn`, `npm`, `bun`. Default: `yarn` diff --git a/docs/init.md b/docs/init.md index 59a936366..b9b9a2e42 100644 --- a/docs/init.md +++ b/docs/init.md @@ -31,7 +31,7 @@ npx react-native@${VERSION} init ProjectName It is possible to initialize a new application with a custom template with a `--template` option. -It should point to a valid package that can be installed with `yarn` or `npm` (if you're using `--npm` option). +It should point to a valid package that can be installed with `npm` or `yarn` (if you're using `--pm yarn` option). The most common options are: diff --git a/packages/cli/src/commands/init/index.ts b/packages/cli/src/commands/init/index.ts index 2c36fb0d5..8364e1ecd 100644 --- a/packages/cli/src/commands/init/index.ts +++ b/packages/cli/src/commands/init/index.ts @@ -14,11 +14,7 @@ export default { { name: '--template ', description: - 'Uses a custom template. Valid arguments are the ones supported by `yarn add [package]` or `npm install [package]`, if you are using `--npm` option', - }, - { - name: '--npm', - description: 'Forces using npm for initialization', + 'Uses a custom template. Valid arguments are the ones supported by `npm install [package]` or `yarn add [package]`, if you are using `--pm yarn` option', }, { name: '--pm ', diff --git a/packages/cli/src/commands/init/init.ts b/packages/cli/src/commands/init/init.ts index f1bfffd34..df01dac6b 100644 --- a/packages/cli/src/commands/init/init.ts +++ b/packages/cli/src/commands/init/init.ts @@ -48,7 +48,6 @@ interface TemplateOptions { projectName: string; shouldBumpYarnVersion: boolean; templateUri: string; - npm?: boolean; pm?: PackageManager.PackageManager; directory: string; projectTitle?: string; @@ -186,7 +185,6 @@ async function createFromTemplate({ projectName, shouldBumpYarnVersion, templateUri, - npm, pm, directory, projectTitle, @@ -213,14 +211,6 @@ async function createFromTemplate({ packageManager = userAgentPM || 'yarn'; } - if (npm) { - logger.warn( - 'Flag --npm is deprecated and will be removed soon. In the future, please use --pm npm instead.', - ); - - packageManager = 'npm'; - } - // if the project with the name already has cache, remove the cache to avoid problems with pods installation cacheManager.removeProjectCache(projectName); @@ -425,7 +415,6 @@ async function createProject( projectName, shouldBumpYarnVersion, templateUri, - npm: options.npm, pm: options.pm, directory, projectTitle: options.title,