diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..387e295 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,39 @@ +name: CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'npm' + + - name: Setup Biome + uses: biomejs/setup-biome@v2 + with: + version: latest + + - name: Install dependencies + run: npm ci + + - name: Check + run: biome ci + + - name: Build Astro project + run: npm run build diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 22a1505..85160ab 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,4 +1,4 @@ { - "recommendations": ["astro-build.astro-vscode"], + "recommendations": ["astro-build.astro-vscode", "biomejs.biome"], "unwantedRecommendations": [] } diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..184991f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,8 @@ +{ + "editor.formatOnSave": true, + "editor.defaultFormatter": "biomejs.biome", + "editor.codeActionsOnSave": { + "quickfix.biome": "explicit", + "source.organizeImports.biome": "explicit" + } +} diff --git a/astro.config.mjs b/astro.config.mjs index 7b45e41..15d13d9 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,15 +1,16 @@ // @ts-check -import { defineConfig } from 'astro/config'; -import react from '@astrojs/react'; -import mdx from '@astrojs/mdx'; -import tailwindcss from '@tailwindcss/vite'; -import starlight from '@astrojs/starlight'; + +import mdx from '@astrojs/mdx' +import react from '@astrojs/react' +import starlight from '@astrojs/starlight' +import tailwindcss from '@tailwindcss/vite' +import { defineConfig } from 'astro/config' import starlightOpenAPI, { openAPISidebarGroups } from 'starlight-openapi' // https://astro.build/config export default defineConfig({ integrations: [ - react(), + react(), starlight({ title: 'Xahau Docs', description: 'Documentation for the Xahau blockchain', @@ -31,21 +32,18 @@ export default defineConfig({ plugins: [ starlightOpenAPI([ { - base: 'docs/data-apis/data-api', - schema: './src/schemas/dataapi.json', - sidebar: { - label: 'Xahau Data API' - } + base: 'docs/data-apis/data-api', + schema: './src/schemas/dataapi.json', + sidebar: { + label: 'Xahau Data API', + }, }, ]), ], sidebar: [ { - label: 'Get started', - items: [ - 'docs', - 'docs/what-is-different' - ], + label: 'Get started', + items: ['docs', 'docs/what-is-different'], }, { label: 'Features', @@ -55,29 +53,29 @@ export default defineConfig({ { label: 'Transaction Signing', autogenerate: { directory: 'docs/features/transaction-signing' }, - collapsed: true + collapsed: true, }, { label: 'Developer Tooling', autogenerate: { directory: 'docs/features/developer-tooling' }, - collapsed: true + collapsed: true, }, { label: 'HTTP / WebSocket APIs', autogenerate: { directory: 'docs/features/http-websocket-apis' }, - collapsed: true + collapsed: true, }, { label: 'Network Features', autogenerate: { directory: 'docs/features/network-features' }, - collapsed: true + collapsed: true, }, 'docs/features/faucet-and-explorer', 'docs/features/balance-adjustments', 'docs/features/governance-game', 'docs/features/burn-2-mint', 'docs/features/versioning-process', - ] + ], }, { label: 'Protocol Reference', @@ -89,22 +87,31 @@ export default defineConfig({ 'docs/protocol-reference/transactions', { label: 'Transaction Types', - autogenerate: { directory: 'docs/protocol-reference/transactions/transaction-types' }, + autogenerate: { + directory: + 'docs/protocol-reference/transactions/transaction-types', + }, collapsed: true, }, { label: 'Pseudo Transaction Types', - autogenerate: { directory: 'docs/protocol-reference/transactions/pseudo-transaction-types' }, + autogenerate: { + directory: + 'docs/protocol-reference/transactions/pseudo-transaction-types', + }, collapsed: true, }, { label: 'Transaction Results', - autogenerate: { directory: 'docs/protocol-reference/transactions/transaction-results' }, + autogenerate: { + directory: + 'docs/protocol-reference/transactions/transaction-results', + }, collapsed: true, }, 'docs/protocol-reference/transactions/transaction-common-fields', 'docs/protocol-reference/transactions/transaction-metadata', - ] + ], }, { label: 'Ledger Data', @@ -113,12 +120,15 @@ export default defineConfig({ 'docs/protocol-reference/ledger-data', { label: 'Ledger Objects Types', - autogenerate: { directory: 'docs/protocol-reference/ledger-data/ledger-objects-types' }, + autogenerate: { + directory: + 'docs/protocol-reference/ledger-data/ledger-objects-types', + }, collapsed: true, }, 'docs/protocol-reference/ledger-data/ledger-header', 'docs/protocol-reference/ledger-data/ledger-object-ids', - ] + ], }, { label: 'Data Types', @@ -127,10 +137,10 @@ export default defineConfig({ 'docs/protocol-reference/data-types', 'docs/protocol-reference/data-types/currency-formats', 'docs/protocol-reference/data-types/base-58-encodings', - ] + ], }, 'docs/protocol-reference/binary-format', - ] + ], }, { label: 'Hooks', @@ -161,7 +171,7 @@ export default defineConfig({ 'docs/hooks/concepts/floating-point-numbers-xfl', 'docs/hooks/concepts/emitted-transactions', 'docs/hooks/concepts/serialized-objects', - ] + ], }, { label: 'Functions', @@ -175,7 +185,9 @@ export default defineConfig({ { label: 'Developer Defined', collapsed: true, - autogenerate: { directory: 'docs/hooks/functions/developer-defined' }, + autogenerate: { + directory: 'docs/hooks/functions/developer-defined', + }, }, { label: 'Control', @@ -190,12 +202,16 @@ export default defineConfig({ { label: 'Serialization', collapsed: true, - autogenerate: { directory: 'docs/hooks/functions/serialization' }, + autogenerate: { + directory: 'docs/hooks/functions/serialization', + }, }, { label: 'Emitted Transaction', collapsed: true, - autogenerate: { directory: 'docs/hooks/functions/emitted-transaction' }, + autogenerate: { + directory: 'docs/hooks/functions/emitted-transaction', + }, }, { label: 'Float', @@ -210,7 +226,9 @@ export default defineConfig({ { label: 'Hook Context', collapsed: true, - autogenerate: { directory: 'docs/hooks/functions/hook-context' }, + autogenerate: { + directory: 'docs/hooks/functions/hook-context', + }, }, { label: 'Slot', @@ -223,37 +241,40 @@ export default defineConfig({ autogenerate: { directory: 'docs/hooks/functions/state' }, }, { - label: 'Trace (Debug)', + label: 'Trace (Debug)', collapsed: true, - autogenerate: { directory: 'docs/hooks/functions/trace-debug' }, + autogenerate: { + directory: 'docs/hooks/functions/trace-debug', + }, }, { label: 'Originating Transaction', collapsed: true, - autogenerate: { directory: 'docs/hooks/functions/originating-transaction' }, + autogenerate: { + directory: 'docs/hooks/functions/originating-transaction', + }, }, { label: 'WebSocket APIs', collapsed: true, - autogenerate: { directory: 'docs/hooks/functions/websocket-apis' }, + autogenerate: { + directory: 'docs/hooks/functions/websocket-apis', + }, }, - ] + ], }, - ] + ], }, { label: 'Data APIs', - items: [ - 'docs/data-apis', - ...openAPISidebarGroups - ] + items: ['docs/data-apis', ...openAPISidebarGroups], }, { label: 'Compliance', items: [ 'docs/compliance/security-audit', 'docs/compliance/responsible-disclosure', - ] + ], }, { label: 'Infrastructure', @@ -265,7 +286,7 @@ export default defineConfig({ items: [ 'docs/infrastructure/running-a-node/running-a-mainnet-node', 'docs/infrastructure/running-a-node/running-a-testnet-node', - ] + ], }, { label: 'Building Xahau (Dev)', @@ -274,16 +295,13 @@ export default defineConfig({ 'docs/infrastructure/building-xahau', 'docs/infrastructure/building-xahau/ubuntu-22-04', 'docs/infrastructure/building-xahau/mac-os-13-5-2', - ] - } - ] + ], + }, + ], }, { - label: 'Resources', - items: [ - 'docs/resources/whitepaper', - 'docs/resources/media-kit', - ], + label: 'Resources', + items: ['docs/resources/whitepaper', 'docs/resources/media-kit'], }, { label: 'Support', @@ -291,10 +309,10 @@ export default defineConfig({ }, ], }), - mdx() + mdx(), ], vite: { plugins: [tailwindcss()], }, - site: 'https://xahau.network/' -}); \ No newline at end of file + site: 'https://xahau.network/', +}) diff --git a/biome.jsonc b/biome.jsonc new file mode 100644 index 0000000..f8f0ca3 --- /dev/null +++ b/biome.jsonc @@ -0,0 +1,37 @@ +{ + "$schema": "https://biomejs.dev/schemas/2.0.6/schema.json", + "vcs": { + "enabled": false, + "clientKind": "git", + "useIgnoreFile": false + }, + "files": { + "includes": ["**", "!*/**/*.astro", "!.astro", "!dist"], + "ignoreUnknown": false + }, + "formatter": { + "enabled": true, + "indentStyle": "space", + "indentWidth": 2 + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true + } + }, + "javascript": { + "formatter": { + "quoteStyle": "single", + "semicolons": "asNeeded" + } + }, + "assist": { + "enabled": true, + "actions": { + "source": { + "organizeImports": "on" + } + } + } +} diff --git a/package-lock.json b/package-lock.json index 055b767..ed62d35 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,9 @@ "starlight-openapi": "^0.19.1", "tailwindcss": "^4.1.11", "vanilla-cookieconsent": "^3.1.0" + }, + "devDependencies": { + "@biomejs/biome": "^2.0.6" } }, "node_modules/@ampproject/remapping": { @@ -452,6 +455,169 @@ "node": ">=6.9.0" } }, + "node_modules/@biomejs/biome": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.0.6.tgz", + "integrity": "sha512-RRP+9cdh5qwe2t0gORwXaa27oTOiQRQvrFf49x2PA1tnpsyU7FIHX4ZOFMtBC4QNtyWsN7Dqkf5EDbg4X+9iqA==", + "dev": true, + "license": "MIT OR Apache-2.0", + "bin": { + "biome": "bin/biome" + }, + "engines": { + "node": ">=14.21.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/biome" + }, + "optionalDependencies": { + "@biomejs/cli-darwin-arm64": "2.0.6", + "@biomejs/cli-darwin-x64": "2.0.6", + "@biomejs/cli-linux-arm64": "2.0.6", + "@biomejs/cli-linux-arm64-musl": "2.0.6", + "@biomejs/cli-linux-x64": "2.0.6", + "@biomejs/cli-linux-x64-musl": "2.0.6", + "@biomejs/cli-win32-arm64": "2.0.6", + "@biomejs/cli-win32-x64": "2.0.6" + } + }, + "node_modules/@biomejs/cli-darwin-arm64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.0.6.tgz", + "integrity": "sha512-AzdiNNjNzsE6LfqWyBvcL29uWoIuZUkndu+wwlXW13EKcBHbbKjNQEZIJKYDc6IL+p7bmWGx3v9ZtcRyIoIz5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-darwin-x64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.0.6.tgz", + "integrity": "sha512-wJjjP4E7bO4WJmiQaLnsdXMa516dbtC6542qeRkyJg0MqMXP0fvs4gdsHhZ7p9XWTAmGIjZHFKXdsjBvKGIJJQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.0.6.tgz", + "integrity": "sha512-ZSVf6TYo5rNMUHIW1tww+rs/krol7U5A1Is/yzWyHVZguuB0lBnIodqyFuwCNqG9aJGyk7xIMS8HG0qGUPz0SA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64-musl": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.0.6.tgz", + "integrity": "sha512-CVPEMlin3bW49sBqLBg2x016Pws7eUXA27XYDFlEtponD0luYjg2zQaMJ2nOqlkKG9fqzzkamdYxHdMDc2gZFw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.0.6.tgz", + "integrity": "sha512-geM1MkHTV1Kh2Cs/Xzot9BOF3WBacihw6bkEmxkz4nSga8B9/hWy5BDiOG3gHDGIBa8WxT0nzsJs2f/hPqQIQw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64-musl": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.0.6.tgz", + "integrity": "sha512-mKHE/e954hR/hSnAcJSjkf4xGqZc/53Kh39HVW1EgO5iFi0JutTN07TSjEMg616julRtfSNJi0KNyxvc30Y4rQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-arm64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.0.6.tgz", + "integrity": "sha512-290V4oSFoKaprKE1zkYVsDfAdn0An5DowZ+GIABgjoq1ndhvNxkJcpxPsiYtT7slbVe3xmlT0ncdfOsN7KruzA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-x64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.0.6.tgz", + "integrity": "sha512-bfM1Bce0d69Ao7pjTjUS+AWSZ02+5UHdiAP85Th8e9yV5xzw6JrHXbL5YWlcEKQ84FIZMdDc7ncuti1wd2sdbw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, "node_modules/@capsizecss/unpack": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/@capsizecss/unpack/-/unpack-2.4.0.tgz", diff --git a/package.json b/package.json index cf0b54a..46b62eb 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,9 @@ "scripts": { "dev": "astro dev", "build": "astro build", - "preview": "astro preview" + "preview": "astro preview", + "check": "biome check --write", + "ci": "biome ci" }, "dependencies": { "@astrojs/mdx": "^4.3.0", @@ -21,5 +23,8 @@ "starlight-openapi": "^0.19.1", "tailwindcss": "^4.1.11", "vanilla-cookieconsent": "^3.1.0" + }, + "devDependencies": { + "@biomejs/biome": "^2.0.6" } } diff --git a/src/CookieConsentConfig.ts b/src/CookieConsentConfig.ts index 2064b33..6c5d61b 100644 --- a/src/CookieConsentConfig.ts +++ b/src/CookieConsentConfig.ts @@ -1,73 +1,79 @@ -import type { CookieConsentConfig } from 'vanilla-cookieconsent'; +import type { CookieConsentConfig } from 'vanilla-cookieconsent' export const config: CookieConsentConfig = { guiOptions: { - consentModal: { - layout: "box", - position: "bottom left", - equalWeightButtons: true, - flipButtons: false - }, - preferencesModal: { - layout: "box", - position: "right", - equalWeightButtons: true, - flipButtons: false - } + consentModal: { + layout: 'box', + position: 'bottom left', + equalWeightButtons: true, + flipButtons: false, + }, + preferencesModal: { + layout: 'box', + position: 'right', + equalWeightButtons: true, + flipButtons: false, + }, }, categories: { - necessary: { - readOnly: true - }, - functionality: { - enabled: true - }, - analytics: { - enabled: true - } + necessary: { + readOnly: true, + }, + functionality: { + enabled: true, + }, + analytics: { + enabled: true, + }, }, language: { - default: "en", - translations: { - en: { - consentModal: { - title: "Select your cookie preferences", - description: "We use cookies to ensure you get the best experience on our website.", - acceptAllBtn: "Accept all", - acceptNecessaryBtn: "Reject all", - showPreferencesBtn: "Manage preferences", - footer: "Privacy Policy" - }, - preferencesModal: { - title: "Consent Preferences Center", - acceptAllBtn: "Accept all", - acceptNecessaryBtn: "Reject all", - savePreferencesBtn: "Save preferences", - closeIconLabel: "Close modal", - serviceCounterLabel: "Service|Services", - sections: [ - { - title: "Strictly Necessary Cookies Always Enabled", - description: "Some cookies are essential in order to use the website and use some of its features.", - linkedCategory: "necessary" - }, - { - title: "Functionality Cookies", - description: "These cookies are used to enhance the performance and functionality of the website but are non-essential to their use. However, without these cookies, certain functionality (like videos) may become unavailable.", - linkedCategory: "functionality" - }, - { - title: "Analytics Cookies", - description: "We use analytics cookies to understand how you use our website so we can improve it.", - linkedCategory: "analytics" - }, - { - title: "More information", - description: "For any query in relation to the policy on cookies and your choices, please refer to the Privacy Policy." - } - ] - } - } - } - } -}; \ No newline at end of file + default: 'en', + translations: { + en: { + consentModal: { + title: 'Select your cookie preferences', + description: + 'We use cookies to ensure you get the best experience on our website.', + acceptAllBtn: 'Accept all', + acceptNecessaryBtn: 'Reject all', + showPreferencesBtn: 'Manage preferences', + footer: 'Privacy Policy', + }, + preferencesModal: { + title: 'Consent Preferences Center', + acceptAllBtn: 'Accept all', + acceptNecessaryBtn: 'Reject all', + savePreferencesBtn: 'Save preferences', + closeIconLabel: 'Close modal', + serviceCounterLabel: 'Service|Services', + sections: [ + { + title: + 'Strictly Necessary Cookies Always Enabled', + description: + 'Some cookies are essential in order to use the website and use some of its features.', + linkedCategory: 'necessary', + }, + { + title: 'Functionality Cookies', + description: + 'These cookies are used to enhance the performance and functionality of the website but are non-essential to their use. However, without these cookies, certain functionality (like videos) may become unavailable.', + linkedCategory: 'functionality', + }, + { + title: 'Analytics Cookies', + description: + 'We use analytics cookies to understand how you use our website so we can improve it.', + linkedCategory: 'analytics', + }, + { + title: 'More information', + description: + 'For any query in relation to the policy on cookies and your choices, please refer to the Privacy Policy.', + }, + ], + }, + }, + }, + }, +} diff --git a/src/components/CookieConsent.astro b/src/components/CookieConsent.astro index 74148b5..5717c4f 100644 --- a/src/components/CookieConsent.astro +++ b/src/components/CookieConsent.astro @@ -1,5 +1,5 @@ --- -import 'vanilla-cookieconsent/dist/cookieconsent.css'; +import 'vanilla-cookieconsent/dist/cookieconsent.css' ---