diff --git a/.github/workflows/docs-validation.yml b/.github/workflows/docs-validation.yml index 77dad776b8..924f064493 100644 --- a/.github/workflows/docs-validation.yml +++ b/.github/workflows/docs-validation.yml @@ -1,64 +1,88 @@ -# Docs validation workflow runs on each PR on main w/ broken link checker -# and code snippet validation - name: Docs validation -on: - pull_request: - branches: - - main - push: - branches: - - main +on: pull_request jobs: -link-check: - name: Broken link checker - runs-on: ubuntu-latest + prettier-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: the-guild-org/shared-config/setup@main + name: setup env + with: + packageManager: pnpm + workingDirectory: ./ + + - name: Install Dependencies + run: pnpm i + + - name: Run Prettier Check + run: pnpm format:check + + link-check: + name: Broken link checker + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - uses: the-guild-org/shared-config/setup@main + name: setup env + with: + packageManager: pnpm + workingDirectory: ./ + + - name: Install Dependencies + run: pnpm i - steps: - - name: Checkout code - uses: actions/checkout@v4 + - name: Build static site + run: pnpm build - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: "20" - cache: "pnpm" + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable - - name: Install dependencies - run: pnpm install --frozen-lockfile + - name: Install lychee + run: cargo install lychee - - name: Build static site - run: pnpm build + - name: Check links + run: lychee --verbose --no-progress './out/**/*.html' - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable + lint: + name: Linting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 - - name: Install lychee - run: cargo install lychee + - uses: the-guild-org/shared-config/setup@main + name: setup env + with: + packageManager: pnpm + workingDirectory: ./ - - name: Check links - run: lychee --verbose --no-progress './out/**/*.html' + - name: Install Dependencies + run: pnpm i -code-validate: - name: Code snippet and GraphQL validation - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 + - name: Run linting + run: pnpm lint:docs - - uses: actions/setup-node@v4 - with: - node-version: "20" - cache: "pnpm" + code-validate: + name: Snippet validation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 - - name: Install dependencies - run: pnpm install --frozen-lockfile + - uses: the-guild-org/shared-config/setup@main + name: setup env + with: + packageManager: pnpm + workingDirectory: ./ - - name: Run validation w/ annotations - run: pnpm lint:docs:ci + - name: Install Dependencies + run: pnpm i - - name: Validate code snippets - run: pnpm validate:snippets + - name: Validate code snippets + run: pnpm validate:snippets diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml deleted file mode 100644 index 0a3bc08fef..0000000000 --- a/.github/workflows/prettier.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Prettier Check - -on: pull_request - -jobs: - prettier-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: the-guild-org/shared-config/setup@main - name: setup env - with: - packageManager: pnpm - workingDirectory: ./ - - - name: Install Dependencies - run: pnpm i - - name: Run Prettier Check - run: pnpm format:check diff --git a/package.json b/package.json index 4b92b8bf88..9d034a744b 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,7 @@ "format": "pnpm format:check --write", "format:check": "prettier --cache --check .", "lint": "eslint --ignore-path .gitignore .", - "lint:docs": "eslint --ignore-path .gitignore src/pages/learn --format stylish", - "lint:docs:ci": "eslint --ignore-path .gitignore src/pages/learn --format eslint-formatter-github", + "lint:docs": "eslint --ignore-path .gitignore src/pages/learn", "postbuild": "next-sitemap", "prebuild": "tsx src/get-github-info.ts", "start": "next start", @@ -74,10 +73,12 @@ "@types/string-similarity": "^4.0.2", "@typescript-eslint/eslint-plugin": "7.18.0", "@typescript-eslint/parser": "7.18.0", + "chalk": "^5.4.1", "eslint": "8.57.1", "eslint-config-prettier": "^9.1.0", "eslint-plugin-mdx": "^3.1.5", "eslint-plugin-tailwindcss": "3.17.5", + "glob": "^11.0.2", "prettier": "3.4.2", "prettier-plugin-pkg": "^0.18.1", "prettier-plugin-tailwindcss": "^0.6.9", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c830a6cbd2..dfc3de4500 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -170,6 +170,9 @@ importers: '@typescript-eslint/parser': specifier: 7.18.0 version: 7.18.0(eslint@8.57.1)(typescript@5.7.2) + chalk: + specifier: ^5.4.1 + version: 5.4.1 eslint: specifier: 8.57.1 version: 8.57.1 @@ -182,6 +185,9 @@ importers: eslint-plugin-tailwindcss: specifier: 3.17.5 version: 3.17.5(tailwindcss@3.4.17) + glob: + specifier: ^11.0.2 + version: 11.0.2 prettier: specifier: 3.4.2 version: 3.4.2 @@ -2069,6 +2075,10 @@ packages: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} + chalk@5.4.1: + resolution: {integrity: sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==} + engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + character-entities-html4@2.1.0: resolution: {integrity: sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==} @@ -2764,15 +2774,15 @@ packages: resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} engines: {node: '>=10.13.0'} - glob@10.3.10: - resolution: {integrity: sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==} - engines: {node: '>=16 || 14 >=14.17'} - hasBin: true - glob@10.4.5: resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} hasBin: true + glob@11.0.2: + resolution: {integrity: sha512-YT7U7Vye+t5fZ/QMkBFrTJ7ZQxInIUjwyAjVj84CYXqgBdv30MFUPGnBR6sQaVq6Is15wYJUsnzTuWaGRBhBAQ==} + engines: {node: 20 || >=22} + hasBin: true + glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} deprecated: Glob versions prior to v9 are no longer supported @@ -3083,13 +3093,13 @@ packages: peerDependencies: ws: '*' - jackspeak@2.3.6: - resolution: {integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==} - engines: {node: '>=14'} - jackspeak@3.4.3: resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} + jackspeak@4.1.0: + resolution: {integrity: sha512-9DDdhb5j6cpeitCbvLO7n7J4IxnbM6hoF6O1g4HQ5TfhvvKN8ywDM7668ZhMHRqVmxqhps/F6syWK2KcPxYlkw==} + engines: {node: 20 || >=22} + jiti@1.21.7: resolution: {integrity: sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==} hasBin: true @@ -3250,6 +3260,10 @@ packages: lru-cache@10.4.3: resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} + lru-cache@11.1.0: + resolution: {integrity: sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A==} + engines: {node: 20 || >=22} + lru-cache@4.1.5: resolution: {integrity: sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==} @@ -3575,6 +3589,10 @@ packages: engines: {node: '>=4'} hasBin: true + minimatch@10.0.1: + resolution: {integrity: sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==} + engines: {node: 20 || >=22} + minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} @@ -3846,6 +3864,10 @@ packages: resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} engines: {node: '>=16 || 14 >=14.18'} + path-scurry@2.0.0: + resolution: {integrity: sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==} + engines: {node: 20 || >=22} + path-type@4.0.0: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} @@ -6204,7 +6226,7 @@ snapshots: '@npmcli/map-workspaces@3.0.4': dependencies: '@npmcli/name-from-folder': 2.0.0 - glob: 10.3.10 + glob: 10.4.5 minimatch: 9.0.5 read-package-json-fast: 3.0.2 @@ -6849,6 +6871,8 @@ snapshots: ansi-styles: 4.3.0 supports-color: 7.2.0 + chalk@5.4.1: {} + character-entities-html4@2.1.0: {} character-entities-legacy@1.1.4: {} @@ -7618,22 +7642,23 @@ snapshots: dependencies: is-glob: 4.0.3 - glob@10.3.10: + glob@10.4.5: dependencies: foreground-child: 3.3.0 - jackspeak: 2.3.6 + jackspeak: 3.4.3 minimatch: 9.0.5 minipass: 7.1.2 + package-json-from-dist: 1.0.1 path-scurry: 1.11.1 - glob@10.4.5: + glob@11.0.2: dependencies: foreground-child: 3.3.0 - jackspeak: 3.4.3 - minimatch: 9.0.5 + jackspeak: 4.1.0 + minimatch: 10.0.1 minipass: 7.1.2 package-json-from-dist: 1.0.1 - path-scurry: 1.11.1 + path-scurry: 2.0.0 glob@7.2.3: dependencies: @@ -8001,17 +8026,15 @@ snapshots: dependencies: ws: 8.18.0 - jackspeak@2.3.6: + jackspeak@3.4.3: dependencies: '@isaacs/cliui': 8.0.2 optionalDependencies: '@pkgjs/parseargs': 0.11.0 - jackspeak@3.4.3: + jackspeak@4.1.0: dependencies: '@isaacs/cliui': 8.0.2 - optionalDependencies: - '@pkgjs/parseargs': 0.11.0 jiti@1.21.7: {} @@ -8136,6 +8159,8 @@ snapshots: lru-cache@10.4.3: {} + lru-cache@11.1.0: {} + lru-cache@4.1.5: dependencies: pseudomap: 1.0.2 @@ -8867,6 +8892,10 @@ snapshots: mime@1.6.0: optional: true + minimatch@10.0.1: + dependencies: + brace-expansion: 2.0.1 + minimatch@3.1.2: dependencies: brace-expansion: 1.1.11 @@ -9192,6 +9221,11 @@ snapshots: lru-cache: 10.4.3 minipass: 7.1.2 + path-scurry@2.0.0: + dependencies: + lru-cache: 11.1.0 + minipass: 7.1.2 + path-type@4.0.0: {} periscopic@3.1.0: @@ -9950,7 +9984,7 @@ snapshots: '@ungap/structured-clone': 1.2.0 concat-stream: 2.0.0 debug: 4.3.4 - glob: 10.3.10 + glob: 10.4.5 ignore: 5.3.1 is-empty: 1.2.0 is-plain-obj: 4.1.0 diff --git a/scripts/validate-snippets.js b/scripts/validate-snippets.js index 8bd70c09bf..69c8dcf72c 100644 --- a/scripts/validate-snippets.js +++ b/scripts/validate-snippets.js @@ -2,7 +2,7 @@ import fs from "node:fs" import path from "node:path" -import glob from "glob" +import { glob } from "glob" import { parse } from "graphql" import chalk from "chalk" import { fileURLToPath } from "node:url"