diff --git a/.cache/eleventy-fetch-1dcf9357ed5b361c3c135a3316eda0 b/.cache/eleventy-fetch-1dcf9357ed5b361c3c135a3316eda0 new file mode 100644 index 00000000..b1cf16be --- /dev/null +++ b/.cache/eleventy-fetch-1dcf9357ed5b361c3c135a3316eda0 @@ -0,0 +1 @@ +{"cachedAt":1772787204171,"type":"buffer","metadata":{"response":{"url":"https://api.github.com/repos/Tuhura-Tech/wiki/contributors?per_page=100&page=1","status":200,"headers":{"access-control-allow-origin":"*","access-control-expose-headers":"ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset","cache-control":"public, max-age=60, s-maxage=60","content-encoding":"gzip","content-security-policy":"default-src 'none'","content-type":"application/json; charset=utf-8","date":"Fri, 06 Mar 2026 08:53:24 GMT","etag":"W/\"16d05c07d99e3dac97c06a5f90ccb36aa9ab26f3d4aa71472e22e475d5fdd661\"","last-modified":"Sat, 21 Feb 2026 22:49:34 GMT","referrer-policy":"origin-when-cross-origin, strict-origin-when-cross-origin","server":"github.com","strict-transport-security":"max-age=31536000; includeSubdomains; preload","transfer-encoding":"chunked","vary":"Accept,Accept-Encoding, Accept, X-Requested-With","x-content-type-options":"nosniff","x-frame-options":"deny","x-github-api-version-selected":"2022-11-28","x-github-media-type":"github.v3; format=json","x-github-request-id":"4DCA:237804:A4A6AF:C4DD64:69AA9603","x-ratelimit-limit":"60","x-ratelimit-remaining":"58","x-ratelimit-reset":"1772789540","x-ratelimit-resource":"core","x-ratelimit-used":"2","x-xss-protection":"0"}}}} \ No newline at end of file diff --git a/.cache/eleventy-fetch-1dcf9357ed5b361c3c135a3316eda0.buffer b/.cache/eleventy-fetch-1dcf9357ed5b361c3c135a3316eda0.buffer new file mode 100644 index 00000000..9eb933a8 --- /dev/null +++ b/.cache/eleventy-fetch-1dcf9357ed5b361c3c135a3316eda0.buffer @@ -0,0 +1 @@ +[{"login":"renovate[bot]","id":29139614,"node_id":"MDM6Qm90MjkxMzk2MTQ=","avatar_url":"https://avatars.githubusercontent.com/in/2740?v=4","gravatar_id":"","url":"https://api.github.com/users/renovate%5Bbot%5D","html_url":"https://github.com/apps/renovate","followers_url":"https://api.github.com/users/renovate%5Bbot%5D/followers","following_url":"https://api.github.com/users/renovate%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/renovate%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/renovate%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/renovate%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/renovate%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/renovate%5Bbot%5D/repos","events_url":"https://api.github.com/users/renovate%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/renovate%5Bbot%5D/received_events","type":"Bot","user_view_type":"public","site_admin":false,"contributions":613},{"login":"Darkflame72","id":31436575,"node_id":"MDQ6VXNlcjMxNDM2NTc1","avatar_url":"https://avatars.githubusercontent.com/u/31436575?v=4","gravatar_id":"","url":"https://api.github.com/users/Darkflame72","html_url":"https://github.com/Darkflame72","followers_url":"https://api.github.com/users/Darkflame72/followers","following_url":"https://api.github.com/users/Darkflame72/following{/other_user}","gists_url":"https://api.github.com/users/Darkflame72/gists{/gist_id}","starred_url":"https://api.github.com/users/Darkflame72/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Darkflame72/subscriptions","organizations_url":"https://api.github.com/users/Darkflame72/orgs","repos_url":"https://api.github.com/users/Darkflame72/repos","events_url":"https://api.github.com/users/Darkflame72/events{/privacy}","received_events_url":"https://api.github.com/users/Darkflame72/received_events","type":"User","user_view_type":"public","site_admin":false,"contributions":69},{"login":"BoopEnthusiast","id":102631339,"node_id":"U_kgDOBh4Hqw","avatar_url":"https://avatars.githubusercontent.com/u/102631339?v=4","gravatar_id":"","url":"https://api.github.com/users/BoopEnthusiast","html_url":"https://github.com/BoopEnthusiast","followers_url":"https://api.github.com/users/BoopEnthusiast/followers","following_url":"https://api.github.com/users/BoopEnthusiast/following{/other_user}","gists_url":"https://api.github.com/users/BoopEnthusiast/gists{/gist_id}","starred_url":"https://api.github.com/users/BoopEnthusiast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BoopEnthusiast/subscriptions","organizations_url":"https://api.github.com/users/BoopEnthusiast/orgs","repos_url":"https://api.github.com/users/BoopEnthusiast/repos","events_url":"https://api.github.com/users/BoopEnthusiast/events{/privacy}","received_events_url":"https://api.github.com/users/BoopEnthusiast/received_events","type":"User","user_view_type":"public","site_admin":false,"contributions":12},{"login":"clenneabig","id":27248862,"node_id":"MDQ6VXNlcjI3MjQ4ODYy","avatar_url":"https://avatars.githubusercontent.com/u/27248862?v=4","gravatar_id":"","url":"https://api.github.com/users/clenneabig","html_url":"https://github.com/clenneabig","followers_url":"https://api.github.com/users/clenneabig/followers","following_url":"https://api.github.com/users/clenneabig/following{/other_user}","gists_url":"https://api.github.com/users/clenneabig/gists{/gist_id}","starred_url":"https://api.github.com/users/clenneabig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clenneabig/subscriptions","organizations_url":"https://api.github.com/users/clenneabig/orgs","repos_url":"https://api.github.com/users/clenneabig/repos","events_url":"https://api.github.com/users/clenneabig/events{/privacy}","received_events_url":"https://api.github.com/users/clenneabig/received_events","type":"User","user_view_type":"public","site_admin":false,"contributions":11},{"login":"lillianhidet","id":70884833,"node_id":"MDQ6VXNlcjcwODg0ODMz","avatar_url":"https://avatars.githubusercontent.com/u/70884833?v=4","gravatar_id":"","url":"https://api.github.com/users/lillianhidet","html_url":"https://github.com/lillianhidet","followers_url":"https://api.github.com/users/lillianhidet/followers","following_url":"https://api.github.com/users/lillianhidet/following{/other_user}","gists_url":"https://api.github.com/users/lillianhidet/gists{/gist_id}","starred_url":"https://api.github.com/users/lillianhidet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lillianhidet/subscriptions","organizations_url":"https://api.github.com/users/lillianhidet/orgs","repos_url":"https://api.github.com/users/lillianhidet/repos","events_url":"https://api.github.com/users/lillianhidet/events{/privacy}","received_events_url":"https://api.github.com/users/lillianhidet/received_events","type":"User","user_view_type":"public","site_admin":false,"contributions":10},{"login":"arimulligan","id":90117279,"node_id":"MDQ6VXNlcjkwMTE3Mjc5","avatar_url":"https://avatars.githubusercontent.com/u/90117279?v=4","gravatar_id":"","url":"https://api.github.com/users/arimulligan","html_url":"https://github.com/arimulligan","followers_url":"https://api.github.com/users/arimulligan/followers","following_url":"https://api.github.com/users/arimulligan/following{/other_user}","gists_url":"https://api.github.com/users/arimulligan/gists{/gist_id}","starred_url":"https://api.github.com/users/arimulligan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arimulligan/subscriptions","organizations_url":"https://api.github.com/users/arimulligan/orgs","repos_url":"https://api.github.com/users/arimulligan/repos","events_url":"https://api.github.com/users/arimulligan/events{/privacy}","received_events_url":"https://api.github.com/users/arimulligan/received_events","type":"User","user_view_type":"public","site_admin":false,"contributions":5},{"login":"aroyasr","id":205250332,"node_id":"U_kgDODDvfHA","avatar_url":"https://avatars.githubusercontent.com/u/205250332?v=4","gravatar_id":"","url":"https://api.github.com/users/aroyasr","html_url":"https://github.com/aroyasr","followers_url":"https://api.github.com/users/aroyasr/followers","following_url":"https://api.github.com/users/aroyasr/following{/other_user}","gists_url":"https://api.github.com/users/aroyasr/gists{/gist_id}","starred_url":"https://api.github.com/users/aroyasr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aroyasr/subscriptions","organizations_url":"https://api.github.com/users/aroyasr/orgs","repos_url":"https://api.github.com/users/aroyasr/repos","events_url":"https://api.github.com/users/aroyasr/events{/privacy}","received_events_url":"https://api.github.com/users/aroyasr/received_events","type":"User","user_view_type":"public","site_admin":false,"contributions":3},{"login":"erictey","id":218436942,"node_id":"U_kgDODQUVTg","avatar_url":"https://avatars.githubusercontent.com/u/218436942?v=4","gravatar_id":"","url":"https://api.github.com/users/erictey","html_url":"https://github.com/erictey","followers_url":"https://api.github.com/users/erictey/followers","following_url":"https://api.github.com/users/erictey/following{/other_user}","gists_url":"https://api.github.com/users/erictey/gists{/gist_id}","starred_url":"https://api.github.com/users/erictey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erictey/subscriptions","organizations_url":"https://api.github.com/users/erictey/orgs","repos_url":"https://api.github.com/users/erictey/repos","events_url":"https://api.github.com/users/erictey/events{/privacy}","received_events_url":"https://api.github.com/users/erictey/received_events","type":"User","user_view_type":"public","site_admin":false,"contributions":2},{"login":"Skelmis","id":47520067,"node_id":"MDQ6VXNlcjQ3NTIwMDY3","avatar_url":"https://avatars.githubusercontent.com/u/47520067?v=4","gravatar_id":"","url":"https://api.github.com/users/Skelmis","html_url":"https://github.com/Skelmis","followers_url":"https://api.github.com/users/Skelmis/followers","following_url":"https://api.github.com/users/Skelmis/following{/other_user}","gists_url":"https://api.github.com/users/Skelmis/gists{/gist_id}","starred_url":"https://api.github.com/users/Skelmis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Skelmis/subscriptions","organizations_url":"https://api.github.com/users/Skelmis/orgs","repos_url":"https://api.github.com/users/Skelmis/repos","events_url":"https://api.github.com/users/Skelmis/events{/privacy}","received_events_url":"https://api.github.com/users/Skelmis/received_events","type":"User","user_view_type":"public","site_admin":false,"contributions":2},{"login":"AlexBerry0","id":116688562,"node_id":"U_kgDOBvSGsg","avatar_url":"https://avatars.githubusercontent.com/u/116688562?v=4","gravatar_id":"","url":"https://api.github.com/users/AlexBerry0","html_url":"https://github.com/AlexBerry0","followers_url":"https://api.github.com/users/AlexBerry0/followers","following_url":"https://api.github.com/users/AlexBerry0/following{/other_user}","gists_url":"https://api.github.com/users/AlexBerry0/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexBerry0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexBerry0/subscriptions","organizations_url":"https://api.github.com/users/AlexBerry0/orgs","repos_url":"https://api.github.com/users/AlexBerry0/repos","events_url":"https://api.github.com/users/AlexBerry0/events{/privacy}","received_events_url":"https://api.github.com/users/AlexBerry0/received_events","type":"User","user_view_type":"public","site_admin":false,"contributions":1},{"login":"CyberFlameGO","id":24910512,"node_id":"MDQ6VXNlcjI0OTEwNTEy","avatar_url":"https://avatars.githubusercontent.com/u/24910512?v=4","gravatar_id":"","url":"https://api.github.com/users/CyberFlameGO","html_url":"https://github.com/CyberFlameGO","followers_url":"https://api.github.com/users/CyberFlameGO/followers","following_url":"https://api.github.com/users/CyberFlameGO/following{/other_user}","gists_url":"https://api.github.com/users/CyberFlameGO/gists{/gist_id}","starred_url":"https://api.github.com/users/CyberFlameGO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CyberFlameGO/subscriptions","organizations_url":"https://api.github.com/users/CyberFlameGO/orgs","repos_url":"https://api.github.com/users/CyberFlameGO/repos","events_url":"https://api.github.com/users/CyberFlameGO/events{/privacy}","received_events_url":"https://api.github.com/users/CyberFlameGO/received_events","type":"User","user_view_type":"public","site_admin":false,"contributions":1}] \ No newline at end of file diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 191d8a4b..00000000 --- a/.editorconfig +++ /dev/null @@ -1,15 +0,0 @@ -# https://EditorConfig.org - -# top-most EditorConfig file -root = true - -[*] -charset = utf-8 -end_of_line = lf -indent_size = 2 -indent_style = tab -insert_final_newline = true -trim_trailing_whitespace = false - -[{.*,*.md,*.mdx,*.json,*.toml,*.yml,}] -indent_style = space diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index f70a65a0..00000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @Darkflame72 \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index d8d2ef31..00000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,5 +0,0 @@ -blank_issues_enabled: true -contact_links: - - name: Tūhura Tech Discord - url: https://discord.gg/PNxh7cwKfQ - about: Please ask and answer questions here. diff --git a/.github/ISSUE_TEMPLATE/new_topic.yaml b/.github/ISSUE_TEMPLATE/new_topic.yaml deleted file mode 100644 index 0e05415c..00000000 --- a/.github/ISSUE_TEMPLATE/new_topic.yaml +++ /dev/null @@ -1,74 +0,0 @@ -name: Request a new topic -description: Request a new topic to be added to the Wiki -title: "[Topic Request]: " -labels: ["new-topic"] -projects: ["Tuhura-Tech/2"] -body: - - type: markdown - attributes: - value: | - Thanks for requesting a new topic to be added to the wiki! - - type: textarea - id: description - attributes: - label: What is the topic? - description: Please describe the topic that you believe should be added along with any information around it. This should include the technology used, how it could tie into other resources (if applicable) and what you think it should cover. Please also indicate any specific prior knowledge or topics that should be assumed for this topic. - placeholder: Really interesting topic that should be added. - value: "Topic information!" - validations: - required: true - - type: dropdown - id: category - attributes: - label: What category would the topic best fit under? - multiple: false - options: - - Python - - JS/TS - - Game Development - - Cyber Security - - Electronics - - Design/Modelling - - NCEA resources - - Other - validations: - required: true - - type: dropdown - id: diataxis - attributes: - label: What [Diataxis](https://diataxis.fr/) category would the topic best fit under? - multiple: false - options: - - Tutorial - - How to guide - - Explanation - - Reference - validations: - required: true - - type: dropdown - id: prior-knowledge - attributes: - label: What prior knowledge should be assumed for this resource? - multiple: false - options: - - No Prior knowledge - - Basic Familiarity with the topic area - - Familiar with the topic area - validations: - required: true - - type: checkboxes - id: assist - attributes: - label: Would you be willing to contribute to or help review this resource? - description: Will you be able to give some of your time to either help build or at least review the completed resource? - options: - - label: I agree to help with this resource - required: false - - type: checkboxes - id: terms - attributes: - label: Code of Conduct - description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/Tuhura-Tech/wiki/blob/main/CODE_OF_CONDUCT.md). - options: - - label: I agree to follow this project's Code of Conduct - required: true diff --git a/.github/ISSUE_TEMPLATE/topic_issue.yaml b/.github/ISSUE_TEMPLATE/topic_issue.yaml deleted file mode 100644 index d6b52fee..00000000 --- a/.github/ISSUE_TEMPLATE/topic_issue.yaml +++ /dev/null @@ -1,41 +0,0 @@ -name: Request an issue with a topic -description: Request a new topic to be added to the Wiki -title: "[Issue]: " -labels: ["topic-issue"] -projects: ["Tuhura-Tech/2"] -body: - - type: markdown - attributes: - value: | - Thanks for reporting an issue with a resource! - - type: textarea - id: description - attributes: - label: What is wrong with this resource? - description: Please describe the the issue with this resource, this could be incorrect information, out of date details or any other issues. - placeholder: X and Y are wrong with this resources because... - validations: - required: true - - type: input - id: category - attributes: - label: What is the url to the page? - description: Please provide the url to the page with the issue. - placeholder: https://wiki.tuhuratech.org.nz/ - value: https://wiki.tuhuratech.org.nz/ - - type: checkboxes - id: assist - attributes: - label: Would you be willing to contribute to or help review this resource? - description: Will you be able to give some of your time to either help fix or at least review the fixed resource? - options: - - label: I agree to help with this resource - required: false - - type: checkboxes - id: terms - attributes: - label: Code of Conduct - description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/Tuhura-Tech/wiki/blob/main/CODE_OF_CONDUCT.md). - options: - - label: I agree to follow this project's Code of Conduct - required: true diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 8726e976..00000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,11 +0,0 @@ - - -#### Description (required) - - - -#### Related issues & labels (optional) - -- Closes # -- Suggested label: - diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml deleted file mode 100644 index 9efcd25e..00000000 --- a/.github/actions/install/action.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Install Tools & Dependencies -description: Installs pnpm, Node.js & package dependencies - -runs: - using: composite - steps: - - name: Setup PNPM - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4 - - - name: Setup Node - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 - with: - node-version: 20 - cache: pnpm - - - name: Install dependencies - run: pnpm install - shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 7ef905f2..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: CI - -on: - push: - branches: [main] - merge_group: - pull_request: - -# Automatically cancel in-progress actions on the same branch -concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }} - cancel-in-progress: true - -jobs: - astrocheck: - name: Check for type issues with astro check - runs-on: ubuntu-latest - env: - FORCE_COLOR: true - timeout-minutes: 15 - steps: - - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - - - name: Install Tools & Dependencies - uses: ./.github/actions/install - - - name: Run Check - run: pnpm run check - eslint: - name: Check for code issues with ESLint - runs-on: ubuntu-latest - timeout-minutes: 15 - steps: - - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - - - name: Install Tools & Dependencies - uses: ./.github/actions/install - - - name: Run Check - run: pnpm run lint:eslint diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml deleted file mode 100644 index 5b61cfce..00000000 --- a/.github/workflows/format.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: 'Format Code' - -on: - push: - branches: - - main - -jobs: - format: - runs-on: ubuntu-latest - steps: - - name: Check out code using Git - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - with: - ref: ${{ github.head_ref }} - # Needs access to push to main - token: ${{ secrets.BOT_GITHUB_TOKEN }} - - name: Install Tools & Dependencies - uses: ./.github/actions/install - - name: Format code - run: pnpm run format:ci - - name: Commit changes - uses: stefanzweifel/git-auto-commit-action@b863ae1933cb653a53c021fe36dbb774e1fb9403 # v5 - with: - commit_message: '[ci] format' - branch: ${{ github.head_ref }} - commit_user_name: bot - commit_user_email: bot@tuhuratech.org.nz diff --git a/.github/workflows/lint-pr.yml b/.github/workflows/lint-pr.yml deleted file mode 100644 index 1400a293..00000000 --- a/.github/workflows/lint-pr.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: "Lint PR" - -on: - pull_request_target: - types: - - opened - - edited - - synchronize - -permissions: - pull-requests: read - -jobs: - main: - name: Validate PR title - runs-on: ubuntu-latest - steps: - - uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pr-coauthor.yml b/.github/workflows/pr-coauthor.yml deleted file mode 100644 index ac4142ae..00000000 --- a/.github/workflows/pr-coauthor.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Write coauthors to a pull request -permissions: - pull-requests: write - -on: - issue_comment: - types: - - created - -jobs: - generate-coauthors: - name: Generate Coauthor - if: ${{ github.event.issue.pull_request }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - - uses: kevinzunigacuellar/coauthor-action@292b32bdbffc663431a2a37b3bfa597d83a74905 # v0.1.3 diff --git a/.gitignore b/.gitignore index a93e596b..38eb16c9 100644 --- a/.gitignore +++ b/.gitignore @@ -38,4 +38,4 @@ sandbox.config.json **/_fonts/brand/ # Wranger folder -.wrangler +.wrangler \ No newline at end of file diff --git a/.npmrc b/.npmrc deleted file mode 100644 index 3bd3b7de..00000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -shell-emulator=true diff --git a/.nvmrc b/.nvmrc deleted file mode 100644 index aa50a62f..00000000 --- a/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -22.21.0 diff --git a/.prettierignore b/.prettierignore index 3e30e177..2d7482a3 100644 --- a/.prettierignore +++ b/.prettierignore @@ -4,4 +4,4 @@ node_modules .changeset *.md *.mdx -pnpm-lock.yaml +pnpm-lock.yaml \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..22a15055 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,4 @@ +{ + "recommendations": ["astro-build.astro-vscode"], + "unwantedRecommendations": [] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..d6422097 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,11 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "command": "./node_modules/.bin/astro dev", + "name": "Development server", + "request": "launch", + "type": "node-terminal" + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index a2219be4..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "files.readonlyInclude": { - "src/content/docs/en/reference/errors/*": true, - "src/content/docs/en/reference/configuration-reference.mdx": true, - "src/content/docs/en/reference/error-reference.mdx": true - }, - "[javascript]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[typescript]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[mdx]": { - "files.trimTrailingWhitespace": false - } -} diff --git a/astro.config.mjs b/astro.config.mjs new file mode 100644 index 00000000..e407eb3f --- /dev/null +++ b/astro.config.mjs @@ -0,0 +1,362 @@ +// @ts-check +import { defineConfig } from 'astro/config'; +import starlight from '@astrojs/starlight'; + +import tailwindcss from '@tailwindcss/vite'; + +// https://astro.build/config +export default defineConfig({ + site: 'https://wiki.tuhuratech.org.nz', + + integrations: [ + starlight({ + //Site config + title: 'Wiki', + social: [ + { icon: 'discord', label: 'Discord', href: 'https://discord.gg/PNxh7cwKfQ' }, + { icon: 'github', label: 'GitHub', href: 'https://github.com/Tuhura-Tech/Wiki' }, + { icon: 'mastodon', label: 'Mastodon', href: 'https://mastodon.nzoss.nz/@tuhuratech' }, + { icon: 'instagram', label: 'Instagram', href: 'https://www.instagram.com/tuhura_tech' }, + { + icon: 'facebook', + label: 'Facebook', + href: 'https://www.facebook.com/p/T%C5%ABhura-Tech-100083052084710/', + }, + { + icon: 'linkedin', + label: 'Linkedin', + href: 'https://www.linkedin.com/company/tuhuratech', + }, + { icon: 'email', label: 'Email', href: 'mailto:contact@tuhuratech.org.nz' }, + ], + + logo: { + light: './public/assets/full-logo-light.png', + dark: './public/assets/full-logo-dark.png', + replacesTitle: true, + }, + + favicon: '/favicon.ico', + + customCss: ['./src/styles/global.css'], + + components: { + Sidebar: './src/components/starlight/Sidebar.astro', + }, + + //Locales + defaultLocale: 'en', + locales: { + en: { + label: 'English', + }, + }, + + //Sidebar Config + sidebar: [ + { + label: 'Guides and Resources', + items: [ + { + label: 'Contribute to this Wiki', + collapsed: true, + autogenerate: { directory: 'guides/contribute' }, + }, + { + label: 'Game Development', + items: [ + // Each item here is one entry in the navigation menu. + { label: 'About', slug: 'guides/game-dev' }, + { label: 'Godot Basics', slug: 'guides/game-dev/basics' }, + { label: 'Godot Tips', slug: 'guides/game-dev/universal' }, + { label: 'Godot with C#', slug: 'guides/game-dev/projectsetup' }, + { label: 'Godot Tilemap Pathfinding', slug: 'guides/game-dev/tilemapnavigation' }, + { + label: '2D Games', + collapsed: true, + items: [ + { + label: '2D Platformer', + collapsed: true, + items: [ + { + label: '1. Making the Player', + slug: 'guides/game-dev/2dplatformer/0-making-the-player', + }, + { + label: '2. Creating a level', + slug: 'guides/game-dev/2dplatformer/1-creating-a-level', + }, + { + label: '3. Adding Movement', + slug: 'guides/game-dev/2dplatformer/2-adding-movement', + }, + { + label: '4. Adding Killzones', + slug: 'guides/game-dev/2dplatformer/3-adding-killzones', + }, + { + label: '5. Making Enemies', + slug: 'guides/game-dev/2dplatformer/4-making-enemies', + }, + { + label: '6. Adding Items', + slug: 'guides/game-dev/2dplatformer/5-adding-items', + }, + { + label: '7. Connecting Levels', + slug: 'guides/game-dev/2dplatformer/6-connecting-levels', + }, + ], + }, + { + label: '2D Racing Game', + collapsed: true, + items: [ + { + label: '1. Making the Cars', + slug: 'guides/game-dev/2dracing/0-making-the-cars', + }, + { + label: '2. Making the Track', + slug: 'guides/game-dev/2dracing/1-making-the-track', + }, + { + label: '3. Making the Menu', + slug: 'guides/game-dev/2dracing/2-making-the-menu', + }, + ], + }, + { + label: 'Dungeon Crawler', + collapsed: true, + items: [ + { + label: '1. Scene Setup', + slug: 'guides/game-dev/dungeoncrawler/0-scenesetup', + }, + { label: '2. The Player', slug: 'guides/game-dev/dungeoncrawler/1-player' }, + { label: '3. The Level', slug: 'guides/game-dev/dungeoncrawler/2-level' }, + { + label: '4. Player Improvement', + slug: 'guides/game-dev/dungeoncrawler/3-playerimprovement', + }, + { + label: '5. Adding the Weapon', + slug: 'guides/game-dev/dungeoncrawler/4-weapon', + }, + { + label: '6. Player Health', + slug: 'guides/game-dev/dungeoncrawler/5-health', + }, + { label: '7. Pickups', slug: 'guides/game-dev/dungeoncrawler/6-pickups' }, + { label: '8. Enemies', slug: 'guides/game-dev/dungeoncrawler/7-enemy' }, + { + label: '9. Multiple Levels', + slug: 'guides/game-dev/dungeoncrawler/8-levels', + }, + { + label: '10. Finishing Up', + slug: 'guides/game-dev/dungeoncrawler/9-finish', + }, + ], + }, + { + label: 'Survivors-Like', + collapsed: true, + items: [ + { label: '1. Setting Up', slug: 'guides/game-dev/survivors/0-settingup' }, + { label: '2. Enemies', slug: 'guides/game-dev/survivors/1-enemies' }, + { label: '3. Health', slug: 'guides/game-dev/survivors/2-health' }, + { label: '4. Spawning', slug: 'guides/game-dev/survivors/3-spawning' }, + { + label: '5. Projectiles', + slug: 'guides/game-dev/survivors/4-projectiles', + }, + { label: '6. Aiming', slug: 'guides/game-dev/survivors/5-aiming' }, + { label: '7. Score', slug: 'guides/game-dev/survivors/6-score' }, + { + label: '8. Bullet Types', + slug: 'guides/game-dev/survivors/7-bullettypes', + }, + { label: '9. Bullet Types', slug: 'guides/game-dev/survivors/8-polish' }, + ], + }, + ], + }, + { + label: '3D Games', + collapsed: true, + items: [ + { + label: '3D Intro', + collapsed: true, + items: [ + { + label: '1. Making a Project', + slug: 'guides/game-dev/3d-intro/0-making-project', + }, + { + label: '2. Navigating the Viewport', + slug: 'guides/game-dev/3d-intro/1-navigating-viewport', + }, + { + label: '3. Making the Player', + slug: 'guides/game-dev/3d-intro/2-making-the-player', + }, + { + label: '4. Controlling the Camera', + slug: 'guides/game-dev/3d-intro/3-controlling-camera', + }, + { + label: '5. Changing Controls', + slug: 'guides/game-dev/3d-intro/4-changing-controls', + }, + { + label: '6. Making Platforms', + slug: 'guides/game-dev/3d-intro/5-making-platforms', + }, + { + label: '7. Adding a Button', + slug: 'guides/game-dev/3d-intro/6-adding-a-button', + }, + { + label: '8. Scripting the Button', + slug: 'guides/game-dev/3d-intro/7-scripting-button', + }, + ], + }, + { + label: '3D Racing Game', + collapsed: true, + items: [ + { + label: '1. Scene Setup', + slug: 'guides/game-dev/3dracinggame/0-main-scene', + }, + { + label: '2. Making the Car', + slug: 'guides/game-dev/3dracinggame/1-making-the-car', + }, + { + label: '3. Car Controls', + slug: 'guides/game-dev/3dracinggame/2-car-controls', + }, + { + label: '4. Track Building', + slug: 'guides/game-dev/3dracinggame/3-track-building', + }, + { label: '5. Main Menu', slug: 'guides/game-dev/3dracinggame/4-main-menu' }, + ], + }, + { + label: 'First Person Game', + collapsed: true, + items: [ + { label: '1. Scene Setup', slug: 'guides/game-dev/crystalgame/0-setup' }, + { + label: '2. Character Controller', + slug: 'guides/game-dev/crystalgame/1-charactercontroller', + }, + { label: '3. Objective', slug: 'guides/game-dev/crystalgame/2-objective' }, + { label: '4. Enemies', slug: 'guides/game-dev/crystalgame/3-enemies' }, + { + label: '5. Enemy Spawning', + slug: 'guides/game-dev/crystalgame/4-spawning', + }, + { + label: '6. Fighting Back', + slug: 'guides/game-dev/crystalgame/5-fightingback', + }, + { label: '7. User Interface', slug: 'guides/game-dev/crystalgame/6-ui' }, + { label: '8. Winning', slug: 'guides/game-dev/crystalgame/7-winning' }, + { + label: '9. Finishing Up', + slug: 'guides/game-dev/crystalgame/8-finishingup', + }, + ], + }, + ], + }, + ], + }, + { + label: 'Cybersecurity', + autogenerate: { directory: 'guides/cybersecurity' }, + }, + { + label: 'Blender', + autogenerate: { directory: 'guides/blender' }, + }, + { + label: 'Databases', + autogenerate: { directory: 'guides/database' }, + }, + { + label: 'Javascript', + autogenerate: { directory: 'guides/javascript' }, + }, + { + label: 'Python', + items: [ + { label: 'Introduction', slug: 'guides/python' }, + { label: 'Conditionals & Loops', slug: 'guides/python/conditionals-loops' }, + { label: 'Functions', slug: 'guides/python/functions' }, + { + label: 'Lists, Tuples, and Dictionaries', + slug: 'guides/python/lists-tuples-dicts', + }, + { label: 'Classes', slug: 'guides/python/classes' }, + { + label: 'Turtle', + collapsed: true, + items: [ + { label: '1. Setup', slug: 'guides/python/turtle/0-setup' }, + { label: '2. Basics', slug: 'guides/python/turtle/1-basics' }, + { label: '3. Variables', slug: 'guides/python/turtle/2-variables' }, + { label: '4. Lists', slug: 'guides/python/turtle/3-lists' }, + { label: '5. Extra', slug: 'guides/python/turtle/4-extra' }, + { label: '6. Hangman', slug: 'guides/python/turtle/5-hangman' }, + ], + }, + { + label: 'Flask', + collapsed: true, + autogenerate: { directory: 'guides/python/Flask' }, + }, + ], + }, + ], + }, + { + label: 'NCEA', + items: [ + { + label: 'Level 1', + collapsed: true, + autogenerate: { directory: 'ncea/level-1' }, + }, + { + label: 'Level 2', + collapsed: true, + autogenerate: { directory: 'ncea/level-2' }, + }, + { + label: 'Level 3', + collapsed: true, + autogenerate: { directory: 'ncea/level-3' }, + }, + ], + }, + //{ + // label: 'Micro-Credentials', + // items: [] + //}, + ], + }), + ], + + vite: { + plugins: [tailwindcss()], + }, +}); diff --git a/astro.config.ts b/astro.config.ts deleted file mode 100644 index 173a2044..00000000 --- a/astro.config.ts +++ /dev/null @@ -1,120 +0,0 @@ -import starlight from '@astrojs/starlight'; -import { pluginCollapsibleSections } from '@expressive-code/plugin-collapsible-sections'; -import { defineConfig, sharpImageService } from 'astro/config'; -import rehypeSlug from 'rehype-slug'; -import remarkSmartypants from 'remark-smartypants'; -import { sidebar } from './astro.sidebar'; -import { devServerFileWatcher } from './config/integrations/dev-server-file-watcher'; -import { sitemap } from './config/integrations/sitemap'; -import { makeLocalesConfig } from './config/locales'; -import { starlightPluginAutolinkHeadings } from './config/plugins/rehype-autolink'; -import { rehypeTasklistEnhancer } from './config/plugins/rehype-tasklist-enhancer'; -import { remarkFallbackLang } from './config/plugins/remark-fallback-lang'; - -import tailwind from '@astrojs/tailwind'; - -// https://astro.build/config -export default defineConfig({ - site: 'https://wiki.tuhuratech.org.nz', - integrations: [ - devServerFileWatcher([ - './config/*', // Custom plugins and integrations - './astro.sidebar.ts', // Sidebar configuration file - './src/content/nav/*.ts', // Sidebar labels - ]), - starlight({ - title: 'Wiki', - description: - 'A collection of guides and resources for learning technology targeted towards tamariki and rangatahi in Aotearoa', - expressiveCode: { - // @ts-expect-error: Temporarily silencing error until full wiki update can resolve - plugins: [pluginCollapsibleSections()] - }, - customCss: [ - // Path to your Tailwind base styles: - './src/tailwind.css', - ], - logo: { - light: './public/assets/full-logo-light.png', - dark: './public/assets/full-logo-dark.png', - replacesTitle: true, - }, - components: { - EditLink: './src/components/starlight/EditLink.astro', - Head: './src/components/starlight/Head.astro', - Hero: './src/components/starlight/Hero.astro', - MarkdownContent: './src/components/starlight/MarkdownContent.astro', - MobileTableOfContents: './src/components/starlight/MobileTableOfContents.astro', - TableOfContents: './src/components/starlight/TableOfContents.astro', - PageSidebar: './src/components/starlight/PageSidebar.astro', - Pagination: './src/components/starlight/Pagination.astro', - Footer: './src/components/starlight/Footer.astro', - Search: './src/components/starlight/Search.astro', - Sidebar: './src/components/starlight/Sidebar.astro', - MobileMenuFooter: './src/components/starlight/MobileMenuFooter.astro', - }, - editLink: { - baseUrl: 'https://github.com/Tuhura-Tech/Wiki/blob/main/', - }, - defaultLocale: 'en', - locales: makeLocalesConfig(), - sidebar, - social: { - discord: 'https://discord.gg/PNxh7cwKfQ', - github: 'https://github.com/Tuhura-Tech/Wiki', - mastodon: 'https://mastodon.nzoss.nz/@tuhuratech', - instagram: 'https://www.instagram.com/tuhura_tech', - facebook: 'https://www.facebook.com/p/T%C5%ABhura-Tech-100083052084710/', - linkedin: 'https://www.linkedin.com/company/tuhuratech', - email: 'mailto:contact@tuhuratech.org.nz', - matrix: 'https://matrix.to/#/#home:tuhuratech.org.nz', - }, - pagefind: false, - head: [ - // Add ICO favicon fallback for Safari. - { - tag: 'link', - attrs: { - rel: 'icon', - href: '/favicon.ico', - sizes: '32x32', - }, - }, - { - tag: 'script', - attrs: { - src: 'https://plausible.tuhuratech.org.nz/js/script.js', - 'data-domain': 'wiki.tuhuratech.org.nz', - defer: true, - }, - }, - ], - disable404Route: true, - plugins: [starlightPluginAutolinkHeadings()], - }), - sitemap(), - tailwind({ - // Disable the default base styles: - applyBaseStyles: false, - }), - ], - markdown: { - // Override with our own config - smartypants: false, - remarkPlugins: [ - // @ts-expect-error: Temporarily silencing error until full wiki update can resolve - [remarkSmartypants, { dashes: false }], - // Add our custom plugin that marks links to fallback language pages - remarkFallbackLang(), - ], - rehypePlugins: [ - rehypeSlug, - // Tweak GFM task list syntax - rehypeTasklistEnhancer(), - ], - }, - image: { - domains: ['avatars.githubusercontent.com'], - service: sharpImageService(), - }, -}); diff --git a/astro.sidebar.ts b/astro.sidebar.ts deleted file mode 100644 index a7b00d99..00000000 --- a/astro.sidebar.ts +++ /dev/null @@ -1,217 +0,0 @@ -import type { StarlightUserConfig } from '@astrojs/starlight/types'; -import { group } from './config/sidebar'; - -/** - * Starlight sidebar configuration object for the global site sidebar. - * - * - Top-level groups become tabs. - * - Use the `group()` utility function to define groups. This uses labels from our - * `src/content/nav/*.ts` files instead of defining labels and translations inline. - * - */ -export const sidebar = [ - // Guides - group('guide', { - items: [ - 'guides', - group('guide.game_dev', { - items: [ - { - label: 'About', - link: 'guides/game-dev', - }, - { - label: 'Godot Basics', - link: 'guides/game-dev/basics', - }, - { - label: '2D Platformer', - link: 'guides/game-dev/2dplatformer/0-making-the-player', - }, - { - label: '2D Racing Game', - link: 'guides/game-dev/2dracing/0-making-the-cars', - }, - { - label: 'Universal Features', - link: 'guides/game-dev/universal', - }, - { - label: 'Survivors-Like', - link: 'guides/game-dev/survivors/0-settingup', - }, - { - label: 'Top-down Dungeon Crawler', - link: 'guides/game-dev/dungeoncrawler/0-scenesetup/', - }, - { - label: 'Setting up C# For Godot', - link: 'guides/game-dev/projectsetup', - }, - { - label: 'Tilemap Navigation', - link: 'guides/game-dev/tilemapnavigation', - }, - { - label: '3D Games', - items: [ - { - label: '3D Intro', - link: 'guides/game-dev/3d-intro/0-making-project/', - }, - { - label: 'Starter 3D Game', - link: 'guides/game-dev/crystalgame/0-setup/', - }, - { - label: '3D Racing Game', - link: 'guides/game-dev/3dracinggame/0-main-scene/', - }, - - ], - collapsed: true, - }, - ], - }), - group('guide.security', { autogenerate: { directory: 'guides/cybersecurity' } }), - group('guide.3d', { autogenerate: { directory: 'guides/blender' } }), - group('guide.python', { - items: [ - { - label: 'Python Basics', - link: 'guides/python', - }, - { - label: 'Conditionals and Loops', - link: 'guides/python/conditionals-loops', - }, - { - label: 'Lists, Tuples, Dictionaries, and Sets', - link: 'guides/python/lists-tuples-dicts', - }, - { - label: 'Functions and Docstrings', - link: 'guides/python/functions', - }, - { - label: 'Classes and Object-Oriented Programming (OOP)', - link: 'guides/python/classes', - }, - { - label: 'Turtle', - link: 'guides/python/turtle/0-setup/', - }, - { - label: 'Setting Up', - link: 'guides/python/setting-up', - }, - { - label: 'Flask', - autogenerate: { - directory: 'guides/python/flask', - }, - collapsed: true, - }, - - ], - }), - group('guide.web', { - items: [ - { - label: 'HTML Reference', - link: 'guides/web/', - }, - { - label: 'HTML & CSS Intro', - items: [ - { - label: 'Intro', - link: 'guides/web/html-css-intro/0-intro/', - }, - { - label: 'Headers and Images', - link: 'guides/web/html-css-intro/1-headers-images/', - }, - { - label: 'CSS Basics', - link: 'guides/web/html-css-intro/2-css-basics/', - }, - { - label: 'Standard Formatting', - link: 'guides/web/html-css-intro/3-standard-formatting/', - }, - { - label: 'Background, borders, padding', - link: 'guides/web/html-css-intro/4-background-borders-padding/', - }, - { - label: 'Divs, IDs, Classes', - link: 'guides/web/html-css-intro/5-divs-ids-classes/', - }, - { - label: 'Fonts', - link: 'guides/web/html-css-intro/6-fonts/', - }, - { - label: 'Text Formatting', - link: 'guides/web/html-css-intro/7-text-formatting/', - }, - { - label: 'Flexbox', - link: 'guides/web/html-css-intro/8-flexbox/', - }, - { - label: 'Grid', - link: 'guides/web/html-css-intro/9-grid/', - }, - - ], - collapsed: true, - }, - ], - }), - group('guide.javascript', { - items: [ - { - label: 'Setting Up', - link: 'guides/javascript', - }, - { - label: 'Creative Coding', - autogenerate: { - directory: 'guides/javascript/creative-coding', - }, - collapsed: true, - }, - ], - }), - group('guide.database', { autogenerate: { directory: 'guides/database' } }), - group('guide.development', { autogenerate: { directory: 'guides/development' } }), - group('guide.contributing', { autogenerate: { directory: 'guides/contribute' } }), - ], - }), - - // NCEA Resources - group('ncea', { - items: [ - 'ncea', - group('ncea.level_1', { autogenerate: { directory: 'ncea/level-1' } }), - group('ncea.level_2', { autogenerate: { directory: 'ncea/level-2' } }), - group('ncea.level_3', { autogenerate: { directory: 'ncea/level-3' } }), - ], - }), - // Micro Credentials - group('microcredentials', { - items: [ - 'microcredentials', - group('microcredentials.web_dev', { items: [] }), - group('microcredentials.security', { items: [] }), - group('microcredentials.policy', { items: [] }), - group('microcredentials.ai_ml', { items: [] }), - group('microcredentials.cloud', { items: [] }), - group('microcredentials.electronics', { items: [] }), - group('microcredentials.software', { items: [] }), - group('microcredentials.game_dev', { items: [] }), - ], - }), -] satisfies StarlightUserConfig['sidebar']; diff --git a/config/README.md b/config/README.md deleted file mode 100644 index dfa8d6a1..00000000 --- a/config/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# `config/` - -This directory contains code related to configuring the docs site, which is used in [`astro.config.ts`](../astro.config.ts). - -Primarily these are custom Astro integrations (in [`integrations/`](./integrations/)) and plugins for remark, rehype, or Starlight (in [`plugins/`](./plugins/)). Other utilities to simplify configuring the site are also included here. diff --git a/config/integrations/dev-server-file-watcher.ts b/config/integrations/dev-server-file-watcher.ts deleted file mode 100644 index 5d70b484..00000000 --- a/config/integrations/dev-server-file-watcher.ts +++ /dev/null @@ -1,31 +0,0 @@ -import type { AstroIntegration } from 'astro'; -import glob from 'fast-glob'; - -/** - * Astro integration that registers the passed paths so that saving them triggers a dev server - * restart. - * - * It also supports passing glob patterns to watch a set of files matching a specific pattern. - * - * @param paths Array of file paths relative to the project root. - * - * @example - * // astro.config.mjs - * export default { - * integrations: [ - * devServerFileWatcher(["./example.js", "./src/content/demo/*.yml"]), - * ], - * } - */ -export const devServerFileWatcher = (paths: string[]) => - ({ - name: 'dev-server-file-watcher', - hooks: { - async 'astro:config:setup'({ addWatchFile, config }) { - for (const path of paths) { - const files = await glob(path); - files.forEach((file) => addWatchFile(new URL(file, config.root))); - } - }, - }, - }) satisfies AstroIntegration; diff --git a/config/integrations/sitemap.ts b/config/integrations/sitemap.ts deleted file mode 100644 index c54c93ba..00000000 --- a/config/integrations/sitemap.ts +++ /dev/null @@ -1,30 +0,0 @@ -import AstroSitemap from '@astrojs/sitemap'; -import type { AstroIntegration } from 'astro'; -import { normalizeLangTag } from '../../src/util/normalizeLangTag'; -import languages from '../../src/languages'; - -const langTags = Object.keys(languages); - -/** Set matching our `/[lang]/something.astro` redirect routes. */ -const blocklist = new Set([ - ...langTags.map((lang) => `/${lang}/`), - ...langTags.map((lang) => `/${lang}/install/`), - ...langTags.map((lang) => `/${lang}/tutorial/`), -]); - -/** Match a pathname starting with “lighthouse” or one of our language tags. */ -const ValidRouteRE = new RegExp(`^/(lighthouse|${langTags.join('|')})/`); - -/** Test a pathname is not in our blocklist and starts with a valid prefix. */ -const isValidPath = (path: string) => !blocklist.has(path) && ValidRouteRE.test(path); - -/** Get a preconfigured instance of the `@astrojs/sitemap` integration. */ -export function sitemap(): AstroIntegration { - return AstroSitemap({ - filter: (page) => isValidPath(new URL(page).pathname), - i18n: { - defaultLocale: 'en', - locales: Object.fromEntries(langTags.map((lang) => [lang, normalizeLangTag(lang)])), - }, - }); -} diff --git a/config/locales.ts b/config/locales.ts deleted file mode 100644 index 6beb5f3c..00000000 --- a/config/locales.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type starlight from '@astrojs/starlight'; -import { normalizeLangTag } from '../src/util/normalizeLangTag'; -import languages from '../src/languages'; - -type StarlightLocalesConfig = NonNullable[0]['locales']>; - -export function makeLocalesConfig(): StarlightLocalesConfig { - return Object.fromEntries( - Object.entries(languages).map(([locale, label]) => [ - locale, - { label, lang: normalizeLangTag(locale) }, - ]) - ); -} diff --git a/config/plugins/rehype-autolink.ts b/config/plugins/rehype-autolink.ts deleted file mode 100644 index 2e8898a8..00000000 --- a/config/plugins/rehype-autolink.ts +++ /dev/null @@ -1,121 +0,0 @@ -import type { StarlightPlugin } from '@astrojs/starlight/types'; -import type { AstroIntegration } from 'astro'; -import type { Root } from 'hast'; -import { toString } from 'hast-util-to-string'; -import { h } from 'hastscript'; -import { escape } from 'html-escaper'; -import { resolve as nodeResolve } from 'node:path'; -import rehypeAutolinkHeadings, { type Options as AutolinkOptions } from 'rehype-autolink-headings'; -import type { Transformer } from 'unified'; -import { visit } from 'unist-util-visit'; -import { createTranslationSystemFromFs } from '../../node_modules/@astrojs/starlight/utils/translations-fs'; -import { getLanguageCodeFromPathname, mdFilePathToUrl } from './remark-fallback-lang'; - -const AnchorLinkIcon = h( - 'span', - { ariaHidden: 'true', class: 'anchor-icon' }, - h( - 'svg', - { width: 16, height: 16, viewBox: '0 0 24 24' }, - h('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', - }) - ) -); - -/** - * Configuration for the `rehype-autolink-headings` plugin. - * This set-up was informed by https://amberwilson.co.uk/blog/are-your-anchor-links-accessible/ - */ -const makeAutolinkConfig = ( - useTranslationsForLang: ReturnType -): AutolinkOptions => { - const t = useTranslationsForLang('en'); - return { - properties: { class: 'anchor-link' }, - behavior: 'after', - group: ({ tagName }) => h('div', { tabIndex: -1, class: `heading-wrapper level-${tagName}` }), - content: (heading) => [ - AnchorLinkIcon, - h( - 'span', - { 'is:raw': true, class: 'sr-only' }, - `${t('a11y.sectionLink')} ${escape(toString(heading))}` - ), - ], - }; -}; - -/** - * Rehype plugin to translate the headings' anchors according to the currently selected language. - */ -function rehypei18nAutolinkHeadings( - useTranslationsForLang: ReturnType -) { - const pageSourceDir = nodeResolve('./src/content/docs'); - const baseUrl = 'https://docs.astro.build/'; - - const transformer: Transformer = (tree, file) => { - const pageUrl = mdFilePathToUrl(file.path, pageSourceDir, baseUrl); - const pageLang = getLanguageCodeFromPathname(pageUrl.pathname); - const englishText = useTranslationsForLang('en')('a11y.sectionLink'); - - // Find anchor links - visit(tree, 'element', (node) => { - if (node.tagName === 'a' && node.properties?.class === 'anchor-link') { - // Find a11y text labels - visit(node, 'text', (text) => { - const heading = text.value.replace(englishText!, ''); - const t = useTranslationsForLang(pageLang); - const title = t('a11y.sectionLink') || englishText; - - text.value = title + heading; - }); - } - }); - }; - - return function attacher() { - return transformer; - }; -} - -type TranslationSystemLocales = Parameters[0]['locales']; - -export const starlightPluginAutolinkHeadings = () => - ({ - name: 'starlight-plugin-autolink-headings' as const, - hooks: { - setup({ config, astroConfig, addIntegration }) { - // TODO: Replace this hack with Starlight’s own translation system once it’s exposed here. - const useTranslationsForLang = createTranslationSystemFromFs( - { - defaultLocale: { lang: 'en', locale: 'en', label: 'English', dir: 'ltr' }, - // In theory user-configured locales might not include `dir` properties (or be undefined). - // But we provide `locales` and always set `dir` currently. - locales: config.locales as TranslationSystemLocales, - }, - astroConfig, - {} - ); - /** Integration to add the required rehype plugins. */ - const astroIntegrationAutolinkHeadings: AstroIntegration = { - name: 'astro-integration-autolink-headings', - hooks: { - 'astro:config:setup'({ updateConfig }) { - updateConfig({ - markdown: { - rehypePlugins: [ - [rehypeAutolinkHeadings, makeAutolinkConfig(useTranslationsForLang)], - rehypei18nAutolinkHeadings(useTranslationsForLang), - ], - }, - }); - }, - }, - }; - addIntegration(astroIntegrationAutolinkHeadings); - }, - }, - }) satisfies StarlightPlugin; diff --git a/config/plugins/rehype-tasklist-enhancer.ts b/config/plugins/rehype-tasklist-enhancer.ts deleted file mode 100644 index 609243c4..00000000 --- a/config/plugins/rehype-tasklist-enhancer.ts +++ /dev/null @@ -1,44 +0,0 @@ -import type { Root } from 'hast'; -import { h } from 'hastscript'; -import type { Plugin, Transformer } from 'unified'; -import { CONTINUE, EXIT, SKIP, visit } from 'unist-util-visit'; - -/** - * Rehype plugin to enhance the output of GitHub-Flavored Markdown’s task lists. - * This improves possibilities for our `` component. - * - * 1. Wraps checkboxes and siblings in a `