sitespeed.io 23.5.0 → 23.6.0

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.
package/.dockerignore CHANGED
@@ -2,4 +2,6 @@
2
2
  !bin
3
3
  !lib
4
4
  !package.json
5
+ !LICENSE
6
+ !npm-shrinkwrap.json
5
7
  !docker
@@ -7,6 +7,9 @@ jobs:
7
7
  docker:
8
8
  runs-on: ubuntu-latest
9
9
  steps:
10
+ -
11
+ name: Checkout
12
+ uses: actions/checkout@v2
10
13
  -
11
14
  name: Set up QEMU
12
15
  uses: docker/setup-qemu-action@v1
@@ -29,6 +32,7 @@ jobs:
29
32
  name: Build and push sitespeed.io
30
33
  uses: docker/build-push-action@v2
31
34
  with:
35
+ context: .
32
36
  platforms: linux/amd64,linux/arm64
33
37
  push: true
34
38
  tags: sitespeedio/sitespeed.io:${{steps.tag.outputs.tag}},sitespeedio/sitespeed.io:latest
@@ -36,6 +40,7 @@ jobs:
36
40
  name: Build and push sitespeed.io+1
37
41
  uses: docker/build-push-action@v2
38
42
  with:
43
+ context: .
39
44
  platforms: linux/amd64,linux/arm64
40
45
  file: ./docker/Dockerfile-plus1
41
46
  build-args: version=${{steps.tag.outputs.tag}}
@@ -45,6 +50,7 @@ jobs:
45
50
  name: Build and push sitespeed.io+wpt
46
51
  uses: docker/build-push-action@v2
47
52
  with:
53
+ context: .
48
54
  platforms: linux/amd64,linux/arm64
49
55
  file: ./docker/Dockerfile-webpagetest
50
56
  build-args: version=${{steps.tag.outputs.tag}}
@@ -54,6 +60,7 @@ jobs:
54
60
  name: Build and push sitespeed.io-slim
55
61
  uses: docker/build-push-action@v2
56
62
  with:
63
+ context: .
57
64
  platforms: linux/amd64,linux/arm64
58
65
  file: ./Dockerfile-slim
59
66
  build-args: version=${{steps.tag.outputs.tag}}
package/CHANGELOG.md CHANGED
@@ -1,8 +1,18 @@
1
1
  # CHANGELOG - sitespeed.io (we use [semantic versioning](https://semver.org))
2
2
 
