1
0
mirror of https://github.com/videojs/video.js.git synced 2024-11-24 08:42:25 +02:00

chore: update version number in readme on release (#8840)

Updates the version number where it appears in URLs in the README, when
`nom version` is ran. It's looking specifically for patterns like
`/8.17.3/` and `/video.js@8.17.3/`; if we change the README we need to
consider this script.
This commit is contained in:
mister-ben 2024-08-28 12:39:46 +02:00 committed by GitHub
parent fa7e64879a
commit 5fac9e1e9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

16
build/readme-version.js Normal file
View File

@ -0,0 +1,16 @@
/*
Replaces the version number in the readme with the current package version.
Looks for patterns like `/8.17.3/` and `/video.js@8.17.3/`
*/
const fs = require('fs');
const path = require('path');
const version = require('../package.json').version;
let doc = fs.readFileSync(path.join(__dirname, '..', 'README.md'), 'utf8');
doc = doc
.replace(/\/video.js@\d\.\d+\.\d+\//g, `/video.js@${version}/`)
.replace(/\/\d\.\d+\.\d+\//g, `/${version}/`);
fs.writeFileSync(path.join(__dirname, '..', 'README.md'), doc, 'utf8');

View File

@ -77,7 +77,7 @@
"netlify": "node ./build/netlify.js", "netlify": "node ./build/netlify.js",
"netlify-docs": "node ./build/netlify-docs.js", "netlify-docs": "node ./build/netlify-docs.js",
"prepublishOnly": "run-p build", "prepublishOnly": "run-p build",
"version": "is-prerelease || npm run changelog && git add CHANGELOG.md", "version": "is-prerelease || npm run changelog && node build/readme-version.js && git add CHANGELOG.md README.md",
"zip": "cd dist && cross-env bestzip \"./video-js-${npm_package_version}.zip\" * && cd .." "zip": "cd dist && cross-env bestzip \"./video-js-${npm_package_version}.zip\" * && cd .."
}, },
"repository": { "repository": {