-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: added
updateVersion
build step
- Loading branch information
Showing
2 changed files
with
28 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,18 @@ | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
const packageJson = require('../package.json'); | ||
const util = require('util'); | ||
const readFile = util.promisify(fs.readFile); | ||
const writeFile = util.promisify(fs.writeFile); | ||
|
||
const srcPath = path.resolve('.'); | ||
const file = path.resolve(srcPath, 'src/datepicker.js'); | ||
|
||
module.exports = async () => { | ||
const datepickerFile = await readFile(file, 'UTF-8'); | ||
const updatedFile = datepickerFile.replace(/static version = '(.+)'/, (match, $1) => { | ||
return match.replace($1, packageJson.version); | ||
}); | ||
|
||
await writeFile(file, updatedFile); | ||
}; |