Skip to content

Commit

Permalink
🔧 Add a script to warn about Container fixture regen
Browse files Browse the repository at this point in the history
  • Loading branch information
belemaire authored and gmbharath12 committed Oct 26, 2018
1 parent 060c602 commit a98636e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -9,13 +9,14 @@
"check": "yarn check:lint && yarn check:yarnlock",
"check:lint": "tslint -c tslint.json '**/src/**/*.ts' '**/test/**/*.ts' -e '**/node_modules/**'",
"check:yarnlock": "node yarn-lock-check",
"check:regen-fixtures": "node regen-fixtures-check",
"coverage:ci": "yarn coverage:unit && yarn coverage:system && yarn istanbul report --include=**/.coverage/coverage-final.json text-lcov | yarn coveralls",
"coverage:system": "rimraf .nyc_output && node system-tests/system-tests-coverage",
"coverage:unit": "rimraf ern-*/.nyc_output && lerna run coverage && yarn istanbul report --include=ern-*/.coverage/coverage-final.json html",
"ern-debug": "node --nolazy --inspect-brk=5858 ern-local-cli/src/index.dev.js",
"istanbul": "istanbul",
"postmerge": "node auto-rebuild.js",
"precommit": "yarn check:yarnlock && yarn check:lint && yarn prettier",
"precommit": "yarn check:yarnlock && yarn check:lint && yarn prettier && yarn check:regen-fixtures",
"prettier": "pretty-quick --staged",
"rebuild": "lerna clean --yes && lerna bootstrap && lerna run build",
"regen-fixtures": "node system-tests/regen-fixtures",
Expand Down
23 changes: 23 additions & 0 deletions regen-fixtures-check.js
@@ -0,0 +1,23 @@
const chalk = require('chalk')

var execSync = require('child_process').execSync

var stdout = execSync(
'git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD'
)

const yellow = str => console.log(chalk.yellow(str))
const green = str => console.log(chalk.green(str))

for (const platform of ['android', 'ios']) {
const containerGenModule = `ern-container-gen-${platform}`
if (stdout && stdout.includes(containerGenModule)) {
yellow('!===========================================================!')
yellow(`Changes detected in ${containerGenModule}.`)
yellow('If the changes are impacting Container generated content,')
yellow(`dont forget to regenerate ${platform} Container fixture.`)
yellow(`In doubt ? Just regenerate the fixture :)`)
green(`$ yarn regen-fixtures`)
yellow('!===========================================================!')
}
}

0 comments on commit a98636e

Please sign in to comment.