Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
chore(dependency-verification): update gitignore, add script to travi…
…s, fix isPre check
  • Loading branch information
Lance Harper committed Aug 20, 2018
1 parent f8d98b6 commit 8999598
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -45,3 +45,5 @@ test/unit/coverage
# Build assets
src/**/dist/*
src/**/styles/themes/*

src/**/package-lock\.json
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -22,6 +22,7 @@ install:
before_script:
- lerna run build
script:
- npm run check-version
- npm run lint
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
npm run unit;
Expand Down
7 changes: 5 additions & 2 deletions check-version.js
Expand Up @@ -27,7 +27,7 @@ function isPre(p1, p2) {
// remove the ^
const stripped = semver.coerce(p2).raw;
const diff = semver.diff(p1, stripped);
return ['premajor', 'preminor', 'prepatch', 'prerelease'].indexOf(diff);
return ['premajor', 'preminor', 'prepatch', 'prerelease'].indexOf(diff) >= 0 ? true : false;
}

async function main() {
Expand All @@ -49,7 +49,7 @@ async function main() {
// check if peerDep version resolves to local component version
locs.forEach((loc) => {
if (!semver.satisfies(loc.version, peerDependencies[loc.name])
&& isPre(loc.version, peerDependencies[loc.name])) {
&& !isPre(loc.version, peerDependencies[loc.name])) {
anyErr = true;
hasErr = true;
errMsg.push(`${loc.name}: "${peerDependencies[loc.name]}" doesn't resolve to the local package version of "${loc.version}"`);
Expand All @@ -65,7 +65,10 @@ async function main() {
});

if (anyErr) {
console.log(chalk.yellow('Update versions in each package.json and publish corrected component(s)'));
process.exitCode = 1;
} else {
console.log(chalk.green('Version checking complete'));
}
}

Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -22,6 +22,7 @@
"build:archive": "node build/component-docs-archive.js",
"build:transfer": "node build/component-docs-transfer.js",
"create": "node generator.js",
"clean": "lerna clean",
"bootstrap": "lerna bootstrap",
"start": "lerna bootstrap && lerna run build",
"check-version": "node check-version.js",
Expand Down
4 changes: 2 additions & 2 deletions templates/package.json
Expand Up @@ -23,11 +23,11 @@
"build": "node build/build.js"
},
"peerDependencies": {
"@rei/cdr-assets": "^0.1.0",
"@rei/cdr-assets": "^0.3.0",
"vue": "^2.5.13"
},
"devDependencies": {
"@rei/cdr-assets": "^0.1.0",
"@rei/cdr-assets": "^0.3.0",
"pkg-ok": "^2.1.0"
}
}

0 comments on commit 8999598

Please sign in to comment.