Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs Site] core formatting checks #17262

Merged
merged 19 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:
- run: npm ci
- run: npm run check

## TODO: formatting checks

- run: npm run format:core:check
## TODO: content formatting checks
- run: npm run build
env:
NODE_OPTIONS: "--max-old-space-size=4192"
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/semgrep.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@

on:
pull_request: {}
workflow_dispatch: {}
push:
push:
branches:
- main
- master
schedule:
- cron: '0 0 * * *'
- cron: "0 0 * * *"
name: Semgrep config
jobs:
semgrep:
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ dist
.github/CODEOWNERS
public/_redirects
public/analytics/static/downloads/main.css
src/content/workers-ai-models/*.json
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
"check:astro": "npm run sync && astro check",
"check:functions": "npx tsc --noEmit -p ./functions/tsconfig.json",
"dev": "npx astro dev",
"format": "npx prettier --write \"**/*.{js,jsx,ts,tsx,mjs,astro,css,json,yaml,yml}\"",
"format": "npm run format:core && npm run format:content && npm run format:data",
Cherry marked this conversation as resolved.
Show resolved Hide resolved
"format:core": "npx prettier --write \"**/*.{js,jsx,ts,tsx,mjs,css}\"",
"format:core:check": "npm run format:core -- --check",
"format:content": "npx prettier --write \"**/*.{md,mdx,astro}\"",
"format:data": "npx prettier --write \"**/*.{json,yaml,yml}\"",
"postinstall": "npx patch-package && npm run sync",
"preview": "npx astro preview",
"start": "npx astro dev",
Expand Down
3 changes: 1 addition & 2 deletions src/asides.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

&.starlight-aside--caution {
background-color: rgb(255, 248, 228);

}

.starlight-aside__title {
Expand All @@ -33,4 +32,4 @@
.starlight-aside--caution {
background-color: rgb(98, 73, 10);
}
}
}
2 changes: 1 addition & 1 deletion src/content/changelogs/magic-network-monitoring.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ entries:
- publish_date: "2024-09-24"
title: Magic Network Monitoring free version available to all customers
description: |-
The free version of Magic Network Monitoring (MNM) is now available to everyone with a Cloudflare account by default.
The free version of Magic Network Monitoring (MNM) is now available to everyone with a Cloudflare account by default.
6 changes: 3 additions & 3 deletions src/content/changelogs/rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ productLink: "/rules/"
productArea: Application performance
productAreaLink: /fundamentals/reference/changelog/performance/
entries:
- publish_date: "2024-09-20"
- publish_date: "2024-09-20"
title: Automatic DNS Validation for Cloudflare Rules
description: |-
description: |-
The Cloudflare dashboard now automatically validates [DNS records](/dns/manage-dns-records/reference/proxied-dns-records/) and [Cloudflare for SaaS custom hostnames](/cloudflare-for-platforms/cloudflare-for-saas/domain-support/) for rules targeting specific hostnames or URLs. To prevent misconfigured rules and ensure smoother deployments, you will get proactive warnings for missing or misconfigured DNS records and custom hostnames.

- publish_date: "2024-09-17"
title: Compression Rules available to all plans with Zstandard support
description: |-
Expand Down
4 changes: 2 additions & 2 deletions src/content/changelogs/security-center.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ entries:
- publish_date: "2024-09-19"
description: |-
- Customers can now create a `security.txt` file file to provide the security research team with a standardized way to report vulnerabilities.
- Customers can now create a `security.txt` file file to provide the security research team with a standardized way to report vulnerabilities.
- publish_date: "2024-09-23"
description: |-
- Customers can now export all matches from a saved query. Select your **Query name** > select the three dots > **Export matches**.
- Customers can now export all matches from a saved query. Select your **Query name** > select the three dots > **Export matches**.
249 changes: 124 additions & 125 deletions src/content/changelogs/zaraz.yaml

Large diffs are not rendered by default.

94 changes: 47 additions & 47 deletions src/content/glossary/durable-objects.yaml
Original file line number Diff line number Diff line change
@@ -1,65 +1,65 @@
---
productName: Durable Objects
entries:
- term: "Durable Objects"
general_definition: |-
The product name, or the collective noun referring to more than one Durable Object instance.
- term: "Durable Objects"
general_definition: |-
The product name, or the collective noun referring to more than one Durable Object instance.

