Skip to content

Commit

Permalink
chore: switch from yarn 1 (legacy) to yarn 4.1.1 (berry/latest) and u…
Browse files Browse the repository at this point in the history
…se pnpm nodeLinker (#631)

* chore: switch from yarn 1 (legacy) to yarn 4.1.1 (berry/latest) and use pnpm nodeLinker

* chore: remove dead meetup link
  • Loading branch information
kaushalkapasi authored Apr 19, 2024
1 parent 83fd088 commit ad5b795
Show file tree
Hide file tree
Showing 4 changed files with 15,761 additions and 11,325 deletions.
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: pnpm
137 changes: 76 additions & 61 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,26 @@ import remarkEmbedder from '@remark-embedder/core'
const YouTubeTransformer = {
name: 'YouTubeTransformer',
shouldTransform(url) {
const ytEndpoints = [{
"schemes": [
"https://*.youtube.com/watch*",
"https://*.youtube.com/v/*",
"https://youtu.be/*",
"https://*.youtube.com/playlist?list=*",
"https://youtube.com/playlist?list=*",
"https://*.youtube.com/shorts*"
],
"url": "https://www.youtube.com/oembed",
"discovery": true
}]
const ytEndpoints = [
{
schemes: [
'https://*.youtube.com/watch*',
'https://*.youtube.com/v/*',
'https://youtu.be/*',
'https://*.youtube.com/playlist?list=*',
'https://youtube.com/playlist?list=*',
'https://*.youtube.com/shorts*',
],
url: 'https://www.youtube.com/oembed',
discovery: true,
},
]

for (const endpoint of ytEndpoints) {
if (
endpoint.schemes?.some(scheme =>
new RegExp(scheme.replace(/\*/g, '(.*)')).test(url),
)
endpoint.schemes?.some((scheme) =>
new RegExp(scheme.replace(/\*/g, '(.*)')).test(url),
)
) {
return true
}
Expand All @@ -31,12 +33,16 @@ const YouTubeTransformer = {
// default config function returns what it's given
getHTML(url, options = {}) {
function getVideoID(userInput) {
var res = userInput.match(/^.*(?:(?:youtu.be\/)|(?:v\/)|(?:\/u\/\w\/)|(?:embed\/)|(?:watch\?))\??v?=?([^#\&\?]*).*/);
if (res) return res[1];
return false;
var res = userInput.match(
/^.*(?:(?:youtu.be\/)|(?:v\/)|(?:\/u\/\w\/)|(?:embed\/)|(?:watch\?))\??v?=?([^#\&\?]*).*/,
)
if (res) return res[1]
return false
}
const videoID = getVideoID(url)
return `<div style="width: ${options.width || '100%'}; margin: 0 ${options.align || '0'};"><div style="position: relative; padding-bottom: 56.25%; padding-top: 25px; height: 0;"><iframe style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" src="https://www.youtube.com/embed/${videoID}"></iframe></div></div>`;
return `<div style="width: ${options.width || '100%'}; margin: 0 ${
options.align || '0'
};"><div style="position: relative; padding-bottom: 56.25%; padding-top: 25px; height: 0;"><iframe style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" src="https://www.youtube.com/embed/${videoID}"></iframe></div></div>`
},
}
/**
Expand All @@ -47,10 +53,13 @@ const DVC_CLI_VERSION = 'v5.14.5' // auto updated by dvc cli release workflow

const VSCODE_EXTENSION_VERSION = 'v1.4.4' // auto updated by extension release workflow

const removeDocsSections = (content, sectionNames, headerIdentifier = "##") => {
const removeDocsSections = (content, sectionNames, headerIdentifier = '##') => {
let result = content
for (const sectionName of sectionNames) {
const regex = new RegExp(`${headerIdentifier} ${sectionName}[\\s\\S]*?(?=## |#$|$)`, 'g');
const regex = new RegExp(
`${headerIdentifier} ${sectionName}[\\s\\S]*?(?=## |#$|$)`,
'g',
)

result = result.replace(regex, '')
}
Expand Down Expand Up @@ -137,15 +146,21 @@ const config = {
name: 'vscode-extension',
sourceBaseUrl: `https://raw.githubusercontent.com/DevCycleHQ/vscode-extension/${VSCODE_EXTENSION_VERSION}`,
outDir: 'docs/integrations/vscode-extension',
documents: [
'README.md',
],
documents: ['README.md'],
performCleanup: true,
modifyContent: (filename, content) => {
if (filename.includes('README')) {
const noTitle = content.replace(/# [\s\S]*?##/, '# DevCycle VSCode Extension \n##')
const noTitle = content.replace(
/# [\s\S]*?##/,
'# DevCycle VSCode Extension \n##',
)
return {
content: removeDocsSections(noTitle, ['About DevCycle', 'Documentation', 'Sign Up for DevCycle', 'Contributing'])
content: removeDocsSections(noTitle, [
'About DevCycle',
'Documentation',
'Sign Up for DevCycle',
'Contributing',
]),
}
}
return undefined
Expand All @@ -156,98 +171,104 @@ const config = {
'docusaurus-plugin-remote-content',
{
name: 'github.feature-usage-action',
sourceBaseUrl: 'https://raw.githubusercontent.com/DevCycleHQ/feature-flag-code-usage-action/main/',
sourceBaseUrl:
'https://raw.githubusercontent.com/DevCycleHQ/feature-flag-code-usage-action/main/',
outDir: 'docs/integrations/github/feature-usage-action',
documents: ['README.md'],
performCleanup: true,
modifyContent: (filename, content) => ({
content:
'# GitHub: Feature Flag Code Usages \n' +
'Get the integration on the [GitHub Marketplace](https://github.com/marketplace/actions/devcycle-feature-flag-code-usages)\n' +
content
})
content,
}),
},
],
[
'docusaurus-plugin-remote-content',
{
name: 'github.pr-insights-action',
sourceBaseUrl: 'https://raw.githubusercontent.com/DevCycleHQ/feature-flag-pr-insights-action/main/',
sourceBaseUrl:
'https://raw.githubusercontent.com/DevCycleHQ/feature-flag-pr-insights-action/main/',
outDir: 'docs/integrations/github/pr-insights-action',
documents: ['README.md'],
performCleanup: true,
modifyContent: (filename, content) => ({
content:
'# GitHub: Feature Flag Change Insights on Pull Request \n' +
'Get the integration on the [GitHub Marketplace](https://github.com/marketplace/actions/devcycle-feature-flag-insights-for-pull-requests)\n' +
content
})
content,
}),
},
],
[
'docusaurus-plugin-remote-content',
{
name: 'bitbucket.feature-usage-action',
sourceBaseUrl: 'https://bitbucket.org/devcyclehq/devcycle-code-refs-pipe/raw/main/',
sourceBaseUrl:
'https://bitbucket.org/devcyclehq/devcycle-code-refs-pipe/raw/main/',
outDir: 'docs/integrations/bitbucket/feature-usage-action',
documents: ['README.md'],
performCleanup: true,
modifyContent: (filename, content) => ({
content:
'# Bitbucket: Feature Flag Code Usages\n' +
'Get the integration on the [Bitbucket Marketplace](https://bitbucket.org/product/features/pipelines/integrations?&p=devcyclehq/devcycle-code-refs-pipe)\n' +
content
})
content,
}),
},
],
[
'docusaurus-plugin-remote-content',
{
name: 'bitbucket.pr-insights-action',
sourceBaseUrl: 'https://bitbucket.org/devcyclehq/devcycle-pr-insights-pipe/raw/main/',
sourceBaseUrl:
'https://bitbucket.org/devcyclehq/devcycle-pr-insights-pipe/raw/main/',
outDir: 'docs/integrations/bitbucket/pr-insights-action',
documents: ['README.md'],
performCleanup: true,
modifyContent: (filename, content) => ({
content:
'# Bitbucket: Feature Flag Change Insights on Pull Request\n' +
'Get the integration on the [Bitbucket Marketplace](https://bitbucket.org/product/features/pipelines/integrations?&p=devcyclehq/devcycle-pr-insights-pipe)\n' +
content
})
content,
}),
},
],
[
'docusaurus-plugin-remote-content',
{
name: 'gitlab.feature-usage-action',
sourceBaseUrl: 'https://gitlab.com/devcycle/devcycle-usages-ci-cd/-/raw/main/',
sourceBaseUrl:
'https://gitlab.com/devcycle/devcycle-usages-ci-cd/-/raw/main/',
outDir: 'docs/integrations/gitlab/feature-usage-action',
documents: ['README.md'],
performCleanup: true,
modifyContent: (filename, content) => ({
content:
'# GitLab: Feature Flag Code Usages \n' +
'Get the integration here: https://gitlab.com/devcycle/devcycle-usages-ci-cd\n' +
content
})
}
content,
}),
},
],
[
'docusaurus-plugin-remote-content',
{
name: 'gitlab.pr-insights-action',
sourceBaseUrl: 'https://gitlab.com/devcycle/devcycle-pr-insights-ci-cd/-/raw/main/',
sourceBaseUrl:
'https://gitlab.com/devcycle/devcycle-pr-insights-ci-cd/-/raw/main/',
outDir: 'docs/integrations/gitlab/pr-insights-action',
documents: ['README.md'],
performCleanup: true,
modifyContent: (filename, content) => ({
content:
'# GitLab: Feature Flag Change Insights on Merge Request\n' +
'Get the integration here: https://gitlab.com/devcycle/devcycle-pr-insights-ci-cd\n' +
content
})
}
]
content,
}),
},
],
],

presets: [
Expand All @@ -263,7 +284,7 @@ const config = {
editCurrentVersion: true,
sidebarPath: require.resolve('./sidebars.js'),
remarkPlugins: [
[remarkEmbedder, {transformers: [[YouTubeTransformer]]}],
[remarkEmbedder, { transformers: [[YouTubeTransformer]] }],
require('remark-docusaurus-tabs'),
],
rehypePlugins: [],
Expand Down Expand Up @@ -373,13 +394,13 @@ const config = {
srcDark: 'devcycle-docs-white.svg',
},
items: [
{
type: 'doc',
docId: 'index',
position: 'left',
collapse: 'false',
label: 'Home',
},
{
type: 'doc',
docId: 'index',
position: 'left',
collapse: 'false',
label: 'Home',
},
{
type: 'doc',
docId: 'sdk/index',
Expand Down Expand Up @@ -426,12 +447,6 @@ const config = {
label: 'Calendar',
to: '/community/calendar',
},
{
href: 'https://www.meetup.com/devcycle/',
label: 'MeetUps',
target: '_blank',
rel: null,
},
{
href: 'https://blog.devcycle.com',
label: 'Blog',
Expand Down
20 changes: 16 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"@docusaurus/plugin-content-docs": "latest",
"@docusaurus/preset-classic": "latest",
"@docusaurus/theme-common": "latest",
"@docusaurus/utils": "latest",
"@docusaurus/utils-validation": "^3.2.1",
"@fortawesome/fontawesome-svg-core": "^6.4.0",
"@fortawesome/free-brands-svg-icons": "^6.4.0",
"@fortawesome/free-regular-svg-icons": "^6.4.0",
Expand All @@ -33,30 +35,39 @@
"@remark-embedder/core": "^3.0.2",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@vercel/analytics": "^1.1.1",
"call-me-maybe": "^1.0.2",
"clsx": "^2.0.0",
"docusaurus-plugin-remote-content": "^4.0.0",
"dotenv": "^16.1.4",
"fast-safe-stringify": "^2.1.1",
"mixpanel-browser": "^2.49.0",
"mobx": "^6.12.3",
"path-browserify": "^1.0.1",
"postcss": "^8.4.38",
"postcss-import": "^15.1.0",
"postcss-preset-env": "^9.3.0",
"prism-react-renderer": "^2.1.0",
"prismjs": "^1.29.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"redocusaurus": "^2.0.0",
"remark-docusaurus-tabs": "^0.2.0",
"styled-components": "^6.1.8",
"tailwindcss": "^3.3.5",
"vercel": "^32.5.0"
"vercel": "^32.5.0",
"yaml": "^2.4.1"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "latest",
"@docusaurus/tsconfig": "latest",
"@docusaurus/types": "latest",
"@iconify-icon/react": "^1.0.8",
"@types/react": "^18.2.29",
"typescript": "~5.2.2"
"typescript": "~5.2.2",
"webpack": "^5.91.0"
},
"engines": {
"node": ">=18.0"
"node": "^18.16"
},
"browserslist": {
"production": [
Expand All @@ -69,5 +80,6 @@
"last 1 firefox version",
"last 1 safari version"
]
}
},
"packageManager": "yarn@4.1.1"
}
Loading

0 comments on commit ad5b795

Please sign in to comment.