-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: adds prettier and proper plugin.xml version patching
- Loading branch information
Showing
6 changed files
with
107 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist/www/detect-webview-engine.js | ||
package-lock.json |
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,5 @@ | ||
{ | ||
"singleQuote": true, | ||
"printWidth": 140, | ||
"useTabs": false | ||
} |
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,58 @@ | ||
{ | ||
"scripts": { | ||
"prebump": "node scripts/patch-plugin-xml-version.js", | ||
"precommit": "git add plugin.xml", | ||
"postchangelog": "npx prettier --write CHANGELOG.md" | ||
}, | ||
"types": [ | ||
{ | ||
"type": "feat", | ||
"section": "Features" | ||
}, | ||
{ | ||
"type": "fix", | ||
"section": "Bug Fixes" | ||
}, | ||
{ | ||
"type": "perf", | ||
"section": "Performance Improvements" | ||
}, | ||
{ | ||
"type": "revert", | ||
"section": "Reverts" | ||
}, | ||
{ | ||
"type": "docs", | ||
"section": "Documentation", | ||
"hidden": true | ||
}, | ||
{ | ||
"type": "style", | ||
"section": "Styles", | ||
"hidden": true | ||
}, | ||
{ | ||
"type": "chore", | ||
"section": "Miscellaneous Chores", | ||
"hidden": true | ||
}, | ||
{ | ||
"type": "refactor", | ||
"section": "Code Refactoring" | ||
}, | ||
{ | ||
"type": "test", | ||
"section": "Tests", | ||
"hidden": true | ||
}, | ||
{ | ||
"type": "build", | ||
"section": "Build System" | ||
}, | ||
{ | ||
"type": "ci", | ||
"section": "Continuous Integration", | ||
"hidden": true | ||
} | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,35 @@ | ||
const packageJson = require('../package.json'); | ||
const conventionalRecommendedBump = require('conventional-recommended-bump'); | ||
const semver = require('semver'); | ||
const replace = require('replace'); | ||
|
||
const getNextVersion = currentVersion => { | ||
return new Promise((resolve, reject) => { | ||
conventionalRecommendedBump( | ||
{ | ||
preset: 'angular' | ||
}, | ||
(err, release) => { | ||
if (err) { | ||
reject(err); | ||
return; | ||
} | ||
|
||
const nextVersion = semver.valid(release.releaseType) || semver.inc(currentVersion, release.releaseType); | ||
|
||
resolve(nextVersion); | ||
} | ||
); | ||
}); | ||
}; | ||
|
||
getNextVersion(packageJson.version) | ||
.then(version => { | ||
replace({ | ||
regex: /(id="[\w\.-]+" version=")([\w\.-]+)(")/, | ||
replacement: `$1${version}$3`, | ||
paths: ['./plugin.xml'], | ||
silent: true | ||
}); | ||
}) | ||
.catch(error => console.log(error)); |