Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

SvelteKit - [CLI Error]: Failed to find tsconfig.json (or jsconfig.json). See: https://www.shadcn-svelte.com/docs/installation#opt-out-of-typescript #1282

Open
imme-emosol opened this issue Sep 24, 2024 · 1 comment
Labels
type: documentation A change or addition to the documentation

Comments

@imme-emosol
Copy link

Change Type

Addition

Proposed Changes

When the project does not have either-or {t,j}sconfig.json,
depending on the (optional) components.json#typescript value, either

[CLI Error]: Failed to find tsconfig.json. See: https://www.shadcn-svelte.com/docs/installation#opt-out-of-typescript

or

[CLI Error]: Failed to find jsconfig.json. See: https://www.shadcn-svelte.com/docs/installation#opt-out-of-typescript

will be shown.

This can be resolved by adding either-or {t,j}sconfig.json with content:

{
        "extends": "./.svelte-kit/tsconfig.json"
}

Perhaps this can/should be added to sites/docs/src/content/installation/sveltekit.md.


Another option might be to change packages/cli/src/utils/sveltekit.ts.

However, this is posted as Docs Issue, since posting as feature-request will not be considered here :

This feature already exists in shadcn/ui - if not, it won't be considered here so don't continue with your issue. *
This project's goal is to remain aligned with shadcn/ui. If the feature you are requesting is not in the original shadcn/ui, it will not be considered here.


Yet another thing that can be observed, is that the link in the error-message points to #opt-out-of-typescript, even when there is no components.json (yet) and also when components.json contains "typescript": false (which is what is mentioned at that anchor).

@imme-emosol imme-emosol added the type: documentation A change or addition to the documentation label Sep 24, 2024
@imme-emosol
Copy link
Author

Given that the current 'step 4' "Setup path aliases" is conditional,
it could perhaps be changed into a suggestion at the end of 'step 3' "Install dependencies" ?

And the code example can perhaps be replaced by a <a>/reference?

A rephrasing might also be useful, to reflect that this optional task also relates to specifying a location for the components and utils, next to being related to an (optionally) changed $lib. For instance :

By default, shadcn-svelte uses the $lib alias to locate its components and utils. When other import aliases are to be used, the next step uses SvelteKit's alias to resolve those import aliases to a path/location for the components and utils

Additional context, used references
Additional context

Also mentioned in pull request 284:

the entire step [adding aliases to the configuration] could be removed

Adding 'step 4' "Setup path aliases"
seems to originate from pull request 180,
which resolved issue 165.


references (cialnum-sorted:{0-9,[Aa]-[Zz]}):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A change or addition to the documentation
Projects
None yet
Development

No branches or pull requests

1 participant