Skip to content

Commit 9bffd0c

Browse files
author
Orta Therox
authored
Merge pull request #795 from microsoft/deps-faff
Remove troublesome deps and punt on the automatic meetup work
2 parents 3fdbe85 + 9df8134 commit 9bffd0c

File tree

7 files changed

+207
-669
lines changed

7 files changed

+207
-669
lines changed

packages/community-meta/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"license": "MIT",
55
"version": "1.0.0",
66
"dependencies": {
7-
"ical-utils": "^1.0.15",
87
"moment": "2.24.0",
98
"moment-timezone": "0.5.28"
109
},

packages/community-meta/scripts/generateRichMeetupData.js

Lines changed: 82 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,99 @@
11
// @ts-check
22

3-
const { join } = require('path')
4-
const { writeFileSync } = require('fs')
5-
const { meetups } = require('./meetups')
6-
const xml2js = require('xml2js')
7-
const nodeFetch = require('node-fetch').default
8-
const icalToolkit = require('ical-utils')
9-
const { format } = require('prettier')
10-
const moment = require('moment')
11-
require('moment-timezone')
3+
// Given that COVID dropped meetups, lets disable this
4+
// until things pick up again in 2021
125

13-
const chalk = require('chalk').default
6+
const { join } = require("path")
7+
const { writeFileSync } = require("fs")
8+
const { meetups } = require("./meetups")
9+
// const xml2js = require("xml2js")
10+
// const nodeFetch = require("node-fetch").default
11+
// const icalToolkit = require("ical-utils")
12+
const { format } = require("prettier")
13+
// const moment = require("moment")
14+
// require("moment-timezone")
1415

15-
const tick = chalk.bold.greenBright('✓')
16-
const cross = chalk.bold.redBright('⤫')
16+
const chalk = require("chalk").default
17+
18+
const tick = chalk.bold.greenBright("✓")
19+
const cross = chalk.bold.redBright("⤫")
1720

