[Docs Site] Move show-changed-files to bin and fix workflow condition (#19784)

This commit is contained in:
Kian 2025-02-06 11:43:44 +00:00 committed by GitHub
parent abd5300e38
commit bbfcd64c42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 786 additions and 3290 deletions

View file

@ -1,859 +0,0 @@
{
"name": "show-changed-files",
"version": "0.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "show-changed-files",
"version": "0.0.0",
"devDependencies": {
"@actions/core": "1.11.1",
"@actions/github": "6.0.0",
"@types/node": "22.13.1",
"github-slugger": "2.0.0",
"tsx": "4.19.2",
"typescript": "5.7.3"
}
},
"node_modules/@actions/core": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.11.1.tgz",
"integrity": "sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A==",
"dev": true,
"license": "MIT",
"dependencies": {
"@actions/exec": "^1.1.1",
"@actions/http-client": "^2.0.1"
}
},
"node_modules/@actions/exec": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz",
"integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==",
"dev": true,
"license": "MIT",
"dependencies": {
"@actions/io": "^1.0.1"
}
},
"node_modules/@actions/github": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/@actions/github/-/github-6.0.0.tgz",
"integrity": "sha512-alScpSVnYmjNEXboZjarjukQEzgCRmjMv6Xj47fsdnqGS73bjJNDpiiXmp8jr0UZLdUB6d9jW63IcmddUP+l0g==",
"dev": true,
"license": "MIT",
"dependencies": {
"@actions/http-client": "^2.2.0",
"@octokit/core": "^5.0.1",
"@octokit/plugin-paginate-rest": "^9.0.0",
"@octokit/plugin-rest-endpoint-methods": "^10.0.0"
}
},
"node_modules/@actions/http-client": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.3.tgz",
"integrity": "sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==",
"dev": true,
"license": "MIT",
"dependencies": {
"tunnel": "^0.0.6",
"undici": "^5.25.4"
}
},
"node_modules/@actions/io": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.3.tgz",
"integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==",
"dev": true,
"license": "MIT"
},
"node_modules/@esbuild/aix-ppc64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz",
"integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==",
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"aix"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/android-arm": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.1.tgz",
"integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/android-arm64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz",
"integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/android-x64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.1.tgz",
"integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/darwin-arm64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz",
"integrity": "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/darwin-x64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz",
"integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/freebsd-arm64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz",
"integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/freebsd-x64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz",
"integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-arm": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz",
"integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-arm64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz",
"integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-ia32": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz",
"integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-loong64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz",
"integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==",
"cpu": [
"loong64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-mips64el": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz",
"integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==",
"cpu": [
"mips64el"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-ppc64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz",
"integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==",
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-riscv64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz",
"integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==",
"cpu": [
"riscv64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-s390x": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz",
"integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==",
"cpu": [
"s390x"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-x64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz",
"integrity": "sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/netbsd-x64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz",
"integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"netbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/openbsd-arm64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz",
"integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/openbsd-x64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz",
"integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/sunos-x64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz",
"integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"sunos"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/win32-arm64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz",
"integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/win32-ia32": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz",
"integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/win32-x64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz",
"integrity": "sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@fastify/busboy": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz",
"integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=14"
}
},
"node_modules/@octokit/auth-token": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz",
"integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 18"
}
},
"node_modules/@octokit/core": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.0.tgz",
"integrity": "sha512-1LFfa/qnMQvEOAdzlQymH0ulepxbxnCYAKJZfMci/5XJyIHWgEYnDmgnKakbTh7CH2tFQ5O60oYDvns4i9RAIg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@octokit/auth-token": "^4.0.0",
"@octokit/graphql": "^7.1.0",
"@octokit/request": "^8.3.1",
"@octokit/request-error": "^5.1.0",
"@octokit/types": "^13.0.0",
"before-after-hook": "^2.2.0",
"universal-user-agent": "^6.0.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/@octokit/endpoint": {
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.5.tgz",
"integrity": "sha512-ekqR4/+PCLkEBF6qgj8WqJfvDq65RH85OAgrtnVp1mSxaXF03u2xW/hUdweGS5654IlC0wkNYC18Z50tSYTAFw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@octokit/types": "^13.1.0",
"universal-user-agent": "^6.0.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/@octokit/graphql": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.1.0.tgz",
"integrity": "sha512-r+oZUH7aMFui1ypZnAvZmn0KSqAUgE1/tUXIWaqUCa1758ts/Jio84GZuzsvUkme98kv0WFY8//n0J1Z+vsIsQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@octokit/request": "^8.3.0",
"@octokit/types": "^13.0.0",
"universal-user-agent": "^6.0.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/@octokit/openapi-types": {
"version": "23.0.1",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-23.0.1.tgz",
"integrity": "sha512-izFjMJ1sir0jn0ldEKhZ7xegCTj/ObmEDlEfpFrx4k/JyZSMRHbO3/rBwgE7f3m2DHt+RrNGIVw4wSmwnm3t/g==",
"dev": true,
"license": "MIT"
},
"node_modules/@octokit/plugin-paginate-rest": {
"version": "9.2.1",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.2.1.tgz",
"integrity": "sha512-wfGhE/TAkXZRLjksFXuDZdmGnJQHvtU/joFQdweXUgzo1XwvBCD4o4+75NtFfjfLK5IwLf9vHTfSiU3sLRYpRw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@octokit/types": "^12.6.0"
},
"engines": {
"node": ">= 18"
},
"peerDependencies": {
"@octokit/core": "5"
}
},
"node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/openapi-types": {
"version": "20.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz",
"integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==",
"dev": true,
"license": "MIT"
},
"node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/types": {
"version": "12.6.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz",
"integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@octokit/openapi-types": "^20.0.0"
}
},
"node_modules/@octokit/plugin-rest-endpoint-methods": {
"version": "10.4.1",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.4.1.tgz",
"integrity": "sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@octokit/types": "^12.6.0"
},
"engines": {
"node": ">= 18"
},
"peerDependencies": {
"@octokit/core": "5"
}
},
"node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/openapi-types": {
"version": "20.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz",
"integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==",
"dev": true,
"license": "MIT"
},
"node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/types": {
"version": "12.6.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz",
"integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@octokit/openapi-types": "^20.0.0"
}
},
"node_modules/@octokit/request": {
"version": "8.4.0",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.0.tgz",
"integrity": "sha512-9Bb014e+m2TgBeEJGEbdplMVWwPmL1FPtggHQRkV+WVsMggPtEkLKPlcVYm/o8xKLkpJ7B+6N8WfQMtDLX2Dpw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@octokit/endpoint": "^9.0.1",
"@octokit/request-error": "^5.1.0",
"@octokit/types": "^13.1.0",
"universal-user-agent": "^6.0.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/@octokit/request-error": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.0.tgz",
"integrity": "sha512-GETXfE05J0+7H2STzekpKObFe765O5dlAKUTLNGeH+x47z7JjXHfsHKo5z21D/o/IOZTUEI6nyWyR+bZVP/n5Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"@octokit/types": "^13.1.0",
"deprecation": "^2.0.0",
"once": "^1.4.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/@octokit/types": {
"version": "13.8.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.8.0.tgz",
"integrity": "sha512-x7DjTIbEpEWXK99DMd01QfWy0hd5h4EN+Q7shkdKds3otGQP+oWE/y0A76i1OvH9fygo4ddvNf7ZvF0t78P98A==",
"dev": true,
"license": "MIT",
"dependencies": {
"@octokit/openapi-types": "^23.0.1"
}
},
"node_modules/@types/node": {
"version": "22.13.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.1.tgz",
"integrity": "sha512-jK8uzQlrvXqEU91UxiK5J7pKHyzgnI1Qnl0QDHIgVGuolJhRb9EEl28Cj9b3rGR8B2lhFCtvIm5os8lFnO/1Ew==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~6.20.0"
}
},
"node_modules/before-after-hook": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz",
"integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==",
"dev": true,
"license": "Apache-2.0"
},
"node_modules/deprecation": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",
"integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==",
"dev": true,
"license": "ISC"
},
"node_modules/esbuild": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.1.tgz",
"integrity": "sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"bin": {
"esbuild": "bin/esbuild"
},
"engines": {
"node": ">=18"
},
"optionalDependencies": {
"@esbuild/aix-ppc64": "0.23.1",
"@esbuild/android-arm": "0.23.1",
"@esbuild/android-arm64": "0.23.1",
"@esbuild/android-x64": "0.23.1",
"@esbuild/darwin-arm64": "0.23.1",
"@esbuild/darwin-x64": "0.23.1",
"@esbuild/freebsd-arm64": "0.23.1",
"@esbuild/freebsd-x64": "0.23.1",
"@esbuild/linux-arm": "0.23.1",
"@esbuild/linux-arm64": "0.23.1",
"@esbuild/linux-ia32": "0.23.1",
"@esbuild/linux-loong64": "0.23.1",
"@esbuild/linux-mips64el": "0.23.1",
"@esbuild/linux-ppc64": "0.23.1",
"@esbuild/linux-riscv64": "0.23.1",
"@esbuild/linux-s390x": "0.23.1",
"@esbuild/linux-x64": "0.23.1",
"@esbuild/netbsd-x64": "0.23.1",
"@esbuild/openbsd-arm64": "0.23.1",
"@esbuild/openbsd-x64": "0.23.1",
"@esbuild/sunos-x64": "0.23.1",
"@esbuild/win32-arm64": "0.23.1",
"@esbuild/win32-ia32": "0.23.1",
"@esbuild/win32-x64": "0.23.1"
}
},
"node_modules/fsevents": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/get-tsconfig": {
"version": "4.10.0",
"resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.10.0.tgz",
"integrity": "sha512-kGzZ3LWWQcGIAmg6iWvXn0ei6WDtV26wzHRMwDSzmAbcXrTEXxHy6IehI6/4eT6VRKyMP1eF1VqwrVUmE/LR7A==",
"dev": true,
"license": "MIT",
"dependencies": {
"resolve-pkg-maps": "^1.0.0"
},
"funding": {
"url": "https://github.com/privatenumber/get-tsconfig?sponsor=1"
}
},
"node_modules/github-slugger": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-2.0.0.tgz",
"integrity": "sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==",
"dev": true,
"license": "ISC"
},
"node_modules/once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"dev": true,
"license": "ISC",
"dependencies": {
"wrappy": "1"
}
},
"node_modules/resolve-pkg-maps": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz",
"integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==",
"dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1"
}
},
"node_modules/tsx": {
"version": "4.19.2",
"resolved": "https://registry.npmjs.org/tsx/-/tsx-4.19.2.tgz",
"integrity": "sha512-pOUl6Vo2LUq/bSa8S5q7b91cgNSjctn9ugq/+Mvow99qW6x/UZYwzxy/3NmqoT66eHYfCVvFvACC58UBPFf28g==",
"dev": true,
"license": "MIT",
"dependencies": {
"esbuild": "~0.23.0",
"get-tsconfig": "^4.7.5"
},
"bin": {
"tsx": "dist/cli.mjs"
},
"engines": {
"node": ">=18.0.0"
},
"optionalDependencies": {
"fsevents": "~2.3.3"
}
},
"node_modules/tunnel": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
}
},
"node_modules/typescript": {
"version": "5.7.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz",
"integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==",
"dev": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
},
"node_modules/undici": {
"version": "5.28.5",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.5.tgz",
"integrity": "sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@fastify/busboy": "^2.0.0"
},
"engines": {
"node": ">=14.0"
}
},
"node_modules/undici-types": {
"version": "6.20.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz",
"integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==",
"dev": true,
"license": "MIT"
},
"node_modules/universal-user-agent": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz",
"integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==",
"dev": true,
"license": "ISC"
},
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
"dev": true,
"license": "ISC"
}
}
}

