0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/packages/astro
Michael Rienstra 7481ffda02
create-astro: always create tsconfig.json (#4810)
* `create-astro`: always create `tsconfig.json`

Currently, we only make sure `tsconfig.json` exists when `strict` or `strictest` is selected. Both `default` & `optout` are intended to correspond to `base` -- and will do so for all [23 official templates](https://github.com/withastro/astro/tree/main/examples), but not necessarily for third-party templates.

The [example command for installing a third-party template](https://github.com/withastro/astro/blob/a800bf7/packages/create-astro/README.md?plain=1#L31-L35) is (rather conveniently for the sake of this PR!) an example of a template without a `tsconfig.json` file, and installing it with the `default` ("Relaxed") Typescript option results in no `tsconfig.json` file, rather than a `tsconfig.json` file containing `{ "extends": "astro/tsconfigs/base" }` as would be expected.

This PR addresses this scenario. 

It also explicitly sets the `tsconfig.json` file to `{ "extends": "astro/tsconfigs/base" }` when `default` (which I renamed to `base`, still presented to the user as "Relaxed") or `optout` is selected (`optout` has always printed a warning about the importance of `tsconfig.json` & `src/env.d.ts` but otherwise behaved identically to `default`). This is necessary in two scenarios:

1. When the `tsconfig.json` file was created by this script.
2. When it either didn't already include `"extends"`, or it extended a different config by default. For example, some third-party templates might default to `strict`, in which case I'm guessing we'd want to respect the user's choice and change that to `base`.

* update `del` 6.1.1 --> 7.0.0

* test: prevent excess writes
(without this it triggers many times)

* test: create-astro typescript prompt

* changeset

* fix: recursive `mkdirSync`

* test: longer timeout for `windows-latest` OS
(see if this fixes failing tests)

* better glob path creation, don't hardcode `/`

* test: longer timeout for windows-latest OS
(since I'm about to trigger another CI run by pushing a commit, might as well try this too)

* create-astro test: show last CLI output on timeout

* drop variable timeout
Typescript tests are slower than directory tests, but they are all usually less than 5000 ms. Less complexity, easier to maintain.

* DRY new error output

* Update lockfile

* Sync lockfile with main

* Update lockfile

Co-authored-by: Princesseuh <princssdev@gmail.com>
2022-09-22 14:37:01 -04:00
..
components chore: updated shiki (#4519) 2022-08-28 08:23:37 -03:00
e2e Fix: Windows client-side script reloads on dev server (#4645) 2022-09-09 10:53:34 -04:00
src Fix slashes for paths containing non-ASCII characters on Windows. (#4712) 2022-09-22 14:33:28 -04:00
test create-astro: always create tsconfig.json (#4810) 2022-09-22 14:37:01 -04:00
tsconfigs Add template tsconfigs for users to extend from (#4439) 2022-08-25 15:15:27 -04:00
astro-jsx.d.ts Add missing slot attribute to possible attributes on SVG elements (#4535) 2022-08-29 12:06:50 -03:00
astro.js Roll back supported Node engines (#3937) 2022-07-15 08:15:04 -04:00
CHANGELOG.md [ci] release (#4833) 2022-09-22 11:04:45 -04:00
client-base.d.ts Vendor Vite's importMeta.d.ts inside our repo to workaround issue with tsc on Linux (#4499) 2022-08-26 12:47:39 -03:00
client.d.ts Fixes type definitions @astrojs/image and adds more documentation to the README (#4045) 2022-07-27 15:39:05 +00:00
config.d.ts fix: config type import (#4524) 2022-08-29 00:12:58 -03:00
config.mjs [ci] format 2022-08-05 19:42:58 +00:00
env.d.ts Make astro package play nice with node16 module resolution (#4182) 2022-08-25 14:57:11 -04:00
import-meta.d.ts Vendor Vite's importMeta.d.ts inside our repo to workaround issue with tsc on Linux (#4499) 2022-08-26 12:47:39 -03:00
package.json [ci] release (#4833) 2022-09-22 11:04:45 -04:00
playwright.config.js [ci] format 2022-07-19 21:49:29 +00:00
README.md fix link (#4070) 2022-07-28 08:11:37 -04:00
tsconfig.json Make astro package play nice with node16 module resolution (#4182) 2022-08-25 14:57:11 -04:00


Astro logo

Astro is a website build tool for the modern web —
powerful developer experience meets lightweight output.

Install

# Recommended!
npm create astro@latest

# Manual:
npm install --save-dev astro

Looking for help? Start with our Getting Started guide.

Looking for quick examples? Open a starter project right in your browser.

Documentation

Visit our offical documentation.

Support

Having trouble? Get help in the official Astro Discord.

Contributing

New contributors welcome! Check out our Contributors Guide for help getting started.

Join us on Discord to meet other maintainers. We'll help you get your first contribution in no time!

Sponsors

Astro is generously supported by Netlify, Vercel, and several other amazing organizations listed here.

❤️ Sponsor Astro! ❤️