From 0cdd9776c1bf8f7e4b0f4f3cbb5c0bfe0f165b4c Mon Sep 17 00:00:00 2001 From: Florian Lefebvre Date: Wed, 28 Aug 2024 15:13:54 +0200 Subject: [PATCH 01/10] feat: update code --- .changeset/old-zebras-teach.md | 15 ++++ packages/astro/src/core/sync/constants.ts | 2 - packages/astro/src/core/sync/index.ts | 32 ++++++++- packages/astro/src/core/sync/write-files.ts | 76 --------------------- 4 files changed, 45 insertions(+), 80 deletions(-) create mode 100644 .changeset/old-zebras-teach.md delete mode 100644 packages/astro/src/core/sync/constants.ts delete mode 100644 packages/astro/src/core/sync/write-files.ts diff --git a/.changeset/old-zebras-teach.md b/.changeset/old-zebras-teach.md new file mode 100644 index 000000000000..593a67227c41 --- /dev/null +++ b/.changeset/old-zebras-teach.md @@ -0,0 +1,15 @@ +--- +'astro': major +--- + +Updates `astro sync` behavior + +`astro sync` will no longer create nor update `src/env.dts`. You can keep using it but we recommend you update your root `tsconfig.json` instead: + +```diff +{ + "extends": "astro/tsconfigs/base", ++ "include": ["**/*", ".astro/types.d.ts"], ++ "exclude": ["dist"] +} +``` \ No newline at end of file diff --git a/packages/astro/src/core/sync/constants.ts b/packages/astro/src/core/sync/constants.ts deleted file mode 100644 index 7ff603105a75..000000000000 --- a/packages/astro/src/core/sync/constants.ts +++ /dev/null @@ -1,2 +0,0 @@ -// TODO: use types.d.ts for backward compatibility. Use astro.d.ts in Astro 5.0 -export const REFERENCE_FILE = './types.d.ts'; diff --git a/packages/astro/src/core/sync/index.ts b/packages/astro/src/core/sync/index.ts index c9769443ee51..c9d9f3212b1d 100644 --- a/packages/astro/src/core/sync/index.ts +++ b/packages/astro/src/core/sync/index.ts @@ -30,7 +30,8 @@ import { import type { Logger } from '../logger/core.js'; import { formatErrorMessage } from '../messages.js'; import { ensureProcessNodeEnv } from '../util.js'; -import { writeFiles } from './write-files.js'; +import { dirname, relative } from 'node:path'; +import { normalizePath } from 'vite'; export type SyncOptions = { /** @@ -135,7 +136,7 @@ export async function syncInternal({ } syncAstroEnv(settings); - await writeFiles(settings, fs, logger); + writeInjectedTypes(settings, fs); logger.info('types', `Generated ${dim(getTimeStat(timerStart, performance.now()))}`); } catch (err) { const error = createSafeError(err); @@ -148,6 +149,33 @@ export async function syncInternal({ } } +function getTsReference(type: 'path' | 'types', value: string) { + return `/// `; +} + +const CLIENT_TYPES_REFERENCE = getTsReference('types', 'astro/client'); + +function writeInjectedTypes(settings: AstroSettings, fs: typeof fsMod) { + const references: Array = []; + + for (const { filename, content } of settings.injectedTypes) { + const filepath = fileURLToPath(new URL(filename, settings.dotAstroDir)); + fs.mkdirSync(dirname(filepath), { recursive: true }); + fs.writeFileSync(filepath, content, 'utf-8'); + references.push(normalizePath(relative(fileURLToPath(settings.dotAstroDir), filepath))); + } + + const astroDtsContent = `${CLIENT_TYPES_REFERENCE}\n${references.map((reference) => getTsReference('path', reference)).join('\n')}`; + if (references.length === 0) { + fs.mkdirSync(settings.dotAstroDir, { recursive: true }); + } + fs.writeFileSync( + fileURLToPath(new URL('./types.d.ts', settings.dotAstroDir)), + astroDtsContent, + 'utf-8', + ); +} + /** * Generate content collection types, and then returns the process exit signal. * diff --git a/packages/astro/src/core/sync/write-files.ts b/packages/astro/src/core/sync/write-files.ts deleted file mode 100644 index 1f7d1d304608..000000000000 --- a/packages/astro/src/core/sync/write-files.ts +++ /dev/null @@ -1,76 +0,0 @@ -import type fsMod from 'node:fs'; -import { dirname, relative } from 'node:path'; -import { fileURLToPath } from 'node:url'; -import { bold } from 'kleur/colors'; -import { normalizePath } from 'vite'; -import type { AstroSettings } from '../../types/astro.js'; -import { AstroError, AstroErrorData } from '../errors/index.js'; -import type { Logger } from '../logger/core.js'; -import { REFERENCE_FILE } from './constants.js'; - -export async function writeFiles(settings: AstroSettings, fs: typeof fsMod, logger: Logger) { - try { - writeInjectedTypes(settings, fs); - await setUpEnvTs(settings, fs, logger); - } catch (e) { - throw new AstroError(AstroErrorData.UnknownFilesystemError, { cause: e }); - } -} - -function getTsReference(type: 'path' | 'types', value: string) { - return `/// `; -} - -const CLIENT_TYPES_REFERENCE = getTsReference('types', 'astro/client'); - -function writeInjectedTypes(settings: AstroSettings, fs: typeof fsMod) { - const references: Array = []; - - for (const { filename, content } of settings.injectedTypes) { - const filepath = fileURLToPath(new URL(filename, settings.dotAstroDir)); - fs.mkdirSync(dirname(filepath), { recursive: true }); - fs.writeFileSync(filepath, content, 'utf-8'); - references.push(normalizePath(relative(fileURLToPath(settings.dotAstroDir), filepath))); - } - - const astroDtsContent = `${CLIENT_TYPES_REFERENCE}\n${references.map((reference) => getTsReference('path', reference)).join('\n')}`; - if (references.length === 0) { - fs.mkdirSync(settings.dotAstroDir, { recursive: true }); - } - fs.writeFileSync( - fileURLToPath(new URL(REFERENCE_FILE, settings.dotAstroDir)), - astroDtsContent, - 'utf-8', - ); -} - -async function setUpEnvTs(settings: AstroSettings, fs: typeof fsMod, logger: Logger) { - const envTsPath = fileURLToPath(new URL('env.d.ts', settings.config.srcDir)); - const envTsPathRelativetoRoot = relative(fileURLToPath(settings.config.root), envTsPath); - const relativePath = normalizePath( - relative( - fileURLToPath(settings.config.srcDir), - fileURLToPath(new URL(REFERENCE_FILE, settings.dotAstroDir)), - ), - ); - const expectedTypeReference = getTsReference('path', relativePath); - - if (fs.existsSync(envTsPath)) { - const initialEnvContents = await fs.promises.readFile(envTsPath, 'utf-8'); - let typesEnvContents = initialEnvContents; - - if (!typesEnvContents.includes(expectedTypeReference)) { - typesEnvContents = `${expectedTypeReference}\n${typesEnvContents}`; - } - - if (initialEnvContents !== typesEnvContents) { - logger.info('types', `Updated ${bold(envTsPathRelativetoRoot)} type declarations.`); - await fs.promises.writeFile(envTsPath, typesEnvContents, 'utf-8'); - } - } else { - // Otherwise, inject the `env.d.ts` file - await fs.promises.mkdir(settings.config.srcDir, { recursive: true }); - await fs.promises.writeFile(envTsPath, expectedTypeReference, 'utf-8'); - logger.info('types', `Added ${bold(envTsPathRelativetoRoot)} type declarations`); - } -} From 528fb3f38b8cfadc647a2a839a877534a6890cf2 Mon Sep 17 00:00:00 2001 From: Florian Lefebvre Date: Wed, 28 Aug 2024 15:14:03 +0200 Subject: [PATCH 02/10] feat: update tsconfigs --- examples/basics/tsconfig.json | 4 +++- examples/blog/tsconfig.json | 2 ++ examples/component/tsconfig.json | 2 ++ examples/container-with-vitest/tsconfig.json | 4 +++- examples/framework-alpine/tsconfig.json | 4 +++- examples/framework-multiple/tsconfig.json | 2 ++ examples/framework-preact/tsconfig.json | 2 ++ examples/framework-react/tsconfig.json | 2 ++ examples/framework-solid/tsconfig.json | 2 ++ examples/framework-svelte/tsconfig.json | 4 +++- examples/framework-vue/tsconfig.json | 2 ++ examples/hackernews/tsconfig.json | 4 +++- examples/integration/tsconfig.json | 4 +++- examples/middleware/tsconfig.json | 4 +++- examples/minimal/tsconfig.json | 4 +++- examples/non-html-pages/tsconfig.json | 4 +++- examples/portfolio/tsconfig.json | 4 +++- examples/ssr/tsconfig.json | 4 +++- examples/toolbar-app/tsconfig.json | 2 ++ examples/view-transitions/tsconfig.json | 2 ++ examples/with-markdoc/tsconfig.json | 2 ++ examples/with-markdown-plugins/tsconfig.json | 4 +++- examples/with-markdown-shiki/tsconfig.json | 4 +++- examples/with-mdx/tsconfig.json | 4 +++- examples/with-nanostores/tsconfig.json | 2 ++ examples/with-tailwindcss/tsconfig.json | 4 +++- examples/with-vitest/tsconfig.json | 4 +++- packages/astro/e2e/fixtures/actions-blog/tsconfig.json | 4 +++- packages/astro/e2e/fixtures/actions-react-19/tsconfig.json | 4 +++- packages/astro/e2e/fixtures/client-only/tsconfig.json | 4 +++- .../astro/e2e/fixtures/custom-client-directives/tsconfig.json | 3 ++- packages/astro/performance/fixtures/md/tsconfig.json | 4 +++- packages/astro/performance/fixtures/mdoc/tsconfig.json | 4 +++- packages/astro/performance/fixtures/mdx/tsconfig.json | 4 +++- packages/astro/performance/fixtures/utils/tsconfig.json | 4 +++- .../test/fixtures/alias-tsconfig-baseurl-only/tsconfig.json | 4 +++- packages/astro/test/fixtures/alias-tsconfig/tsconfig.json | 4 +++- .../test/fixtures/astro-env-content-collections/tsconfig.json | 4 +++- .../test/fixtures/astro-env-required-public/tsconfig.json | 4 +++- .../astro/test/fixtures/astro-env-server-fail/tsconfig.json | 4 +++- .../astro/test/fixtures/astro-env-server-secret/tsconfig.json | 4 +++- packages/astro/test/fixtures/astro-env/tsconfig.json | 4 +++- packages/astro/test/fixtures/core-image-base/tsconfig.json | 4 +++- .../astro/test/fixtures/core-image-deletion/tsconfig.json | 4 +++- .../astro/test/fixtures/core-image-infersize/tsconfig.json | 4 +++- .../test/fixtures/core-image-remark-imgattr/tsconfig.json | 4 +++- packages/astro/test/fixtures/core-image-ssg/tsconfig.json | 4 +++- .../fixtures/core-image-unconventional-settings/tsconfig.json | 4 +++- packages/astro/test/fixtures/core-image/tsconfig.json | 4 +++- packages/astro/test/fixtures/react-and-solid/tsconfig.json | 4 +++- .../astro/test/fixtures/ssr-prerender-chunks/tsconfig.json | 4 +++- packages/db/test/fixtures/ticketing-example/tsconfig.json | 4 +++- .../markdoc/test/fixtures/image-assets/tsconfig.json | 4 +++- .../test/fixtures/render-with-components/tsconfig.json | 4 +++- .../integrations/mdx/test/fixtures/mdx-images/tsconfig.json | 4 +++- 55 files changed, 153 insertions(+), 44 deletions(-) diff --git a/examples/basics/tsconfig.json b/examples/basics/tsconfig.json index d78f81ec4e8e..d2e51fb463de 100644 --- a/examples/basics/tsconfig.json +++ b/examples/basics/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/examples/blog/tsconfig.json b/examples/blog/tsconfig.json index e51e062706f0..c2e5e77cdc53 100644 --- a/examples/blog/tsconfig.json +++ b/examples/blog/tsconfig.json @@ -1,5 +1,7 @@ { "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"], "compilerOptions": { "strictNullChecks": true } diff --git a/examples/component/tsconfig.json b/examples/component/tsconfig.json index 26f2fc53ddc1..3e4a08650bd4 100644 --- a/examples/component/tsconfig.json +++ b/examples/component/tsconfig.json @@ -1,5 +1,7 @@ { "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"], "compilerOptions": { "jsx": "preserve" } diff --git a/examples/container-with-vitest/tsconfig.json b/examples/container-with-vitest/tsconfig.json index d78f81ec4e8e..d2e51fb463de 100644 --- a/examples/container-with-vitest/tsconfig.json +++ b/examples/container-with-vitest/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/examples/framework-alpine/tsconfig.json b/examples/framework-alpine/tsconfig.json index d78f81ec4e8e..d2e51fb463de 100644 --- a/examples/framework-alpine/tsconfig.json +++ b/examples/framework-alpine/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/examples/framework-multiple/tsconfig.json b/examples/framework-multiple/tsconfig.json index 2d48ed5fd9c3..38d2e052b524 100644 --- a/examples/framework-multiple/tsconfig.json +++ b/examples/framework-multiple/tsconfig.json @@ -1,5 +1,7 @@ { "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"], "compilerOptions": { // Needed for TypeScript intellisense in the template inside Vue files "jsx": "preserve" diff --git a/examples/framework-preact/tsconfig.json b/examples/framework-preact/tsconfig.json index bdd1b5a88e0a..8faaad1f8958 100644 --- a/examples/framework-preact/tsconfig.json +++ b/examples/framework-preact/tsconfig.json @@ -1,5 +1,7 @@ { "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"], "compilerOptions": { // Preact specific settings "jsx": "react-jsx", diff --git a/examples/framework-react/tsconfig.json b/examples/framework-react/tsconfig.json index e726bd0b9a32..1bb17eb064a5 100644 --- a/examples/framework-react/tsconfig.json +++ b/examples/framework-react/tsconfig.json @@ -1,5 +1,7 @@ { "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"], "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "react" diff --git a/examples/framework-solid/tsconfig.json b/examples/framework-solid/tsconfig.json index 6e107fd32216..c1ca2dae5f79 100644 --- a/examples/framework-solid/tsconfig.json +++ b/examples/framework-solid/tsconfig.json @@ -1,5 +1,7 @@ { "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"], "compilerOptions": { // Solid specific settings "jsx": "preserve", diff --git a/examples/framework-svelte/tsconfig.json b/examples/framework-svelte/tsconfig.json index d78f81ec4e8e..d2e51fb463de 100644 --- a/examples/framework-svelte/tsconfig.json +++ b/examples/framework-svelte/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/examples/framework-vue/tsconfig.json b/examples/framework-vue/tsconfig.json index 2d48ed5fd9c3..38d2e052b524 100644 --- a/examples/framework-vue/tsconfig.json +++ b/examples/framework-vue/tsconfig.json @@ -1,5 +1,7 @@ { "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"], "compilerOptions": { // Needed for TypeScript intellisense in the template inside Vue files "jsx": "preserve" diff --git a/examples/hackernews/tsconfig.json b/examples/hackernews/tsconfig.json index d78f81ec4e8e..d2e51fb463de 100644 --- a/examples/hackernews/tsconfig.json +++ b/examples/hackernews/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/examples/integration/tsconfig.json b/examples/integration/tsconfig.json index d78f81ec4e8e..d2e51fb463de 100644 --- a/examples/integration/tsconfig.json +++ b/examples/integration/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/examples/middleware/tsconfig.json b/examples/middleware/tsconfig.json index d78f81ec4e8e..d2e51fb463de 100644 --- a/examples/middleware/tsconfig.json +++ b/examples/middleware/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/examples/minimal/tsconfig.json b/examples/minimal/tsconfig.json index d78f81ec4e8e..d2e51fb463de 100644 --- a/examples/minimal/tsconfig.json +++ b/examples/minimal/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/examples/non-html-pages/tsconfig.json b/examples/non-html-pages/tsconfig.json index d78f81ec4e8e..d2e51fb463de 100644 --- a/examples/non-html-pages/tsconfig.json +++ b/examples/non-html-pages/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/examples/portfolio/tsconfig.json b/examples/portfolio/tsconfig.json index d78f81ec4e8e..d2e51fb463de 100644 --- a/examples/portfolio/tsconfig.json +++ b/examples/portfolio/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/examples/ssr/tsconfig.json b/examples/ssr/tsconfig.json index d78f81ec4e8e..d2e51fb463de 100644 --- a/examples/ssr/tsconfig.json +++ b/examples/ssr/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/examples/toolbar-app/tsconfig.json b/examples/toolbar-app/tsconfig.json index b3e754ea04d9..44d7ab28920c 100644 --- a/examples/toolbar-app/tsconfig.json +++ b/examples/toolbar-app/tsconfig.json @@ -1,5 +1,7 @@ { "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"], "compilerOptions": { "outDir": "dist", "rootDir": "src" diff --git a/examples/view-transitions/tsconfig.json b/examples/view-transitions/tsconfig.json index d9bbfacf871a..60762da04dcf 100644 --- a/examples/view-transitions/tsconfig.json +++ b/examples/view-transitions/tsconfig.json @@ -1,5 +1,7 @@ { "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"], "compilerOptions": { "resolveJsonModule": true } diff --git a/examples/with-markdoc/tsconfig.json b/examples/with-markdoc/tsconfig.json index e51e062706f0..c2e5e77cdc53 100644 --- a/examples/with-markdoc/tsconfig.json +++ b/examples/with-markdoc/tsconfig.json @@ -1,5 +1,7 @@ { "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"], "compilerOptions": { "strictNullChecks": true } diff --git a/examples/with-markdown-plugins/tsconfig.json b/examples/with-markdown-plugins/tsconfig.json index d78f81ec4e8e..d2e51fb463de 100644 --- a/examples/with-markdown-plugins/tsconfig.json +++ b/examples/with-markdown-plugins/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/examples/with-markdown-shiki/tsconfig.json b/examples/with-markdown-shiki/tsconfig.json index d78f81ec4e8e..d2e51fb463de 100644 --- a/examples/with-markdown-shiki/tsconfig.json +++ b/examples/with-markdown-shiki/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/examples/with-mdx/tsconfig.json b/examples/with-mdx/tsconfig.json index d78f81ec4e8e..d2e51fb463de 100644 --- a/examples/with-mdx/tsconfig.json +++ b/examples/with-mdx/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/examples/with-nanostores/tsconfig.json b/examples/with-nanostores/tsconfig.json index bdd1b5a88e0a..8faaad1f8958 100644 --- a/examples/with-nanostores/tsconfig.json +++ b/examples/with-nanostores/tsconfig.json @@ -1,5 +1,7 @@ { "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"], "compilerOptions": { // Preact specific settings "jsx": "react-jsx", diff --git a/examples/with-tailwindcss/tsconfig.json b/examples/with-tailwindcss/tsconfig.json index d78f81ec4e8e..d2e51fb463de 100644 --- a/examples/with-tailwindcss/tsconfig.json +++ b/examples/with-tailwindcss/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/examples/with-vitest/tsconfig.json b/examples/with-vitest/tsconfig.json index d78f81ec4e8e..d2e51fb463de 100644 --- a/examples/with-vitest/tsconfig.json +++ b/examples/with-vitest/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/packages/astro/e2e/fixtures/actions-blog/tsconfig.json b/packages/astro/e2e/fixtures/actions-blog/tsconfig.json index 6bed1f7a51c0..0d8f554cc0ff 100644 --- a/packages/astro/e2e/fixtures/actions-blog/tsconfig.json +++ b/packages/astro/e2e/fixtures/actions-blog/tsconfig.json @@ -4,5 +4,7 @@ "strictNullChecks": true, "jsx": "react-jsx", "jsxImportSource": "react" - } + }, + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } \ No newline at end of file diff --git a/packages/astro/e2e/fixtures/actions-react-19/tsconfig.json b/packages/astro/e2e/fixtures/actions-react-19/tsconfig.json index 6bed1f7a51c0..0d8f554cc0ff 100644 --- a/packages/astro/e2e/fixtures/actions-react-19/tsconfig.json +++ b/packages/astro/e2e/fixtures/actions-react-19/tsconfig.json @@ -4,5 +4,7 @@ "strictNullChecks": true, "jsx": "react-jsx", "jsxImportSource": "react" - } + }, + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } \ No newline at end of file diff --git a/packages/astro/e2e/fixtures/client-only/tsconfig.json b/packages/astro/e2e/fixtures/client-only/tsconfig.json index 9e4ac6056834..ea5145d3093a 100644 --- a/packages/astro/e2e/fixtures/client-only/tsconfig.json +++ b/packages/astro/e2e/fixtures/client-only/tsconfig.json @@ -1,5 +1,7 @@ { "compilerOptions": { "importsNotUsedAsValues": "error" - } + }, + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } \ No newline at end of file diff --git a/packages/astro/e2e/fixtures/custom-client-directives/tsconfig.json b/packages/astro/e2e/fixtures/custom-client-directives/tsconfig.json index 59a562e0e58b..97a67903ae0d 100644 --- a/packages/astro/e2e/fixtures/custom-client-directives/tsconfig.json +++ b/packages/astro/e2e/fixtures/custom-client-directives/tsconfig.json @@ -4,5 +4,6 @@ // This is only needed because we link Astro locally. "preserveSymlinks": true }, - "include": ["./src/**/*"] + "include": ["./src/**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } \ No newline at end of file diff --git a/packages/astro/performance/fixtures/md/tsconfig.json b/packages/astro/performance/fixtures/md/tsconfig.json index 7fb90fafc062..98ab98bc4c3e 100644 --- a/packages/astro/performance/fixtures/md/tsconfig.json +++ b/packages/astro/performance/fixtures/md/tsconfig.json @@ -3,5 +3,7 @@ "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "react" - } + }, + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } \ No newline at end of file diff --git a/packages/astro/performance/fixtures/mdoc/tsconfig.json b/packages/astro/performance/fixtures/mdoc/tsconfig.json index 7fb90fafc062..98ab98bc4c3e 100644 --- a/packages/astro/performance/fixtures/mdoc/tsconfig.json +++ b/packages/astro/performance/fixtures/mdoc/tsconfig.json @@ -3,5 +3,7 @@ "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "react" - } + }, + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } \ No newline at end of file diff --git a/packages/astro/performance/fixtures/mdx/tsconfig.json b/packages/astro/performance/fixtures/mdx/tsconfig.json index 7fb90fafc062..98ab98bc4c3e 100644 --- a/packages/astro/performance/fixtures/mdx/tsconfig.json +++ b/packages/astro/performance/fixtures/mdx/tsconfig.json @@ -3,5 +3,7 @@ "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "react" - } + }, + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } \ No newline at end of file diff --git a/packages/astro/performance/fixtures/utils/tsconfig.json b/packages/astro/performance/fixtures/utils/tsconfig.json index 33fcab125ab3..4d99793aa010 100644 --- a/packages/astro/performance/fixtures/utils/tsconfig.json +++ b/packages/astro/performance/fixtures/utils/tsconfig.json @@ -2,5 +2,7 @@ "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "react" - } + } , + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/packages/astro/test/fixtures/alias-tsconfig-baseurl-only/tsconfig.json b/packages/astro/test/fixtures/alias-tsconfig-baseurl-only/tsconfig.json index 738e8a46502e..0c7d303e8e82 100644 --- a/packages/astro/test/fixtures/alias-tsconfig-baseurl-only/tsconfig.json +++ b/packages/astro/test/fixtures/alias-tsconfig-baseurl-only/tsconfig.json @@ -1,5 +1,7 @@ { "compilerOptions": { "baseUrl": "./src" - } + }, + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/packages/astro/test/fixtures/alias-tsconfig/tsconfig.json b/packages/astro/test/fixtures/alias-tsconfig/tsconfig.json index 52553e7d3002..1598f5fa3174 100644 --- a/packages/astro/test/fixtures/alias-tsconfig/tsconfig.json +++ b/packages/astro/test/fixtures/alias-tsconfig/tsconfig.json @@ -13,5 +13,7 @@ "src/*" ] } - } + }, + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/packages/astro/test/fixtures/astro-env-content-collections/tsconfig.json b/packages/astro/test/fixtures/astro-env-content-collections/tsconfig.json index d78f81ec4e8e..d2e51fb463de 100644 --- a/packages/astro/test/fixtures/astro-env-content-collections/tsconfig.json +++ b/packages/astro/test/fixtures/astro-env-content-collections/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/packages/astro/test/fixtures/astro-env-required-public/tsconfig.json b/packages/astro/test/fixtures/astro-env-required-public/tsconfig.json index d78f81ec4e8e..d2e51fb463de 100644 --- a/packages/astro/test/fixtures/astro-env-required-public/tsconfig.json +++ b/packages/astro/test/fixtures/astro-env-required-public/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/packages/astro/test/fixtures/astro-env-server-fail/tsconfig.json b/packages/astro/test/fixtures/astro-env-server-fail/tsconfig.json index d78f81ec4e8e..d2e51fb463de 100644 --- a/packages/astro/test/fixtures/astro-env-server-fail/tsconfig.json +++ b/packages/astro/test/fixtures/astro-env-server-fail/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/packages/astro/test/fixtures/astro-env-server-secret/tsconfig.json b/packages/astro/test/fixtures/astro-env-server-secret/tsconfig.json index d78f81ec4e8e..d2e51fb463de 100644 --- a/packages/astro/test/fixtures/astro-env-server-secret/tsconfig.json +++ b/packages/astro/test/fixtures/astro-env-server-secret/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/packages/astro/test/fixtures/astro-env/tsconfig.json b/packages/astro/test/fixtures/astro-env/tsconfig.json index d78f81ec4e8e..d2e51fb463de 100644 --- a/packages/astro/test/fixtures/astro-env/tsconfig.json +++ b/packages/astro/test/fixtures/astro-env/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/packages/astro/test/fixtures/core-image-base/tsconfig.json b/packages/astro/test/fixtures/core-image-base/tsconfig.json index 923ed4e24fb7..b47976e21c42 100644 --- a/packages/astro/test/fixtures/core-image-base/tsconfig.json +++ b/packages/astro/test/fixtures/core-image-base/tsconfig.json @@ -7,5 +7,7 @@ "src/assets/*" ] }, - } + }, + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/packages/astro/test/fixtures/core-image-deletion/tsconfig.json b/packages/astro/test/fixtures/core-image-deletion/tsconfig.json index b5bf6a715eb5..074b459078ff 100644 --- a/packages/astro/test/fixtures/core-image-deletion/tsconfig.json +++ b/packages/astro/test/fixtures/core-image-deletion/tsconfig.json @@ -5,5 +5,7 @@ "paths": { "~/assets/*": ["src/assets/*"] }, - } + }, + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/packages/astro/test/fixtures/core-image-infersize/tsconfig.json b/packages/astro/test/fixtures/core-image-infersize/tsconfig.json index 72b184b171ae..1e6aa1b676cd 100644 --- a/packages/astro/test/fixtures/core-image-infersize/tsconfig.json +++ b/packages/astro/test/fixtures/core-image-infersize/tsconfig.json @@ -2,5 +2,7 @@ "extends": "astro/tsconfigs/base", "compilerOptions": { "baseUrl": ".", - } + }, + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/packages/astro/test/fixtures/core-image-remark-imgattr/tsconfig.json b/packages/astro/test/fixtures/core-image-remark-imgattr/tsconfig.json index 72b184b171ae..1e6aa1b676cd 100644 --- a/packages/astro/test/fixtures/core-image-remark-imgattr/tsconfig.json +++ b/packages/astro/test/fixtures/core-image-remark-imgattr/tsconfig.json @@ -2,5 +2,7 @@ "extends": "astro/tsconfigs/base", "compilerOptions": { "baseUrl": ".", - } + }, + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/packages/astro/test/fixtures/core-image-ssg/tsconfig.json b/packages/astro/test/fixtures/core-image-ssg/tsconfig.json index b5bf6a715eb5..074b459078ff 100644 --- a/packages/astro/test/fixtures/core-image-ssg/tsconfig.json +++ b/packages/astro/test/fixtures/core-image-ssg/tsconfig.json @@ -5,5 +5,7 @@ "paths": { "~/assets/*": ["src/assets/*"] }, - } + }, + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/packages/astro/test/fixtures/core-image-unconventional-settings/tsconfig.json b/packages/astro/test/fixtures/core-image-unconventional-settings/tsconfig.json index b5bf6a715eb5..074b459078ff 100644 --- a/packages/astro/test/fixtures/core-image-unconventional-settings/tsconfig.json +++ b/packages/astro/test/fixtures/core-image-unconventional-settings/tsconfig.json @@ -5,5 +5,7 @@ "paths": { "~/assets/*": ["src/assets/*"] }, - } + }, + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/packages/astro/test/fixtures/core-image/tsconfig.json b/packages/astro/test/fixtures/core-image/tsconfig.json index 923ed4e24fb7..b47976e21c42 100644 --- a/packages/astro/test/fixtures/core-image/tsconfig.json +++ b/packages/astro/test/fixtures/core-image/tsconfig.json @@ -7,5 +7,7 @@ "src/assets/*" ] }, - } + }, + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/packages/astro/test/fixtures/react-and-solid/tsconfig.json b/packages/astro/test/fixtures/react-and-solid/tsconfig.json index 0b4b89bbce69..d5f1fa6e4c05 100644 --- a/packages/astro/test/fixtures/react-and-solid/tsconfig.json +++ b/packages/astro/test/fixtures/react-and-solid/tsconfig.json @@ -3,5 +3,7 @@ "strict": true, "jsxImportSource": "solid-js", "types": ["astro/client"] - } + }, + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/packages/astro/test/fixtures/ssr-prerender-chunks/tsconfig.json b/packages/astro/test/fixtures/ssr-prerender-chunks/tsconfig.json index 7fb90fafc062..98ab98bc4c3e 100644 --- a/packages/astro/test/fixtures/ssr-prerender-chunks/tsconfig.json +++ b/packages/astro/test/fixtures/ssr-prerender-chunks/tsconfig.json @@ -3,5 +3,7 @@ "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "react" - } + }, + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } \ No newline at end of file diff --git a/packages/db/test/fixtures/ticketing-example/tsconfig.json b/packages/db/test/fixtures/ticketing-example/tsconfig.json index b7243b92ccf8..9d7495d5bac1 100644 --- a/packages/db/test/fixtures/ticketing-example/tsconfig.json +++ b/packages/db/test/fixtures/ticketing-example/tsconfig.json @@ -3,5 +3,7 @@ "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "react" - } + }, + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/packages/integrations/markdoc/test/fixtures/image-assets/tsconfig.json b/packages/integrations/markdoc/test/fixtures/image-assets/tsconfig.json index b5bf6a715eb5..074b459078ff 100644 --- a/packages/integrations/markdoc/test/fixtures/image-assets/tsconfig.json +++ b/packages/integrations/markdoc/test/fixtures/image-assets/tsconfig.json @@ -5,5 +5,7 @@ "paths": { "~/assets/*": ["src/assets/*"] }, - } + }, + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } diff --git a/packages/integrations/markdoc/test/fixtures/render-with-components/tsconfig.json b/packages/integrations/markdoc/test/fixtures/render-with-components/tsconfig.json index 99df2e61a11d..7c03d38d1fc9 100644 --- a/packages/integrations/markdoc/test/fixtures/render-with-components/tsconfig.json +++ b/packages/integrations/markdoc/test/fixtures/render-with-components/tsconfig.json @@ -3,5 +3,7 @@ "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "preact" - } + }, + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } \ No newline at end of file diff --git a/packages/integrations/mdx/test/fixtures/mdx-images/tsconfig.json b/packages/integrations/mdx/test/fixtures/mdx-images/tsconfig.json index b5bf6a715eb5..074b459078ff 100644 --- a/packages/integrations/mdx/test/fixtures/mdx-images/tsconfig.json +++ b/packages/integrations/mdx/test/fixtures/mdx-images/tsconfig.json @@ -5,5 +5,7 @@ "paths": { "~/assets/*": ["src/assets/*"] }, - } + }, + "include": ["**/*", ".astro/types.d.ts"], + "exclude": ["dist"] } From 0867260dbff78e5a648c4fdb94615f8492d3f78b Mon Sep 17 00:00:00 2001 From: Florian Lefebvre Date: Wed, 28 Aug 2024 15:19:32 +0200 Subject: [PATCH 03/10] chore: remove env.d.ts --- examples/blog/src/env.d.ts | 1 - examples/framework-alpine/src/env.d.ts | 1 - examples/framework-multiple/src/env.d.ts | 1 - examples/framework-preact/src/env.d.ts | 1 - examples/framework-react/src/env.d.ts | 1 - examples/framework-solid/src/env.d.ts | 1 - examples/framework-svelte/src/env.d.ts | 1 - examples/framework-vue/src/env.d.ts | 1 - examples/hackernews/src/env.d.ts | 1 - examples/middleware/src/env.d.ts | 1 - examples/minimal/src/env.d.ts | 1 - examples/non-html-pages/src/env.d.ts | 1 - examples/portfolio/src/env.d.ts | 1 - examples/ssr/src/env.d.ts | 1 - examples/with-markdoc/src/env.d.ts | 1 - examples/with-markdown-plugins/src/env.d.ts | 1 - examples/with-markdown-shiki/src/env.d.ts | 1 - examples/with-mdx/src/env.d.ts | 1 - examples/with-nanostores/src/env.d.ts | 1 - examples/with-tailwindcss/src/env.d.ts | 1 - packages/astro/performance/fixtures/md/src/env.d.ts | 3 --- packages/astro/performance/fixtures/mdoc/src/env.d.ts | 2 -- packages/astro/performance/fixtures/mdx/src/env.d.ts | 2 -- packages/astro/test/fixtures/error-bad-js/src/env.d.ts | 1 - packages/astro/test/fixtures/error-build-location/src/env.d.ts | 1 - packages/astro/test/fixtures/error-non-error/src/env.d.ts | 1 - .../vercel/test/hosted/hosted-astro-project/src/env.d.ts | 1 - 27 files changed, 31 deletions(-) delete mode 100644 examples/blog/src/env.d.ts delete mode 100644 examples/framework-alpine/src/env.d.ts delete mode 100644 examples/framework-multiple/src/env.d.ts delete mode 100644 examples/framework-preact/src/env.d.ts delete mode 100644 examples/framework-react/src/env.d.ts delete mode 100644 examples/framework-solid/src/env.d.ts delete mode 100644 examples/framework-svelte/src/env.d.ts delete mode 100644 examples/framework-vue/src/env.d.ts delete mode 100644 examples/hackernews/src/env.d.ts delete mode 100644 examples/minimal/src/env.d.ts delete mode 100644 examples/non-html-pages/src/env.d.ts delete mode 100644 examples/portfolio/src/env.d.ts delete mode 100644 examples/ssr/src/env.d.ts delete mode 100644 examples/with-markdoc/src/env.d.ts delete mode 100644 examples/with-markdown-plugins/src/env.d.ts delete mode 100644 examples/with-markdown-shiki/src/env.d.ts delete mode 100644 examples/with-mdx/src/env.d.ts delete mode 100644 examples/with-nanostores/src/env.d.ts delete mode 100644 examples/with-tailwindcss/src/env.d.ts delete mode 100644 packages/astro/performance/fixtures/md/src/env.d.ts delete mode 100644 packages/astro/performance/fixtures/mdoc/src/env.d.ts delete mode 100644 packages/astro/performance/fixtures/mdx/src/env.d.ts delete mode 100644 packages/astro/test/fixtures/error-bad-js/src/env.d.ts delete mode 100644 packages/astro/test/fixtures/error-build-location/src/env.d.ts delete mode 100644 packages/astro/test/fixtures/error-non-error/src/env.d.ts delete mode 100644 packages/integrations/vercel/test/hosted/hosted-astro-project/src/env.d.ts diff --git a/examples/blog/src/env.d.ts b/examples/blog/src/env.d.ts deleted file mode 100644 index e16c13c6952a..000000000000 --- a/examples/blog/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/framework-alpine/src/env.d.ts b/examples/framework-alpine/src/env.d.ts deleted file mode 100644 index e16c13c6952a..000000000000 --- a/examples/framework-alpine/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/framework-multiple/src/env.d.ts b/examples/framework-multiple/src/env.d.ts deleted file mode 100644 index e16c13c6952a..000000000000 --- a/examples/framework-multiple/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/framework-preact/src/env.d.ts b/examples/framework-preact/src/env.d.ts deleted file mode 100644 index e16c13c6952a..000000000000 --- a/examples/framework-preact/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/framework-react/src/env.d.ts b/examples/framework-react/src/env.d.ts deleted file mode 100644 index e16c13c6952a..000000000000 --- a/examples/framework-react/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/framework-solid/src/env.d.ts b/examples/framework-solid/src/env.d.ts deleted file mode 100644 index e16c13c6952a..000000000000 --- a/examples/framework-solid/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/framework-svelte/src/env.d.ts b/examples/framework-svelte/src/env.d.ts deleted file mode 100644 index e16c13c6952a..000000000000 --- a/examples/framework-svelte/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/framework-vue/src/env.d.ts b/examples/framework-vue/src/env.d.ts deleted file mode 100644 index e16c13c6952a..000000000000 --- a/examples/framework-vue/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/hackernews/src/env.d.ts b/examples/hackernews/src/env.d.ts deleted file mode 100644 index e16c13c6952a..000000000000 --- a/examples/hackernews/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/middleware/src/env.d.ts b/examples/middleware/src/env.d.ts index 74b9019e5746..e992c531518b 100644 --- a/examples/middleware/src/env.d.ts +++ b/examples/middleware/src/env.d.ts @@ -1,4 +1,3 @@ -/// declare namespace App { interface Locals { user: { diff --git a/examples/minimal/src/env.d.ts b/examples/minimal/src/env.d.ts deleted file mode 100644 index e16c13c6952a..000000000000 --- a/examples/minimal/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/non-html-pages/src/env.d.ts b/examples/non-html-pages/src/env.d.ts deleted file mode 100644 index e16c13c6952a..000000000000 --- a/examples/non-html-pages/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/portfolio/src/env.d.ts b/examples/portfolio/src/env.d.ts deleted file mode 100644 index e16c13c6952a..000000000000 --- a/examples/portfolio/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/ssr/src/env.d.ts b/examples/ssr/src/env.d.ts deleted file mode 100644 index e16c13c6952a..000000000000 --- a/examples/ssr/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/with-markdoc/src/env.d.ts b/examples/with-markdoc/src/env.d.ts deleted file mode 100644 index e16c13c6952a..000000000000 --- a/examples/with-markdoc/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/with-markdown-plugins/src/env.d.ts b/examples/with-markdown-plugins/src/env.d.ts deleted file mode 100644 index e16c13c6952a..000000000000 --- a/examples/with-markdown-plugins/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/with-markdown-shiki/src/env.d.ts b/examples/with-markdown-shiki/src/env.d.ts deleted file mode 100644 index e16c13c6952a..000000000000 --- a/examples/with-markdown-shiki/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/with-mdx/src/env.d.ts b/examples/with-mdx/src/env.d.ts deleted file mode 100644 index e16c13c6952a..000000000000 --- a/examples/with-mdx/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/with-nanostores/src/env.d.ts b/examples/with-nanostores/src/env.d.ts deleted file mode 100644 index e16c13c6952a..000000000000 --- a/examples/with-nanostores/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/with-tailwindcss/src/env.d.ts b/examples/with-tailwindcss/src/env.d.ts deleted file mode 100644 index e16c13c6952a..000000000000 --- a/examples/with-tailwindcss/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/packages/astro/performance/fixtures/md/src/env.d.ts b/packages/astro/performance/fixtures/md/src/env.d.ts deleted file mode 100644 index 4b38f4e5c680..000000000000 --- a/packages/astro/performance/fixtures/md/src/env.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -/// -/// \ No newline at end of file diff --git a/packages/astro/performance/fixtures/mdoc/src/env.d.ts b/packages/astro/performance/fixtures/mdoc/src/env.d.ts deleted file mode 100644 index acef35f175aa..000000000000 --- a/packages/astro/performance/fixtures/mdoc/src/env.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/// -/// diff --git a/packages/astro/performance/fixtures/mdx/src/env.d.ts b/packages/astro/performance/fixtures/mdx/src/env.d.ts deleted file mode 100644 index acef35f175aa..000000000000 --- a/packages/astro/performance/fixtures/mdx/src/env.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/// -/// diff --git a/packages/astro/test/fixtures/error-bad-js/src/env.d.ts b/packages/astro/test/fixtures/error-bad-js/src/env.d.ts deleted file mode 100644 index f964fe0cffd8..000000000000 --- a/packages/astro/test/fixtures/error-bad-js/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/packages/astro/test/fixtures/error-build-location/src/env.d.ts b/packages/astro/test/fixtures/error-build-location/src/env.d.ts deleted file mode 100644 index f964fe0cffd8..000000000000 --- a/packages/astro/test/fixtures/error-build-location/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/packages/astro/test/fixtures/error-non-error/src/env.d.ts b/packages/astro/test/fixtures/error-non-error/src/env.d.ts deleted file mode 100644 index f964fe0cffd8..000000000000 --- a/packages/astro/test/fixtures/error-non-error/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/packages/integrations/vercel/test/hosted/hosted-astro-project/src/env.d.ts b/packages/integrations/vercel/test/hosted/hosted-astro-project/src/env.d.ts deleted file mode 100644 index f964fe0cffd8..000000000000 --- a/packages/integrations/vercel/test/hosted/hosted-astro-project/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// From f6e9349a568e662e7adbbdb6bf86bdc5c41b209b Mon Sep 17 00:00:00 2001 From: Florian Lefebvre Date: Wed, 28 Aug 2024 15:25:27 +0200 Subject: [PATCH 04/10] feat: update test --- packages/astro/test/astro-sync.test.js | 47 +++++--------------------- 1 file changed, 9 insertions(+), 38 deletions(-) diff --git a/packages/astro/test/astro-sync.test.js b/packages/astro/test/astro-sync.test.js index ce1345322261..f12fb5bc42ed 100644 --- a/packages/astro/test/astro-sync.test.js +++ b/packages/astro/test/astro-sync.test.js @@ -24,10 +24,6 @@ const createFixture = () => { return astroFixture.config; }, clean() { - const envPath = new URL('env.d.ts', astroFixture.config.srcDir); - if (fs.existsSync(envPath)) { - fs.unlinkSync(new URL('env.d.ts', astroFixture.config.srcDir)); - } fs.rmSync(new URL('./.astro/', astroFixture.config.root), { force: true, recursive: true }); }, async whenSyncing() { @@ -108,40 +104,15 @@ describe('astro sync', () => { fixture = createFixture(); }); - describe('References', () => { - it('Writes `src/env.d.ts` if none exists', async () => { - await fixture.load('./fixtures/astro-basic/'); - fixture.clean(); - await fixture.whenSyncing(); - fixture.thenFileShouldExist('src/env.d.ts'); - fixture.thenFileContentShouldInclude( - 'src/env.d.ts', - `/// `, - ); - }); - - it('Updates `src/env.d.ts` if one exists', async () => { - const config = await fixture.load('./fixtures/astro-basic/'); - fixture.clean(); - fs.writeFileSync(new URL('./env.d.ts', config.srcDir), '// whatever', 'utf-8'); - await fixture.whenSyncing(); - fixture.thenFileShouldExist('src/env.d.ts'); - fixture.thenFileContentShouldInclude( - 'src/env.d.ts', - `/// `, - ); - }); - - it('Writes `src/types.d.ts`', async () => { - await fixture.load('./fixtures/astro-basic/'); - fixture.clean(); - await fixture.whenSyncing(); - fixture.thenFileShouldExist('.astro/types.d.ts'); - fixture.thenFileContentShouldInclude( - '.astro/types.d.ts', - `/// `, - ); - }); + it('Writes `.astro/types.d.ts`', async () => { + await fixture.load('./fixtures/astro-basic/'); + fixture.clean(); + await fixture.whenSyncing(); + fixture.thenFileShouldExist('.astro/types.d.ts'); + fixture.thenFileContentShouldInclude( + '.astro/types.d.ts', + `/// `, + ); }); describe('Content collections', () => { From 9d2d316e3756f540d6ed486c3aa0ce94f6f2ffb4 Mon Sep 17 00:00:00 2001 From: Florian Lefebvre Date: Wed, 28 Aug 2024 15:44:51 +0200 Subject: [PATCH 05/10] fix: examples --- examples/integration/tsconfig.json | 4 +--- examples/starlog/tsconfig.json | 1 + examples/toolbar-app/tsconfig.json | 2 -- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/examples/integration/tsconfig.json b/examples/integration/tsconfig.json index d2e51fb463de..d78f81ec4e8e 100644 --- a/examples/integration/tsconfig.json +++ b/examples/integration/tsconfig.json @@ -1,5 +1,3 @@ { - "extends": "astro/tsconfigs/base", - "include": ["**/*", ".astro/types.d.ts"], - "exclude": ["dist"] + "extends": "astro/tsconfigs/base" } diff --git a/examples/starlog/tsconfig.json b/examples/starlog/tsconfig.json index da42df94e013..08454317ed8d 100644 --- a/examples/starlog/tsconfig.json +++ b/examples/starlog/tsconfig.json @@ -1,4 +1,5 @@ { "extends": "astro/tsconfigs/strict", + "include": ["**/*", ".astro/types.d.ts"], "exclude": ["dist"] } diff --git a/examples/toolbar-app/tsconfig.json b/examples/toolbar-app/tsconfig.json index 44d7ab28920c..b3e754ea04d9 100644 --- a/examples/toolbar-app/tsconfig.json +++ b/examples/toolbar-app/tsconfig.json @@ -1,7 +1,5 @@ { "extends": "astro/tsconfigs/base", - "include": ["**/*", ".astro/types.d.ts"], - "exclude": ["dist"], "compilerOptions": { "outDir": "dist", "rootDir": "src" From 32635281309ac042c8e10faababf48639d74bbf9 Mon Sep 17 00:00:00 2001 From: Florian Lefebvre Date: Fri, 30 Aug 2024 14:06:03 +0200 Subject: [PATCH 06/10] Update .changeset/old-zebras-teach.md Co-authored-by: Sarah Rainsberger --- .changeset/old-zebras-teach.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.changeset/old-zebras-teach.md b/.changeset/old-zebras-teach.md index 593a67227c41..6c1503b619f3 100644 --- a/.changeset/old-zebras-teach.md +++ b/.changeset/old-zebras-teach.md @@ -4,7 +4,11 @@ Updates `astro sync` behavior -`astro sync` will no longer create nor update `src/env.dts`. You can keep using it but we recommend you update your root `tsconfig.json` instead: +Astro examples default `tsconfig.json` has been updated to include generated types and exclude your build output. This means that `src/env.d.ts` is only necessary if you have added custom or if you're not using a `tsconfig.json` file. + +Additionally, running `astro sync` no longer creates, nor updates, `src/env.d.ts` as it is not required for type-checking standard Astro projects. + +To update your project to Astro's recommended TypeScript settings, please add the following `include` and `exclude` properties to `tsconfig.json`: ```diff { From 5c7c10ffe5c020eae038cb3de174e3ea298ce0b6 Mon Sep 17 00:00:00 2001 From: Florian Lefebvre Date: Fri, 30 Aug 2024 14:06:58 +0200 Subject: [PATCH 07/10] Discard changes to packages/integrations/vercel/test/hosted/hosted-astro-project/src/env.d.ts --- .../vercel/test/hosted/hosted-astro-project/src/env.d.ts | 1 + 1 file changed, 1 insertion(+) create mode 100644 packages/integrations/vercel/test/hosted/hosted-astro-project/src/env.d.ts diff --git a/packages/integrations/vercel/test/hosted/hosted-astro-project/src/env.d.ts b/packages/integrations/vercel/test/hosted/hosted-astro-project/src/env.d.ts new file mode 100644 index 000000000000..f964fe0cffd8 --- /dev/null +++ b/packages/integrations/vercel/test/hosted/hosted-astro-project/src/env.d.ts @@ -0,0 +1 @@ +/// From 91eccdf6f3352aeb3fb94e98399909b711a540b3 Mon Sep 17 00:00:00 2001 From: Florian Lefebvre Date: Sat, 31 Aug 2024 09:59:24 +0200 Subject: [PATCH 08/10] Update .changeset/old-zebras-teach.md --- .changeset/old-zebras-teach.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/old-zebras-teach.md b/.changeset/old-zebras-teach.md index 6c1503b619f3..6c93135180b8 100644 --- a/.changeset/old-zebras-teach.md +++ b/.changeset/old-zebras-teach.md @@ -2,7 +2,7 @@ 'astro': major --- -Updates `astro sync` behavior +Changes the default `tsconfig.json` with better defaults, and makes `src/env.d.ts` optional Astro examples default `tsconfig.json` has been updated to include generated types and exclude your build output. This means that `src/env.d.ts` is only necessary if you have added custom or if you're not using a `tsconfig.json` file. From 796cacf15a043e6bbc48772a6e53f9b055258846 Mon Sep 17 00:00:00 2001 From: Florian Lefebvre Date: Mon, 2 Sep 2024 15:20:33 +0200 Subject: [PATCH 09/10] Update packages/astro/performance/fixtures/utils/tsconfig.json Co-authored-by: Bjorn Lu --- packages/astro/performance/fixtures/utils/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/astro/performance/fixtures/utils/tsconfig.json b/packages/astro/performance/fixtures/utils/tsconfig.json index 4d99793aa010..5851e5189ac9 100644 --- a/packages/astro/performance/fixtures/utils/tsconfig.json +++ b/packages/astro/performance/fixtures/utils/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "react" - } , + }, "include": ["**/*", ".astro/types.d.ts"], "exclude": ["dist"] } From c2c517473719c590ad8b8ef5d0626f5ff83727f2 Mon Sep 17 00:00:00 2001 From: Florian Lefebvre Date: Tue, 3 Sep 2024 17:27:30 +0200 Subject: [PATCH 10/10] Update .changeset/old-zebras-teach.md Co-authored-by: Sarah Rainsberger --- .changeset/old-zebras-teach.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/old-zebras-teach.md b/.changeset/old-zebras-teach.md index 6c93135180b8..1b22948949e5 100644 --- a/.changeset/old-zebras-teach.md +++ b/.changeset/old-zebras-teach.md @@ -4,7 +4,7 @@ Changes the default `tsconfig.json` with better defaults, and makes `src/env.d.ts` optional -Astro examples default `tsconfig.json` has been updated to include generated types and exclude your build output. This means that `src/env.d.ts` is only necessary if you have added custom or if you're not using a `tsconfig.json` file. +Astro's default `tsconfig.json` in starter examples has been updated to include generated types and exclude your build output. This means that `src/env.d.ts` is only necessary if you have added custom type declarations or if you're not using a `tsconfig.json` file. Additionally, running `astro sync` no longer creates, nor updates, `src/env.d.ts` as it is not required for type-checking standard Astro projects.