View file

@ -1,13 +0,0 @@
{
"private": true,
"version": "0.0.0",
"name": "show-changed-files",
"devDependencies": {
"@actions/core": "1.11.1",
"@actions/github": "6.0.0",
"@types/node": "22.13.1",
"github-slugger": "2.0.0",
"tsx": "4.19.2",
"typescript": "5.7.3"
}
}

View file

@ -1,21 +0,0 @@
{
"compilerOptions": {
// Treat files as modules even if it doesn't use import/export
"moduleDetection": "force",
// Ignore module structure
"module": "Preserve",
// Allow JSON modules to be imported
"resolveJsonModule": true,
// Allow JS files to be imported from TS and vice versa
"allowJs": true,
// Use correct ESM import behavior
"esModuleInterop": true,
// Disallow features that require cross-file awareness
"isolatedModules": true
}
}

View file

@ -32,7 +32,7 @@ jobs:
name: Build
env:
NODE_OPTIONS: --max-old-space-size=4096
- run: npx wrangler versions upload -c ./wrangler-workers.toml
- run: npx wrangler versions upload
name: Deploy to Cloudflare Workers
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}

View file

@ -28,7 +28,7 @@ jobs:
name: Build
env:
NODE_OPTIONS: --max-old-space-size=4096
- run: npx wrangler deploy -c ./wrangler-workers.toml
- run: npx wrangler deploy
name: Deploy to Cloudflare Workers
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}

