From 470f10a7b54ddebd8bd6f4ae65f290c00905d086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Roma=C5=84czyk?= Date: Tue, 23 May 2023 10:13:02 +0200 Subject: [PATCH] fix(init): fix bad package name in handleReactNativeConfig (#363) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(init): fix bad package name in handleReactNativeConfig * chore(init): add changeset --------- Co-authored-by: RafaƂ Zakrzewski --- .changeset/polite-rockets-double.md | 5 +++++ packages/init/src/tasks/handleReactNativeConfig.ts | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .changeset/polite-rockets-double.md diff --git a/.changeset/polite-rockets-double.md b/.changeset/polite-rockets-double.md new file mode 100644 index 000000000..66f645453 --- /dev/null +++ b/.changeset/polite-rockets-double.md @@ -0,0 +1,5 @@ +--- +"@callstack/repack-init": patch +--- + +Fix bad package name when creating/updating react-native.config.js diff --git a/packages/init/src/tasks/handleReactNativeConfig.ts b/packages/init/src/tasks/handleReactNativeConfig.ts index 90de165cc..ec887678e 100644 --- a/packages/init/src/tasks/handleReactNativeConfig.ts +++ b/packages/init/src/tasks/handleReactNativeConfig.ts @@ -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 @@ -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;