Skip to content

Commit a414d98

Browse files
chore: remove deprecated --npm flag (#2504)
1 parent a4e3fc4 commit a414d98

File tree

5 files changed

+2
-62
lines changed

5 files changed

+2
-62
lines changed

__e2e__/init.test.ts

-38
Original file line numberDiff line numberDiff line change
@@ -155,44 +155,6 @@ test('init skips installation of dependencies with --skip-install', () => {
155155
);
156156
});
157157

158-
test('init uses npm as the package manager with --npm', () => {
159-
createCustomTemplateFiles();
160-
161-
const {stdout} = runCLI(DIR, [
162-
'init',
163-
'--template',
164-
templatePath,
165-
PROJECT_NAME,
166-
'--npm',
167-
'--install-pods',
168-
'false',
169-
]);
170-
171-
expect(stdout).toContain('Run instructions');
172-
173-
// make sure we don't leave garbage
174-
expect(fs.readdirSync(DIR)).toContain('custom');
175-
176-
const initDirPath = path.join(DIR, PROJECT_NAME);
177-
178-
// Remove yarn specific files and node_modules
179-
const filteredFiles = customTemplateCopiedFiles.filter(
180-
(file) =>
181-
!['yarn.lock', 'node_modules', '.yarnrc.yml', '.yarn'].includes(file),
182-
);
183-
184-
// Add package-lock.json
185-
const customTemplateCopiedFilesForNpm = [
186-
...filteredFiles,
187-
'package-lock.json',
188-
];
189-
190-
// Assert for existence
191-
customTemplateCopiedFilesForNpm.forEach((file) => {
192-
expect(fs.existsSync(path.join(initDirPath, file))).toBe(true);
193-
});
194-
});
195-
196158
// 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.
197159
test.skip('init --platform-name should work for out of tree platform', () => {
198160
createCustomTemplateFiles();

docs/commands.md

-7
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,6 @@ Skip dependencies installation
100100

101101
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
102102

103-
#### `--npm`
104-
105-
> [!WARNING]
106-
> `--npm` is deprecated and will be removed in the future. Please use `--pm npm` instead.
107-
108-
Force use of npm during initialization
109-
110103
#### `--pm <string>`
111104

112105
Use specific package manager to initialize the project. Available options: `yarn`, `npm`, `bun`. Default: `yarn`

docs/init.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ npx react-native@${VERSION} init ProjectName
3131
It is possible to initialize a new application with a custom template with
3232
a `--template` option.
3333

34-
It should point to a valid package that can be installed with `yarn` or `npm` (if you're using `--npm` option).
34+
It should point to a valid package that can be installed with `npm` or `yarn` (if you're using `--pm yarn` option).
3535

3636
The most common options are:
3737

packages/cli/src/commands/init/index.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ export default {
1414
{
1515
name: '--template <string>',
1616
description:
17-
'Uses a custom template. Valid arguments are the ones supported by `yarn add [package]` or `npm install [package]`, if you are using `--npm` option',
18-
},
19-
{
20-
name: '--npm',
21-
description: 'Forces using npm for initialization',
17+
'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',
2218
},
2319
{
2420
name: '--pm <string>',

packages/cli/src/commands/init/init.ts

-11
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ interface TemplateOptions {
4848
projectName: string;
4949
shouldBumpYarnVersion: boolean;
5050
templateUri: string;
51-
npm?: boolean;
5251
pm?: PackageManager.PackageManager;
5352
directory: string;
5453
projectTitle?: string;
@@ -186,7 +185,6 @@ async function createFromTemplate({
186185
projectName,
187186
shouldBumpYarnVersion,
188187
templateUri,
189-
npm,
190188
pm,
191189
directory,
192190
projectTitle,
@@ -213,14 +211,6 @@ async function createFromTemplate({
213211
packageManager = userAgentPM || 'yarn';
214212
}
215213

216-
if (npm) {
217-
logger.warn(
218-
'Flag --npm is deprecated and will be removed soon. In the future, please use --pm npm instead.',
219-
);
220-
221-
packageManager = 'npm';
222-
}
223-
224214
// if the project with the name already has cache, remove the cache to avoid problems with pods installation
225215
cacheManager.removeProjectCache(projectName);
226216

@@ -425,7 +415,6 @@ async function createProject(
425415
projectName,
426416
shouldBumpYarnVersion,
427417
templateUri,
428-
npm: options.npm,
429418
pm: options.pm,
430419
directory,
431420
projectTitle: options.title,

0 commit comments

Comments
 (0)