@tgwf/co2 0.13.5 → 0.13.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,39 +1,129 @@
1
1
  {
2
+ "projectName": "co2.js",
3
+ "projectOwner": "thegreenwebfoundation",
4
+ "repoType": "github",
5
+ "repoHost": "https://github.com",
2
6
  "files": [
3
7
  "README.md"
4
8
  ],
5
9
  "imageSize": 100,
6
- "commit": false,
10
+ "commit": true,
11
+ "commitConvention": "none",
7
12
  "contributors": [
8
13
  {
9
- "login": "JamieBeevor",
10
- "name": "JamieB",
11
- "avatar_url": "https://avatars1.githubusercontent.com/u/26165947?v=4",
12
- "profile": "https://greengumption.co.uk",
14
+ "login": "mrchrisadams",
15
+ "name": "Chris Adams",
16
+ "avatar_url": "https://avatars.githubusercontent.com/u/17906?v=4",
17
+ "profile": "https://github.com/mrchrisadams",
18
+ "contributions": [
19
+ "code"
20
+ ]
21
+ },
22
+ {
23
+ "login": "fershad",
24
+ "name": "fershad",
25
+ "avatar_url": "https://avatars.githubusercontent.com/u/27988517?v=4",
26
+ "profile": "https://www.fershad.com/",
13
27
  "contributions": [
14
- "ideas",
15
- "question",
16
- "review"
28
+ "code",
29
+ "doc",
30
+ "maintenance"
17
31
  ]
18
32
  },
19
33
  {
20
- "login": "soulgalore",
34
+ "login": "soulgalore",
21
35
  "name": "Peter Hedenskog",
22
- "avatar_url": "https://avatars2.githubusercontent.com/u/540757?v=4",
23
- "profile": "https://www.peterhedenskog.com",
36
+ "avatar_url": "https://avatars.githubusercontent.com/u/540757?v=4",
37
+ "profile": "https://www.peterhedenskog.com/",
38
+ "contributions": [
39
+ "code"
40
+ ]
41
+ },
42
+ {
43
+ "login": "drydenwilliams",
44
+ "name": "Dryden",
45
+ "avatar_url": "https://avatars.githubusercontent.com/u/4403089?v=4",
46
+ "profile": "https://www.drydenwilliams.co.uk/",
47
+ "contributions": [
48
+ "code"
49
+ ]
50
+ },
51
+ {
52
+ "login": "EvanHahn",
53
+ "name": "Evan Hahn",
54
+ "avatar_url": "https://avatars.githubusercontent.com/u/777712?v=4",
55
+ "profile": "https://evanhahn.com/",
56
+ "contributions": [
57
+ "code",
58
+ "test"
59
+ ]
60
+ },
61
+ {
62
+ "login": "PrathumP",
63
+ "name": "Prathum Pandey",
64
+ "avatar_url": "https://avatars.githubusercontent.com/u/115390367?v=4",
65
+ "profile": "https://github.com/PrathumP",
66
+ "contributions": [
67
+ "bug",
68
+ "code"
69
+ ]
70
+ },
71
+ {
72
+ "login": "Fdawgs",
73
+ "name": "Frazer Smith",
74
+ "avatar_url": "https://avatars.githubusercontent.com/u/43814140?v=4",
75
+ "profile": "https://github.com/Fdawgs",
24
76
  "contributions": [
25
77
  "code",
26
- "ideas",
27
- "review",
28
- "infra",
29
- "docs"
78
+ "test"
79
+ ]
80
+ },
81
+ {
82
+ "login": "hamishfagg",
83
+ "name": "Hamish Fagg",
84
+ "avatar_url": "https://avatars.githubusercontent.com/u/895845?v=4",
85
+ "profile": "https://github.com/hamishfagg",
86
+ "contributions": [
87
+ "code"
88
+ ]
89
+ },
90
+ {
91
+ "login": "toolness",
92
+ "name": "Atul Varma",
93
+ "avatar_url": "https://avatars.githubusercontent.com/u/124687?v=4",
94
+ "profile": "http://portfolio.toolness.org/",
95
+ "contributions": [
96
+ "code"
97
+ ]
98
+ },
99
+ {
100
+ "login": "piperchester",
101
+ "name": "Piper",
102
+ "avatar_url": "https://avatars.githubusercontent.com/u/1530684?v=4",
103
+ "profile": "https://www.intersectionalenvironmentalist.com/",
104
+ "contributions": [
105
+ "code"
106
+ ]
107
+ },
108
+ {
109
+ "login": "raymundovr",
110
+ "name": "Raymundo Vásquez Ruiz",
111
+ "avatar_url": "https://avatars.githubusercontent.com/u/108420?v=4",
112
+ "profile": "https://vasquezruiz.com/",
113
+ "contributions": [
114
+ "code"
115
+ ]
116
+ },
117
+ {
118
+ "login": "JamieBeevor",
119
+ "name": "JamieB",
120
+ "avatar_url": "https://avatars.githubusercontent.com/u/26165947?v=4",
121
+ "profile": "https://greengumption.co.uk/",
122
+ "contributions": [
123
+ "code"
30
124
  ]
31
125
  }
32
126
  ],
33
127
  "contributorsPerLine": 7,
34
- "projectName": "co2.js",
35
- "projectOwner": "thegreenwebfoundation",
36
- "repoType": "github",
37
- "repoHost": "https://github.com",
38
- "skipCi": true
128
+ "linkToUsage": false
39
129
  }
