Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make update script cross platform compatible #1687

Merged
merged 2 commits into from
Dec 3, 2019
Merged
Changes from 1 commit
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
20 changes: 14 additions & 6 deletions Composer/scripts/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@ const chalk = require('react-dev-utils/chalk');
const { execSync } = require('child_process');

const RELEASE_BRANCH = 'stable';
const branch = execSync("git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* (.*)/ \1/'");
const trimmedBranch = branch
.toString()
.trim()
.replace(/\*\s?/, '');
let currentBranch;

if (trimmedBranch === RELEASE_BRANCH) {
try {
currentBranch = execSync('git branch', { stdio: ['ignore', 'pipe', 'ignore'] })
.toString()
.split('\n')
.find(b => b.startsWith('* '))
.substring(2);
} catch (err) {
// just exit script without error and continue
console.log(chalk.yellow('Unable to compare applications versions.. continuing'));
process.exit();
}

if (currentBranch === RELEASE_BRANCH) {
console.log(chalk.yellow('Checking for updates...\n'));
try {
execSync('git fetch');
Expand Down