Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/polite-rockets-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@callstack/repack-init": patch
---

Fix bad package name when creating/updating react-native.config.js
8 changes: 4 additions & 4 deletions packages/init/src/tasks/handleReactNativeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import logger from '../utils/logger.js';

const defaultConfig = dedent`
module.exports = {
commands: require('repack/commands'),
}`;
commands: require('@callstack/repack/commands'),
};`;

/**
* Checks whether react-native.config.js exists and adds the commands to it
Expand All @@ -29,14 +29,14 @@ export default function handleReactNativeConfig(cwd: string): void {
if (!configContent.includes('commands:')) {
updatedConfigContent = configContent.replace(
'module.exports = {',
"module.exports = {\n commands: require('repack/commands'),"
"module.exports = {\n commands: require('@callstack/repack/commands'),"
);
} else {
const commandsIndex = configContent.indexOf('commands:');
const commandsEndIndex = configContent.indexOf(',', commandsIndex);
const commandsString = configContent.slice(commandsIndex, commandsEndIndex);

const newCommandsString = `commands: require('repack/commands')`;
const newCommandsString = `commands: require('@callstack/repack/commands')`;
if (commandsString === newCommandsString) {
logger.success('File react-native.config.js is already up to date');
return;
Expand Down