From 387652f4e8002ded27afaca4394909e01ea14073 Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Fri, 31 Jul 2026 15:01:27 -0400 Subject: [PATCH 1/3] style: reformat with oxfmt --- .github/.kodiak.toml | 2 +- .github/PULL_REQUEST_TEMPLATE.md | 4 +- CLAUDE.md | 29 ++- CODE_OF_CONDUCT.md | 64 +++---- CONTRIBUTING.md | 4 +- bin/run.js | 2 +- .../scheduled-function/{{name}}.mts | 8 +- layout.html | 2 +- renovate.json5 | 74 ++++---- site/netlify.toml | 100 +++++----- site/netlify/functions/error-reporting.ts | 3 +- site/scripts/util/generate-command-data.js | 10 +- site/src/content.config.ts | 10 +- site/src/fonts/font-face.css | 15 +- site/src/styles/custom.css | 31 ++-- src/commands/clone/clone.ts | 2 +- src/commands/types.d.ts | 2 +- src/lib/api.ts | 2 +- src/utils/deploy/hash-fns.ts | 16 +- src/utils/get-repo-data.ts | 4 +- src/utils/live-tunnel.ts | 2 +- src/utils/shell.ts | 5 +- .../netlify.toml | 2 +- .../public/index.html | 2 +- .../hugo-site/layouts/_default/list.html | 2 +- .../next-app-without-config/app/globals.css | 45 +---- .../app/page.module.css | 18 +- .../__fixtures__/next-app/app/globals.css | 45 +---- .../__fixtures__/next-app/app/page.module.css | 18 +- .../plugin-changing-publish-dir/netlify.toml | 2 +- .../commands/dev/redirects.test.ts | 7 +- .../integration/commands/env/env-get.test.ts | 79 ++++---- .../integration/commands/env/env-list.test.ts | 54 +++--- .../integration/commands/env/env-set.test.ts | 65 ++++--- .../functions-invoke/functions-invoke.test.ts | 173 +++++++++--------- .../database/db-migration-pull.test.ts | 4 +- .../database/db-migrations-reset.test.ts | 4 +- .../unit/commands/database/db-status.test.ts | 6 +- .../commands/database/util/api-errors.test.ts | 2 +- types/ascii-table/index.d.ts | 64 +++---- types/express-logging/index.d.ts | 28 +-- types/maxstache-stream/index.d.ts | 8 +- types/maxstache/index.d.ts | 6 +- 43 files changed, 486 insertions(+), 539 deletions(-) diff --git a/.github/.kodiak.toml b/.github/.kodiak.toml index 0209e106eb7..b1efccec660 100644 --- a/.github/.kodiak.toml +++ b/.github/.kodiak.toml @@ -5,4 +5,4 @@ versions = ["minor", "patch"] usernames = ["renovate"] [approve] -auto_approve_usernames = ["renovate"] \ No newline at end of file +auto_approve_usernames = ["renovate"] diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 204585a4853..afe255883bc 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -12,7 +12,9 @@ Explain the **motivation** for making this change. What existing problem does th For us to review and ship your PR efficiently, please perform the following steps: -- [ ] Open a [bug/issue](https://github.com/netlify/cli/issues/new/choose) before writing your code ๐Ÿง‘โ€๐Ÿ’ป. This ensures we can discuss the changes and get feedback from everyone that should be involved. If you\`re fixing a typo or something that\`s on fire ๐Ÿ”ฅ (e.g. incident related), you can skip this step. +- [ ] Open a [bug/issue](https://github.com/netlify/cli/issues/new/choose) before writing your code ๐Ÿง‘โ€๐Ÿ’ป. This ensures we + can discuss the changes and get feedback from everyone that should be involved. If you\`re fixing a typo or + something that\`s on fire ๐Ÿ”ฅ (e.g. incident related), you can skip this step. - [ ] Read the [contribution guidelines](../CONTRIBUTING.md) ๐Ÿ“–. This ensures your code follows our style guide and passes our tests. - [ ] Update or add tests (if any source code was changed or added) ๐Ÿงช diff --git a/CLAUDE.md b/CLAUDE.md index 9fda070ae3e..8875a43ee3f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -5,11 +5,13 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Development Commands ### Build and Development + - `npm run build` - Compiles TypeScript using `tsc --project tsconfig.build.json` - `npm run dev` - Runs TypeScript compiler in watch mode - `npm run clean` - Removes the `dist/` directory ### Testing + - `npm test` - Runs the full test suite (unit, integration, and e2e tests) - `npm run test:unit` - Runs unit tests only with `vitest run tests/unit/` - `npm run test:integration` - Runs integration tests with `vitest run --retry=3 tests/integration/` @@ -20,14 +22,16 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co - `npm run test:init` - Sets up test dependencies for various fixtures (Hugo, Next.js, monorepo) ### Code Quality + - `npm run lint` - Runs ESLint with cache - `npm run lint:fix` - Runs ESLint and automatically fixes issues -- `npm run format` - Formats code with Prettier +- `npm run format` - Formats code with oxfmt - `npm run format:check` - Checks code formatting without modifying files - `npm run typecheck` - Runs TypeScript type checking - `npm run typecheck:watch` - Runs TypeScript type checking in watch mode ### Running the CLI Locally + - `./bin/run.js [command]` - Runs the CLI locally - `DEBUG=true ./bin/run.js [command]` - Runs with stack traces enabled for debugging - `npm run start -- [command]` - Alternative way to run CLI locally @@ -35,11 +39,15 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Architecture ### Core Structure -The Netlify CLI is built with **Commander.js** for CLI interface, **@netlify/js-client** for API interactions, and **TypeScript** with modular architecture. The system uses a registry pattern for managing Functions and Edge Functions, with sophisticated local development server capabilities. + +The Netlify CLI is built with **Commander.js** for CLI interface, **@netlify/js-client** for API interactions, and +**TypeScript** with modular architecture. The system uses a registry pattern for managing Functions and Edge Functions, +with sophisticated local development server capabilities. ### Key Architectural Patterns #### Command Architecture + - All commands extend `BaseCommand` class (`src/commands/base-command.ts`) which provides: - Consistent config loading and API client setup - Site information management and linking @@ -49,6 +57,7 @@ The Netlify CLI is built with **Commander.js** for CLI interface, **@netlify/js- - Each command supports both interactive prompts and non-interactive flag-based operation #### Registry Pattern for Runtime Management + - **FunctionsRegistry** (`src/lib/functions/registry.ts`): Manages Netlify Functions lifecycle - Supports multiple runtimes (JavaScript/TypeScript, Go, Rust) - Handles hot reloading and file watching @@ -58,7 +67,9 @@ The Netlify CLI is built with **Commander.js** for CLI interface, **@netlify/js- - Handles Edge Function deployment and local serving #### Development Server Architecture (`netlify dev`) + The dev server (`src/commands/dev/dev.ts`) orchestrates multiple subsystems: + - **Proxy Server**: Routes requests between static files, functions, and edge functions - **Functions Server**: Executes Netlify Functions locally with runtime-specific handlers - **Edge Functions Proxy**: Serves Edge Functions via Deno runtime @@ -66,6 +77,7 @@ The dev server (`src/commands/dev/dev.ts`) orchestrates multiple subsystems: - **Live Tunneling**: Provides public URLs for local development via Netlify's tunnel service #### Config System + - Uses `@netlify/config` for configuration resolution and normalization - Supports `netlify.toml` files with environment-specific overrides - Integrates with Netlify's build plugins system @@ -74,12 +86,14 @@ The dev server (`src/commands/dev/dev.ts`) orchestrates multiple subsystems: ### Key Libraries and Their Roles #### Core Infrastructure + - `src/lib/api.ts` - Netlify API client wrapper with authentication - `src/lib/build.ts` - Build system integration and config caching - `src/lib/settings.ts` - Project and global settings management - `src/utils/command-helpers.ts` - Shared utilities for CLI commands (logging, error handling, prompts) #### Function Runtime System + - `src/lib/functions/runtimes/` - Runtime-specific builders and executors - `js/` - JavaScript/TypeScript function handling with `zip-it-and-ship-it` - `go/` - Go function compilation and execution @@ -87,17 +101,20 @@ The dev server (`src/commands/dev/dev.ts`) orchestrates multiple subsystems: - `src/lib/functions/server.ts` - Local function server with request/response handling #### Development Tools + - `src/utils/dev.ts` - Development server utilities and environment setup - `src/utils/proxy-server.ts` - HTTP proxy for routing dev server requests - `src/utils/detect-server-settings.ts` - Framework detection and port management #### Deployment System + - `src/utils/deploy/` - Site deployment orchestration - File hashing, diffing, and upload optimization - Build artifact management and caching - Progress tracking and status reporting ### Testing Architecture + - **Unit Tests** (`tests/unit/`): Test individual modules and utilities - **Integration Tests** (`tests/integration/`): Test full command workflows using fixtures - **E2E Tests**: Test complete user scenarios with real Netlify API interactions @@ -106,7 +123,9 @@ The dev server (`src/commands/dev/dev.ts`) orchestrates multiple subsystems: ### Important Implementation Details #### Environment Variable Handling + Environment variables are loaded from multiple sources with specific precedence: + 1. Process environment 2. `.env` files (multiple variants supported) 3. Netlify site settings (shared, project-specific) @@ -114,22 +133,28 @@ Environment variables are loaded from multiple sources with specific precedence: 5. Build-time configuration #### Function URL Routing + Functions are accessible via standardized URL patterns: + - `/.netlify/functions/[function-name]` - Standard functions - `/.netlify/builders/[function-name]` - On-demand builders - Custom paths supported via function configuration #### Build Plugin Integration + The CLI integrates with Netlify's build plugin system, allowing plugins to: + - Modify build configuration - Add custom build steps - Integrate with the development server - Provide additional CLI commands ### Development Setup Requirements + - Node.js 22.13.0+ required - Git LFS must be installed for full test suite - Some integration tests require Netlify Auth Token (`NETLIFY_AUTH_TOKEN`) or login via `./bin/run.js login` ### Coding Style: + - Never write comments on what the code does, make the code clean and self explanatory instead diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 73b70570546..fad7632a356 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -2,17 +2,14 @@ ## Our Pledge -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of experience, -nationality, personal appearance, race, religion, or sexual identity and -orientation. +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making +participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, +disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, +religion, or sexual identity and orientation. ## Our Standards -Examples of behavior that contributes to creating a positive environment -include: +Examples of behavior that contributes to creating a positive environment include: - Using welcoming and inclusive language - Being respectful of differing viewpoints and experiences @@ -22,53 +19,42 @@ include: Examples of unacceptable behavior by participants include: -- The use of sexualized language or imagery and unwelcome sexual attention or - advances +- The use of sexualized language or imagery and unwelcome sexual attention or advances - Trolling, insulting/derogatory comments, and personal or political attacks - Public or private harassment -- Publishing others' private information, such as a physical or electronic - address, without explicit permission -- Other conduct which could reasonably be considered inappropriate in a - professional setting +- Publishing others' private information, such as a physical or electronic address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take +appropriate and fair corrective action in response to any instances of unacceptable behavior. -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, +issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any +contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the +project or its community. Examples of representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed representative at an online or offline +event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at david@netlify.com. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at +david@netlify.com. All complaints will be reviewed and investigated and will result in a response that is deemed +necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to +the reporter of an incident. Further details of specific enforcement policies may be posted separately. -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent +repercussions as determined by other members of the project's leadership. ## Attribution -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at [http://contributor-covenant.org/version/1/4][version] +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at +[http://contributor-covenant.org/version/1/4][version] [homepage]: http://contributor-covenant.org [version]: http://contributor-covenant.org/version/1/4/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b23b6fde72a..b9579c8a46f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -66,8 +66,8 @@ npm run watch Make sure everything is correctly set up by running those tests first. -We recommend you set up your IDE or text editor to run ESLint and Prettier automatically on file save. Otherwise, you -can run them manually using: +We recommend you set up your IDE or text editor to run ESLint and oxfmt automatically on file save. Otherwise, you can +run them manually using: ```bash npm run format diff --git a/bin/run.js b/bin/run.js index 16b04a73ebc..1d69460a1ab 100755 --- a/bin/run.js +++ b/bin/run.js @@ -15,7 +15,7 @@ const UPDATE_BOXEN_OPTIONS = { padding: 1, margin: 1, textAlignment: 'center', - borderStyle: 'round', + borderStyle: 'round', borderColor: NETLIFY_CYAN_HEX, float: 'center', // This is an intentional half-width space to work around a unicode padding math bug in boxen diff --git a/functions-templates/typescript/scheduled-function/{{name}}.mts b/functions-templates/typescript/scheduled-function/{{name}}.mts index 8613ce21de7..dc76ca59d5a 100644 --- a/functions-templates/typescript/scheduled-function/{{name}}.mts +++ b/functions-templates/typescript/scheduled-function/{{name}}.mts @@ -1,11 +1,11 @@ -import type { Config } from "@netlify/functions" +import type { Config } from '@netlify/functions' export default async (req: Request) => { - const { next_run } = await req.json() + const { next_run } = await req.json() - console.log("Received event! Next invocation at:", next_run) + console.log('Received event! Next invocation at:', next_run) } export const config: Config = { - schedule: "@hourly" + schedule: '@hourly', } diff --git a/layout.html b/layout.html index 601e33be959..424adc67901 100644 --- a/layout.html +++ b/layout.html @@ -1,4 +1,4 @@ - + diff --git a/renovate.json5 b/renovate.json5 index 4416b8b8ca4..07281ec5dd0 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -1,55 +1,55 @@ { - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": ["github>netlify/renovate-config:esm"], - "ignorePresets": [":prHourlyLimit2"], - "semanticCommits": "enabled", - "dependencyDashboard": true, - "constraints": { + $schema: 'https://docs.renovatebot.com/renovate-schema.json', + extends: ['github>netlify/renovate-config:esm'], + ignorePresets: [':prHourlyLimit2'], + semanticCommits: 'enabled', + dependencyDashboard: true, + constraints: { // Use npm@10 due to https://github.com/npm/cli/issues/8489 and https://github.com/npm/cli/issues/8767 - "npm": '^10.0.0', + npm: '^10.0.0', }, - "postUpdateOptions": ["npmDedupe"], - "packageRules": [ + postUpdateOptions: ['npmDedupe'], + packageRules: [ { - "description": "Open PRs immediately for @netlify/ packages without a schedule", - "matchPackagePatterns": ["^@netlify/"], - "schedule": ["at any time"] + description: 'Open PRs immediately for @netlify/ packages without a schedule', + matchPackagePatterns: ['^@netlify/'], + schedule: ['at any time'], }, { - "matchFileNames": ["site/package.json"], - "semanticCommitType": "chore", - "addLabels": ["website"], - "semanticCommitScope": "website", - "additionalBranchPrefix": "website-" + matchFileNames: ['site/package.json'], + semanticCommitType: 'chore', + addLabels: ['website'], + semanticCommitScope: 'website', + additionalBranchPrefix: 'website-', }, // Reduce noise by grouping `site/package.json` non-major updates together { - "matchFileNames": ["site/package.json"], - "matchUpdateTypes": ["minor", "patch", "pin", "digest"], - "groupName": "website non-major dependencies" + matchFileNames: ['site/package.json'], + matchUpdateTypes: ['minor', 'patch', 'pin', 'digest'], + groupName: 'website non-major dependencies', }, { - "matchFileNames": ["tests/**/package.json"], - "semanticCommitType": "chore", - "addLabels": ["tests"], - "semanticCommitScope": "tests", - "additionalBranchPrefix": "tests-" + matchFileNames: ['tests/**/package.json'], + semanticCommitType: 'chore', + addLabels: ['tests'], + semanticCommitScope: 'tests', + additionalBranchPrefix: 'tests-', }, { - "matchFileNames": ["src/**/package.json"], - "semanticCommitType": "fix", - "addLabels": ["templates"], - "semanticCommitScope": "templates", - "additionalBranchPrefix": "templates-" + matchFileNames: ['src/**/package.json'], + semanticCommitType: 'fix', + addLabels: ['templates'], + semanticCommitScope: 'templates', + additionalBranchPrefix: 'templates-', }, { - "matchFileNames": ["tests/**/package.json"], - "extends": [":pinAllExceptPeerDependencies"] + matchFileNames: ['tests/**/package.json'], + extends: [':pinAllExceptPeerDependencies'], }, { - "description": "Pin get-port to v5 (https://github.com/netlify/cli/pull/6531)", - "matchPackageNames": ["get-port"], - "allowedVersions": "<6" - } - ] + description: 'Pin get-port to v5 (https://github.com/netlify/cli/pull/6531)', + matchPackageNames: ['get-port'], + allowedVersions: '<6', + }, + ], } diff --git a/site/netlify.toml b/site/netlify.toml index 4a17efcf571..b1b1d371fca 100644 --- a/site/netlify.toml +++ b/site/netlify.toml @@ -1,58 +1,58 @@ [build] - command = "pushd .. && npm ci --no-verify && popd && npm run build" - publish = "dist" +command = "pushd .. && npm ci --no-verify && popd && npm run build" +publish = "dist" [functions] - node_bundler = "esbuild" +node_bundler = "esbuild" ##################### # Redirect Rules # ##################### [[redirects]] - # Telemetry link - from = "/telemetry/*" - to = "/.netlify/functions/telemetry" - status = 200 - force = true -[[redirects]] - # Bugsnag link - from = "/report-error" - to = "/.netlify/functions/error-reporting" - status = 200 - force = true -[[redirects]] - # Old CLI download links. - from = "/download/latest/mac" - to = "https://github.com/netlify/netlifyctl/releases/download/v0.4.0/netlifyctl-darwin-amd64-0.4.0.tar.gz" - status = 302 - force = false -[[redirects]] - # Old CLI download links. - from = "/download/latest/linux" - to = "https://github.com/netlify/netlifyctl/releases/download/v0.4.0/netlifyctl-linux-amd64-0.4.0.tar.gz" - status = 302 - force = false -[[redirects]] - # Old CLI download links. - from = "/download/latest/windows" - to = "https://github.com/netlify/netlifyctl/releases/download/v0.4.0/netlifyctl-windows-amd64-0.4.0.zip" - status = 302 - force = false -[[redirects]] - # Old CLI download links. - from = "/download/latest/source-zip" - to = "https://github.com/netlify/netlifyctl/archive/v0.4.0.zip" - status = 302 - force = false -[[redirects]] - # Old CLI download links. - from = "/download/latest/source-tar" - to = "https://github.com/netlify/netlifyctl/archive/v0.4.0.tar.gz" - status = 302 - force = false -[[redirects]] - # Old database command - from = "/commands/db/" - to = "/commands/database/" - status = 301 - force = false +# Telemetry link +from = "/telemetry/*" +to = "/.netlify/functions/telemetry" +status = 200 +force = true +[[redirects]] +# Bugsnag link +from = "/report-error" +to = "/.netlify/functions/error-reporting" +status = 200 +force = true +[[redirects]] +# Old CLI download links. +from = "/download/latest/mac" +to = "https://github.com/netlify/netlifyctl/releases/download/v0.4.0/netlifyctl-darwin-amd64-0.4.0.tar.gz" +status = 302 +force = false +[[redirects]] +# Old CLI download links. +from = "/download/latest/linux" +to = "https://github.com/netlify/netlifyctl/releases/download/v0.4.0/netlifyctl-linux-amd64-0.4.0.tar.gz" +status = 302 +force = false +[[redirects]] +# Old CLI download links. +from = "/download/latest/windows" +to = "https://github.com/netlify/netlifyctl/releases/download/v0.4.0/netlifyctl-windows-amd64-0.4.0.zip" +status = 302 +force = false +[[redirects]] +# Old CLI download links. +from = "/download/latest/source-zip" +to = "https://github.com/netlify/netlifyctl/archive/v0.4.0.zip" +status = 302 +force = false +[[redirects]] +# Old CLI download links. +from = "/download/latest/source-tar" +to = "https://github.com/netlify/netlifyctl/archive/v0.4.0.tar.gz" +status = 302 +force = false +[[redirects]] +# Old database command +from = "/commands/db/" +to = "/commands/database/" +status = 301 +force = false diff --git a/site/netlify/functions/error-reporting.ts b/site/netlify/functions/error-reporting.ts index 4b5d6629a79..c8729fac083 100755 --- a/site/netlify/functions/error-reporting.ts +++ b/site/netlify/functions/error-reporting.ts @@ -52,8 +52,7 @@ const toError = ({ // file:///C:/Users/jane/AppData/Roaming/npm/node_modules/netlify-cli/dist/utils/x.js. // Stripping everything up to the last `node_modules` makes the same frame identical // across machines and install layouts (npm, npx, pnpm) so Bugsnag groups on it. -const normalizeFrameFile = (file: string): string => - file.replace(/^.*node_modules[/\\]/, '').replace(/\\/g, '/') +const normalizeFrameFile = (file: string): string => file.replace(/^.*node_modules[/\\]/, '').replace(/\\/g, '/') export const handler: Handler = async ({ body }) => { try { diff --git a/site/scripts/util/generate-command-data.js b/site/scripts/util/generate-command-data.js index 168a71bb78f..a03ae6f01a4 100644 --- a/site/scripts/util/generate-command-data.js +++ b/site/scripts/util/generate-command-data.js @@ -34,17 +34,19 @@ const parseCommand = function (command) { } }, {}) - const isTopLevel = command.parent?.name() === "netlify" + const isTopLevel = command.parent?.name() === 'netlify' return { parent: !isTopLevel ? command.parent?.name() : undefined, name: command.name(), description: command.description(), commands: [ - ...command.commands.filter(cmd => !cmd._hidden).map(cmd => parseCommand(cmd)), + ...command.commands.filter((cmd) => !cmd._hidden).map((cmd) => parseCommand(cmd)), ...(isTopLevel - ? commands.filter((cmd) => cmd.name().startsWith(`${command.name()}:`) && !cmd._hidden).map(cmd => parseCommand(cmd)) - : []) + ? commands + .filter((cmd) => cmd.name().startsWith(`${command.name()}:`) && !cmd._hidden) + .map((cmd) => parseCommand(cmd)) + : []), ], examples: command.examples.length !== 0 && command.examples, args: args.length !== 0 && args, diff --git a/site/src/content.config.ts b/site/src/content.config.ts index d9ee8c9d1c9..9cfdab0958b 100644 --- a/site/src/content.config.ts +++ b/site/src/content.config.ts @@ -1,7 +1,7 @@ -import { defineCollection } from 'astro:content'; -import { docsLoader } from '@astrojs/starlight/loaders'; -import { docsSchema } from '@astrojs/starlight/schema'; +import { defineCollection } from 'astro:content' +import { docsLoader } from '@astrojs/starlight/loaders' +import { docsSchema } from '@astrojs/starlight/schema' export const collections = { - docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }), -}; + docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }), +} diff --git a/site/src/fonts/font-face.css b/site/src/fonts/font-face.css index 35c86c2be63..65c20c29049 100644 --- a/site/src/fonts/font-face.css +++ b/site/src/fonts/font-face.css @@ -3,8 +3,9 @@ src: url('./pacaembuvar-latin-nohint.woff2') format('woff2'); font-weight: 100 1000; font-display: swap; - unicode-range: U+0-FF, U+131, U+152, U+153, U+2BB, U+2BC, U+2C6, U+2DA, U+2DC, U+2000-206F, U+2074, U+20AC, U+2122, - U+2191, U+2193, U+2212, U+2215; + unicode-range: + U+0-FF, U+131, U+152, U+153, U+2BB, U+2BC, U+2C6, U+2DA, U+2DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, + U+2212, U+2215; } @font-face { @@ -12,8 +13,9 @@ src: url('./mulishvar-latin-nohint.woff2') format('woff2'); font-weight: 100 1000; font-display: swap; - unicode-range: U+0-FF, U+131, U+152, U+153, U+2BB, U+2BC, U+2C6, U+2DA, U+2DC, U+2000-206F, U+2074, U+20AC, U+2122, - U+2191, U+2193, U+2212, U+2215; + unicode-range: + U+0-FF, U+131, U+152, U+153, U+2BB, U+2BC, U+2C6, U+2DA, U+2DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, + U+2212, U+2215; } @font-face { @@ -22,6 +24,7 @@ font-weight: 200 900; font-style: italic; font-display: swap; - unicode-range: U+0-FF, U+131, U+152, U+153, U+2BB, U+2BC, U+2C6, U+2DA, U+2DC, U+2000-206F, U+2074, U+20AC, U+2122, - U+2191, U+2193, U+2212, U+2215; + unicode-range: + U+0-FF, U+131, U+152, U+153, U+2BB, U+2BC, U+2C6, U+2DA, U+2DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, + U+2212, U+2215; } diff --git a/site/src/styles/custom.css b/site/src/styles/custom.css index a35830679f1..5405ad86b9b 100644 --- a/site/src/styles/custom.css +++ b/site/src/styles/custom.css @@ -7,8 +7,9 @@ ::backdrop { /* All variables below are selectively copied from netlify/docs: https://github.com/netlify/docs/blob/main/docs/.vuepress/theme/styles/variables.css */ - --fontFamilyHeading: Pacaembu, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, - 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; + --fontFamilyHeading: + Pacaembu, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', + 'Segoe UI Emoji', 'Segoe UI Symbol'; --fontFamilyMono: 'Roboto Mono', 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', Courier, monospace; /* Color Palette: Neutral colors */ @@ -46,8 +47,9 @@ /* Adjust Starlight's theme defaults */ --sl-nav-pad-y: 0; - --sl-font-system: Mulishvar, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, - Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol; + --sl-font-system: + Mulishvar, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, + Segoe UI Emoji, Segoe UI Symbol; --sl-font-mono: var(--fontFamilyMono); --sl-color-bg: var(--colorBg); --sl-color-bg-nav: var(--sl-color-bg); @@ -76,7 +78,7 @@ & .right-sidebar a[aria-current='true'], & .right-sidebar a[aria-current='true']:hover, - & .sidebar [open]>summary>.group-label>.large { + & .sidebar [open] > summary > .group-label > .large { background: transparent; color: var(--colorText); } @@ -87,7 +89,7 @@ & .sidebar details a:hover, & .sidebar .large:hover, - & .sidebar [open]>summary>.group-label>.large:hover, + & .sidebar [open] > summary > .group-label > .large:hover, & .sidebar a.large[aria-current='page'], & .right-sidebar a:hover { color: var(--colorSidebarActiveLink); @@ -199,7 +201,7 @@ a { } /* Bump font size of first paragraph */ -.main-pane .sl-markdown-content>p:first-of-type:not(.netlify-panel) { +.main-pane .sl-markdown-content > p:first-of-type:not(.netlify-panel) { font-size: var(--mediumText); } @@ -222,7 +224,7 @@ a { } /* Remove border in between main heading and content */ -.content-panel+.content-panel { +.content-panel + .content-panel { border-top-width: 0; } @@ -252,7 +254,7 @@ a { } /* Align top-level links to caret */ -.sidebar .top-level>li>a { +.sidebar .top-level > li > a { --sl-icon-size: 1.25rem; --sl-icon-caret-size: 4.16; /* caret icon width is 4.16 at the original icon size of 16x16 */ @@ -268,7 +270,7 @@ a { } /* Second level sidebar links */ -.sidebar details ul>li { +.sidebar details ul > li { border-inline-start: 0; padding-inline-start: 2.5rem; @@ -278,7 +280,7 @@ a { } /* Second-level items with accordion (`summary`) */ -.sidebar ul ul>li:has(summary) { +.sidebar ul ul > li:has(summary) { margin-inline-start: -1rem; & .large { @@ -301,7 +303,7 @@ a { /* Starlight's current sidebar HTML markup contains whitespace in between tags, reduce default value a bit (not 0 to stay on the safe side re:upstream changes) */ -.sidebar .top-level>li>a.external-link:after { +.sidebar .top-level > li > a.external-link:after { margin-left: 0.125em; } @@ -382,10 +384,9 @@ details summary { /* Medium screens (Starlight breakpoint) */ @media (min-width: 50rem) { - /* Increase default margin in between top-level sidebar items with collapsible sub-items, very bespoke to the current sidebar structure */ - .top-level>li+li>details { + .top-level > li + li > details { margin-top: 1rem; } @@ -395,7 +396,7 @@ details summary { } } -.tab>a { +.tab > a { border-color: var(--colorBorder) !important; &[aria-selected='true'] { diff --git a/src/commands/clone/clone.ts b/src/commands/clone/clone.ts index 10e0a272efd..7d09289d1c7 100644 --- a/src/commands/clone/clone.ts +++ b/src/commands/clone/clone.ts @@ -25,7 +25,7 @@ const cloneRepo = async (repoUrl: string, targetDir: string, debug: boolean): Pr try { await runGit(['clone', repoUrl, targetDir], !debug) } catch (error) { - throw new Error(`Failed to clone repository: ${error instanceof Error ? error.message : error?.toString() ?? ''}`) + throw new Error(`Failed to clone repository: ${error instanceof Error ? error.message : (error?.toString() ?? '')}`) } } diff --git a/src/commands/types.d.ts b/src/commands/types.d.ts index bcd3d73f8aa..62c43490799 100644 --- a/src/commands/types.d.ts +++ b/src/commands/types.d.ts @@ -29,7 +29,7 @@ export type NetlifyOptions = { scheme?: string host?: string pathPrefix?: string - }, + } repositoryRoot: string /** Absolute path of the netlify configuration file */ configFilePath: string diff --git a/src/lib/api.ts b/src/lib/api.ts index 22666fb3352..751031572fa 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -9,7 +9,7 @@ export const cancelDeploy = async ({ api, deployId }: { api: NetlifyAPI; deployI } catch (error) { warn( `Failed canceling deploy with id ${deployId}: ${ - error instanceof Error ? error.message : error?.toString() ?? '' + error instanceof Error ? error.message : (error?.toString() ?? '') }`, ) } diff --git a/src/utils/deploy/hash-fns.ts b/src/utils/deploy/hash-fns.ts index c9edc6379a3..c7e441da785 100644 --- a/src/utils/deploy/hash-fns.ts +++ b/src/utils/deploy/hash-fns.ts @@ -188,14 +188,14 @@ const hashFns = async ( .filter((func) => Boolean( func.displayName || - func.generator || - func.routes || - func.buildData || - func.priority || - func.trafficRules || - func.region || - func.memory || - func.vcpu, + func.generator || + func.routes || + func.buildData || + func.priority || + func.trafficRules || + func.region || + func.memory || + func.vcpu, ), ) .reduce( diff --git a/src/utils/get-repo-data.ts b/src/utils/get-repo-data.ts index 3e619ce482c..b3aeab41b89 100644 --- a/src/utils/get-repo-data.ts +++ b/src/utils/get-repo-data.ts @@ -70,12 +70,12 @@ const getRepoData = async ({ repo, url, branch, - provider: host != null ? PROVIDERS[host] ?? host : host, + provider: host != null ? (PROVIDERS[host] ?? host) : host, httpsUrl: `https://${host}/${repo}`, } } catch (error) { return { - error: error instanceof Error ? error.message : error?.toString() ?? 'Failed to get repo data', + error: error instanceof Error ? error.message : (error?.toString() ?? 'Failed to get repo data'), } } } diff --git a/src/utils/live-tunnel.ts b/src/utils/live-tunnel.ts index 6da618754d2..e0139d5ebc8 100644 --- a/src/utils/live-tunnel.ts +++ b/src/utils/live-tunnel.ts @@ -191,7 +191,7 @@ export const getLiveTunnelSlug = (state: LocalState, override?: string) => { } catch (error) { log( `${NETLIFYDEVERR} Could not read or write local state file: ${ - error instanceof Error ? error.message : error?.toString() ?? '' + error instanceof Error ? error.message : (error?.toString() ?? '') }`, ) } diff --git a/src/utils/shell.ts b/src/utils/shell.ts index a0da60bb303..0be071980d7 100644 --- a/src/utils/shell.ts +++ b/src/utils/shell.ts @@ -58,7 +58,10 @@ const isMissingCommandMessage = ({ command, output }: { command: string; output: const createStripAnsiControlCharsStream = (): Transform => new Transform({ transform(chunk, _encoding, callback) { - callback(null, stripVTControlCharacters(typeof chunk === 'string' ? chunk : (chunk as unknown)?.toString() ?? '')) + callback( + null, + stripVTControlCharacters(typeof chunk === 'string' ? chunk : ((chunk as unknown)?.toString() ?? '')), + ) }, }) diff --git a/tests/integration/__fixtures__/dev-server-with-header-matching-edge-functions/netlify.toml b/tests/integration/__fixtures__/dev-server-with-header-matching-edge-functions/netlify.toml index eec6a99eae6..9fd45163ef5 100644 --- a/tests/integration/__fixtures__/dev-server-with-header-matching-edge-functions/netlify.toml +++ b/tests/integration/__fixtures__/dev-server-with-header-matching-edge-functions/netlify.toml @@ -1,2 +1,2 @@ [build] -publish = "public" \ No newline at end of file +publish = "public" diff --git a/tests/integration/__fixtures__/dev-server-with-header-matching-edge-functions/public/index.html b/tests/integration/__fixtures__/dev-server-with-header-matching-edge-functions/public/index.html index 4a3cf2488c1..297392be14a 100644 --- a/tests/integration/__fixtures__/dev-server-with-header-matching-edge-functions/public/index.html +++ b/tests/integration/__fixtures__/dev-server-with-header-matching-edge-functions/public/index.html @@ -1,4 +1,4 @@ - + Header Matching Test diff --git a/tests/integration/__fixtures__/hugo-site/layouts/_default/list.html b/tests/integration/__fixtures__/hugo-site/layouts/_default/list.html index 1eed5d7bc6a..55603300d4f 100644 --- a/tests/integration/__fixtures__/hugo-site/layouts/_default/list.html +++ b/tests/integration/__fixtures__/hugo-site/layouts/_default/list.html @@ -1,4 +1,4 @@ - + diff --git a/tests/integration/__fixtures__/next-app-without-config/app/globals.css b/tests/integration/__fixtures__/next-app-without-config/app/globals.css index f4bd77c0cca..760b257c8cc 100644 --- a/tests/integration/__fixtures__/next-app-without-config/app/globals.css +++ b/tests/integration/__fixtures__/next-app-without-config/app/globals.css @@ -1,9 +1,9 @@ :root { --max-width: 1100px; --border-radius: 12px; - --font-mono: ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono", - "Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Source Code Pro", - "Fira Mono", "Droid Sans Mono", "Courier New", monospace; + --font-mono: + ui-monospace, Menlo, Monaco, 'Cascadia Mono', 'Segoe UI Mono', 'Roboto Mono', 'Oxygen Mono', 'Ubuntu Monospace', + 'Source Code Pro', 'Fira Mono', 'Droid Sans Mono', 'Courier New', monospace; --foreground-rgb: 0, 0, 0; --background-start-rgb: 214, 219, 220; @@ -17,22 +17,11 @@ #0071ff33 160deg, transparent 360deg ); - --secondary-glow: radial-gradient( - rgba(255, 255, 255, 1), - rgba(255, 255, 255, 0) - ); + --secondary-glow: radial-gradient(rgba(255, 255, 255, 1), rgba(255, 255, 255, 0)); --tile-start-rgb: 239, 245, 249; --tile-end-rgb: 228, 232, 233; - --tile-border: conic-gradient( - #00000080, - #00000040, - #00000030, - #00000020, - #00000010, - #00000010, - #00000080 - ); + --tile-border: conic-gradient(#00000080, #00000040, #00000030, #00000020, #00000010, #00000010, #00000080); --callout-rgb: 238, 240, 241; --callout-border-rgb: 172, 175, 176; @@ -47,24 +36,11 @@ --background-end-rgb: 0, 0, 0; --primary-glow: radial-gradient(rgba(1, 65, 255, 0.4), rgba(1, 65, 255, 0)); - --secondary-glow: linear-gradient( - to bottom right, - rgba(1, 65, 255, 0), - rgba(1, 65, 255, 0), - rgba(1, 65, 255, 0.3) - ); + --secondary-glow: linear-gradient(to bottom right, rgba(1, 65, 255, 0), rgba(1, 65, 255, 0), rgba(1, 65, 255, 0.3)); --tile-start-rgb: 2, 13, 46; --tile-end-rgb: 2, 5, 19; - --tile-border: conic-gradient( - #ffffff80, - #ffffff40, - #ffffff30, - #ffffff20, - #ffffff10, - #ffffff10, - #ffffff80 - ); + --tile-border: conic-gradient(#ffffff80, #ffffff40, #ffffff30, #ffffff20, #ffffff10, #ffffff10, #ffffff80); --callout-rgb: 20, 20, 20; --callout-border-rgb: 108, 108, 108; @@ -87,12 +63,7 @@ body { body { color: rgb(var(--foreground-rgb)); - background: linear-gradient( - to bottom, - transparent, - rgb(var(--background-end-rgb)) - ) - rgb(var(--background-start-rgb)); + background: linear-gradient(to bottom, transparent, rgb(var(--background-end-rgb))) rgb(var(--background-start-rgb)); } a { diff --git a/tests/integration/__fixtures__/next-app-without-config/app/page.module.css b/tests/integration/__fixtures__/next-app-without-config/app/page.module.css index 5c4b1e6a2c6..999dc979ad6 100644 --- a/tests/integration/__fixtures__/next-app-without-config/app/page.module.css +++ b/tests/integration/__fixtures__/next-app-without-config/app/page.module.css @@ -51,7 +51,9 @@ border-radius: var(--border-radius); background: rgba(var(--card-rgb), 0); border: 1px solid rgba(var(--card-border-rgb), 0); - transition: background 200ms, border 200ms; + transition: + background 200ms, + border 200ms; } .card span { @@ -98,7 +100,7 @@ .center::before, .center::after { - content: ""; + content: ''; left: 50%; position: absolute; filter: blur(45px); @@ -179,11 +181,7 @@ border-radius: 0; border: none; border-bottom: 1px solid rgba(var(--callout-border-rgb), 0.25); - background: linear-gradient( - to bottom, - rgba(var(--background-start-rgb), 1), - rgba(var(--callout-rgb), 0.5) - ); + background: linear-gradient(to bottom, rgba(var(--background-start-rgb), 1), rgba(var(--callout-rgb), 0.5)); background-clip: padding-box; backdrop-filter: blur(24px); } @@ -194,11 +192,7 @@ inset: auto 0 0; padding: 2rem; height: 200px; - background: linear-gradient( - to bottom, - transparent 0%, - rgb(var(--background-end-rgb)) 40% - ); + background: linear-gradient(to bottom, transparent 0%, rgb(var(--background-end-rgb)) 40%); z-index: 1; } } diff --git a/tests/integration/__fixtures__/next-app/app/globals.css b/tests/integration/__fixtures__/next-app/app/globals.css index f4bd77c0cca..760b257c8cc 100644 --- a/tests/integration/__fixtures__/next-app/app/globals.css +++ b/tests/integration/__fixtures__/next-app/app/globals.css @@ -1,9 +1,9 @@ :root { --max-width: 1100px; --border-radius: 12px; - --font-mono: ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono", - "Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Source Code Pro", - "Fira Mono", "Droid Sans Mono", "Courier New", monospace; + --font-mono: + ui-monospace, Menlo, Monaco, 'Cascadia Mono', 'Segoe UI Mono', 'Roboto Mono', 'Oxygen Mono', 'Ubuntu Monospace', + 'Source Code Pro', 'Fira Mono', 'Droid Sans Mono', 'Courier New', monospace; --foreground-rgb: 0, 0, 0; --background-start-rgb: 214, 219, 220; @@ -17,22 +17,11 @@ #0071ff33 160deg, transparent 360deg ); - --secondary-glow: radial-gradient( - rgba(255, 255, 255, 1), - rgba(255, 255, 255, 0) - ); + --secondary-glow: radial-gradient(rgba(255, 255, 255, 1), rgba(255, 255, 255, 0)); --tile-start-rgb: 239, 245, 249; --tile-end-rgb: 228, 232, 233; - --tile-border: conic-gradient( - #00000080, - #00000040, - #00000030, - #00000020, - #00000010, - #00000010, - #00000080 - ); + --tile-border: conic-gradient(#00000080, #00000040, #00000030, #00000020, #00000010, #00000010, #00000080); --callout-rgb: 238, 240, 241; --callout-border-rgb: 172, 175, 176; @@ -47,24 +36,11 @@ --background-end-rgb: 0, 0, 0; --primary-glow: radial-gradient(rgba(1, 65, 255, 0.4), rgba(1, 65, 255, 0)); - --secondary-glow: linear-gradient( - to bottom right, - rgba(1, 65, 255, 0), - rgba(1, 65, 255, 0), - rgba(1, 65, 255, 0.3) - ); + --secondary-glow: linear-gradient(to bottom right, rgba(1, 65, 255, 0), rgba(1, 65, 255, 0), rgba(1, 65, 255, 0.3)); --tile-start-rgb: 2, 13, 46; --tile-end-rgb: 2, 5, 19; - --tile-border: conic-gradient( - #ffffff80, - #ffffff40, - #ffffff30, - #ffffff20, - #ffffff10, - #ffffff10, - #ffffff80 - ); + --tile-border: conic-gradient(#ffffff80, #ffffff40, #ffffff30, #ffffff20, #ffffff10, #ffffff10, #ffffff80); --callout-rgb: 20, 20, 20; --callout-border-rgb: 108, 108, 108; @@ -87,12 +63,7 @@ body { body { color: rgb(var(--foreground-rgb)); - background: linear-gradient( - to bottom, - transparent, - rgb(var(--background-end-rgb)) - ) - rgb(var(--background-start-rgb)); + background: linear-gradient(to bottom, transparent, rgb(var(--background-end-rgb))) rgb(var(--background-start-rgb)); } a { diff --git a/tests/integration/__fixtures__/next-app/app/page.module.css b/tests/integration/__fixtures__/next-app/app/page.module.css index 5c4b1e6a2c6..999dc979ad6 100644 --- a/tests/integration/__fixtures__/next-app/app/page.module.css +++ b/tests/integration/__fixtures__/next-app/app/page.module.css @@ -51,7 +51,9 @@ border-radius: var(--border-radius); background: rgba(var(--card-rgb), 0); border: 1px solid rgba(var(--card-border-rgb), 0); - transition: background 200ms, border 200ms; + transition: + background 200ms, + border 200ms; } .card span { @@ -98,7 +100,7 @@ .center::before, .center::after { - content: ""; + content: ''; left: 50%; position: absolute; filter: blur(45px); @@ -179,11 +181,7 @@ border-radius: 0; border: none; border-bottom: 1px solid rgba(var(--callout-border-rgb), 0.25); - background: linear-gradient( - to bottom, - rgba(var(--background-start-rgb), 1), - rgba(var(--callout-rgb), 0.5) - ); + background: linear-gradient(to bottom, rgba(var(--background-start-rgb), 1), rgba(var(--callout-rgb), 0.5)); background-clip: padding-box; backdrop-filter: blur(24px); } @@ -194,11 +192,7 @@ inset: auto 0 0; padding: 2rem; height: 200px; - background: linear-gradient( - to bottom, - transparent 0%, - rgb(var(--background-end-rgb)) 40% - ); + background: linear-gradient(to bottom, transparent 0%, rgb(var(--background-end-rgb)) 40%); z-index: 1; } } diff --git a/tests/integration/__fixtures__/plugin-changing-publish-dir/netlify.toml b/tests/integration/__fixtures__/plugin-changing-publish-dir/netlify.toml index 7caee501c35..575013c3bbf 100644 --- a/tests/integration/__fixtures__/plugin-changing-publish-dir/netlify.toml +++ b/tests/integration/__fixtures__/plugin-changing-publish-dir/netlify.toml @@ -1,2 +1,2 @@ [[plugins]] - package="/plugin" \ No newline at end of file +package = "/plugin" diff --git a/tests/integration/commands/dev/redirects.test.ts b/tests/integration/commands/dev/redirects.test.ts index 93233f3e9ab..8a586d446e6 100644 --- a/tests/integration/commands/dev/redirects.test.ts +++ b/tests/integration/commands/dev/redirects.test.ts @@ -49,9 +49,10 @@ describe('redirects', async () => { await writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`) await writeFile( netlifyTomlPath, - ( - await readFile(netlifyTomlPath, 'utf8') - ).replace('targetPort = 6123', `targetPort = ${targetPort.toString()}`), + (await readFile(netlifyTomlPath, 'utf8')).replace( + 'targetPort = 6123', + `targetPort = ${targetPort.toString()}`, + ), ) }, }, diff --git a/tests/integration/commands/env/env-get.test.ts b/tests/integration/commands/env/env-get.test.ts index 8e960e3e88c..badc8d51f89 100644 --- a/tests/integration/commands/env/env-get.test.ts +++ b/tests/integration/commands/env/env-get.test.ts @@ -15,55 +15,48 @@ describe('env:get command', () => { expect(cliResponse).toEqual({}) }) - test.concurrent( - 'should return the value for the given context when present', - async ({ fixture }) => { - const cliResponse = await fixture.callCli(['env:get', '--json', 'EXISTING_VAR', '--context', 'production'], { - offline: false, - parseJson: true, - }) + test.concurrent('should return the value for the given context when present', async ({ + fixture, + }) => { + const cliResponse = await fixture.callCli(['env:get', '--json', 'EXISTING_VAR', '--context', 'production'], { + offline: false, + parseJson: true, + }) - expect(cliResponse.EXISTING_VAR).toBe('envelope-prod-value') - }, - ) + expect(cliResponse.EXISTING_VAR).toBe('envelope-prod-value') + }) - test.concurrent( - 'should not return the value for the given context when not present', - async ({ fixture }) => { - const cliResponse = await fixture.callCli( - ['env:get', '--json', 'EXISTING_VAR', '--context', 'deploy-preview'], - { - offline: false, - parseJson: true, - }, - ) + test.concurrent('should not return the value for the given context when not present', async ({ + fixture, + }) => { + const cliResponse = await fixture.callCli(['env:get', '--json', 'EXISTING_VAR', '--context', 'deploy-preview'], { + offline: false, + parseJson: true, + }) - expect(cliResponse.EXISTING_VAR).toBeUndefined() - }, - ) + expect(cliResponse.EXISTING_VAR).toBeUndefined() + }) - test.concurrent( - 'should find the value for the given scope when present', - async ({ fixture }) => { - const cliResponse = await fixture.callCli(['env:get', '--json', 'EXISTING_VAR', '--scope', 'functions'], { - offline: false, - parseJson: true, - }) + test.concurrent('should find the value for the given scope when present', async ({ + fixture, + }) => { + const cliResponse = await fixture.callCli(['env:get', '--json', 'EXISTING_VAR', '--scope', 'functions'], { + offline: false, + parseJson: true, + }) - expect(cliResponse.EXISTING_VAR).toBe('envelope-dev-value') - }, - ) + expect(cliResponse.EXISTING_VAR).toBe('envelope-dev-value') + }) - test.concurrent( - 'should not find the value for the given scope when not present', - async ({ fixture }) => { - const cliResponse = await fixture.callCli(['env:get', '--json', 'EXISTING_VAR', '--scope', 'runtime'], { - offline: false, - parseJson: true, - }) + test.concurrent('should not find the value for the given scope when not present', async ({ + fixture, + }) => { + const cliResponse = await fixture.callCli(['env:get', '--json', 'EXISTING_VAR', '--scope', 'runtime'], { + offline: false, + parseJson: true, + }) - expect(cliResponse.EXISTING_VAR).toBeUndefined() - }, - ) + expect(cliResponse.EXISTING_VAR).toBeUndefined() + }) }) }) diff --git a/tests/integration/commands/env/env-list.test.ts b/tests/integration/commands/env/env-list.test.ts index 7c073537320..5585a1b19de 100644 --- a/tests/integration/commands/env/env-list.test.ts +++ b/tests/integration/commands/env/env-list.test.ts @@ -18,33 +18,31 @@ describe('env:list command', () => { }) }) - test.concurrent( - 'should return the keys and values for the given context', - async ({ fixture }) => { - const cliResponse = await fixture.callCli(['env:list', '--context', 'production', '--json'], { - offline: false, - parseJson: true, - }) - - expect(cliResponse).toEqual({ - EXISTING_VAR: 'envelope-prod-value', - OTHER_VAR: 'envelope-all-value', - }) - }, - ) - - test.concurrent( - 'should return the keys and values for the given scope', - async ({ fixture }) => { - const cliResponse = await fixture.callCli(['env:list', '--scope', 'runtime', '--json'], { - offline: false, - parseJson: true, - }) - - expect(cliResponse).toEqual({ - OTHER_VAR: 'envelope-all-value', - }) - }, - ) + test.concurrent('should return the keys and values for the given context', async ({ + fixture, + }) => { + const cliResponse = await fixture.callCli(['env:list', '--context', 'production', '--json'], { + offline: false, + parseJson: true, + }) + + expect(cliResponse).toEqual({ + EXISTING_VAR: 'envelope-prod-value', + OTHER_VAR: 'envelope-all-value', + }) + }) + + test.concurrent('should return the keys and values for the given scope', async ({ + fixture, + }) => { + const cliResponse = await fixture.callCli(['env:list', '--scope', 'runtime', '--json'], { + offline: false, + parseJson: true, + }) + + expect(cliResponse).toEqual({ + OTHER_VAR: 'envelope-all-value', + }) + }) }) }) diff --git a/tests/integration/commands/env/env-set.test.ts b/tests/integration/commands/env/env-set.test.ts index b0ae1f948a0..c24a2d3ea0d 100644 --- a/tests/integration/commands/env/env-set.test.ts +++ b/tests/integration/commands/env/env-set.test.ts @@ -234,42 +234,39 @@ describe('env:set command', async () => { expect(putRequest).toHaveProperty('body.scopes[1]', 'functions') }) describe('errors', () => { - test.concurrent( - 'should error when a value is passed without --context', - async ({ fixture }) => { - await expect( - fixture.callCli(['env:set', 'TOTALLY_NEW', 'cool-value', '--secret', '--force'], { - offline: false, - parseJson: false, - }), - ).rejects.toThrowError(`please specify a non-development context`) - }, - ) - test.concurrent( - 'should error when set with a post-processing --scope', - async ({ fixture }) => { - await expect( - fixture.callCli( - ['env:set', 'TOTALLY_NEW', 'cool-value', '--secret', '--scope', 'builds', 'post-processing', '--force'], - { - offline: false, - parseJson: false, - }, - ), - ).rejects.toThrowError(`Secret values cannot be used within the post-processing scope.`) - }, - ) - test.concurrent( - 'should error when --scope and --context are passed on an existing env var', - async ({ fixture }) => { - await expect( - fixture.callCli(['env:set', 'EXISTING_VAR', '--scope', 'functions', '--context', 'production', '--force'], { + test.concurrent('should error when a value is passed without --context', async ({ + fixture, + }) => { + await expect( + fixture.callCli(['env:set', 'TOTALLY_NEW', 'cool-value', '--secret', '--force'], { + offline: false, + parseJson: false, + }), + ).rejects.toThrowError(`please specify a non-development context`) + }) + test.concurrent('should error when set with a post-processing --scope', async ({ + fixture, + }) => { + await expect( + fixture.callCli( + ['env:set', 'TOTALLY_NEW', 'cool-value', '--secret', '--scope', 'builds', 'post-processing', '--force'], + { offline: false, parseJson: false, - }), - ).rejects.toThrowError(`Setting the context and scope at the same time on an existing env var is not allowed`) - }, - ) + }, + ), + ).rejects.toThrowError(`Secret values cannot be used within the post-processing scope.`) + }) + test.concurrent('should error when --scope and --context are passed on an existing env var', async ({ + fixture, + }) => { + await expect( + fixture.callCli(['env:set', 'EXISTING_VAR', '--scope', 'functions', '--context', 'production', '--force'], { + offline: false, + parseJson: false, + }), + ).rejects.toThrowError(`Setting the context and scope at the same time on an existing env var is not allowed`) + }) }) }) diff --git a/tests/integration/commands/functions-invoke/functions-invoke.test.ts b/tests/integration/commands/functions-invoke/functions-invoke.test.ts index 206ab20fbab..f801ba83692 100644 --- a/tests/integration/commands/functions-invoke/functions-invoke.test.ts +++ b/tests/integration/commands/functions-invoke/functions-invoke.test.ts @@ -5,90 +5,95 @@ import { FixtureTestContext, setupFixtureTests } from '../../utils/fixture.js' describe('functions:invoke command', async () => { await setupFixtureTests('dev-server-with-functions', { devServer: true }, () => { - test.concurrent( - 'should return function response when invoked with no identity argument', - async ({ devServer, expect, fixture }) => { - const stdout = await fixture.callCli(['functions:invoke', 'ping', `--port=${devServer!.port.toString()}`]) - - expect(stdout).toBe('ping') - }, - ) - - test.concurrent( - 'should return function response when invoked', - async ({ devServer, expect, fixture }) => { - const stdout = await fixture.callCli([ - 'functions:invoke', - 'ping', - '--identity', - `--port=${devServer!.port.toString()}`, - ]) - - expect(stdout).toBe('ping') - }, - ) - - test.concurrent( - 'should trigger background function from event', - async ({ devServer, expect, fixture }) => { - const stdout = await fixture.callCli([ - 'functions:invoke', - 'identity-validate-background', - '--identity', - `--port=${devServer!.port.toString()}`, - ]) - - // background functions always return an empty response - expect(stdout).toBe('') - }, - ) - - test.concurrent( - 'should serve helpful tips and tricks', - async ({ devServer, expect, fixture }) => { - const textResponse = await fetch( - `http://localhost:${devServer!.port.toString()}/.netlify/functions/scheduled-isc-body`, - {}, - ) - - const bodyPlainTextResponse = await textResponse.text() - - const youReturnedBodyRegex = /.*Your function returned `body`. Is this an accident\?.*/ - expect(bodyPlainTextResponse).toMatch(youReturnedBodyRegex) - expect(bodyPlainTextResponse).toMatch(/.*You performed an HTTP request.*/) - expect(textResponse.status).toBe(200) - - const htmlResponse = await fetch( - `http://localhost:${devServer!.port.toString()}/.netlify/functions/scheduled-isc-body`, - { - headers: { - accept: 'text/html', - }, + test.concurrent('should return function response when invoked with no identity argument', async ({ + devServer, + expect, + fixture, + }) => { + const stdout = await fixture.callCli(['functions:invoke', 'ping', `--port=${devServer!.port.toString()}`]) + + expect(stdout).toBe('ping') + }) + + test.concurrent('should return function response when invoked', async ({ + devServer, + expect, + fixture, + }) => { + const stdout = await fixture.callCli([ + 'functions:invoke', + 'ping', + '--identity', + `--port=${devServer!.port.toString()}`, + ]) + + expect(stdout).toBe('ping') + }) + + test.concurrent('should trigger background function from event', async ({ + devServer, + expect, + fixture, + }) => { + const stdout = await fixture.callCli([ + 'functions:invoke', + 'identity-validate-background', + '--identity', + `--port=${devServer!.port.toString()}`, + ]) + + // background functions always return an empty response + expect(stdout).toBe('') + }) + + test.concurrent('should serve helpful tips and tricks', async ({ + devServer, + expect, + fixture, + }) => { + const textResponse = await fetch( + `http://localhost:${devServer!.port.toString()}/.netlify/functions/scheduled-isc-body`, + {}, + ) + + const bodyPlainTextResponse = await textResponse.text() + + const youReturnedBodyRegex = /.*Your function returned `body`. Is this an accident\?.*/ + expect(bodyPlainTextResponse).toMatch(youReturnedBodyRegex) + expect(bodyPlainTextResponse).toMatch(/.*You performed an HTTP request.*/) + expect(textResponse.status).toBe(200) + + const htmlResponse = await fetch( + `http://localhost:${devServer!.port.toString()}/.netlify/functions/scheduled-isc-body`, + { + headers: { + accept: 'text/html', }, - ) - - const BodyHtmlResponse = await htmlResponse.text() - - expect(BodyHtmlResponse).toMatch(/.*( - 'should detect netlify-toml defined scheduled functions', - async ({ devServer, expect, fixture }) => { - const stdout = await fixture.callCli(['functions:invoke', 'scheduled', `--port=${devServer!.port.toString()}`]) - - expect(stdout).toBe('') - }, - ) + }, + ) + + const BodyHtmlResponse = await htmlResponse.text() + + expect(BodyHtmlResponse).toMatch(/.*('should detect netlify-toml defined scheduled functions', async ({ + devServer, + expect, + fixture, + }) => { + const stdout = await fixture.callCli(['functions:invoke', 'scheduled', `--port=${devServer!.port.toString()}`]) + + expect(stdout).toBe('') + }) }) }) diff --git a/tests/unit/commands/database/db-migration-pull.test.ts b/tests/unit/commands/database/db-migration-pull.test.ts index adcdb3abd50..a7ffcc86ac5 100644 --- a/tests/unit/commands/database/db-migration-pull.test.ts +++ b/tests/unit/commands/database/db-migration-pull.test.ts @@ -76,8 +76,8 @@ const sampleMigrations: SampleMigration[] = [ function createMockCommand( overrides: { siteId?: string | null; accessToken?: string | null; migrationsPath?: string } = {}, ) { - const siteId = overrides.siteId === null ? undefined : overrides.siteId ?? 'site-123' - const accessToken = overrides.accessToken === null ? undefined : overrides.accessToken ?? 'Bearer test-token' + const siteId = overrides.siteId === null ? undefined : (overrides.siteId ?? 'site-123') + const accessToken = overrides.accessToken === null ? undefined : (overrides.accessToken ?? 'Bearer test-token') const migrationsPath = overrides.migrationsPath ?? '/project/netlify/database/migrations' return { diff --git a/tests/unit/commands/database/db-migrations-reset.test.ts b/tests/unit/commands/database/db-migrations-reset.test.ts index 4c30cf69aed..1c46d3ba031 100644 --- a/tests/unit/commands/database/db-migrations-reset.test.ts +++ b/tests/unit/commands/database/db-migrations-reset.test.ts @@ -65,8 +65,8 @@ function createMockCommand( overrides: { buildDir?: string; projectRoot?: string; siteId?: string | null; accessToken?: string | null } = {}, ) { const { buildDir = '/project', projectRoot = '/project' } = overrides - const siteId = overrides.siteId === null ? undefined : overrides.siteId ?? 'site-123' - const accessToken = overrides.accessToken === null ? undefined : overrides.accessToken ?? 'Bearer test-token' + const siteId = overrides.siteId === null ? undefined : (overrides.siteId ?? 'site-123') + const accessToken = overrides.accessToken === null ? undefined : (overrides.accessToken ?? 'Bearer test-token') return { siteId, diff --git a/tests/unit/commands/database/db-status.test.ts b/tests/unit/commands/database/db-status.test.ts index 23ef50d0c3f..651d3008a57 100644 --- a/tests/unit/commands/database/db-status.test.ts +++ b/tests/unit/commands/database/db-status.test.ts @@ -152,10 +152,10 @@ const migrationsTree = (names: string[]): MockFSNode => ({ function createMockCommand( overrides: { siteRoot?: string | null; migrationsPath?: string | null; siteId?: string | null } = {}, ) { - const siteRoot = overrides.siteRoot === null ? undefined : overrides.siteRoot ?? '/project' + const siteRoot = overrides.siteRoot === null ? undefined : (overrides.siteRoot ?? '/project') const migrationsPath = - overrides.migrationsPath === null ? undefined : overrides.migrationsPath ?? '/project/netlify/database/migrations' - const siteId = overrides.siteId === null ? undefined : overrides.siteId ?? 'site-123' + overrides.migrationsPath === null ? undefined : (overrides.migrationsPath ?? '/project/netlify/database/migrations') + const siteId = overrides.siteId === null ? undefined : (overrides.siteId ?? 'site-123') return { siteId, diff --git a/tests/unit/commands/database/util/api-errors.test.ts b/tests/unit/commands/database/util/api-errors.test.ts index 3c487844a9b..03504864253 100644 --- a/tests/unit/commands/database/util/api-errors.test.ts +++ b/tests/unit/commands/database/util/api-errors.test.ts @@ -2,7 +2,7 @@ import { describe, expect, test } from 'vitest' import { readApiErrorMessage } from '../../../../../src/commands/database/util/api-errors.js' -const makeResponse = (text: string): Response => ({ text: () => Promise.resolve(text) } as unknown as Response) +const makeResponse = (text: string): Response => ({ text: () => Promise.resolve(text) }) as unknown as Response describe('readApiErrorMessage', () => { test('extracts the `message` field from a JSON error body', async () => { diff --git a/types/ascii-table/index.d.ts b/types/ascii-table/index.d.ts index 9f6319f1b34..b8429d37da4 100644 --- a/types/ascii-table/index.d.ts +++ b/types/ascii-table/index.d.ts @@ -1,37 +1,37 @@ declare module 'ascii-table' { export default class AsciiTable { - constructor(title?: string); + constructor(title?: string) - setTitle(title: string): void; - setHeading(...headings: string[]): void; - addRow(...values: string[]): void; - addRow(row: string[]): void; - addRow(row: Record): void; - addRow(row: string[], truncate: boolean): void; - addRow(row: Record, truncate: boolean): void; - addRowMatrix(row: unknown[]): void; - setAlign(column: number, alignment: 'left' | 'center' | 'right'): void; - setAlign(alignments: ('left' | 'center' | 'right')[]): void; - setJustify(column: number, justify: boolean): void; - setJustify(justify: boolean[]): void; - setChars(chars: Record): void; - setStyle(style: 'default' | 'fat' | 'thin' | 'double' | 'round' | 'single'): void; - setBorder(border: boolean): void; - removeBorder(): void; - setTruncate(truncate: boolean): void; - setMaxColWidth(maxWidth: number): void; - setMinColWidth(minWidth: number): void; - setColWidth(column: number, width: number): void; - setColWidths(widths: number[]): void; - setDefaultColWidth(width: number): void; - setDefaultAlignment(alignment: 'left' | 'center' | 'right'): void; - setDefaultJustify(justify: boolean): void; - setDefaultTruncate(truncate: boolean): void; - setDefaultMaxColWidth(maxWidth: number): void; - setDefaultMinColWidth(minWidth: number): void; - setDefaultStyle(style: 'default' | 'fat' | 'thin' | 'double' | 'round' | 'single'): void; - setDefaultBorder(border: boolean): void; - setDefaultChars(chars: Record): void; - toString(): string; + setTitle(title: string): void + setHeading(...headings: string[]): void + addRow(...values: string[]): void + addRow(row: string[]): void + addRow(row: Record): void + addRow(row: string[], truncate: boolean): void + addRow(row: Record, truncate: boolean): void + addRowMatrix(row: unknown[]): void + setAlign(column: number, alignment: 'left' | 'center' | 'right'): void + setAlign(alignments: ('left' | 'center' | 'right')[]): void + setJustify(column: number, justify: boolean): void + setJustify(justify: boolean[]): void + setChars(chars: Record): void + setStyle(style: 'default' | 'fat' | 'thin' | 'double' | 'round' | 'single'): void + setBorder(border: boolean): void + removeBorder(): void + setTruncate(truncate: boolean): void + setMaxColWidth(maxWidth: number): void + setMinColWidth(minWidth: number): void + setColWidth(column: number, width: number): void + setColWidths(widths: number[]): void + setDefaultColWidth(width: number): void + setDefaultAlignment(alignment: 'left' | 'center' | 'right'): void + setDefaultJustify(justify: boolean): void + setDefaultTruncate(truncate: boolean): void + setDefaultMaxColWidth(maxWidth: number): void + setDefaultMinColWidth(minWidth: number): void + setDefaultStyle(style: 'default' | 'fat' | 'thin' | 'double' | 'round' | 'single'): void + setDefaultBorder(border: boolean): void + setDefaultChars(chars: Record): void + toString(): string } } diff --git a/types/express-logging/index.d.ts b/types/express-logging/index.d.ts index 0e01094a3b3..cd16e44d57c 100644 --- a/types/express-logging/index.d.ts +++ b/types/express-logging/index.d.ts @@ -1,17 +1,19 @@ declare module 'express-logging' { - import { RequestHandler } from 'express'; - - interface LoggerOptions {blacklist?: string[]} - + import { RequestHandler } from 'express' + + interface LoggerOptions { + blacklist?: string[] + } + interface Logger { - info(...args: unknown[]): void; - error(...args: unknown[]): void; - warn(...args: unknown[]): void; - debug?(...args: unknown[]): void; - log(...args: unknown[]): void; + info(...args: unknown[]): void + error(...args: unknown[]): void + warn(...args: unknown[]): void + debug?(...args: unknown[]): void + log(...args: unknown[]): void } - - function expressLogging(logger?: Logger, options?: LoggerOptions): RequestHandler; - - export default expressLogging; + + function expressLogging(logger?: Logger, options?: LoggerOptions): RequestHandler + + export default expressLogging } diff --git a/types/maxstache-stream/index.d.ts b/types/maxstache-stream/index.d.ts index 76f88f265bd..e4cc705866a 100644 --- a/types/maxstache-stream/index.d.ts +++ b/types/maxstache-stream/index.d.ts @@ -1,7 +1,7 @@ declare module 'maxstache-stream' { - import { Transform } from 'stream'; + import { Transform } from 'stream' - function maxstacheStream(vars: Record): Transform; - - export default maxstacheStream; + function maxstacheStream(vars: Record): Transform + + export default maxstacheStream } diff --git a/types/maxstache/index.d.ts b/types/maxstache/index.d.ts index 2ff2f5c817e..85f35880516 100644 --- a/types/maxstache/index.d.ts +++ b/types/maxstache/index.d.ts @@ -1,5 +1,5 @@ declare module 'maxstache' { - function maxstache(str: string, ctx: Record): string; - - export default maxstache; + function maxstache(str: string, ctx: Record): string + + export default maxstache } From d0c15ecc8fe7f5c2ec5bddef0eba25bf813f7bb1 Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Fri, 31 Jul 2026 15:01:46 -0400 Subject: [PATCH 2/3] build: fix invalid local types --- src/commands/types.d.ts | 2 +- types/lambda-local/index.d.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/commands/types.d.ts b/src/commands/types.d.ts index 62c43490799..49028851860 100644 --- a/src/commands/types.d.ts +++ b/src/commands/types.d.ts @@ -14,7 +14,7 @@ export type NetlifySite = { configPath?: string siteId?: string get id(): string | undefined - set id(id: string): void + set id(id: string) } /** diff --git a/types/lambda-local/index.d.ts b/types/lambda-local/index.d.ts index 3c01ebf17a3..9fba1bf3883 100644 --- a/types/lambda-local/index.d.ts +++ b/types/lambda-local/index.d.ts @@ -1,7 +1,7 @@ // This module is "TypeScript" but contains no actual type annotations, so // the resulting `.d.ts` file is just useless `any`s. declare module 'lambda-local' { - declare interface Options { + interface Options { clientContext?: string | Record environment?: Record esm?: boolean @@ -16,7 +16,7 @@ declare module 'lambda-local' { // See https://github.com/ashiina/lambda-local/blob/8914e6804533450fa68c56fe6c34858b645735d0/src/lambdalocal.ts#L110 // But this whole thing is kind of a lie (we're exercising a code path where the `event` we pass in is returned, so // this is just our type we happen to define. - declare interface LambdaEvent { + interface LambdaEvent { body?: NodeJS.ReadableStream | string | undefined headers?: Record | undefined level?: unknown From bf51b9d2383c367022c7cceec081e1b4717b3a53 Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Fri, 31 Jul 2026 15:02:18 -0400 Subject: [PATCH 3/3] build: switch from prettier to 10x faster oxfmt - `prettier --check`: 3413 ms median over 5 runs - `oxfmt --check`: 304 ms median over 5 runs Instead of porting over our exact prettier globs, this also starts formatting all oxfmt default globs, including json, toml, markdown, etc. --- .oxfmtrc.json | 10 ++ .prettierignore | 3 - .prettierrc.json | 7 - package-lock.json | 401 ++++++++++++++++++++++++++++++++++++++++++++-- package.json | 7 +- 5 files changed, 399 insertions(+), 29 deletions(-) create mode 100644 .oxfmtrc.json delete mode 100644 .prettierignore delete mode 100644 .prettierrc.json diff --git a/.oxfmtrc.json b/.oxfmtrc.json new file mode 100644 index 00000000000..ebc46166bea --- /dev/null +++ b/.oxfmtrc.json @@ -0,0 +1,10 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "semi": false, + "singleQuote": true, + "printWidth": 120, + "proseWrap": "always", + "trailingComma": "all", + "sortPackageJson": false, + "ignorePatterns": ["node_modules", "CHANGELOG.md", "docs/**", "**/package-lock.json"] +} diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 9e0e8f4e5a6..00000000000 --- a/.prettierignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -src/**/*.js -src/**/*.d.ts diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index ad48f6cec4f..00000000000 --- a/.prettierrc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "semi": false, - "singleQuote": true, - "printWidth": 120, - "proseWrap": "always", - "trailingComma": "all" -} diff --git a/package-lock.json b/package-lock.json index 2268e69d495..c6ff4b18bc6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -162,9 +162,9 @@ "memfs": "^4.56.10", "nock": "^14.0.10", "npm-run-all2": "^8.0.4", + "oxfmt": "0.61.0", "p-timeout": "^7.0.0", "picomatch": "^4.0.4", - "prettier": "^2.8.8", "serialize-javascript": "^7.0.5", "strip-ansi": "^7.1.2", "temp-dir": "^3.0.0", @@ -6772,6 +6772,329 @@ "node": ">=14" } }, + "node_modules/@oxfmt/binding-android-arm-eabi": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-android-arm-eabi/-/binding-android-arm-eabi-0.61.0.tgz", + "integrity": "sha512-BaS+1OVvg9sr+Xav0+KdWedQRcAzrdoEcwMZeqoc2F6ieC1s/t5eM35YQoRPQ7vAqkZ+p3tbQb1r9I9mrV5oGA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-android-arm64": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-android-arm64/-/binding-android-arm64-0.61.0.tgz", + "integrity": "sha512-of8atAV0M1egGcVOMbgZCvc10sFOP3ayQBNQV5h5G3fNq8gACdEswfFk9bzGrdbM23rtg0Coxi7np7oPLcueNw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-darwin-arm64": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-darwin-arm64/-/binding-darwin-arm64-0.61.0.tgz", + "integrity": "sha512-7l8+5ov4BGwtAcmpzvEik/TG3bciwyw/S3e6j5GKH7pcQqcgCVxD3AuJeP6upto+SOTBKQ4wrrdbMt0gq8fHSQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-darwin-x64": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-darwin-x64/-/binding-darwin-x64-0.61.0.tgz", + "integrity": "sha512-Fnz4dDDXBb7udk+DmwelNjxbD6yptyxwCqwCH2ebo4RVLxVsRfFsn/AHJC49KIltPrVokamGv4SSOsiV50DTxQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-freebsd-x64": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-freebsd-x64/-/binding-freebsd-x64-0.61.0.tgz", + "integrity": "sha512-mddOebKNCP+AucmzfNsk3jgbr681qAUvgMqi865GW5gWLJ/AnzXbvjQRrny0e++NAN8aphav/aRSrfFxNsNjpA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-arm-gnueabihf": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-0.61.0.tgz", + "integrity": "sha512-svx59iYL+DbaZGZUIoice4W0CjRXGExnbz7Re+awIb60rVxBS2KrU7Hnlx+nZYanLGLpjneUEgo/VFEKkSZAyQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-arm-musleabihf": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-0.61.0.tgz", + "integrity": "sha512-BYK9MPJPCf6d+fLKMTruThmEyCtHzQ1zLcsrTlUVkmnoXIaHAbfpeLYQwX1tkjs7W11dyzoi6HFvKcdnvX1zNg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-arm64-gnu": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-0.61.0.tgz", + "integrity": "sha512-QUaCNLq2/EC6G5ljOuFanl9Lgw6ZWp4co7rs4+KOMUzbGfA4Lq58FHRjjF9sVIG+93XSbo343MxFATrOU1qctA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-arm64-musl": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm64-musl/-/binding-linux-arm64-musl-0.61.0.tgz", + "integrity": "sha512-S6uvJ6MXnRXl+zTs0CARNDvkE+cymj0EVWEKKsyKnlLlqTyQJBjw5s4D2pSIOZc+S46cy4STefzcr/sm0VzVPA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-ppc64-gnu": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-0.61.0.tgz", + "integrity": "sha512-6VDlRcytvZG6UlSIdAFKDLbppo9tvPxrWzle6vHldYFMeuDPQEfMKrkwezp7FaBq1wik9ra554ZZeRPsyIkFpg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-riscv64-gnu": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-0.61.0.tgz", + "integrity": "sha512-KkBTYbzExpbmn15XjKPLu2fRV2PVlq+KWt+brad5rwIa03vdYoaDRWiS7raHII/dCTR6Ro4UpYUCH4t6lif4WQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-riscv64-musl": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-0.61.0.tgz", + "integrity": "sha512-69tzIq7sJLVB9dxYYtvMzcSSsnZHSO+U2U19O2RqDqgj6+Q4O7HjSXdaszbcgqzhsUwzSH7z5kWvk8nmf6BHTg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-s390x-gnu": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-0.61.0.tgz", + "integrity": "sha512-Oqi/N0OvtOVXsPKAOOhKgGH3msRYF8BLJaNBbWiupRiKoKVyc8JRKPCfarkQJC+RgP9U8raUKLe+bNwd0HUMiA==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-x64-gnu": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-x64-gnu/-/binding-linux-x64-gnu-0.61.0.tgz", + "integrity": "sha512-3TKwv/ed4uwJSemAA8P9XcoqETpjQI4waquF9UilhA9Mn/dhr1PdUEXWlL74mtc6ZNfmKPA9+NEJm01nRF8CVA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-x64-musl": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-x64-musl/-/binding-linux-x64-musl-0.61.0.tgz", + "integrity": "sha512-uFso4u4nLkVSlMCpgjyvWV60Gt7GvDQHnk1mmRxHIkZTMB0ljpUKwCD9FYGgN9H97x2wYl0UwEjgRZaPIuhEhw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-openharmony-arm64": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-openharmony-arm64/-/binding-openharmony-arm64-0.61.0.tgz", + "integrity": "sha512-keGLkzeOvkMpNmPp4hffXWpfoSsY6e1K8++KXD4mSSfxdvM8q9QUDsYY689TB1k6Co832DZn1MnaaVx6cIBMWQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-win32-arm64-msvc": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-0.61.0.tgz", + "integrity": "sha512-VzsAISkFxmNhJ5LBDEL9VuH6tJsVJMtqYit2LyIUf/HLnsCe4Pg9SMOjjVQzGWt0bnpyfJ94CrqTqcpNZzK+ug==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-win32-ia32-msvc": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-0.61.0.tgz", + "integrity": "sha512-xv4t7yzwJoYaLB6Zv28B3W+j7brEjsyv50rLTAQgmxJzddce9fAMCxed8dSAkbWES0zz2J29nYK5FaTuD2YBHg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-win32-x64-msvc": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-x64-msvc/-/binding-win32-x64-msvc-0.61.0.tgz", + "integrity": "sha512-6EZXFkqOwxdDYjIn3TSNnPk3ST5E5GiYd4FiM6UF/mCL/LZSfr6D6UygTfW3R1PCQP2quCKpCEGRlij8E3VYbg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, "node_modules/@parcel/watcher": { "version": "2.5.1", "hasInstallScript": true, @@ -18065,6 +18388,68 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/oxfmt": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/oxfmt/-/oxfmt-0.61.0.tgz", + "integrity": "sha512-DxdHBEMYpcEnHoUHjjOigUqV2TYKsvxLwUPXnVYBjgFdqrcQ/91OtwubtZ2PUodCs3sStI8R5Qw3fKNGK4e8wQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinypool": "2.1.0" + }, + "bin": { + "oxfmt": "bin/oxfmt" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/sponsors/Boshen" + }, + "optionalDependencies": { + "@oxfmt/binding-android-arm-eabi": "0.61.0", + "@oxfmt/binding-android-arm64": "0.61.0", + "@oxfmt/binding-darwin-arm64": "0.61.0", + "@oxfmt/binding-darwin-x64": "0.61.0", + "@oxfmt/binding-freebsd-x64": "0.61.0", + "@oxfmt/binding-linux-arm-gnueabihf": "0.61.0", + "@oxfmt/binding-linux-arm-musleabihf": "0.61.0", + "@oxfmt/binding-linux-arm64-gnu": "0.61.0", + "@oxfmt/binding-linux-arm64-musl": "0.61.0", + "@oxfmt/binding-linux-ppc64-gnu": "0.61.0", + "@oxfmt/binding-linux-riscv64-gnu": "0.61.0", + "@oxfmt/binding-linux-riscv64-musl": "0.61.0", + "@oxfmt/binding-linux-s390x-gnu": "0.61.0", + "@oxfmt/binding-linux-x64-gnu": "0.61.0", + "@oxfmt/binding-linux-x64-musl": "0.61.0", + "@oxfmt/binding-openharmony-arm64": "0.61.0", + "@oxfmt/binding-win32-arm64-msvc": "0.61.0", + "@oxfmt/binding-win32-ia32-msvc": "0.61.0", + "@oxfmt/binding-win32-x64-msvc": "0.61.0" + }, + "peerDependencies": { + "svelte": "^5.0.0", + "vite-plus": "*" + }, + "peerDependenciesMeta": { + "svelte": { + "optional": true + }, + "vite-plus": { + "optional": true + } + } + }, + "node_modules/oxfmt/node_modules/tinypool": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-2.1.0.tgz", + "integrity": "sha512-Pugqs6M0m7Lv1I7FtxN4aoyToKg1C4tu+/381vH35y8oENM/Ai7f7C4StcoK4/+BSw9ebcS8jRiVrORFKCALLw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.0.0 || >=22.0.0" + } + }, "node_modules/p-event": { "version": "6.0.1", "license": "MIT", @@ -18843,20 +19228,6 @@ "node": ">= 0.8.0" } }, - "node_modules/prettier": { - "version": "2.8.8", - "dev": true, - "license": "MIT", - "bin": { - "prettier": "bin-prettier.js" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, "node_modules/pretty-ms": { "version": "9.3.0", "license": "MIT", diff --git a/package.json b/package.json index f6c78faff4f..56c7c9e847d 100644 --- a/package.json +++ b/package.json @@ -30,13 +30,12 @@ "url": "https://github.com/netlify/cli/issues" }, "scripts": { - "_format": "prettier --loglevel=warn \"{src,tools,scripts,tests,e2e,.github}/**/*.{mjs,cjs,js,mts,md,yml,json,html,ts}\" \"*.{mjs,cjs,js,mts,yml,json,html,ts}\" \".*.{mjs,cjs,js,yml,json,html,ts}\" \"!CHANGELOG.md\" \"!**/*/package-lock.json\" \"!.github/**/*.md\"", "build": "node ./node_modules/typescript-native/bin/tsc --project tsconfig.build.json", "clean": "rm -rf dist/", "dev": "node ./node_modules/typescript-native/bin/tsc --project tsconfig.build.json --watch", "docs": "npm run --prefix=site build", - "format": "npm run _format -- --write", - "format:check": "npm run _format -- --check", + "format": "oxfmt --write", + "format:check": "oxfmt --check", "lint": "eslint --cache", "lint:fix": "npm run lint -- --fix", "start": "node ./bin/run.js", @@ -203,9 +202,9 @@ "memfs": "^4.56.10", "nock": "^14.0.10", "npm-run-all2": "^8.0.4", + "oxfmt": "0.61.0", "p-timeout": "^7.0.0", "picomatch": "^4.0.4", - "prettier": "^2.8.8", "serialize-javascript": "^7.0.5", "strip-ansi": "^7.1.2", "temp-dir": "^3.0.0",