Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,71 @@
"contributions": [
"code"
]
},
{
"login": "dsubject",
"name": "Dani Subject",
"avatar_url": "https://avatars.githubusercontent.com/u/33845418?s=64&v=4",
"profile": "https://github.com/dsubject",
"contributions": [
"code"
]
},
{
"login": "Malay-dev",
"name": "Malay Kumar",
"avatar_url": "https://avatars.githubusercontent.com/u/91375797?s=64&v=4",
"profile": "https://github.com/Malay-dev",
"contributions": [
"doc"
]
},
{
"login": "samuelIkoli",
"name": "Samuel Ikoli",
"avatar_url": "https://avatars.githubusercontent.com/u/98848723?v=4",
"profile": "https://github.com/samuelIkoli",
"contributions": [
"doc"
]
},
{
"login": "APJohns",
"name": "Ash Johns",
"avatar_url": "https://avatars.githubusercontent.com/u/18357173?v=4",
"profile": "https://github.com/APJohns",
"contributions": [
"bug",
"code"
]
},
{
"login": "mgriffin-scottlogic",
"name": "Matthew Griffin",
"avatar_url": "https://avatars.githubusercontent.com/u/117279304?v=4",
"profile": "https://github.com/mgriffin-scottlogic",
"contributions": [
"doc",
"code"
]
},
{
"login": "hanopcan",
"name": "Hannah",
"avatar_url": "https://avatars.githubusercontent.com/u/11687898?v=4",
"profile": "https://github.com/hanopcan",
"contributions": [
"doc"
]
},
{
"login": "alexzurbonsen",
"name": "Alex",
"avatar_url": "https://avatars.githubusercontent.com/u/82914459?v=4",
"profile": "https://github.com/alexzurbonsen",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,
Expand Down
35 changes: 18 additions & 17 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,30 @@ name: Unit tests
on:
push:
branches:
- main
- ca-v0.10.0
- main
pull_request:
branches:
- main
- ca-v0.10.0
- main
permissions:
contents: read
contents: read
jobs:
build:
runs-on: ubuntu-latest
# We officially support LTS versions of nodejs still inside
# their security support window
# https://endoflife.date/nodejs
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: npm ci
- name: Verify lint
run: npm run lint
- name: Run unit tests
run: npm test
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: npm ci
- name: Verify lint
run: npm run lint
- name: Run unit tests
run: npm test
54 changes: 54 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,60 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Released

### [0.16.7] - 2025-04-18

#### Changed

- Automated monthly update of annual average grid intensity data.
- Bump esbuild from 0.14.54 to 0.25.0

### [0.16.6] - 2025-02-10

#### Changed

- Automated monthly update of annual average grid intensity data.

### [0.16.5] - 2025-01-20

#### Changed

- Automated monthly update of annual average grid intensity data.

### [0.16.4] - 2024-12-10

#### Changed

- Separate options parsing for byteTrace and visitTrace functions in #226
- Automated monthly update of annual average grid intensity data.

### [0.16.3] - 2024-11-30

#### Fixed

- Include all gridIntensity values when running the perVisitTrace or perByteTrace functions. #237

### [0.16.2] - 2024-11-12

#### _Added_

- Add JSDoc comments to data generation scripts and outputs #230
- Added basic error handling to data fetch in emissions script #221

#### Fixed

- Bump url2green version #238

#### Changed

- Automated monthly update of annual average grid intensity data.

### [0.16.1] - 2024-09-10

#### Changed

- _[Experimental]_ Add minimum capability to publish CO2.js to JSR.
- Automated monthly update of annual average grid intensity data.

### [0.16.0] - 2024-07-01

#### _Added_
Expand Down
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

[![All Contributors](https://img.shields.io/badge/all_contributors-14-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-21-orange.svg?style=flat-square)](#contributors-)

<!-- ALL-CONTRIBUTORS-BADGE:END -->

Expand All @@ -24,7 +24,7 @@ Internally, you may want to use this library to create a _carbon budget_ for you

For user facing applications, CO2.js could be used to check & block the uploading of carbon intensive files. Or, to present users with information about the carbon impact of their online activities (such as browsing a website).

The above a just a few examples of the many and varied ways CO2.js can be applied to provide carbon estimates for data transfer. If you’re using CO2.js in production we’d love to hear how! [Contact us](https://www.thegreenwebfoundation.org/support-form/) via our website.
The above are just a few examples of the many and varied ways CO2.js can be applied to provide carbon estimates for data transfer. If you’re using CO2.js in production we’d love to hear how! [Contact us](https://www.thegreenwebfoundation.org/support-form/) via our website.

## Installation

Expand All @@ -36,12 +36,12 @@ You can install CO2.js as a dependency for your projects using NPM.
npm install @tgwf/co2
```

### Using Skypack
### Using esm.sh

You can import the CO2.js library into projects using Skypack.
You can import the CO2.js library into projects using esm.sh.

```js
import tgwf from "https://cdn.skypack.dev/@tgwf/co2";
import tgwf from "https://esm.sh/@tgwf/co2@latest";
```

## Using a JS CDN
Expand Down Expand Up @@ -160,6 +160,15 @@ To contribute changes back to this project, please follow the steps outlined in
<td align="center" valign="top" width="14.28%"><a href="https://github.com/p-gerard"><img src="https://avatars.githubusercontent.com/u/97036756?v=4?s=100" width="100px;" alt="p-gerard"/><br /><sub><b>p-gerard</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/issues?q=author%3Ap-gerard" title="Bug reports">🐛</a> <a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=p-gerard" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sfishel18"><img src="https://avatars.githubusercontent.com/u/294695?v=4?s=100" width="100px;" alt="Simon Fishel"/><br /><sub><b>Simon Fishel</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=sfishel18" title="Code">💻</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/dsubject"><img src="https://avatars.githubusercontent.com/u/33845418?s=64&v=4?s=100" width="100px;" alt="Dani Subject"/><br /><sub><b>Dani Subject</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=dsubject" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Malay-dev"><img src="https://avatars.githubusercontent.com/u/91375797?s=64&v=4?s=100" width="100px;" alt="Malay Kumar"/><br /><sub><b>Malay Kumar</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=Malay-dev" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/samuelIkoli"><img src="https://avatars.githubusercontent.com/u/98848723?v=4?s=100" width="100px;" alt="Samuel Ikoli"/><br /><sub><b>Samuel Ikoli</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=samuelIkoli" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/APJohns"><img src="https://avatars.githubusercontent.com/u/18357173?v=4?s=100" width="100px;" alt="Ash Johns"/><br /><sub><b>Ash Johns</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/issues?q=author%3AAPJohns" title="Bug reports">🐛</a> <a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=APJohns" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mgriffin-scottlogic"><img src="https://avatars.githubusercontent.com/u/117279304?v=4?s=100" width="100px;" alt="Matthew Griffin"/><br /><sub><b>Matthew Griffin</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=mgriffin-scottlogic" title="Documentation">📖</a> <a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=mgriffin-scottlogic" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/hanopcan"><img src="https://avatars.githubusercontent.com/u/11687898?v=4?s=100" width="100px;" alt="Hannah"/><br /><sub><b>Hannah</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=hanopcan" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/alexzurbonsen"><img src="https://avatars.githubusercontent.com/u/82914459?v=4?s=100" width="100px;" alt="Alex"/><br /><sub><b>Alex</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=alexzurbonsen" title="Code">💻</a></td>
</tr>
</tbody>
</table>

Expand Down
Loading