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

Feature Request(CLI): Using custom .svelte-kit locations #1486

Closed
RonenEizen opened this issue Nov 14, 2024 · 5 comments
Closed

Feature Request(CLI): Using custom .svelte-kit locations #1486

RonenEizen opened this issue Nov 14, 2024 · 5 comments
Labels
type: CLI type: feature Introduction of new functionality to the application

Comments

@RonenEizen
Copy link

Describe the bug

I am using non-default setup for sveltekit where files are not in .svelte-kit. When I run pnpm dlx shadcn-svelte@next add ... the command fails at pnpm dlx svelte-kit sync with ERR_PNPM_DLX_NO_BIN  No binaries found in svelte-kit.

This is my svelte.config.js file:

const config = {
  kit: {
    ...
    files: {
      hooks: {
        universal: process.env.CLIENT ? 'src/client/hooks' : 'src/admin/hooks',
        server: process.env.CLIENT ? 'src/client/hooks.server' : 'src/admin/hooks.server',
        client: process.env.CLIENT ? 'src/client/hooks.client' : 'src/admin/hooks.client'
      },
      routes: process.env.CLIENT ? 'src/client/routes' : 'src/admin/routes'
    },
    outDir: `.dist.${process.env.CLIENT ? 'client' : 'admin'}`
  },
  ...
}

NOTE: I am using the next version of shadcn

Reproduction

  1. Create a new SvelteKit project
  2. Set files property to non-default values in svelte.config.js
  3. Run shadcn cli to set it up with the project

Logs

ERR_PNPM_DLX_NO_BIN  No binaries found in svelte-kit

System Info

MacOS

Severity

annoyance

@ieedan

This comment was marked as off-topic.

@RonenEizen
Copy link
Author

@ieedan not sure which step you are reffering to. I've ran pnpm install multiple times. When I get to the pnpm dlx shadcn-svelte@next init this is the error I am getting:

┌   shadcn-svelte  v1.0.0-next.2 
│
└  Error: Command failed with exit code 1: pnpm dlx svelte-kit sync
┌   shadcn-svelte  v1.0.0-next.2 
│
└  Error: Command failed with exit code 1: pnpm dlx svelte-kit sync
 ERR_PNPM_DLX_NO_BIN  No binaries found in svelte-kit
    at makeError (file:///Users/ronen/Library/Caches/pnpm/dlx/g4vh4unkxgiirjz23rsfeewzdm/1932ca44204-22f5/node_modules/.pnpm/[email protected]/node_modules/execa/lib/error.js:60:11)
    at handlePromise (file:///Users/ronen/Library/Caches/pnpm/dlx/g4vh4unkxgiirjz23rsfeewzdm/1932ca44204-22f5/node_modules/.pnpm/[email protected]/node_modules/execa/index.js:124:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async sn (file:///Users/ronen/Library/Caches/pnpm/dlx/g4vh4unkxgiirjz23rsfeewzdm/1932ca44204-22f5/node_modules/.pnpm/[email protected]/node_modules/shadcn-svelte/dist/index.js:59:2258)
    at async et (file:///Users/ronen/Library/Caches/pnpm/dlx/g4vh4unkxgiirjz23rsfeewzdm/1932ca44204-22f5/node_modules/.pnpm/[email protected]/node_modules/shadcn-svelte/dist/index.js:59:3551)
    at async Te (file:///Users/ronen/Library/Caches/pnpm/dlx/g4vh4unkxgiirjz23rsfeewzdm/1932ca44204-22f5/node_modules/.pnpm/[email protected]/node_modules/shadcn-svelte/dist/index.js:59:3509)
    at async Command.<anonymous> (file:///Users/ronen/Library/Caches/pnpm/dlx/g4vh4unkxgiirjz23rsfeewzdm/1932ca44204-22f5/node_modules/.pnpm/[email protected]/node_modules/shadcn-svelte/dist/index.js:181:1163)

@huntabyte
Copy link
Owner

I don't think we're doing any reading of the Svelte config to detect that. TBH I didn't even know it was possible to change this. Will defer to @AdrianGonz97 to see if we should expose a flag or if it is simple enough to detect.

@huntabyte huntabyte added type: feature Introduction of new functionality to the application type: CLI labels Nov 15, 2024
@huntabyte huntabyte changed the title pnpm dlx svelte-kit sync fails when installing a new component Feature Request(CLI): Using custom .svelte-kit locations Nov 15, 2024
@AdrianGonz97
Copy link
Collaborator

AdrianGonz97 commented Nov 15, 2024

It's erroring because the command is wrong. pnpm dlx svelte-kit sync should instead be pnpm exec svelte-kit sync or pnpm svelte-kit sync. resolveCommand should resolve the execute-local command instead of execute

const cmd = resolveCommand(agent.agent, "execute", ["svelte-kit", "sync"]);

@huntabyte
Copy link
Owner

It's erroring because the command is wrong. pnpm dlx svelte-kit sync should instead be pnpm exec svelte-kit sync or pnpm svelte-kit sync. resolveCommand should resolve the execute-local command instead of execute

Didn't even realize that was an option to resolve!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: CLI type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

4 participants