react-native-rename
Advanced tools
Comparing version
@@ -118,3 +118,3 @@ #!/usr/bin/env node | ||
_commander2.default.version('2.2.1').arguments('<newName>').option('-b, --bundleID [value]', 'Set custom bundle identifier eg. "com.junedomingo.travelapp"').action(function (newName) { | ||
_commander2.default.version('2.2.2').arguments('<newName>').option('-b, --bundleID [value]', 'Set custom bundle identifier eg. "com.junedomingo.travelapp"').action(function (newName) { | ||
var nS_NewName = newName.replace(/\s/g, ''); | ||
@@ -147,2 +147,3 @@ var pattern = /^([0-9]|[a-z])+([0-9a-z\s]+)$/i; | ||
var itemsProcessed = 1; | ||
var successMsg = '/' + dest + ' ' + _colors2.default.green('RENAMED'); | ||
@@ -153,14 +154,13 @@ setTimeout(function () { | ||
if (_fs2.default.existsSync(_path2.default.join(__dirname, element)) || !_fs2.default.existsSync(_path2.default.join(__dirname, element))) { | ||
// don't run this in production | ||
if (devTestRNProject.length && !_fs2.default.existsSync(_path2.default.join(__dirname, dest))) { | ||
_shelljs2.default.mkdir('-p', dest); | ||
} | ||
var move = _shelljs2.default.exec('git mv "' + _path2.default.join(__dirname, element) + '" "' + _path2.default.join(__dirname, dest) + '" 2>/dev/null'); | ||
var move = devTestRNProject.length ? _shelljs2.default.mv('-f', _path2.default.join(__dirname, element), _path2.default.join(__dirname, dest)).code === 0 // for development | ||
: _shelljs2.default.exec('git mv "' + _path2.default.join(__dirname, element) + '" "' + _path2.default.join(__dirname, dest) + '"').code === 0; // for production | ||
if (move) { | ||
console.log('/' + dest + ' ' + _colors2.default.green('RENAMED')); | ||
} else { | ||
console.log("Ignore above error if this file doesn't exist"); | ||
if (move.code === 0) { | ||
console.log(successMsg); | ||
} else if (move.code === 128) { | ||
// if "outside repository" error occured | ||
if (_shelljs2.default.mv('-f', _path2.default.join(__dirname, element), _path2.default.join(__dirname, dest)).code === 0) { | ||
console.log(successMsg); | ||
} else { | ||
console.log("Ignore above error if this file doesn't exist"); | ||
} | ||
} | ||
@@ -236,7 +236,14 @@ } | ||
itemsProcessed++; | ||
var move = devTestRNProject.length ? _shelljs2.default.mv('-f', _path2.default.join(__dirname, currentJavaPath, file), _path2.default.join(__dirname, newBundlePath, file)).code === 0 : _shelljs2.default.exec('git mv "' + _path2.default.join(__dirname, currentJavaPath, file) + '" "' + _path2.default.join(__dirname, newBundlePath, file) + '" -f').code === 0; | ||
if (move) { | ||
console.log(newBundlePath + ' ' + _colors2.default.green('BUNDLE INDENTIFIER CHANGED')); | ||
} else { | ||
console.log('ERROR: git mv "' + currentJavaPath + '/' + file + '" "' + newBundlePath + '/' + file + '" -f'); | ||
var successMsg = newBundlePath + ' ' + _colors2.default.green('BUNDLE INDENTIFIER CHANGED'); | ||
var move = _shelljs2.default.exec('git mv "' + _path2.default.join(__dirname, currentJavaPath, file) + '" "' + _path2.default.join(__dirname, newBundlePath, file) + '" 2>/dev/null'); | ||
if (move === 0) { | ||
console.log(successMsg); | ||
} else if (move.code === 128) { | ||
// if "outside repository" error occured | ||
if (_shelljs2.default.mv('-f', _path2.default.join(__dirname, currentJavaPath, file), _path2.default.join(__dirname, newBundlePath, file)).code === 0) { | ||
console.log(successMsg); | ||
} else { | ||
console.log('Error moving: "' + currentJavaPath + '/' + file + '" "' + newBundlePath + '/' + file + '"'); | ||
} | ||
} | ||
@@ -303,2 +310,6 @@ | ||
}).then(function () { | ||
if (_fs2.default.existsSync(_path2.default.join(__dirname, 'ios', 'Podfile'))) { | ||
console.log('' + _colors2.default.yellow('Podfile has been modified, please run "pod install" inside ios directory.')); | ||
} | ||
}).then(function () { | ||
return console.log('' + _colors2.default.yellow('Please make sure to run "watchman watch-del-all" and "npm start --reset-cache" before running the app. ')); | ||
@@ -305,0 +316,0 @@ }); |
{ | ||
"name": "react-native-rename", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "Rename react-native app with just one command", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
249180
0.22%18
12.5%343
3.94%