3
- ## 23.4.0 - 2022-03-11
3
+
4
+ ## 23.6.0 - 2022-03-25
5
+ ### Added
6
+ * Various fixes to add more content to the JSON stored from the latest run, making it easier to show more meta data for a run in Grafana [#3607](https://github.com/sitespeedio/sitespeed.io/pull/3607), [#3609](https://github.com/sitespeedio/sitespeed.io/pull/3609) and [#3610](https://github.com/sitespeedio/sitespeed.io/pull/3610).
7
+ ## 23.5.2 - 2022-03-22
8
+ ### Fixed
9
+ * Updated to latest NodeJS and Ubuntu updates in the Docker container with some security updates[#3306](https://github.com/sitespeedio/sitespeed.io/pull/3606). Also updated the slim container with latest NodeJS.
10
+ * Make sure the shrinkwrap file is used when building the container [#3604](https://github.com/sitespeedio/sitespeed.io/pull/3604) and (hopefully) fix so that .dockerignore is not ignored when Github Actions build the containers.
11
+
12
+ ## 23.5.0 - 2022-03-11
13
+
4
14
  ### Added
5
- * The -slim DOcker container now uses Firefox 98.
15
+ * The -slim Docker container now uses Firefox 98.
6
16
  * Updated Grafana to latest 8.4.3 in the Docker compose file.
7
17
  * Updated [Graphite dashboards](https://github.com/sitespeedio/grafana-bootstrap-docker/tree/main/dashboards/graphite) to use Timeseries graphs instead of old "Graph".
8
18
  * You can use `-o` or `--open` or `--view` to open the result page after you run sitespeed.io on Mac and Linux [#3569](https://github.com/sitespeedio/sitespeed.io/pull/3596).
package/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM sitespeedio/webbrowsers:chrome-99.0-firefox-98.0-edge-99.0
1
+ FROM sitespeedio/webbrowsers:chrome-99.0-firefox-98.0-edge-99.0-b
2
2
 
3
3
  ARG TARGETPLATFORM=linux/amd64
4
4
 
@@ -26,7 +26,8 @@ RUN wpr installroot --https_cert_file /webpagereplay/certs/wpr_cert.pem --https_
26
26
  RUN mkdir -p /usr/src/app
27
27
  WORKDIR /usr/src/app
28
28
 
29
- COPY package.* /usr/src/app/
29
+ COPY package.json /usr/src/app/
30
+ COPY npm-shrinkwrap.json /usr/src/app/
30
31
  RUN npm install --production && npm cache clean --force
31
32
  COPY . /usr/src/app
32
33
 
@@ -37,7 +38,6 @@ RUN mkdir -m 0750 /root/.android
37
38
  ADD docker/adb/insecure_shared_adbkey /root/.android/adbkey
38
39
  ADD docker/adb/insecure_shared_adbkey.pub /root/.android/adbkey.pub
39
40
 
40
-
41
41
  # Allow all users to run commands needed by sitespeedio/throttle via sudo
42
42
  # See https://github.com/sitespeedio/throttle/blob/main/lib/tc.js
43
43
  RUN echo 'ALL ALL=NOPASSWD: /usr/sbin/tc, /usr/sbin/route, /usr/sbin/ip' > /etc/sudoers.d/tc
package/Dockerfile-slim CHANGED
@@ -1,4 +1,4 @@
1
- FROM node:16.14.0-bullseye-slim
1
+ FROM node:16.14.2-bullseye-slim
2
2
 
3
3
  ARG TARGETPLATFORM=linux/amd64
4
4
 
@@ -1,13 +1,21 @@
1
1
  'use strict';
2
2
 
3
3
  const path = require('path');
4
+ const osName = require('os-name');
5
+ const getos = require('getos');
6
+ const { promisify } = require('util');
7
+ const getOS = promisify(getos);
8
+ const os = require('os');
9
+ const get = require('lodash.get');
4
10
  const graphiteUtil = require('../../support/tsdbUtil');
11
+ const helpers = require('../../support/helpers');
5
12
 
6
13
  module.exports = {
7
14
  open(context, options) {
8
15
  this.storageManager = context.storageManager;
9
16
  this.alias = {};
10
17
  this.options = options;
18
+ this.context = context;
11
19
  },
12
20
  async processMessage(message) {
13
21
  switch (message.type) {
@@ -17,6 +25,11 @@ module.exports = {
17
25
  break;
18
26
  }
19
27
 
28
+ case 'browsertime.browser': {
29
+ this.browserData = message.data;
30
+ break;
31
+ }
32
+
20
33
  case 'browsertime.config': {
21
34
  if (message.data.screenshot) {
22
35
  this.useScreenshots = message.data.screenshot;
@@ -29,6 +42,7 @@ module.exports = {
29
42
  // Only use the first one for now
30
43
  if (message.iteration === 1 && this.options.copyLatestFilesToBase) {
31
44
  const options = this.options;
45
+ const browserData = this.browserData;
32
46
  const baseDir = this.storageManager.getBaseDir();
33
47
  // Hack to get out of the date dir
34
48
  const newPath = path.resolve(baseDir, '..');
@@ -122,6 +136,63 @@ module.exports = {
122
136
  json.android.androidVersion = message.data.android.androidVersion;
123
137
  }
124
138
 
139
+ json.browser = {};
140
+ json.browser.name = helpers.cap(get(browserData, 'browser.name'));
141
+ json.browser.version = get(browserData, 'browser.version', 'unknown');
142
+
143
+ json.friendlyHTML = `Tested <a href="${message.url}">${
144
+ json.alias ? json.alias : message.url
145
+ }</a> ${helpers.plural(
146
+ options.browsertime.iterations,
147
+ 'iteration'
148
+ )} at ${json.timestamp} using ${json.browser.name} ${
149
+ json.browser.version
150
+ }`;
151
+
152
+ if (options.mobile) {
153
+ json.friendlyHTML += ` (emulating mobile)`;
154
+ }
155
+
156
+ if (options.multi) {
157
+ json.friendlyHTML += ` as a multi page test`;
158
+ }
159
+
160
+ if (options.replay) {
161
+ json.friendlyHTML += ' using a replay proxy';
162
+ }
163
+
164
+ if (!options.mobile && !options.ios && !browserData.android) {
165
+ json.friendlyHTML += ' with viewport ' + options.viewPort;
166
+ }
167
+
168
+ if (browserData.android) {
169
+ json.friendlyHTML += ` on ${browserData.android.model} Android version ${browserData.android.androidVersion} [${browserData.android.id}].`;
170
+ } else if (message.data.ios) {
171
+ json.friendlyHTML += ` ${message.data.ios.deviceName} [${message.data.ios.deviceUDID}].`;
172
+ } else {
173
+ // We are testing on desktop
174
+ let osInfo = osName();
175
+ if (os.platform() === 'linux') {
176
+ const linux = await getOS();
177
+ osInfo = `${linux.dist} ${linux.release}`;
178
+ }
179
+ json.friendlyHTML += options.browsertime.docker
180
+ ? ' using Docker ' + osInfo + '.'
181
+ : ' on ' + osInfo + '.';
182
+ }
183
+
184
+ // Hack to add a result URL
185
+ if (this.context.resultUrls.hasBaseUrl()) {
186
+ let resultURL =
187
+ this.context.resultUrls.absoluteSummaryPageUrl(
188
+ message.url,
189
+ this.alias[message.url]
190
+ ) + 'index.html';
191
+
192
+ json.friendlyHTML += ' [<a href="' + resultURL + '">result</a>].';
193
+ json.result = resultURL;
194
+ }
195
+
125
196
  const data = JSON.stringify(json, null, 0);
126
197
  return this.storageManager.writeDataToDir(
127
198
  data,
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "sitespeed.io",
3
- "version": "23.5.0",
3
+ "version": "23.6.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "sitespeed.io",
9
- "version": "23.5.0",
9
+ "version": "23.6.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@google-cloud/storage": "5.8.3",
@@ -59,7 +59,7 @@
59
59
  "bluebird": "3.5.5",
60
60
  "chai": "4.2.0",
61
61
  "chai-as-promised": "7.1.1",
62
- "changelog-parser": "2.8.0",
62
+ "changelog-parser": "2.8.1",
63
63
  "clean-css-cli": "4.3.0",
64
64
  "eslint": "8.0.0",
65
65
  "eslint-config-prettier": "8.3.0",
@@ -67,6 +67,7 @@
67
67
  "feed": "4.2.2",
68
68
  "jsdoc": "^3.6.7",
69
69
  "license-checker": "^16.0.0",
70
+ "marked": "4.0.12",
70
71
  "mocha": "^5.0.4",
71
72
  "prettier": "2.4.1",
72
73
  "pug-lint": "^2.6.0",
@@ -1628,9 +1629,9 @@
1628
1629
  }
1629
1630
  },
1630
1631
  "node_modules/changelog-parser": {
1631
- "version": "2.8.0",
1632
- "resolved": "https://registry.npmjs.org/changelog-parser/-/changelog-parser-2.8.0.tgz",
1633
- "integrity": "sha512-ZtSwN0hY7t+WpvaXqqXz98RHCNhWX9HsvCRAv1aBLlqJ7BpKtqdM6Nu6JOiUhRAWR7Gov0aN0fUnmflTz0WgZg==",
1632
+ "version": "2.8.1",
1633
+ "resolved": "https://registry.npmjs.org/changelog-parser/-/changelog-parser-2.8.1.tgz",
1634
+ "integrity": "sha512-tNUYFRCEeWTXmwLqoNtOEzx9wcytg72MmGQqsEs14ClYwIDln7sbQw7FJj/dulXgSlsxkemc9gpPQhZYZx1TPw==",
1634
1635
  "dev": true,
1635
1636
  "dependencies": {
1636
1637
  "line-reader": "^0.2.4",
@@ -4164,6 +4165,18 @@
4164
4165
  "markdown-it": "bin/markdown-it.js"
4165
4166
  }
4166
4167
  },
4168
+ "node_modules/jsdoc/node_modules/marked": {
4169
+ "version": "2.1.3",
4170
+ "resolved": "https://registry.npmjs.org/marked/-/marked-2.1.3.tgz",
4171
+ "integrity": "sha512-/Q+7MGzaETqifOMWYEA7HVMaZb4XbcRfaOzcSsHZEith83KGlvaSG33u0SKu89Mj5h+T8V2hM+8O45Qc5XTgwA==",
4172
+ "dev": true,
4173
+ "bin": {
4174
+ "marked": "bin/marked"
4175
+ },
4176
+ "engines": {
4177
+ "node": ">= 10"
4178
+ }
4179
+ },
4167
4180
  "node_modules/jsdoc/node_modules/mkdirp": {
4168
4181
  "version": "1.0.4",
4169
4182
  "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
@@ -4726,15 +4739,15 @@
4726
4739
  }
4727
4740
  },
4728
4741
  "node_modules/marked": {
4729
- "version": "2.0.4",
4730
- "resolved": "https://registry.npmjs.org/marked/-/marked-2.0.4.tgz",
4731
- "integrity": "sha512-MIL0xKRDQM3DE7dJr/wa6JV0EmK9yZ3cwuTc2bu66FNm/tmEMm9cJCgJZpt9R+K1T+pB2iBNV55wvnwSd345zg==",
4742
+ "version": "4.0.12",
4743
+ "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.12.tgz",
4744
+ "integrity": "sha512-hgibXWrEDNBWgGiK18j/4lkS6ihTe9sxtV4Q1OQppb/0zzyPSzoFANBa5MfsG/zgsWklmNnhm0XACZOH/0HBiQ==",
4732
4745
  "dev": true,
4733
4746
  "bin": {
4734
- "marked": "bin/marked"
4747
+ "marked": "bin/marked.js"
4735
4748
  },
4736
4749
  "engines": {
4737
- "node": ">= 8.16.2"
4750
+ "node": ">= 12"
4738
4751
  }
4739
4752
  },
4740
4753
  "node_modules/mdurl": {
@@ -8735,9 +8748,9 @@
8735
8748
  }
8736
8749
  },
8737
8750
  "changelog-parser": {
8738
- "version": "2.8.0",
8739
- "resolved": "https://registry.npmjs.org/changelog-parser/-/changelog-parser-2.8.0.tgz",
8740
- "integrity": "sha512-ZtSwN0hY7t+WpvaXqqXz98RHCNhWX9HsvCRAv1aBLlqJ7BpKtqdM6Nu6JOiUhRAWR7Gov0aN0fUnmflTz0WgZg==",
8751
+ "version": "2.8.1",
8752
+ "resolved": "https://registry.npmjs.org/changelog-parser/-/changelog-parser-2.8.1.tgz",
8753
+ "integrity": "sha512-tNUYFRCEeWTXmwLqoNtOEzx9wcytg72MmGQqsEs14ClYwIDln7sbQw7FJj/dulXgSlsxkemc9gpPQhZYZx1TPw==",
8741
8754
  "dev": true,
8742
8755
  "requires": {
8743
8756
  "line-reader": "^0.2.4",
@@ -10755,6 +10768,12 @@
10755
10768
  "uc.micro": "^1.0.5"
10756
10769
  }
10757
10770
  },
10771
+ "marked": {
10772
+ "version": "2.1.3",
10773
+ "resolved": "https://registry.npmjs.org/marked/-/marked-2.1.3.tgz",
10774
+ "integrity": "sha512-/Q+7MGzaETqifOMWYEA7HVMaZb4XbcRfaOzcSsHZEith83KGlvaSG33u0SKu89Mj5h+T8V2hM+8O45Qc5XTgwA==",
10775
+ "dev": true
10776
+ },
10758
10777
  "mkdirp": {
10759
10778
  "version": "1.0.4",
10760
10779
  "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
@@ -11230,9 +11249,9 @@
11230
11249
  "requires": {}
11231
11250
  },
11232
11251
  "marked": {
11233
- "version": "2.0.4",
11234
- "resolved": "https://registry.npmjs.org/marked/-/marked-2.0.4.tgz",
11235
- "integrity": "sha512-MIL0xKRDQM3DE7dJr/wa6JV0EmK9yZ3cwuTc2bu66FNm/tmEMm9cJCgJZpt9R+K1T+pB2iBNV55wvnwSd345zg==",
11252
+ "version": "4.0.12",
11253
+ "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.12.tgz",
11254
+ "integrity": "sha512-hgibXWrEDNBWgGiK18j/4lkS6ihTe9sxtV4Q1OQppb/0zzyPSzoFANBa5MfsG/zgsWklmNnhm0XACZOH/0HBiQ==",
11236
11255
  "dev": true
11237
11256
  },
11238
11257
  "mdurl": {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "sitespeed.io": "./bin/sitespeed.js",
5
5
  "sitespeed.io-wpr": "./bin/browsertimeWebPageReplay.js"
6
6
  },
7
- "version": "23.5.0",
7
+ "version": "23.6.0",
8
8
  "description": "Analyze the web performance of your site",
9
9
  "keywords": [
10
10
  "performance",
@@ -54,7 +54,7 @@
54
54
  "bluebird": "3.5.5",
55
55
  "chai": "4.2.0",
56
56
  "chai-as-promised": "7.1.1",
57
- "changelog-parser": "2.8.0",
57
+ "changelog-parser": "2.8.1",
58
58
  "clean-css-cli": "4.3.0",
59
59
  "eslint": "8.0.0",
60
60
  "eslint-config-prettier": "8.3.0",
@@ -62,6 +62,7 @@
62
62
  "feed": "4.2.2",
63
63
  "jsdoc": "^3.6.7",
64
64
  "license-checker": "^16.0.0",
65
+ "marked": "4.0.12",
65
66
  "mocha": "^5.0.4",
66
67
  "sass": "1.34.0",
67
68
  "prettier": "2.4.1",
package/release/feed.js CHANGED
@@ -2,6 +2,22 @@ const Feed = require('feed').Feed;
2
2
  const fs = require('fs');
3
3
  const path = require('path');
4
4
  const parseChangelog = require('changelog-parser');
5
+ const { marked } = require('marked');
6
+
7
+ const allFeeds = [];
8
+
9
+ const images = {
10
+ 'sitespeed.io': 'https://www.sitespeed.io/img/logos/sitespeed.io.png',
11
+ browsertime: 'https://www.sitespeed.io/img/logos/browsertime.png',
12
+ 'coach-core': 'https://www.sitespeed.io/img/logos/coach.png',
13
+ pagexray: 'https://www.sitespeed.io/img/logos/pagexray.png',
14
+ throttle: '',
15
+ coach: 'https://www.sitespeed.io/img/logos/coach.png',
16
+ 'chrome-har': '',
17
+ 'chrome-trace': '',
18
+ compare: 'https://www.sitespeed.io/img/logos/compare.png',
19
+ humble: ''
20
+ };
5
21
 
6
22
  const getSortedFiles = dir => {
7
23
  const files = fs.readdirSync(dir);
@@ -16,118 +32,162 @@ const getSortedFiles = dir => {
16
32
  .sort((a, b) => b.time - a.time);
17
33
  };
18
34
 
19
- function getResult(result) {
35
+ function getFeed(tool, time) {
36
+ return new Feed({
37
+ title: `${tool} release feed`,
38
+ description: `New releases and changelog feed of ${tool}`,
39
+ id: `${tool}-release-feed`,
40
+ link: 'https://www.sitespeed.io',
41
+ language: 'en', // optional, used only in RSS 2.0, possible values: http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
42
+ image: images[tool],
43
+ favicon: 'http://www.sitespeed.io/favicon.ico',
44
+ copyright: 'All rights reserved 2022, Peter Hedenskog and team',
45
+ updated: new Date(time),
46
+ feedLinks: {
47
+ atom:
48
+ tool === 'sitespeed.io'
49
+ ? `https://www.sitespeed.io/feed/atom.xml`
50
+ : `https://www.sitespeed.io/feed/${tool}.atom`,
51
+ rss:
52
+ tool === 'sitespeed.io'
53
+ ? `https://www.sitespeed.io/feed/rss.xml`
54
+ : `https://www.sitespeed.io/feed/${tool}.rss`
55
+ },
56
+ author: {
57
+ name: 'Peter Hedenskog',
58
+ email: 'peter@soulgalore.com',
59
+ link: 'https://www.peterhedenskog.com'
60
+ }
61
+ });
62
+ }
63
+
64
+ function addItemToFeed(feed, item, tool) {
65
+ feed.addItem({
66
+ title: `${tool} ${item.version}`,
67
+ id: `https://github.com/sitespeedio/${tool}/blob/main/CHANGELOG.md#${item.version}`,
68
+ link: `https://github.com/sitespeedio/${tool}/blob/main/CHANGELOG.md#${item.version}`,
69
+ description: getResultAsHTML(item),
70
+ author: [
71
+ {
72
+ name: 'Sitespeed.io',
73
+ link: 'https://www.sitespeed.io'
74
+ }
75
+ ],
76
+ date: new Date(item.date),
77
+ image: images[tool]
78
+ });
79
+ }
80
+
81
+ function getResultAsHTML(result) {
20
82
  let allData = '';
21
83
  if (result.parsed) {
22
84
  if (result.parsed.Added) {
85
+ allData += `<h3>Added</h3>\n`;
23
86
  for (let added of result.parsed.Added) {
24
- allData += ' ' + added;
87
+ allData += ' ' + marked.parse(added);
25
88
  }
26
89
  }
27
90
  if (result.parsed.Fixed) {
91
+ allData += `<h3>Fixed</h3>\n`;
28
92
  for (let fixed of result.parsed.Fixed) {
29
- allData += ' ' + fixed;
93
+ allData += ' ' + marked.parse(fixed);
30
94
  }
31
95
  }
32
96
 
33
97
  if (result.parsed.Changed) {
98
+ allData += `<h3>Changed</h3>\n`;
34
99
  for (let changed of result.parsed.Changed) {
35
- allData += ' ' + changed;
100
+ allData += ' ' + marked.parse(changed);
36
101
  }
37
102
  }
38
103
 
39
104
  if (result.parsed['Breaking changes']) {
105
+ allData += `<h3>Breaking changes</h3>\n`;
40
106
  for (let breaking of result.parsed['Breaking changes']) {
41
- allData += ' ' + breaking;
107
+ allData += ' ' + marked.parse(breaking);
108
+ }
109
+ }
110
+
111
+ if (result.parsed['Deprecated']) {
112
+ allData += `<h3>Deprecated</h3>\n`;
113
+ for (let deprecated of result.parsed['Deprecated']) {
114
+ allData += ' ' + marked.parse(deprecated);
115
+ }
116
+ }
117
+
118
+ if (result.parsed['Removed']) {
119
+ allData += `<h3>Removed</h3>\n`;
120
+ for (let removed of result.parsed['Removed']) {
121
+ allData += ' ' + marked.parse(removed);
42
122
  }
43
123
  }
124
+
125
+ if (result.parsed['Security']) {
126
+ allData += `<h3>Security</h3>\n`;
127
+ for (let security of result.parsed['Security']) {
128
+ allData += ' ' + marked.parse(security);
129
+ }
130
+ }
131
+
44
132
  return allData;
45
133
  }
46
134
  }
47
135
 
136
+ const getContent = async tool => {
137
+ const content = [];
138
+ const changelog =
139
+ tool === 'sitespeed.io' ? './CHANGELOG.md' : '../' + tool + '/CHANGELOG.md';
140
+ const result = await parseChangelog({
141
+ filePath: changelog,
142
+ removeMarkdown: false
143
+ });
144
+
145
+ for (let i = 0; i < 10; i++) {
146
+ // It's not unreleased
147
+ if (result.versions[i] && result.versions[i].date !== null) {
148
+ content.push(result.versions[i]);
149
+ allFeeds.push({ tool, item: result.versions[i] });
150
+ }
151
+ }
152
+ return content;
153
+ };
48
154
  async function generateFeed() {
49
155
  const versionDir = './docs/_includes/version/';
50
156
  const sortedVersionFiles = getSortedFiles(versionDir);
51
157
 
52
- const feed = new Feed({
53
- title: 'sitespeed.io release feed',
54
- description: 'Follow new releases of sitespeed.io tools',
55
- id: 'https://www.sitespeed.io',
56
- link: 'https://www.sitespeed.io',
57
- language: 'en', // optional, used only in RSS 2.0, possible values: http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
58
- image: 'https://www.sitespeed.io/img/logos/sitespeed.io.png',
59
- favicon: 'http://www.sitespeed.io/favicon.ico',
60
- copyright: 'All rights reserved 2021, Peter Hedenskog and team',
61
- updated: new Date(sortedVersionFiles[0].time), // use the date from the latest updated version file
62
- feedLinks: {
63
- atom: 'https://www.sitespeed.io/feed/atom.xml',
64
- rss: 'https://www.sitespeed.io/feed/rss.xml'
65
- },
66
- author: {
67
- name: 'Peter Hedenskog',
68
- email: 'peter@soulgalore.com',
69
- link: 'https://www.peterhedenskog.com'
158
+ for (let tool of sortedVersionFiles) {
159
+ const feed = getFeed(tool.name, tool.time);
160
+ feed.addCategory('Web Performance');
161
+ const items = await getContent(tool.name);
162
+ for (let item of items) {
163
+ addItemToFeed(feed, item, tool.name);
70
164
  }
71
- });
72
165
 
73
- const getContent = async () => {
74
- const content = {};
75
- for (let tool of sortedVersionFiles) {
76
- const changelog =
77
- tool.name === 'sitespeed.io'
78
- ? './CHANGELOG.md'
79
- : '../' + tool.name + '/CHANGELOG.md';
80
- const result = await parseChangelog(changelog);
81
- if (result.versions[0].date !== null) {
82
- content[tool.name] = getResult(result.versions[0]);
83
- } else if (result.versions[1]) {
84
- content[tool.name] = getResult(result.versions[1]);
85
- } else {
86
- // skip missing data
87
- console.log(`Missing data for tool ${tool.name}`);
88
- }
89
- }
90
- return content;
91
- };
92
-
93
- const descriptions = await getContent();
94
- const images = {
95
- 'sitespeed.io': 'https://www.sitespeed.io/img/logos/sitespeed.io.png',
96
- browsertime: 'https://www.sitespeed.io/img/logos/browsertime.png',
97
- 'coach-core': 'https://www.sitespeed.io/img/logos/coach.png',
98
- pagexray: 'https://www.sitespeed.io/img/logos/pagexray.png',
99
- throttle: '',
100
- coach: 'https://www.sitespeed.io/img/logos/coach.png',
101
- 'chrome-har': '',
102
- 'chrome-trace': '',
103
- compare: 'https://www.sitespeed.io/img/logos/compare.png',
104
- humble: ''
105
- };
106
-
107
- sortedVersionFiles.forEach(file => {
108
- feed.addItem({
109
- title: `${file.name} ${file.version}`,
110
- id: `https://github.com/sitespeedio/${file.name}/blob/main/CHANGELOG.md#${file.version}`,
111
- link: `https://github.com/sitespeedio/${file.name}/blob/main/CHANGELOG.md#`,
112
- description: descriptions[file.name],
113
- // content: content[file.name],
114
- author: [
115
- {
116
- name: 'Sitespeed.io',
117
- link: 'https://www.sitespeed.io'
118
- }
119
- ],
120
- date: new Date(file.time),
121
- image: images[file.name]
122
- });
166
+ const docPath = './docs/';
167
+
168
+ fs.writeFileSync(
169
+ path.join(docPath, 'feed', `${tool.name}.rss`),
170
+ feed.rss2()
171
+ );
172
+ fs.writeFileSync(
173
+ path.join(docPath, 'feed', `${tool.name}.atom`),
174
+ feed.atom1()
175
+ );
176
+ }
177
+
178
+ allFeeds.sort(function (a, b) {
179
+ return new Date(b.item.date) - new Date(a.item.date);
123
180
  });
124
181
 
125
- feed.addCategory('Performance');
182
+ const allFeed = getFeed('sitespeed.io', allFeeds[0].item.date);
183
+ for (let item of allFeeds) {
184
+ addItemToFeed(allFeed, item.item, item.tool);
185
+ }
126
186
 
127
187
  const docPath = './docs/';
128
188
 
129
- fs.writeFileSync(path.join(docPath, 'feed', 'rss.xml'), feed.rss2());
130
- fs.writeFileSync(path.join(docPath, 'feed', 'atom.xml'), feed.atom1());
189
+ fs.writeFileSync(path.join(docPath, 'feed', `rss.xml`), allFeed.rss2());
190
+ fs.writeFileSync(path.join(docPath, 'feed', `atom.xml`), allFeed.atom1());
131
191
  }
132
192
 
133
193
  generateFeed();