1821
const go = async () => {
1922
let meetupDeets = []
20-
console.log('Looking at meetups: ')
23+
console.log("Looking at meetups: ")
2124

2225
for (const meetup of meetups) {
23-
if (meetup !== meetups[0]) process.stdout.write(', ')
26+
if (meetup !== meetups[0]) process.stdout.write(", ")
2427

2528
const meetupURL = meetup.meetup || meetup.url
26-
if (meetupURL.includes('meetup.com')) {
27-
try {
28-
const meetupID = meetupURL.split('/').pop()
29-
process.stdout.write(meetupID)
30-
31-
const icalResponse = await nodeFetch(`https://www.meetup.com/${meetupID}/events/ical/`)
32-
const icalText = await icalResponse.text()
33-
const ical = await icalToolkit.parseToJSON(icalText)
34-
35-
const upcomingEvent = ical.events[0]
36-
if (!upcomingEvent) {
37-
process.stdout.write(' -')
38-
meetupDeets.push({ meetup })
39-
40-
continue
41-
}
42-
43-
const id = upcomingEvent.uid.split('_')[1].split('@')[0]
44-
const title = upcomingEvent.summary.replace(/\\,/g, ',')
45-
const location = upcomingEvent.location.replace(/\\,/g, ',')
46-
const textDescription = upcomingEvent.description.replace(/\\,/g, ',').replace(/\\n/g, '<br />')
47-
const date = moment(upcomingEvent.start.value).tz(upcomingEvent.start.tzid)
48-
const url = upcomingEvent.additionalTags.URL
49-
50-
let richDescription = '<p>' + upcomingEvent.description + '</p>'
51-
52-
// Best to not assume meetup.com's long term health, and it's rss
53-
const rssResponse = await nodeFetch(`https://www.meetup.com/${meetupID}/events/rss/`)
54-
const rssText = await rssResponse.text()
55-
const rss = await xml2js.parseStringPromise(rssText)
56-
57-
// const removeDoubleLinks =
58-
59-
const upcoming = rss.rss.channel[0].item[0]
60-
61-
if (upcoming.title[0] === title) {
62-
richDescription = upcoming.description[0]
63-
}
64-
65-
const linkifiedRegex = new RegExp(`<a href="[^>]+" class="linkified">`, "g")
66-
let filteredRichText = richDescription.replace(linkifiedRegex, "").replace(new RegExp("</a></a>"), "</a>")
67-
68-
const event = {
69-
id,
70-
url,
71-
date,
72-
location,
73-
textDescription,
74-
richDescription: filteredRichText,
75-
title,
76-
}
77-
78-
meetupDeets.push({ meetup, event })
79-
process.stdout.write(' ' + tick)
80-
} catch (error) {
81-
console.log(error)
82-
meetupDeets.push({ meetup })
83-
process.stdout.write(' ' + cross)
84-
}
85-
} else {
86-
process.stdout.write(meetup.title)
87-
meetupDeets.push({ meetup })
88-
}
29+
// if (meetupURL.includes('meetup.com')) {
30+
// try {
31+
// const meetupID = meetupURL.split('/').pop()
32+
// process.stdout.write(meetupID)
33+
34+
// const icalResponse = await nodeFetch(`https://www.meetup.com/${meetupID}/events/ical/`)
35+
// const icalText = await icalResponse.text()
36+
// const ical = await icalToolkit.parseToJSON(icalText)
37+
38+
// const upcomingEvent = ical.events[0]
39+
// if (!upcomingEvent) {
40+
// process.stdout.write(' -')
41+
// meetupDeets.push({ meetup })
42+
43+
// continue
44+
// }
45+
46+
// const id = upcomingEvent.uid.split('_')[1].split('@')[0]
47+
// const title = upcomingEvent.summary.replace(/\\,/g, ',')
48+
// const location = upcomingEvent.location.replace(/\\,/g, ',')
49+
// const textDescription = upcomingEvent.description.replace(/\\,/g, ',').replace(/\\n/g, '<br />')
50+
// const date = moment(upcomingEvent.start.value).tz(upcomingEvent.start.tzid)
51+
// const url = upcomingEvent.additionalTags.URL
52+
53+
// let richDescription = '<p>' + upcomingEvent.description + '</p>'
54+
55+
// // Best to not assume meetup.com's long term health, and it's rss
56+
// const rssResponse = await nodeFetch(`https://www.meetup.com/${meetupID}/events/rss/`)
57+
// const rssText = await rssResponse.text()
58+
// const rss = await xml2js.parseStringPromise(rssText)
59+
60+
// // const removeDoubleLinks =
61+
62+
// const upcoming = rss.rss.channel[0].item[0]
63+
64+
// if (upcoming.title[0] === title) {
65+
// richDescription = upcoming.description[0]
66+
// }
67+
68+
// const linkifiedRegex = new RegExp(`<a href="[^>]+" class="linkified">`, "g")
69+
// let filteredRichText = richDescription.replace(linkifiedRegex, "").replace(new RegExp("</a></a>"), "</a>")
70+
71+
// const event = {
72+
// id,
73+
// url,
74+
// date,
75+
// location,
76+
// textDescription,
77+
// richDescription: filteredRichText,
78+
// title,
79+
// }
80+
81+
// meetupDeets.push({ meetup, event })
82+
// process.stdout.write(' ' + tick)
83+
// } catch (error) {
84+
// console.log(error)
85+
// meetupDeets.push({ meetup })
86+
// process.stdout.write(' ' + cross)
87+
// }
88+
// } else {
89+
process.stdout.write(meetup.title)
90+
meetupDeets.push({ meetup })
91+
// }
8992
}
9093

91-
if (meetups.length !== meetupDeets.length) throw new Error('\n\nMeetup Deets was not the same length\n\n')
94+
if (meetups.length !== meetupDeets.length) throw new Error("\n\nMeetup Deets was not the same length\n\n")
9295

93-
const path = join(__dirname, '..', 'generated', 'meetups.json')
96+
const path = join(__dirname, "..", "generated", "meetups.json")
9497
writeFileSync(path, format(JSON.stringify(meetupDeets), { filepath: path }))
9598
}
9699