- term: "Namespace"
general_definition: |-
A container for a collection of Durable Objects that all share the same Durable Object (class) definition. A single Namespace can have (tens of) millions of Durable Objects. Metrics are scoped per Namespace.
- term: "Namespace"
general_definition: |-
A container for a collection of Durable Objects that all share the same Durable Object (class) definition. A single Namespace can have (tens of) millions of Durable Objects. Metrics are scoped per Namespace.

- term: "Durable Object"
general_definition: |-
An individual Durable Object. A Durable Object is globally unique (referenced by ID), provides a global point of coordination for all methods/requests sent to it, and has private, persistent storage that is not shared with other Durable Objects within a Namespace.
- term: "Durable Object"
general_definition: |-
An individual Durable Object. A Durable Object is globally unique (referenced by ID), provides a global point of coordination for all methods/requests sent to it, and has private, persistent storage that is not shared with other Durable Objects within a Namespace.

- term: "Stub"
general_definition: |-
An object that refers to a unique Durable Object within a Namespace and allows you to call into that Durable Object via RPC methods or the `fetch` API. For example, `let stub = env.MY_DURABLE_OBJECT.get(id)`
- term: "Stub"
general_definition: |-
An object that refers to a unique Durable Object within a Namespace and allows you to call into that Durable Object via RPC methods or the `fetch` API. For example, `let stub = env.MY_DURABLE_OBJECT.get(id)`

- term: "actor"
general_definition: |-
A term referring to a unique Durable Object.
- term: "actor"
general_definition: |-
A term referring to a unique Durable Object.

- term: "instance"
general_definition: |-
See 'actor'.
- term: "instance"
general_definition: |-
See 'actor'.

- term: "Durable Object class"
general_definition: |-
The JavaScript class that defines the methods (RPC) and handlers (`fetch`, `alarm`) as part of your Durable Object, and/or an optional `constructor`. All Durable Objects within a single Namespace share the same class definition.
- term: "Durable Object class"
general_definition: |-
The JavaScript class that defines the methods (RPC) and handlers (`fetch`, `alarm`) as part of your Durable Object, and/or an optional `constructor`. All Durable Objects within a single Namespace share the same class definition.

