Skip to content

Commit

Permalink
Generate static compressed badge.
Browse files Browse the repository at this point in the history
  • Loading branch information
create3000 committed Jul 1, 2024
1 parent b193b51 commit 3c8034d
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# [X_ITE](https://create3000.github.io/x_ite/) X3D Browser

[![npm Version](https://badgen.net/npm/v/x_ite)](https://www.npmjs.com/package/x_ite)
[![Build Size](https://badgen.net/bundlephobia/minzip/x_ite)](https://bundlephobia.com/package/x_ite)
[![Build Size](https://create3000.github.io/x_ite/assets/img/badges/compressed.svg)](https://create3000.github.io/x_ite/features/){: .badge-link }
[![jsDelivr Hits](https://badgen.net/jsdelivr/hits/npm/x_ite)](https://www.jsdelivr.com/package/npm/x_ite)
[![npm Downloads](https://badgen.net/npm/dm/x_ite)](https://npmtrends.com/x_ite)
[![DeepScan grade](https://deepscan.io/api/teams/23540/projects/26814/branches/855447/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=23540&pid=26814&bid=855447)
Expand Down
13 changes: 11 additions & 2 deletions build/bin/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,21 @@ function readme (version)

function docs (version)
{
const contentLength = Math .floor (parseInt (sh (`brotli -6 dist/x_ite.min.js --stdout | wc -c`) .trim ()) / 1000);
const size = Math .floor (parseInt (sh (`brotli -6 dist/x_ite.min.js --stdout | wc -c`) .trim ()) / 1000);

if (size < 270)
var color = "green";
else if (size < 290)
var color = "cyan";
else
var color = "blue";

systemSync (`wget -q -O - https://badgen.net/static/compressed/${size}KB/${color} > docs/assets/img/badges/compressed.svg`);

let config = sh (`cat 'docs/_config.yml'`);

config = config .replace (/\x_ite_latest_version:\s*[\d\.]+/sg, `x_ite_latest_version: ${version}`);
config = config .replace (/\x_ite_compressed_size:\s*[\d\.]+/sg, `x_ite_compressed_size: ${contentLength}`);
config = config .replace (/\x_ite_compressed_size:\s*[\d\.]+/sg, `x_ite_compressed_size: ${size}`);

fs .writeFileSync ("docs/_config.yml", config);
}
Expand Down
2 changes: 1 addition & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ description: >- # used by seo meta and the atom feed
X_ITE X3D Browser, a framework for integrating and manipulating X3D and VRML scenes in HTML.
x_ite_latest_version: 10.0.2 # x_ite latest version
x_ite_compressed_size: 304 # size in kb
x_ite_compressed_size: 265 # size in kb
x3d_latest_version: 4.0 # x3d latest version

# Fill in the protocol & hostname for your site.
Expand Down
2 changes: 1 addition & 1 deletion docs/_posts/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Runs completely standalone, ie. there are no other library dependencies. You jus
Competitive performance for most frequently used functions and nodes. All function within X_ITE are optimized to give your the best performance that JavaScript can offer.

![Terser Logo](/assets/img/features/terser.png){: .left }
The X_ITE package is optimized in size with Terser to achieve the smallest size we can reach. **X_ITE core module has only {{ site.x_ite_compressed_size }}kB in size minified and compressed**, all other modules are loaded on demand.
The X_ITE package is optimized in size with Terser to achieve the smallest size we can reach. **X_ITE core module has only {{ site.x_ite_compressed_size }}KB in size minified and compressed**, all other modules are loaded on demand.

X_ITE is designed for optimal performance with event driven programming. The flow of the program is determined by events such as user actions (mouse clicks, key presses), sensor outputs, or messages from other scripts.

Expand Down
2 changes: 1 addition & 1 deletion docs/_posts/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ tags: [Getting Started]
permalink: /
---
[![npm Version](https://badgen.net/npm/v/x_ite)](https://www.npmjs.com/package/x_ite){: .badge-link }
[![Build Size](https://badgen.net/bundlephobia/minzip/x_ite)](https://bundlephobia.com/package/x_ite){: .badge-link }
[![Build Size](/assets/img/badges/compressed.svg)](/x_ite/features/){: .badge-link }
[![jsDelivr Hits](https://badgen.net/jsdelivr/hits/npm/x_ite)](https://www.jsdelivr.com/package/npm/x_ite){: .badge-link }
[![npm Downloads](https://badgen.net/npm/dm/x_ite)](https://npmtrends.com/x_ite){: .badge-link }
[![DeepScan grade](https://deepscan.io/api/teams/23540/projects/26814/branches/855447/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=23540&pid=26814&bid=855447){: .badge-link }
Expand Down
20 changes: 20 additions & 0 deletions docs/assets/img/badges/compressed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3c8034d

Please sign in to comment.