Skip to content

Commit 6935df9

Browse files
chore(deps-dev): bump node-fetch from 2.6.1 to 3.1.1 (#877)
* chore(deps-dev): bump node-fetch from 2.6.1 to 3.1.1 Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.6.1 to 3.1.1. - [Release notes](https://github.com/node-fetch/node-fetch/releases) - [Changelog](https://github.com/node-fetch/node-fetch/blob/main/docs/CHANGELOG.md) - [Commits](node-fetch/node-fetch@v2.6.1...v3.1.1) --- updated-dependencies: - dependency-name: node-fetch dependency-type: direct:development ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Moshe Feuchtwanger <moshfeu@gmail.com>
1 parent af785f2 commit 6935df9

3 files changed

Lines changed: 66 additions & 17 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
},
3737
"scripts": {
3838
"start": "react-scripts start",
39-
"build": "node scripts/pre-build.js && react-scripts build",
39+
"build": "node scripts/pre-build.mjs && react-scripts build",
4040
"test": "yarn test:unit && yarn test:e2e:run",
4141
"test:unit": "react-scripts test",
4242
"test:unit:update-snapshot": "react-scripts test -u",
@@ -97,7 +97,7 @@
9797
"is-ci-cli": "^1.1.1",
9898
"jest-styled-components": "^7.0.2",
9999
"nock": "^13.1.3",
100-
"node-fetch": "^2.6.1",
100+
"node-fetch": "^3.1.1",
101101
"nodemon": "^1.19.1",
102102
"npm-run-all": "^4.1.5",
103103
"object-path": "^0.11.8",
Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,54 @@
1-
const fs = require('fs');
2-
const fetch = require('node-fetch');
1+
import fs from 'fs';
2+
import fetch from 'node-fetch';
33

44
(async () => {
5-
const mentors = await fetch(`https://api.codingcoach.io/mentors`)
6-
.then(data => data.json())
7-
.then(res => res.data);
5+
const mentors = await fetch(`https://api.codingcoach.io/mentors?limit=1400`)
6+
.then((data) => data.json())
7+
.then((res) => res.data);
88

99
const json = {
1010
technology: [],
1111
country: [],
12-
name: [],
12+
id: [],
1313
language: [],
1414
};
1515

1616
for (let i = 0; i < mentors.length; i++) {
1717
json.technology.push(...(mentors[i].tags || []));
1818
json.country.push(mentors[i].country);
19-
json.name.push(mentors[i].name);
19+
json.id.push(mentors[i]._id);
2020
json.language.push(...(mentors[i].spokenLanguages || []));
2121
}
2222

2323
json.technology = [...new Set(json.technology)];
2424
json.country = [...new Set(json.country)];
2525
json.language = [...new Set(json.language)];
2626

27-
const breaklink = '\n\t';
28-
const createUrl = (key, value) =>
29-
`<url><loc>https://mentors.codingcoach.io/${
30-
key ? `?${key}=${encodeURIComponent(value)}` : ''
31-
}</loc></url>`;
27+
const lineBreak = '\n\t';
3228
const xml = `<?xml version="1.0" encoding="UTF-8"?>
3329
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3430
${createUrl()}
3531
${Object.keys(json)
36-
.map(key =>
37-
[...json[key]].map(value => createUrl(key, value)).join(breaklink)
32+
.map((key) =>
33+
[...json[key]].map((value) => createUrl(key, value)).join(lineBreak)
3834
)
39-
.join(breaklink)}
35+
.join(lineBreak)}
4036
</urlset>
4137
`;
4238

4339
fs.writeFileSync('public/sitemap.xml', xml);
4440
})();
41+
42+
const getPath = (key, value) => {
43+
if (!key) {
44+
return '';
45+
}
46+
if (key === 'id') {
47+
return `u/${value}`;
48+
}
49+
return `?${key}=${encodeURIComponent(value)}`;
50+
}
51+
52+
const createUrl = (key, value) => {
53+
return `<url><loc>https://mentors.codingcoach.io/${getPath(key, value)}</loc></url>`;
54+
}

yarn.lock

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6832,6 +6832,11 @@ dashdash@^1.12.0:
68326832
dependencies:
68336833
assert-plus "^1.0.0"
68346834

6835+
data-uri-to-buffer@^4.0.0:
6836+
version "4.0.0"
6837+
resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz#b5db46aea50f6176428ac05b73be39a57701a64b"
6838+
integrity sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==
6839+
68356840
data-urls@^2.0.0:
68366841
version "2.0.0"
68376842
resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-2.0.0.tgz#156485a72963a970f5d5821aaf642bef2bf2db9b"
@@ -8229,6 +8234,14 @@ fd-slicer@~1.1.0:
82298234
dependencies:
82308235
pend "~1.2.0"
82318236

8237+
fetch-blob@^3.1.2, fetch-blob@^3.1.3:
8238+
version "3.1.4"
8239+
resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.1.4.tgz#e8c6567f80ad7fc22fd302e7dcb72bafde9c1717"
8240+
integrity sha512-Eq5Xv5+VlSrYWEqKrusxY1C3Hm/hjeAsCGVG3ft7pZahlUAChpGZT/Ms1WmSLnEAisEXszjzu/s+ce6HZB2VHA==
8241+
dependencies:
8242+
node-domexception "^1.0.0"
8243+
web-streams-polyfill "^3.0.3"
8244+
82328245
figgy-pudding@^3.5.1:
82338246
version "3.5.2"
82348247
resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.2.tgz#b4eee8148abb01dcf1d1ac34367d59e12fa61d6e"
@@ -8508,6 +8521,13 @@ format@^0.2.0:
85088521
resolved "https://registry.yarnpkg.com/format/-/format-0.2.2.tgz#d6170107e9efdc4ed30c9dc39016df942b5cb58b"
85098522
integrity sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs=
85108523

8524+
formdata-polyfill@^4.0.10:
8525+
version "4.0.10"
8526+
resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423"
8527+
integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==
8528+
dependencies:
8529+
fetch-blob "^3.1.2"
8530+
85118531
formidable@^1.2.2:
85128532
version "1.2.2"
85138533
resolved "https://registry.yarnpkg.com/formidable/-/formidable-1.2.2.tgz#bf69aea2972982675f00865342b982986f6b8dd9"
@@ -11831,11 +11851,25 @@ node-dir@^0.1.10:
1183111851
dependencies:
1183211852
minimatch "^3.0.2"
1183311853

11854+
node-domexception@^1.0.0:
11855+
version "1.0.0"
11856+
resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5"
11857+
integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==
11858+
1183411859
node-fetch@^2.6.1:
1183511860
version "2.6.1"
1183611861
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
1183711862
integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==
1183811863

11864+
node-fetch@^3.1.1:
11865+
version "3.1.1"
11866+
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.1.1.tgz#d0d9607e455b3087e3092b821b5b1f1ebf4c2147"
11867+
integrity sha512-SMk+vKgU77PYotRdWzqZGTZeuFKlsJ0hu4KPviQKkfY+N3vn2MIzr0rvpnYpR8MtB3IEuhlEcuOLbGvLRlA+yg==
11868+
dependencies:
11869+
data-uri-to-buffer "^4.0.0"
11870+
fetch-blob "^3.1.3"
11871+
formdata-polyfill "^4.0.10"
11872+
1183911873
node-forge@^0.10.0:
1184011874
version "0.10.0"
1184111875
resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.10.0.tgz#32dea2afb3e9926f02ee5ce8794902691a676bf3"
@@ -16910,6 +16944,11 @@ web-namespaces@^1.0.0:
1691016944
resolved "https://registry.yarnpkg.com/web-namespaces/-/web-namespaces-1.1.4.tgz#bc98a3de60dadd7faefc403d1076d529f5e030ec"
1691116945
integrity sha512-wYxSGajtmoP4WxfejAPIr4l0fVh+jeMXZb08wNc0tMg6xsfZXj3cECqIK0G7ZAqUq0PP8WlMDtaOGVBTAWztNw==
1691216946

16947+
web-streams-polyfill@^3.0.3:
16948+
version "3.2.0"
16949+
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.0.tgz#a6b74026b38e4885869fb5c589e90b95ccfc7965"
16950+
integrity sha512-EqPmREeOzttaLRm5HS7io98goBgZ7IVz79aDvqjD0kYXLtFZTc0T/U6wHTPKyIjb+MdN7DFIIX6hgdBEpWmfPA==
16951+
1691316952
webidl-conversions@^5.0.0:
1691416953
version "5.0.0"
1691516954
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-5.0.0.tgz#ae59c8a00b121543a2acc65c0434f57b0fc11aff"

0 commit comments

Comments
 (0)