- term: "Storage Backend"
general_definition: |-
By default, a Durable Object class can use Storage API that leverages a key-value storage backend. New Durable Object classes can opt-in to using a [SQLite storage backend](/durable-objects/best-practices/access-durable-objects-storage/#sqlite-storage-backend).
- term: "Storage Backend"
general_definition: |-
By default, a Durable Object class can use Storage API that leverages a key-value storage backend. New Durable Object classes can opt-in to using a [SQLite storage backend](/durable-objects/best-practices/access-durable-objects-storage/#sqlite-storage-backend).

- term: "Storage API"
general_definition: |-
The transactional and strongly consistent (serializable) [Storage API](/durable-objects/api/storage-api/) for persisting data within each Durable Object instance. State stored within a unique DO instance is "private" to that Durable Object, and not accessible from other Durable Objects.
- term: "Storage API"
general_definition: |-
The transactional and strongly consistent (serializable) [Storage API](/durable-objects/api/storage-api/) for persisting data within each Durable Object instance. State stored within a unique DO instance is "private" to that Durable Object, and not accessible from other Durable Objects.

Storage API includes key-value (KV) API, SQL API, and point-in-time-recovery (PITR) API.
Storage API includes key-value (KV) API, SQL API, and point-in-time-recovery (PITR) API.

- Durable Object classes with the key-value storage backend can use KV API.
- Durable Object classes with the SQLite storage backend can use KV API, SQL API, and PITR API.
- Durable Object classes with the key-value storage backend can use KV API.
- Durable Object classes with the SQLite storage backend can use KV API, SQL API, and PITR API.

- term: "KV API"
general_definition: |-
API methods part of Storage API that support persisting key-value data.
- term: "KV API"
general_definition: |-
API methods part of Storage API that support persisting key-value data.

- term: "SQL API"
general_definition: |-
API methods part of Storage API that support SQL querying.
- term: "SQL API"
general_definition: |-
API methods part of Storage API that support SQL querying.

- term: Migration
general_definition: |-
A Durable Object migration is a mapping process from a class name to a runtime state.
Initiate a Durable Object migration when you need to:
- term: Migration
general_definition: |-
A Durable Object migration is a mapping process from a class name to a runtime state.
Initiate a Durable Object migration when you need to:

- Create a new Durable Object class.
- Rename a Durable Object class.
- Delete a Durable Object class.
- Transfer an existing Durable Objects class.
- Create a new Durable Object class.
- Rename a Durable Object class.
- Delete a Durable Object class.
- Transfer an existing Durable Objects class.

- term: Alarm
general_definition: |-
A Durable Object alarm is a mechanism that allows you to schedule the Durable Object to be woken up at a time in the future.
- term: Alarm
general_definition: |-
A Durable Object alarm is a mechanism that allows you to schedule the Durable Object to be woken up at a time in the future.
56 changes: 28 additions & 28 deletions src/content/plans/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -2730,34 +2730,34 @@
"ent": "Yes"
}
}
},
"client_certificates": {
"title": "Client Certificates",
"link": "/ssl/client-certificates/",
"properties": {
"availability": {
"title": "Availability",
"summary": "Available on all plans.",
"free": "Yes",
"pro": "Yes",
"biz": "Yes",
"ent": "Yes"
},
"quantity": {
"title": "Client Certificates included, issued by a Cloudflare Managed CA",
"free": 100,
"pro": 100,
"biz": 100,
"ent": "100 (default), but can allocate more quota."
},
"byo_ca": {
"title": "[Bring your own CA](/ssl/client-certificates/byo-ca/)",
"free": "No",
"pro": "No",
"biz": "No",
"ent": "Yes"
}
}
},
"client_certificates": {
"title": "Client Certificates",
"link": "/ssl/client-certificates/",
"properties": {
"availability": {
"title": "Availability",
"summary": "Available on all plans.",
"free": "Yes",
"pro": "Yes",
"biz": "Yes",
"ent": "Yes"
},
"quantity": {
"title": "Client Certificates included, issued by a Cloudflare Managed CA",
"free": 100,
"pro": 100,
"biz": 100,
"ent": "100 (default), but can allocate more quota."
},
"byo_ca": {
"title": "[Bring your own CA](/ssl/client-certificates/byo-ca/)",
"free": "No",
"pro": "No",
"biz": "No",
"ent": "Yes"
}
}
}
},
"support": {
Expand Down
3 changes: 1 addition & 2 deletions src/content/products/images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ product:

meta:
title: Cloudflare Images docs
description:
Store, transform, optimize, and deliver images at scale.
description: Store, transform, optimize, and deliver images at scale.
author: "@cloudflare"

resources:
Expand Down
3 changes: 1 addition & 2 deletions src/content/products/key-transparency.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ product:

meta:
title: Key Transparency Auditor
description:
Key Transparency Auditor docs
description: Key Transparency Auditor docs
author: "@cloudflare"

externals:
Expand Down
19 changes: 12 additions & 7 deletions src/schemas/types/badge.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Vendored from https://github.com/withastro/starlight/blob/a171a996b842f1fdb37a0bdbb2c9d86e1073e1a4/packages/starlight/schemas/badge.ts#
import { z } from 'astro:schema';
import { z } from "astro:schema";

const badgeBaseSchema = z.object({
variant: z.enum(['note', 'danger', 'success', 'caution', 'tip', 'default']).default('default'),
variant: z
.enum(["note", "danger", "success", "caution", "tip", "default"])
.default("default"),
class: z.string().optional(),
});

Expand All @@ -16,7 +18,7 @@ const i18nBadgeSchema = badgeBaseSchema.extend({

export const BadgeComponentSchema = badgeSchema
.extend({
size: z.enum(['small', 'medium', 'large']).default('small'),
size: z.enum(["small", "medium", "large"]).default("small"),
})
.passthrough();

Expand All @@ -26,15 +28,18 @@ export const BadgeConfigSchema = () =>
z
.union([z.string(), badgeSchema])
.transform((badge) => {
if (typeof badge === 'string') {
return { variant: 'default' as const, text: badge };
if (typeof badge === "string") {
return { variant: "default" as const, text: badge };
}
return badge;
})
.optional();

export const I18nBadgeConfigSchema = () => z.union([z.string(), i18nBadgeSchema]).optional();
export const I18nBadgeConfigSchema = () =>
z.union([z.string(), i18nBadgeSchema]).optional();

export type Badge = z.output<typeof badgeSchema>;
export type I18nBadge = z.output<typeof i18nBadgeSchema>;
export type I18nBadgeConfig = z.output<ReturnType<typeof I18nBadgeConfigSchema>>;
export type I18nBadgeConfig = z.output<
ReturnType<typeof I18nBadgeConfigSchema>
>;
Loading