Skip to content

Commit

Permalink
fix: move version output from preversion to version script (#546)
Browse files Browse the repository at this point in the history
  • Loading branch information
platosha authored Jan 29, 2021
1 parent ef98d5e commit 9ee302b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,14 @@ function polymerBuild() {
}

gulp.task('version:update', function() {
// Should be run from 'preversion'
// Assumes that the old version is in package.json and the new version in the `npm_package_version` environment variable
const oldversion = require('./package.json').version;
// Should be run from 'version'
// Assumes that the new version is in the `npm_package_version` environment variable
const newversion = process.env.npm_package_version;
if (!oldversion) {
throw new 'No old version found in package.json';
}
if (!newversion) {
throw new 'New version must be given as a npm_package_version environment variable.';
}
return gulp.src(['src/router-meta.js'])
.pipe(replace(oldversion, newversion))
.pipe(replace(/version: '.*'/, `version: '${newversion}'`))
.pipe(gulp.dest('src'))
.pipe(git.add());
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"docs:analyze": "polymer analyze dist/vaadin-router.js src/documentation/*.js > analysis.json",
"browserslist": "browserslist && browserslist --coverage",
"prepare": "npm run build",
"preversion": "gulp version:update"
"version": "gulp version:update"
},
"bundlesize": [
{
Expand Down

0 comments on commit 9ee302b

Please sign in to comment.