View file

@ -13,16 +13,15 @@ on:
jobs:
changed-files-links:
name: Show Changed Files
if: github.event.issue.pull_request && github.event.issue.state == 'open' && github.event.comment.user.id == 41898282 && contains(github.event.comment.body, '**Preview URL**')
if: github.event.issue.pull_request && github.event.issue.state == 'open' && github.event.comment.user.id == 41898282 && contains(github.event.comment.body, '**Preview URL:**')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cd ./.github/actions/show-changed-files
- uses: actions/setup-node@v4
with:
node-version: 22
cache: "npm"
- run: npm ci
- run: npx tsx index.ts
- run: npx tsx bin/show-changed-files/index.ts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -5,4 +5,3 @@ dist
public/_redirects
public/analytics/static/downloads/main.css
src/content/workers-ai-models/*.json
tests/fixtures/openapi.json

View file

@ -0,0 +1,5 @@
export const GITHUB_ACTIONS_BOT_ID = 41898282;
export const DOCS_BASE_URL = "https://developers.cloudflare.com";
export const CONTENT_BASE_PATH = "src/content";
export const EXISTING_COMMENT_SUBSTRING = "| Original Link | Updated Link |";
export const PREVIEW_URL_REGEX = /^\*\*Preview URL:\*\* (.*)$/m;

View file

@ -0,0 +1,52 @@
import { describe, expect, test } from "vitest";
import { DOCS_BASE_URL, PREVIEW_URL_REGEX } from "./constants";
import { filenameToPath } from "./util";
test("PREVIEW_URL_REGEX", () => {
const comment =
"**Preview URL:** https://ac148943-cloudflare-docs.cloudflare-docs.workers.dev";
const matches = comment.match(PREVIEW_URL_REGEX);
expect(matches).toBeDefined();
expect(matches![1]).toEqual(
"https://ac148943-cloudflare-docs.cloudflare-docs.workers.dev",
);
});
describe("filenameToPath", () => {
test("index", () => {
expect(filenameToPath("src/content/docs/workers/index.mdx")).toEqual(
"workers/",
);
});
test("index base", () => {
expect(
`${DOCS_BASE_URL}/${filenameToPath("src/content/docs/workers/index.mdx")}`,
).toEqual("https://developers.cloudflare.com/workers/");
});
test("folder", () => {
expect(
filenameToPath("src/content/docs/workers/get-started/cli.mdx"),
).toEqual("workers/get-started/cli/");
});
test("1.1.1.1", () => {
expect(filenameToPath("src/content/docs/1111/index.mdx")).toEqual(
"1.1.1.1/",
);
});
test("changelog", () => {
expect(
filenameToPath("src/content/changelogs-next/2025-02-05-title.mdx"),
).toEqual("changelog/2025-02-05-title/");
});
test("changelog base", () => {
expect(
`${DOCS_BASE_URL}/${filenameToPath("src/content/changelogs-next/2025-02-05-title.mdx")}`,
).toEqual("https://developers.cloudflare.com/changelog/2025-02-05-title/");
});
});

View file

@ -1,11 +1,15 @@
import * as core from "@actions/core";
import * as github from "@actions/github";
import { slug } from "github-slugger";
import {
CONTENT_BASE_PATH,
DOCS_BASE_URL,
EXISTING_COMMENT_SUBSTRING,
GITHUB_ACTIONS_BOT_ID,
PREVIEW_URL_REGEX,
} from "./constants";
const GITHUB_ACTIONS_BOT_ID = 41898282;
const DOCS_BASE_URL = "https://developers.cloudflare.com";
const CONTENT_BASE_PATH = "src/content/docs/";
import { filenameToPath } from "./util";
async function run(): Promise<void> {
try {
@ -13,6 +17,12 @@ async function run(): Promise<void> {
const octokit = github.getOctokit(token);
const ctx = github.context;
if (!ctx.payload.issue) {
core.setFailed(`Payload ${ctx.payload} is missing an 'issue' property`);
process.exit();
}
const issue = ctx.payload.issue.number;
const files = await octokit.paginate(octokit.rest.pulls.listFiles, {
@ -30,33 +40,31 @@ async function run(): Promise<void> {
const existingComment = comments.find(
(comment) =>
comment.user.id === GITHUB_ACTIONS_BOT_ID &&
comment.body.includes("| Original Link | Updated Link |"),
comment.user?.id === GITHUB_ACTIONS_BOT_ID &&
comment.body?.includes(EXISTING_COMMENT_SUBSTRING),
);
const urlComment = comments.find(
(comment) =>
comment.user.id === GITHUB_ACTIONS_BOT_ID &&
comment.body.includes("**Preview URL:**"),
comment.user?.id === GITHUB_ACTIONS_BOT_ID &&
PREVIEW_URL_REGEX.test(comment.body ?? ""),
);
let previewUrl: string;
if (urlComment) {
if (!urlComment.body) {
core.setFailed(`${urlComment.id} has no body`);
if (!urlComment || !urlComment.body) {
core.setFailed(
`Could not find a comment from ${GITHUB_ACTIONS_BOT_ID} on ${issue}`,
);
process.exit();
}
const match = urlComment.body.match(/^\*\*Preview URL:\*\* (.*)$/m)[1];
const match = urlComment.body.match(PREVIEW_URL_REGEX);
if (!match) {
core.setFailed(`Could not extract URL from ${urlComment.body}`);
process.exit();
}
previewUrl = match;
}
const previewUrl = match[1];
core.debug(previewUrl);
@ -64,29 +72,12 @@ async function run(): Promise<void> {
.filter(
(file) =>
file.filename.endsWith(".mdx") &&
file.filename.startsWith(CONTENT_BASE_PATH),
(file.filename.startsWith(`${CONTENT_BASE_PATH}/docs/`) ||
file.filename.startsWith(`${CONTENT_BASE_PATH}/changelogs-next/`)),
)
.sort((a, b) => b.changes - a.changes)
.slice(0, 15) // Limit to 15 entries
.map(({ filename }) => {
const filenameToPath = (filename: string) => {
return filename
.replace(".mdx", "")
.split("/")
.map((segment, idx) => {
const slugified = slug(segment);
if (idx === 0 && slugified === "1111") {
return "1.1.1.1";
}
return slugified;
})
.join("/")
.replace(/\/index$/, "")
.concat("/");
};
const original = `${DOCS_BASE_URL}/${filenameToPath(filename)}`;
const preview = `${previewUrl}/${filenameToPath(filename)}`;
@ -122,7 +113,9 @@ async function run(): Promise<void> {
});
}
} catch (error) {
if (error instanceof Error) {
core.setFailed(error.message);
}
process.exit();
}
}

View file

@ -0,0 +1,31 @@
import { slug } from "github-slugger";
import { CONTENT_BASE_PATH } from "./constants";
export const filenameToPath = (filename: string) => {
return filename
.replace(CONTENT_BASE_PATH, "")
.replace(".mdx", "")
.split("/")
.filter(Boolean)
.flatMap((segment) => {
if (segment === "docs") {
return [];
}
if (segment === "changelogs-next") {
segment = "changelog";
}
const slugified = slug(segment);
if (slugified === "1111") {
return "1.1.1.1";
}
return slugified;
})
.join("/")
.replace(/\/index$/, "")
.concat("/");
};

2621
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -5,11 +5,10 @@
"scripts": {
"astro": "npx astro",
"build": "npx astro build",
"postbuild": "npm run build:worker",
"build:worker": "npx wrangler types -c wrangler-workers.toml --experimental-include-runtime",
"typegen:worker": "npx wrangler types ./worker/worker-configuration.d.ts",
"check": "npm run check:astro && npm run check:worker",
"check:astro": "npm run sync && astro check",
"check:worker": "npm run build:worker && npx tsc --noEmit -p ./worker/tsconfig.json",
"check:astro": "npx astro check",
"check:worker": "npx tsc --noEmit -p ./worker/tsconfig.json",
"dev": "npx astro dev",
"format": "npm run format:core && npm run format:data",
"format:core": "npx prettier --write \"**/*.{js,jsx,ts,tsx,mjs,css}\"",
@ -25,6 +24,8 @@
"lint": "npx eslint"
},
"devDependencies": {
"@actions/core": "1.11.1",
"@actions/github": "6.0.0",
"@astrojs/check": "0.9.4",
"@astrojs/react": "4.2.0",
"@astrojs/rss": "4.0.11",
@ -33,7 +34,6 @@
"@astrojs/starlight-docsearch": "0.5.0",
"@astrojs/starlight-tailwind": "3.0.0",
"@astrojs/tailwind": "5.1.5",
"@cloudflare/puppeteer": "0.0.14",
"@cloudflare/vitest-pool-workers": "0.6.11",
"@cloudflare/workers-types": "4.20250121.0",
"@codingheads/sticky-header": "1.0.2",
@ -78,7 +78,6 @@
"prettier-plugin-astro": "0.14.1",
"prettier-plugin-tailwindcss": "0.6.9",
"pretty-bytes": "6.1.1",
"puppeteer": "24.1.1",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-icons": "5.4.0",
@ -87,6 +86,8 @@
"rehype": "13.0.2",
"rehype-autolink-headings": "7.1.0",
"rehype-external-links": "3.0.0",
"rehype-parse": "9.0.1",
"rehype-stringify": "10.0.1",
"rehype-title-figure": "0.1.2",
"remark": "15.0.1",
"sharp": "0.33.5",
@ -102,15 +103,12 @@
"tsx": "4.19.2",
"typescript": "5.7.3",
"typescript-eslint": "8.20.0",
"unified": "11.0.5",
"unist-util-visit": "5.0.0",
"vitest": "2.1.9",
"vite-tsconfig-paths": "5.1.4",
"vitest": "2.1.6",
"wrangler": "3.103.2"
},
"overrides": {
"@cloudflare/puppeteer": {
"ws": "8.18.0"
}
},
"engines": {
"node": ">=22"
},

