The back-end service powering brackets-extension-badges.github.io
Brackets extension badges are download counters for your Brackets extensions
This repository is the node.js version of the server, which manages both statistics databases and .svg
badge generation.
Currently deployed at badges.ml using â–²now
The name of an extension is defined in the package.json
file, at the root of the extension.
/
- Redirects to brackets-extension-badges.github.io/EXTENSION_NAME/version.svg
- A badge showing the version number/EXTENSION_NAME/total.svg
- A badge showing the total number of downloads/EXTENSION_NAME/last-version.svg
- A badge showing number of downloads for the latest version of the extension/EXTENSION_NAME/week.svg
- A badge showing the number of downloads during the last 7 days/EXTENSION_NAME/day.svg
- A badge showing the average downloads per day, based on the last 7 days/list.json
- A list of all extensions with total download numbers.
The badge provider is very light, and doesn't need any third-party database.
Deploying it is super fast and easy, you just need git
and node.js
:
# Clone the project
git clone https://github.com/brackets-extension-badges/badge-provider-nodejs && cd badge-provider-nodejs
# Install dependencies
npm i
# Build the project
npm run build
# Choose a port (default to 80)
export PORT=80
# Run the badge provider
npm start
The data is refreshed every time the server starts and every 2 hours. Everything is saved in RAM, which means the data is erased when the server stops.
Running npm run build
will achieve two things:
- It will compile the typescript from the /src folder to javascript
- It will compile the doT.js template
You should build every time the code changes.
Running npm test
will validate the quality of your typescript code.
Apache-2.0 © Boris K