Fixed minified version download link.
h3rald h3rald@h3rald.com
Sat, 31 Oct 2020 19:05:59 +0100
4 files changed,
25 insertions(+),
34 deletions(-)
M
README.md
→
README.md
@@ -21,7 +21,7 @@ Here, look, it's just one file:
<a href="https://raw.githubusercontent.com/h3rald/h3/v0.11.0/h3.js" target="_blank" class="button primary">Download v0.11.0 (Keen Klingon)</a> -<small>Or get the minified version [here](https://raw.githubusercontent.com/h3rald/h3/v0.9.0/h3.min.js).</small> +<small>Or get the minified version <a href="https://raw.githubusercontent.com/h3rald/h3/v0.11.0/h3.min.js" target="_blank">here</a>.</small> Yes there is also a [NPM package](https://www.npmjs.com/package/@h3rald/h3) if you want to use it with WebPack and similar, but let me repeat: _it's just one file_.
M
docs/H3_DeveloperGuide.htm
→
docs/H3_DeveloperGuide.htm
@@ -7337,7 +7337,7 @@ <p>Here, look, it’s just one file:</p>
<p><a href="https://raw.githubusercontent.com/h3rald/h3/v0.11.0/h3.js" target="_blank" class="button primary">Download v0.11.0 (Keen Klingon)</a></p> -<p><small>Or get the minified version <a href="https://raw.githubusercontent.com/h3rald/h3/v0.9.0/h3.min.js">here</a>.</small></p> +<p><small>Or get the minified version <a href="https://raw.githubusercontent.com/h3rald/h3/v0.11.0/h3.min.js" target="_blank">here</a>.</small></p> <p>Yes there is also a <a href="https://www.npmjs.com/package/@h3rald/h3">NPM package</a> if you want to use it with WebPack and similar, but let me repeat: <em>it’s just one file</em>.</p>
M
docs/md/overview.md
→
docs/md/overview.md
@@ -14,7 +14,7 @@ Here, look, it's just one file:
<a href="https://raw.githubusercontent.com/h3rald/h3/v0.11.0/h3.js" target="_blank" class="button primary">Download v0.11.0 (Keen Klingon)</a> -<small>Or get the minified version [here](https://raw.githubusercontent.com/h3rald/h3/v0.9.0/h3.min.js).</small> +<small>Or get the minified version <a href="https://raw.githubusercontent.com/h3rald/h3/v0.11.0/h3.min.js" target="_blank">here</a>.</small> Yes there is also a [NPM package](https://www.npmjs.com/package/@h3rald/h3) if you want to use it with WebPack and similar, but let me repeat: _it's just one file_.
M
scripts/release.js
→
scripts/release.js
@@ -1,21 +1,21 @@
-const fs = require("fs"); -const path = require("path"); -const terser = require("terser"); +const fs = require('fs'); +const path = require('path'); +const terser = require('terser'); -const readme = "./README.md"; -const overview = "./docs/md/overview.md"; -const app = "./docs/js/app.js"; -const tutorial = "./docs/md/tutorial.md"; -const package = "./package.json"; -const h3 = "./h3.js"; -const h3min = "./h3.min.js"; -const h3map = "./h3.js.map"; +const readme = './README.md'; +const overview = './docs/md/overview.md'; +const app = './docs/js/app.js'; +const tutorial = './docs/md/tutorial.md'; +const package = './package.json'; +const h3 = './h3.js'; +const h3min = './h3.min.js'; +const h3map = './h3.js.map'; -const pkg = JSON.parse(fs.readFileSync(package, "utf8")); +const pkg = JSON.parse(fs.readFileSync(package, 'utf8')); // Update h3.js -let h3Data = fs.readFileSync(h3, "utf8"); +let h3Data = fs.readFileSync(h3, 'utf8'); const notice = h3Data.match(/\/\*\*((.|\n|\r)+?)\*\//gm)[0]; const newNotice = notice .replace(/v\d+\.\d+\.\d+/, `v${pkg.version}`)@@ -24,34 +24,25 @@ .replace(/Copyright \d+/, `Copyright ${new Date().getFullYear()}`);
h3Data = h3Data.replace(notice, newNotice); fs.writeFileSync(h3, h3Data); const minified = terser.minify(h3Data, { - sourceMap: { filename: "h3.js", url: "h3.js.map" }, + sourceMap: { filename: 'h3.js', url: 'h3.js.map' }, }); -fs.writeFileSync( - h3min, - minified.code -); -fs.writeFileSync( - h3map, - minified.map -); +fs.writeFileSync(h3min, minified.code); +fs.writeFileSync(h3map, minified.map); // Update README.md -let readmeData = fs.readFileSync(readme, "utf8"); -readmeData = readmeData.replace(/v\d+\.\d+\.\d+/, `v${pkg.version}`); +let readmeData = fs.readFileSync(readme, 'utf8'); readmeData = readmeData.replace(/v\d+\.\d+\.\d+/, `v${pkg.version}`); -readmeData = readmeData.replace( - /Download v\d+\.\d+\.\d+ \([^)]+\)/, - `Download v${pkg.version} (${pkg.versionName})` -); +readmeData = readmeData.replace(/Download v\d+\.\d+\.\d+ \([^)]+\)/, `Download v${pkg.version} (${pkg.versionName})`); +readmeData = readmeData.replace(/v\d+\.\d+\.\d+\/h3\.min\.js/, `v${pkg.version}/h3.min.js`); fs.writeFileSync(readme, readmeData); // Remove badges and copy to overview.md -const overviewData = readmeData.replace(/[^\*]+\*\*\*\s+/m, ""); +const overviewData = readmeData.replace(/[^\*]+\*\*\*\s+/m, ''); fs.writeFileSync(overview, overviewData); // Update app.js and tutorial.md const updateCode = (file) => { - let data = fs.readFileSync(file, "utf8"); + let data = fs.readFileSync(file, 'utf8'); data = data.replace(/v\d+\.\d+\.\d+/, `v${pkg.version}`); data = data.replace(/“.+“/, `“${pkg.versionName}“`); fs.writeFileSync(file, data);@@ -60,6 +51,6 @@ updateCode(app);
updateCode(tutorial); // Update package.json -const packageData = JSON.parse(fs.readFileSync(package, "utf8")); +const packageData = JSON.parse(fs.readFileSync(package, 'utf8')); packageData.version = pkg.version; fs.writeFileSync(package, JSON.stringify(packageData, null, 2));