View file

@ -0,0 +1,114 @@
import { describe, expect, test } from "vitest";
import { unified } from "unified";
import rehypeParse from "rehype-parse";
import rehypeStringify from "rehype-stringify";
import rehypeAutolinkHeadings from "./autolink-headings";
import rehypeExternalLinks from "./external-links";
import rehypeHeadingSlugs from "./heading-slugs";
import rehypeMermaid from "./mermaid";
describe("heading-slugs", () => {
const process = async (html: string) => {
const file = await unified()
.data("settings", {
fragment: true,
})
.use([rehypeParse, rehypeHeadingSlugs, rehypeStringify])
.process(html);
return file.toString();
};
test("adds id to heading", async () => {
const text = await process("<h2>foo</h2>");
expect(text).toMatchInlineSnapshot(`"<h2 id="foo">foo</h2>"`);
});
test("ignores existing id", async () => {
const text = await process('<h2 id="bar">foo</h2>');
expect(text).toMatchInlineSnapshot(`"<h2 id="bar">foo</h2>"`);
});
});
describe("external-links", () => {
const process = async (html: string) => {
const file = await unified()
.data("settings", {
fragment: true,
})
.use([rehypeParse, rehypeExternalLinks, rehypeStringify])
.process(html);
return file.toString();
};
test("adds icon to external link", async () => {
const text = await process("<a href='https://example.com'>foo</a>");
expect(text).toMatchInlineSnapshot(
`"<a href="https://example.com" target="_blank" rel="noopener">foo<span class="external-link"> ↗</span></a>"`,
);
});
test("ignores internal link", async () => {
const text = await process('<a href="/">foo</a>');
expect(text).toMatchInlineSnapshot(`"<a href="/">foo</a>"`);
});
});
describe("autolink-headings", () => {
const process = async (html: string) => {
const file = await unified()
.data("settings", {
fragment: true,
})
.use([rehypeParse, rehypeAutolinkHeadings, rehypeStringify])
.process(html);
return file.toString();
};
test("ignores headings without id", async () => {
const text = await process("<h2>foo</h2>");
expect(text).toMatchInlineSnapshot(`"<h2>foo</h2>"`);
});
test("wraps heading with id", async () => {
const text = await process("<h2 id='bar'>foo</h2>");
expect(text).toMatchInlineSnapshot(
`"<div tabindex="-1" class="heading-wrapper level-h2"><h2 id="bar">foo</h2><a class="anchor-link" href="#bar"><span aria-hidden="true" class="anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span></a></div>"`,
);
});
});
describe("mermaid", () => {
const process = async (html: string) => {
const file = await unified()
.data("settings", {
fragment: true,
})
.use([rehypeParse, rehypeMermaid, rehypeStringify])
.process(html);
return file.toString();
};
test("ignores code without mermaid language", async () => {
const text = await process("<code>foo</code>");
expect(text).toMatchInlineSnapshot(`"<code>foo</code>"`);
});
test("transforms code with mermaid language into pre", async () => {
const text = await process("<code class='language-mermaid'>foo</code>");
expect(text).toMatchInlineSnapshot(`"<pre class="mermaid">foo</pre>"`);
});
});

