emotion/scripts/replace-slack-link.js
Josh Goldberg 23f43ab9f2
Bump Prettier and Prettier accessories to 2.x (#2387)
* chore: bump Prettier and Prettier accessories to 2.x

Excluded Markdown files because some of them had a lot of noise.

* Undid .md, .mdx changes

* Undid site/CHANGELOG.md changes too
2021-05-24 16:37:21 +02:00

26 lines
729 B
JavaScript

// slack invite links expire after 30 days and you can't(at least as far as i can tell) create tokens for things like slackin anymore
const fs = require('fs')
const slackInviteLink = process.argv[2]
const siteHeaderPath = `${__dirname}/../site/src/components/SiteHeader.js`
const readmePath = `${__dirname}/../README.md`
const slackInviteLinkRegex =
/https:\/\/join\.slack\.com\/t\/emotion-slack\/shared_invite\/[^/]+\//
const siteHeader = fs.readFileSync(siteHeaderPath, 'utf8')
fs.writeFileSync(
siteHeaderPath,
siteHeader.replace(slackInviteLinkRegex, slackInviteLink)
)
const readme = fs.readFileSync(readmePath, 'utf8')
fs.writeFileSync(
readmePath,
readme.replace(slackInviteLinkRegex, slackInviteLink)
)