-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core/auto update version env var (#1274)
* break up env var * add script * export update core version func * fix export * test * update func * update func * remove passing in global var and fix the func (checkout this commit to test the scripts) * remove test comments * apply review suggestions * fix error * Update scripts/update-version.js Co-authored-by: Steven Murray <[email protected]> * Revert "Update scripts/update-version.js" This reverts commit bd720a8. * Revert "apply review suggestions" This reverts commit c55cec3. Co-authored-by: Steven Murray <[email protected]>
- Loading branch information
1 parent
565bf08
commit 946ef7f
Showing
3 changed files
with
23 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
VERSION=@10.3.0 | ||
PKG=@massds/mayflower-assets | ||
STORYBOOK_CDN=https://unpkg.com/ | ||
STORYBOOK_PKG=@massds/[email protected] | ||
STORYBOOK_PKG=$PKG$VERSION | ||
STORYBOOK_CDN_PATH=$STORYBOOK_CDN$STORYBOOK_PKG |
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,16 @@ | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
|
||
module.exports = function updateCoreVersion(newVer) { | ||
const filePath = `${path.resolve(__dirname, '../packages/core')}/.env`; | ||
|
||
const content = fs.readFileSync(filePath).toString(); | ||
|
||
|
||
const regex = /[0-9]+\.[0-9]+\.[0-9]+/g; | ||
const newContent = content.replace(regex, newVer) | ||
|
||
fs.writeFileSync(filePath, newContent, (err) => { | ||
if (err) throw err; | ||
}) | ||
} |