View file

@ -0,0 +1,43 @@
import { describe, expect, test } from "vitest";
import { generateDescription } from "./props";
import { rehypeExternalLinksOptions } from "~/plugins/rehype/external-links";
describe("description", () => {
describe("markdown", () => {
test("unwraps formatting into text", async () => {
const desc = await generateDescription({
markdown: "`code` and [links](/)",
});
expect(desc).toEqual("code and links");
});
test("removes external link icon", async () => {
const icon = rehypeExternalLinksOptions.content.value;
const desc = await generateDescription({
markdown: `[links${icon}](/) and **${icon}stuff**`,
});
expect(desc).toEqual("links and \\*\\*stuff\\*\\*");
});
});
describe("html", () => {
test("selects first paragraph", async () => {
const desc = await generateDescription({
html: "<code>not this</code><p>this <code>and this</code></p>",
});
expect(desc).toEqual("this and this");
});
test("decodes html entities", async () => {
const desc = await generateDescription({
html: "<p>&lt;this&gt;</p>",
});
expect(desc).toEqual("<this>");
});
});
});

View file

@ -1,21 +0,0 @@
import type { GlobalSetupContext } from "vitest/node";
import puppeteer, { Browser } from "puppeteer";
let browser: Browser;
export default async function setup({ provide }: GlobalSetupContext) {
browser = await puppeteer.launch({
args: ["--no-sandbox", "--disable-setuid-sandbox"],
});
provide("browserWSEndpoint", browser.wsEndpoint());
}
export async function teardown() {
await browser.close();
}
declare module "vitest" {
export interface ProvidedContext {
browserWSEndpoint: string;
}
}

