Skip to content
Open
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
24 changes: 17 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const pathToPlist = argv.pathToPlist || `${pathToRoot}/ios/${info.name}/Info.pli
const pathToGradle = argv.pathToGradle || `${pathToRoot}/android/app/build.gradle`;
// handle case of several plist files
const pathsToPlists = Array.isArray(pathToPlist) ? pathToPlist : [pathToPlist];

const interactive = !argv.nonInteractive

// getting next version
const versionCurrent = info.version;
Expand Down Expand Up @@ -56,9 +56,15 @@ const chain = new Promise((resolve, reject) => {
log.warning(`I can\'t understand format of the version "${versionCurrent}".`);
}

const question = log.info(`Use "${version}" as the next version? [y/n] `, 0, true);
const answer = readlineSync.question(question).toLowerCase();
answer === 'y' ? resolve() : reject('Process canceled.');
let answer
if (interactive) {
const question = log.info(`Use "${version}" as the next version? [y/n] `, 0, true);
answer = readlineSync.question(question).toLowerCase();
}

(!interactive || (answer === 'y'))
? resolve()
: reject()
});


Expand Down Expand Up @@ -90,9 +96,13 @@ const commit = update.then(() => {
log.info(`I want to add a tag:`, 1);
log.info(`"v${version}"`, 2);

const question = log.info(`Do you allow me to do this? [y/n] `, 1, true);
const answer = readlineSync.question(question).toLowerCase();
if (answer === 'y') {
let answer
if (interactive) {
const question = log.info(`Do you allow me to do this? [y/n] `, 1, true);
answer = readlineSync.question(question).toLowerCase();
}

if (!interactive || (answer === 'y')) {
return helpers.commitVersionIncrease(version, message, [
pathToPackage,
...pathsToPlists,
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,4 @@ yarn version:up --flag value
| **`--pathToPackage './path'`** | `string` | `./package.json` | Path to `package.json` file in your project. |
| **`--pathToPlist './path'`** | `string` | `./ios/${package.name}/Info.plist` | Path to `Info.plist` file (ios project). |
| **`--pathToGradle './path'`** | `string` | `./android/app/build.gradle` | Path to `build.gradle` file (android project). |
| **`--non-interactive`** | `flag` | | Skip prompts |