Skip to content

Commit

Permalink
Merge branch 'master' into benbrown/docker-memoruy
Browse files Browse the repository at this point in the history
  • Loading branch information
a-b-r-o-w-n committed Dec 2, 2019
2 parents 7fc13cc + 9bfd927 commit 88948c2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Composer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"packages/tools/language-servers/*"
],
"scripts": {
"build": "node scripts/begin.js && yarn build:prod",
"build": "node scripts/update.js && node scripts/begin.js && yarn build:prod",
"build:prod": "yarn build:dev && yarn build:server && yarn build:client",
"build:dev": "yarn build:tools && yarn build:lib && yarn build:extensions",
"build:lib": "yarn workspace @bfc/libs build:all",
Expand All @@ -28,7 +28,7 @@
"build:client": "yarn workspace @bfc/client build",
"build:tools": "yarn workspace @bfc/tools build:all",
"start": "cross-env NODE_ENV=production PORT=3000 yarn start:server",
"startall": "concurrently --kill-others-on-fail \"npm:runtime\" \"npm:start\"",
"startall": "node scripts/update.js && concurrently --kill-others-on-fail \"npm:runtime\" \"npm:start\"",
"start:dev": "concurrently \"npm:start:client\" \"npm:start:server:dev\"",
"start:client": "yarn workspace @bfc/client start",
"start:server": "yarn workspace @bfc/server start",
Expand Down
29 changes: 29 additions & 0 deletions Composer/scripts/update.js
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'));
}
}

0 comments on commit 88948c2

Please sign in to comment.