View file

@ -1,11 +0,0 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"moduleResolution": "Bundler",
"types": [
"@cloudflare/workers-types/experimental",
"@cloudflare/vitest-pool-workers"
]
},
"include": ["./**/*.ts", "../wrangler-configuration.d.ts"]
}

View file

@ -10,5 +10,5 @@
"jsxImportSource": "react"
},
"include": [".astro/types.d.ts", "**/*"],
"exclude": ["dist", "functions", "./worker", "tests"]
"exclude": ["dist", "worker"]
}

View file

@ -1,12 +0,0 @@
import { defineWorkersConfig } from "@cloudflare/vitest-pool-workers/config";
export default defineWorkersConfig({
test: {
globalSetup: ["./tests/globalSetup.ts"],
poolOptions: {
workers: {
wrangler: { configPath: "./wrangler-workers.toml" },
},
},
},
});

27
vitest.workspace.ts Normal file
View file

@ -0,0 +1,27 @@
import { defineWorkspace, defineProject } from "vitest/config";
import { defineWorkersProject } from "@cloudflare/vitest-pool-workers/config";
import tsconfigPaths from "vite-tsconfig-paths";
const workspace = defineWorkspace([
defineWorkersProject({
test: {
name: "Workers",
include: ["**/*.worker.test.ts"],
poolOptions: {
workers: {
wrangler: { configPath: "./wrangler.toml" },
},
},
},
}),
defineProject({
test: {
name: "Node",
include: ["**/*.node.test.ts"],
},
plugins: [tsconfigPaths()],
}),
]);
export default workspace;

