Skip to content

Commit

Permalink
up-to-date check script (mdn#1095)
Browse files Browse the repository at this point in the history
* up-to-date check script

* feedbacked
  • Loading branch information
peterbe authored Jan 12, 2021
1 parent b96550b commit 90bd6e7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"node": ">=12.0.0"
},
"scripts": {
"start": "env-cmd --silent cross-env CONTENT_ROOT=files REACT_APP_DISABLE_AUTH=true node node_modules/@mdn/yari/server",
"up-to-date-check": "node scripts/up-to-date-check.js",
"start": "yarn up-to-date-check && env-cmd --silent cross-env CONTENT_ROOT=files REACT_APP_DISABLE_AUTH=true node node_modules/@mdn/yari/server",
"filecheck": "env-cmd --silent cross-env CONTENT_ROOT=files node node_modules/@mdn/yari/filecheck/cli.js --cwd=$(pwd)",
"content": "env-cmd --silent cross-env CONTENT_ROOT=files node node_modules/@mdn/yari/tool/cli.js"
},
Expand Down
15 changes: 15 additions & 0 deletions scripts/up-to-date-check.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const yariPackageJson = require("@mdn/yari/package.json");
const thisPackageJson = require("../package.json");

const availableYariVersion = thisPackageJson.dependencies["@mdn/yari"];
const installedYariVersion = yariPackageJson.version;

if (installedYariVersion < availableYariVersion) {
console.log(
`The installed version of Yari (${installedYariVersion}) is older than ` +
`the version referenced in package.json (${availableYariVersion}). ` +
`Please make sure your main git branch is up-to-date with ` +
`https://github.com/mdn/content/, then run yarn install to ` +
`install the latest Yari.`
);
}

0 comments on commit 90bd6e7

Please sign in to comment.