-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add startup script to check for oudated versions (#1674)
* Initial update script * Updates * More updates * Final updates * Cleanup * Update error message * test fetch * Revert test release branch
- Loading branch information
Showing
2 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
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?/, ''); | ||
|
||
if (trimmedBranch === RELEASE_BRANCH) { | ||
console.log(chalk.yellow('Checking for updates...\n')); | ||
try { | ||
execSync('git fetch'); | ||
const sha = execSync(`git rev-parse --short ${RELEASE_BRANCH}`).toString(); | ||
const originSha = execSync(`git rev-parse --short origin/${RELEASE_BRANCH}`).toString(); | ||
if (sha !== originSha) { | ||
console.log( | ||
chalk.yellow( | ||
`An update to Composer is available.\n\nRun 'git pull origin stable' or fetch from origin/stable using another git-based tool.\n\nSee the CHANGELOG for more details.\nhttps://github.com/microsoft/BotFramework-Composer/blob/stable/CHANGELOG.md#releases\n` | ||
) | ||
); | ||
} else { | ||
console.log(chalk.green('You are using the most up to date version of Composer.')); | ||
} | ||
} catch (e) { | ||
console.log(chalk.yellow('Unable to compare applications versions.. continuing')); | ||
} | ||
} |