View file

@ -1,10 +0,0 @@
// Generated by Wrangler by running `wrangler types -c wrangler-workers.toml --experimental-include-runtime`
interface Env {
API_DOCS_KV: KVNamespace;
ASSETS: Fetcher;
}
declare module "*/_redirects" {
const value: string;
export default value;
}

View file

@ -1,39 +1,7 @@
import { fetchMock, SELF } from "cloudflare:test";
import { describe, it, expect, beforeAll, afterEach } from "vitest";
import puppeteer, { Browser, HTTPRequest } from "@cloudflare/puppeteer";
import { inject } from "vitest";
const interceptRequest = async (request: HTTPRequest) => {
const miniflareRequest = new Request(request.url(), {
method: request.method(),
body: request.postData(),
});
const response = await SELF.fetch(miniflareRequest);
const arrayBuffer = await response.arrayBuffer();
await request.respond({
body: Buffer.from(arrayBuffer),
headers: Object.fromEntries(response.headers.entries()),
status: response.status,
});
};
import { SELF } from "cloudflare:test";
import { describe, it, expect } from "vitest";
describe("Cloudflare Docs", () => {
let browser: Browser;
beforeAll(async () => {
fetchMock.activate();
fetchMock.disableNetConnect();
browser = await puppeteer.connect({
browserWSEndpoint: inject("browserWSEndpoint"),
});
});
afterEach(() => {
fetchMock.assertNoPendingInterceptors();
});
it("responds with index.html at `/`", async () => {
const request = new Request("http://fakehost/");
const response = await SELF.fetch(request);
@ -91,17 +59,4 @@ describe("Cloudflare Docs", () => {
expect(response.status).toBe(404);
expect(await response.text()).toContain("Page not found.");
});
it("works in Chrome", async () => {
const page = await browser.newPage();
page.setRequestInterception(true);
page.on("request", interceptRequest);
await page.goto("http://developers.cloudflare.com/workers");
const textSelector = await page.locator("text/Cloudflare").waitHandle();
const fullTitle = await textSelector?.evaluate((el) => el.textContent);
expect(fullTitle).toContain("Cloudflare Docs");
});
});

View file

@ -1,19 +1,11 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"esModuleInterop": true,
"skipLibCheck": true,
"target": "ESNext",
"allowJs": true,
"resolveJsonModule": true,
"moduleDetection": "force",
"isolatedModules": true,
"verbatimModuleSyntax": true,
"strict": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"module": "Preserve",
"noEmit": true,
"lib": ["ESNext"],
"types": ["../.wrangler/types/runtime.d.ts", "../worker-configuration.d.ts"]
}
"target": "esnext",
"module": "esnext",
"lib": ["esnext"],
"types": ["@cloudflare/workers-types", "@cloudflare/vitest-pool-workers"]
},
"include": ["*.ts"],
"exclude": []
}