package/CHANGELOG.md CHANGED
@@ -18,6 +18,96 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
18
18
 
19
19
  # Released
20
20
 
21
+ ## [0.13.5] - 2023-07-5
22
+
23
+ ### Changed
24
+
25
+ - Automated monthly update of annual average grid intensity data.
26
+
27
+ ## [0.13.4] - 2023-05-24
28
+
29
+ ### Fixed
30
+
31
+ - Fixed an error when try to use global grid intensities in IIFE. (PR #147)
32
+
33
+ ## [0.13.3] - 2023-05-18
34
+
35
+ ### Changed
36
+
37
+ - Updated the global grid intensity constant to use the latest WORLD grid intensity value from Ember. (PR #142)
38
+
39
+ ## [0.13.2] - 2023-04-21
40
+
41
+ - Fix to ensure that region names that are keys in the average annual grid intensity export are capitalised.
42
+
43
+ ## [0.13.1] - 2023-04-20
44
+
45
+ ### Fixed
46
+
47
+ - Fixed the import of average grid intensities in node. (PR #137)
48
+
49
+ ## [0.13.0] - 2023-04-13
50
+
51
+ ### Changed
52
+
53
+ In PR #135 there were significant changes made to how average annual grid intensities are fetched and generated.
54
+
55
+ - Updated average annual grid intensities to include 2022 values from Ember.
56
+ - Changed the functions to generate average grid intensities to:
57
+ - Fetch data directly from Ember's API.
58
+ - Get the *latest* annual average values for each country/region.
59
+ - Renamed the average grid intensities export file.
60
+
61
+ ## [0.12.2] - 2023-03-01
62
+
63
+ ### Added
64
+
65
+ - Add a module declaration for use from typescript (PR #131)
66
+
67
+ ### Changed
68
+
69
+ - Updated 2021 average annual grid intensity values (PR #133)
70
+
71
+ ## [0.12.1] - 2023-02-02
72
+
73
+ ### Fixed
74
+
75
+ - Removed incorrectly imported constants in tests.
76
+
77
+ ## [0.12.0] - 2023-02-02
78
+
79
+ ### Added
80
+
81
+ - Introduced two new functions `perByteTrace` and `perVisitTrace` which allow developers to pass an options object containing customised values for the constants used in the Sustainable Web Design model. (PR #126)
82
+
83
+ ### Changed
84
+
85
+ - Allowed developers now have the option to return a breakdown of carbon emissions estimates by system segment when using the Sustainable Web Design model. (PR #113)
86
+
87
+ ## [0.11.4] - 2022-12-02
88
+
89
+ ### Fixed
90
+
91
+ - Updated the `greenCheckMulti` function to work properly in ESM. (PR #123)
92
+
93
+ ## [0.11.3] - 2022-10-13
94
+
95
+ ### Fixed
96
+
97
+ - Corrected the Node export for the hosting raised in issue #110. (PR #118)
98
+
99
+ ## [0.11.2] - 2022-10-11
100
+
101
+ ### Fixed
102
+
103
+ - v0.11.x updates increased library size to 17MB + when published to NPM. This has been raised in [#108](https://github.com/thegreenwebfoundation/co2.js/issues/108) and it was found data files were being included in the published package. (PR #117)
104
+
105
+ ## [0.11.1] - 2022-10-07
106
+
107
+ ### Changed
108
+
109
+ - We have used generic filenames for data files, to avoid any confusion around the data being provided in this library. (PR #112)
110
+
21
111
  ## [0.11.0] - 2022-10-03
22
112
 
23
113
  ### Added
@@ -33,13 +123,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
33
123
  - Changed the default model for transfer based CO2 calculations from the _1byte_ model to the _Sustainable Web Design_ model instead. See https://developers.thegreenwebfoundation.org/co2js/models/ for guidance on the differences and how to migrate between them. See [#94 for more](https://github.com/thegreenwebfoundation/co2.js/issues/94).
34
124
  - Updated our release commands to generate and format the carbon intensity data as part of the release process.
35
125
 
36
- ## 0.10.4 2022-08-12
126
+ ## [0.10.4] - 2022-08-12
37
127
 
38
128
  ### Added
39
129
 
40
130
  - Introduced a `release:patch` command, to automate the publishing process. This is designed to make sure we always publish the most recent compiled code, by adding a rebuild step that can be easy to forget.
41
131
 
42
- ## 0.10.3 2022-08-12
132
+ ## [0.10.3] - 2022-08-12
43
133
 
44
134
  ### Added
45
135
 
package/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CO2.js
2
2
 
3
+ <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
4
+ [![All Contributors](https://img.shields.io/badge/all_contributors-12-orange.svg?style=flat-square)](#contributors-)
5
+ <!-- ALL-CONTRIBUTORS-BADGE:END -->
6
+
3
7
  <img src="https://github.com/thegreenwebfoundation/co2.js/actions/workflows/unittests.yml/badge.svg" />
4
8
 
5
9
  One day, the internet will be powered by renewable energy. Until that day comes, there’ll be a CO2 cost that comes with every byte of data that’s uploaded or downloaded. By being able to calculate these emissions, developers can be empowered to create more efficient, lower carbon apps, websites, and software.
@@ -14,7 +18,7 @@ CO2.js is a JavaScript library that enables developers a way to estimate the emi
14
18
 
15
19
  Being able to estimate the CO2 emissions associated with digital activities can be of benefit to both developers and users.
16
20
 
17
- Internally, you may want to use this library to create a *carbon budget* for your site or app. It is also useful for inclusion in dashboards and monitoring tools.
21
+ Internally, you may want to use this library to create a _carbon budget_ for your site or app. It is also useful for inclusion in dashboards and monitoring tools.
18
22
 
19
23
  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).
20
24
 
@@ -35,7 +39,7 @@ npm install @tgwf/co2
35
39
  You can import the CO2.js library into projects using Skypack.
36
40
 
37
41
  ```js
38
- import tgwf from 'https://cdn.skypack.dev/@tgwf/co2';
42
+ import tgwf from "https://cdn.skypack.dev/@tgwf/co2";
39
43
  ```
40
44
 
41
45
  ## Using a JS CDN
@@ -66,10 +70,10 @@ You can also build the CO2.js library from the source code. To do this:
66
70
  1. Clone or fork the repository.
67
71
  1. Navigate to the folder on your machine and run `npm run build` in your terminal.
68
72
  1. Once the build has finished running, you will find a `/dist` folder has been created. Inside you can find:
69
-
70
- - `dist/cjs` - A CommonJS compatible build.
71
- - `dist/esm` - An ES Modules compatible build.
72
- - `dist/iife` - An Immediately Invoked Function Expression (IIFE) version of the library.
73
+
74
+ - `dist/cjs` - A CommonJS compatible build.
75
+ - `dist/esm` - An ES Modules compatible build.
76
+ - `dist/iife` - An Immediately Invoked Function Expression (IIFE) version of the library.
73
77
 
74
78
  ## Marginal and average emissions intensity data
75
79
 
@@ -80,13 +84,14 @@ CO2.js includes yearly average grid intensity data from [Ember](https://ember-cl
80
84
  You can import annual, country-level marginal or average grid intensity data into your projects directly from CO2.js. For example, if we wanted to use the average grid intensity for Australia in our project, we could use the code below:
81
85
 
82
86
  ```js
83
- import { averageIntensity } from '@tgwf/co2';
87
+ import { averageIntensity } from "@tgwf/co2";
84
88
  const { data } = averageIntensity;
85
89
  const { AUS } = data;
86
- console.log({ AUS })
90
+ console.log({ AUS });
87
91
  ```
88
92
 
89
93
  All countries are represented by their respective [Alpha-3 ISO country code](https://www.iso.org/obp/ui/#search).
94
+
90
95
  ## Publishing to NPM
91
96
 
92
97
  We use [`np`](https://www.npmjs.com/package/np) to publish new versions of this library to NPM. To do this:
@@ -100,20 +105,58 @@ We use [`np`](https://www.npmjs.com/package/np) to publish new versions of this
100
105
 
101
106
  CO2.js releases will be communicated through the following channels:
102
107
 
103
- | Channel | Minor Release (0.xx) | Patch Release (0.xx.x) |
104
- |----------|----------------------|----------------------|
105
- | [Github](https://github.com/thegreenwebfoundation/co2.js/releases) | ✅ | ✅ |
106
- | [Green Web Foundation website](https://www.thegreenwebfoundation.org/co2-js/#releases) | ✅ | ❌ |
107
- | W3C Slack Sustainability Channel | ✅ | ❌ |
108
- | ClimateAction.Tech Slack | ✅ | ❌ |
109
- | [Green Web Foundation LinkedIn Account](https://www.linkedin.com/company/green-web-foundation/) | ✅ | ❌ |
108
+ | Channel | Minor Release (0.xx) | Patch Release (0.xx.x) |
109
+ | ----------------------------------------------------------------------------------------------- | -------------------- | ---------------------- |
110
+ | [Github](https://github.com/thegreenwebfoundation/co2.js/releases) | ✅ | ✅ |
111
+ | [Green Web Foundation website](https://www.thegreenwebfoundation.org/co2-js/#releases) | ✅ | ❌ |
112
+ | W3C Slack Sustainability Channel | ✅ | ❌ |
113
+ | ClimateAction.Tech Slack | ✅ | ❌ |
114
+ | [Green Web Foundation LinkedIn Account](https://www.linkedin.com/company/green-web-foundation/) | ✅ | ❌ |
110
115
 
111
116
  ## Licenses
112
117
 
113
- The code for CO2.js is licensed Apache 2.0. ([What does this mean?](https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)))
118
+ The code for CO2.js is licensed Apache 2.0. ([What does this mean?](<https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)>))
114
119
 
115
120
  The average carbon intensity data from Ember is published under the Creative Commons ShareAlike Attribution Licence ([CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)). ([What does this mean?](https://www.tldrlegal.com/license/creative-commons-attribution-share-alike-cc-sa))
116
121
 
117
122
  The marginal intensity data is published by the Green Web Foundation, under the Creative Commons ShareAlike Attribution Licence ([CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)). ([What does this mean?](https://www.tldrlegal.com/license/creative-commons-attribution-share-alike-cc-sa))
118
123
 
119
124
  See LICENCE for more.
125
+
126
+ ## Contributors
127
+
128
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
129
+ <!-- prettier-ignore-start -->
130
+ <!-- markdownlint-disable -->
131
+ <table>
132
+ <tbody>
133
+ <tr>
134
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/mrchrisadams"><img src="https://avatars.githubusercontent.com/u/17906?v=4?s=100" width="100px;" alt="Chris Adams"/><br /><sub><b>Chris Adams</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=mrchrisadams" title="Code">💻</a></td>
135
+ <td align="center" valign="top" width="14.28%"><a href="https://www.fershad.com/"><img src="https://avatars.githubusercontent.com/u/27988517?v=4?s=100" width="100px;" alt="fershad"/><br /><sub><b>fershad</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=fershad" title="Code">💻</a> <a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=fershad" title="Documentation">📖</a> <a href="#maintenance-fershad" title="Maintenance">🚧</a></td>
136
+ <td align="center" valign="top" width="14.28%"><a href="https://www.peterhedenskog.com/"><img src="https://avatars.githubusercontent.com/u/540757?v=4?s=100" width="100px;" alt="Peter Hedenskog"/><br /><sub><b>Peter Hedenskog</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=soulgalore" title="Code">💻</a></td>
137
+ <td align="center" valign="top" width="14.28%"><a href="https://www.drydenwilliams.co.uk/"><img src="https://avatars.githubusercontent.com/u/4403089?v=4?s=100" width="100px;" alt="Dryden"/><br /><sub><b>Dryden</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=drydenwilliams" title="Code">💻</a></td>
138
+ <td align="center" valign="top" width="14.28%"><a href="https://evanhahn.com/"><img src="https://avatars.githubusercontent.com/u/777712?v=4?s=100" width="100px;" alt="Evan Hahn"/><br /><sub><b>Evan Hahn</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=EvanHahn" title="Code">💻</a> <a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=EvanHahn" title="Tests">⚠️</a></td>
139
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/PrathumP"><img src="https://avatars.githubusercontent.com/u/115390367?v=4?s=100" width="100px;" alt="Prathum Pandey"/><br /><sub><b>Prathum Pandey</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/issues?q=author%3APrathumP" title="Bug reports">🐛</a> <a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=PrathumP" title="Code">💻</a></td>
140
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/Fdawgs"><img src="https://avatars.githubusercontent.com/u/43814140?v=4?s=100" width="100px;" alt="Frazer Smith"/><br /><sub><b>Frazer Smith</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=Fdawgs" title="Code">💻</a> <a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=Fdawgs" title="Tests">⚠️</a></td>
141
+ </tr>
142
+ <tr>
143
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/hamishfagg"><img src="https://avatars.githubusercontent.com/u/895845?v=4?s=100" width="100px;" alt="Hamish Fagg"/><br /><sub><b>Hamish Fagg</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=hamishfagg" title="Code">💻</a></td>
144
+ <td align="center" valign="top" width="14.28%"><a href="http://portfolio.toolness.org/"><img src="https://avatars.githubusercontent.com/u/124687?v=4?s=100" width="100px;" alt="Atul Varma"/><br /><sub><b>Atul Varma</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=toolness" title="Code">💻</a></td>
145
+ <td align="center" valign="top" width="14.28%"><a href="https://www.intersectionalenvironmentalist.com/"><img src="https://avatars.githubusercontent.com/u/1530684?v=4?s=100" width="100px;" alt="Piper"/><br /><sub><b>Piper</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=piperchester" title="Code">💻</a></td>
146
+ <td align="center" valign="top" width="14.28%"><a href="https://vasquezruiz.com/"><img src="https://avatars.githubusercontent.com/u/108420?v=4?s=100" width="100px;" alt="Raymundo Vásquez Ruiz"/><br /><sub><b>Raymundo Vásquez Ruiz</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=raymundovr" title="Code">💻</a></td>
147
+ <td align="center" valign="top" width="14.28%"><a href="https://greengumption.co.uk/"><img src="https://avatars.githubusercontent.com/u/26165947?v=4?s=100" width="100px;" alt="JamieB"/><br /><sub><b>JamieB</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=JamieBeevor" title="Code">💻</a></td>
148
+ </tr>
149
+ </tbody>
150
+ </table>
151
+
152
+ <!-- markdownlint-restore -->
153
+ <!-- prettier-ignore-end -->
154
+
155
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
156
+ <!-- prettier-ignore-start -->
157
+ <!-- markdownlint-disable -->
158
+
159
+ <!-- markdownlint-restore -->
160
+ <!-- prettier-ignore-end -->
161
+
162
+ <!-- ALL-CONTRIBUTORS-LIST:END -->