-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement versioning as prebuild step (#111)
## What is the goal of this PR? Fixes #109 (it will need re-releasing though) Workbase version should be read from `VERSION`, just like in other repos ## What are the changes implemented in this PR? `prebuild` stage invokes `version.js` `version.js` puts contents of `VERSION` into `package.json`'s `version` field `postbuild` stage returns the file to its initial state `package.json` now contains placeholder instead of proper version so we don't forget that there's a script that generates it.
- Loading branch information
1 parent
b3a1f8d
commit 541885b
Showing
2 changed files
with
18 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require('fs'); | ||
|
||
const package_json_filename = 'package.json'; | ||
const version_filename = 'VERSION'; | ||
|
||
const version = fs.readFileSync(version_filename).toString().trim(); | ||
const packageJsonContent = fs.readFileSync(package_json_filename).toString(); | ||
const packageJson = JSON.parse(packageJsonContent); | ||
|
||
packageJson['version'] = version; | ||
|
||
fs.writeFileSync(package_json_filename, JSON.stringify(packageJson, null, 4)); |