9
worker/worker-configuration.d.ts vendored Normal file
View file

@ -0,0 +1,9 @@
// Generated by Wrangler by running `wrangler types ./worker/worker-configuration.d.ts`
interface Env {
ASSETS: Fetcher;
}
declare module "*/_redirects" {
const value: string;
export default value;
}

View file

@ -1,23 +0,0 @@
#:schema ./node_modules/wrangler/config-schema.json
name = "cloudflare-docs"
account_id = "b54f07a6c269ecca2fa60f1ae4920c99"
compatibility_date = "2024-10-14"
compatibility_flags = ["nodejs_compat"]
main = "./worker/index.ts"
workers_dev = true
route = { pattern = "developers.cloudflare.com/*", zone_name = "developers.cloudflare.com"}
rules = [
{ type = "Text", globs = ["**/_redirects"], fallthrough = true },
]
[assets]
directory = "./dist"
binding = "ASSETS"
not_found_handling = "404-page"
run_worker_first = true
[[kv_namespaces]]
binding = "API_DOCS_KV"
id = "77919060ee0444caa5113f5866b047df"

View file

@ -1,3 +1,19 @@
#:schema ./node_modules/wrangler/config-schema.json
name = "cloudflare-docs"
compatibility_date = "2022-09-27"
account_id = "b54f07a6c269ecca2fa60f1ae4920c99"
compatibility_date = "2024-10-14"
compatibility_flags = ["nodejs_compat"]
main = "./worker/index.ts"
workers_dev = true
route = { pattern = "developers.cloudflare.com/*", zone_name = "developers.cloudflare.com"}
rules = [
{ type = "Text", globs = ["**/_redirects"], fallthrough = true },
]
[assets]
directory = "./dist"
binding = "ASSETS"
not_found_handling = "404-page"
run_worker_first = true