Skip to content

Commit 3a32f01

Browse files
committed
Merge branch 'release/3.2.2'
2 parents ef45aab + 8b6496e commit 3a32f01

3 files changed

Lines changed: 18 additions & 13 deletions

File tree

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-rename",
3-
"version": "3.2.1",
3+
"version": "3.2.2",
44
"description": "Rename react-native app with just one command",
55
"main": "lib/index.js",
66
"scripts": {
@@ -63,8 +63,9 @@
6363
"cheerio": "^1.0.0-rc.12",
6464
"commander": "^9.4.1",
6565
"dotenv": "^16.0.3",
66-
"globby": "^13.1.2",
66+
"globby": "^13.1.3",
6767
"html-entities": "^2.3.3",
68+
"normalize-path": "^3.0.0",
6869
"replace-in-file": "^6.3.5",
6970
"shelljs": "^0.8.5",
7071
"update-check": "^1.5.4"

src/utils.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ export const bundleIDToPath = bundleID => bundleID.replace(/\./g, '/');
4343
export const decodeXmlEntities = name => decode(name, { level: 'xml' });
4444
export const encodeXmlEntities = name =>
4545
encode(name, { mode: 'nonAscii', level: 'xml', numeric: 'hexadecimal' });
46+
const normalizePath = process.platform === 'win32' ? require('normalize-path') : p => p;
4647
const androidValuesStringsFullPath = path.join(APP_PATH, androidValuesStrings);
4748

4849
export const validateCreation = () => {
49-
const iosInfoPlistFullPath = globbySync(path.join(APP_PATH, iosPlist))[0];
50+
const iosInfoPlistFullPath = globbySync(normalizePath(path.join(APP_PATH, iosPlist)))[0];
5051
const fileExists =
5152
fs.existsSync(iosInfoPlistFullPath) && fs.existsSync(androidValuesStringsFullPath);
5253

@@ -139,7 +140,7 @@ const getElementFromXml = ({ filepath, selector }) => {
139140
};
140141

141142
export const getIosCurrentName = () => {
142-
const filepath = globbySync(path.join(APP_PATH, iosPlist))[0];
143+
const filepath = globbySync(normalizePath(path.join(APP_PATH, iosPlist)))[0];
143144
const selector = 'dict > key:contains("CFBundleDisplayName") + string';
144145
const element = getElementFromXml({ filepath, selector });
145146

@@ -167,7 +168,7 @@ export const getAndroidCurrentBundleID = () => {
167168
* @returns {string} The name of the xcode project folder
168169
*/
169170
export const getIosXcodeProjectPathName = () => {
170-
const xcodeProjectPath = globbySync(path.join(APP_PATH, iosXcodeproj), {
171+
const xcodeProjectPath = globbySync(normalizePath(path.join(APP_PATH, iosXcodeproj)), {
171172
onlyDirectories: true,
172173
});
173174

@@ -300,7 +301,7 @@ const updateElementInXml = async ({ filepath, selector, text }) => {
300301

301302
export const updateIosNameInInfoPlist = async newName => {
302303
await updateElementInXml({
303-
filepath: globbySync(path.join(APP_PATH, iosPlist))[0],
304+
filepath: globbySync(normalizePath(path.join(APP_PATH, iosPlist)))[0],
304305
selector: 'dict > key:contains("CFBundleDisplayName") + string',
305306
text: newName,
306307
});
@@ -319,9 +320,9 @@ export const renameAndroidBundleIDFolders = async ({
319320
newBundleIDAsPath,
320321
}) => {
321322
const currentBundleIDFoldersRelativePaths = globbySync(
322-
path.join(APP_PATH, `${androidJava}/${currentBundleIDAsPath}`),
323+
normalizePath(path.join(APP_PATH, `${androidJava}`)),
323324
{ onlyDirectories: true }
324-
).map(folderPath => toRelativePath(folderPath));
325+
).map(folderPath => normalizePath(toRelativePath(`${folderPath}/${currentBundleIDAsPath}`)));
325326

326327
await renameFoldersAndFiles({
327328
foldersAndFilesPaths: currentBundleIDFoldersRelativePaths,
@@ -417,12 +418,15 @@ ${chalk.green('SUCCESS! 🎉 🎉 🎉')} Your app has been renamed to "${chalk.
417418
chalk.yellow(`- Make sure to check old .xcodeproj and .xcworkspace in ios folder, please delete them manually.
418419
- Please make sure to run "npx pod-install" and "watchman watch-del-all" before running the app.
419420
420-
If you like this tool, please give it a star on GitHub: https://github.com/junedomingo/react-native-rename`)
421+
If you like this tool, please give it a star on GitHub: https://github.com/junedomingo/react-native-rename
422+
423+
`)
421424
);
422425
};
423426

424427
export const gitStageChanges = () => {
425428
shell.cd(APP_PATH);
429+
shell.exec('git config --local core.autocrlf false');
426430
shell.exec('git add .');
427431
};
428432

0 commit comments

Comments
 (0)