packages/typescriptlang-org/gatsby-config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ module.exports = {
1515

1616
plugins: [
1717
// SCSS provides inheritance for CSS and which pays the price for the dep
18-
"gatsby-plugin-sass",
18+
{
19+
resolve: `gatsby-plugin-sass`,
20+
options: {
21+
implementation: require("sass"),
22+
},
23+
},
1924
// PWA metadata
2025
{
2126
resolve: `gatsby-plugin-manifest`,

packages/typescriptlang-org/package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
"@types/node-fetch": "^2.5.3",
2727
"@types/react-helmet": "^5.0.15",
2828
"@typescript/twoslash": "0.6.2",
29-
"@uifabric/fluent-theme": "^7.1.22",
30-
"@uifabric/react-cards": "^0.109.23",
3129
"canvas": "^2.6.1",
3230
"gatsby": "^2.19.18",
3331
"gatsby-plugin-catch-links": "^2.1.25",
@@ -50,18 +48,18 @@
5048
"gatsby-source-filesystem": "^2.1.48",
5149
"gatsby-transformer-remark": "^2.6.52",
5250
"jsdom": "^16.2.0",
53-
"node-sass": "^4.13.1",
5451
"react": "^16.12.0",
5552
"react-dom": "^16.12.0",
5653
"react-helmet": "^5.2.1",
5754
"react-intl": "^3.12.0",
5855
"rehype-shiki": "^0.0.7",
56+
"sass": "^1.26.10",
5957
"ts-debounce": "^2.0.1",
6058
"ts-node": "^8.6.2",
6159
"typescript": "*",
6260
"typescript-playground": "0.1.0",
6361
"typescript-sandbox": "0.1.0",
64-
"xml2json": "^0.12.0"
62+
"xml-js": "^1.6.11"
6563
},
6664
"devDependencies": {
6765
"@babel/plugin-syntax-optional-chaining": "^7.8.3",

packages/typescriptlang-org/scripts/createLighthouseJSON.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
11
const nodeFetch = require("node-fetch").default
22
const { writeFileSync } = require("fs")
33
const { join } = require("path")
4-
const parser = require("xml2json")
4+
const parser = require("xml-js")
55

6-
const prNumber = process.env.PR_NUMBER || "245"
6+
const prNumber = process.env.PR_NUMBER || "789"
77

88
const go = async () => {
9-
const sitemap =
10-
"https://typescript-v2-" + prNumber + ".ortam.now.sh/sitemap.xml"
11-
9+
const sitemap = `https://typescript-v2-${prNumber}.vercel.app/sitemap.xml`
1210
try {
1311
const packageJSON = await nodeFetch(sitemap)
1412

1513
const contents = await packageJSON.text()
14+
const sitemapJSON = JSON.parse(
15+
parser.xml2json(contents, { compact: true, spaces: 4 })
16+
)
1617

17-
const sitemapJSON = JSON.parse(parser.toJson(contents))
1818
/** @type {string[]} */
1919
const grabbedURLs = sitemapJSON.urlset.url.map(u => u.loc)
20+
2021
const urls = grabbedURLs
22+
.filter(Boolean)
2123
.map(url => {
2224
// from "https://www.typescriptlang.org/v2/docs/handbook/advanced-types.html",
23-
// to "https://typescript-v2-" + prNumber + ".ortam.now.sh/docs/handbook/advanced-types.html",
24-
return url.replace(
25+
// to "https://typescript-v2-" + prNumber + ".vercel.app/docs/handbook/advanced-types.html",
26+
27+
return url._text.replace(
2528
"https://www.typescriptlang.org/",
26-
"https://typescript-v2-" + prNumber + ".ortam.now.sh/"
29+
"https://typescript-v2-" + prNumber + ".vercel.app/"
2730
)
2831
})
2932
.reverse()
@@ -62,8 +65,10 @@ const go = async () => {
6265
}
6366

6467
console.log(`Looking at ${json.ci.collect.url.length} urls`)
68+
console.log(`- ${json.ci.collect.url.join("\n - ")}`)
6569
writeFileSync(lighthouseFiles, JSON.stringify(json))
6670
} catch (error) {
71+
console.log(error)
6772
console.log(
6873
"Failed to generate lighthouse JSON, this is fine if you are not an orta"
6974
)

packages/typescriptlang-org/src/templates/pages/community.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export const Comm: React.FC<Props> = props => {
167167
</div>
168168

169169

170-
<div className="raised main-content-block container community">
170+
{/* <div className="raised main-content-block container community" style={{ display: "none" }}>
171171
<h3 className="centered-highlight">Upcoming Events</h3>
172172
<div className="events">
173173
<Row>
@@ -188,8 +188,7 @@ export const Comm: React.FC<Props> = props => {
188188
))}
189189
</Row>
190190
</div>
191-
</div>
192-
191+
</div> */}
193192

194193
<div className="raised main-content-block container community">
195194
<h3 className="centered-highlight">Meetups</h3>

0 commit comments

Comments
 (0)