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

[adapter api]: pass svelte.config.js config object to adapter #1435

Closed
jthegedus opened this issue May 12, 2021 · 3 comments · Fixed by #1559
Closed

[adapter api]: pass svelte.config.js config object to adapter #1435

jthegedus opened this issue May 12, 2021 · 3 comments · Fixed by #1559

Comments

@jthegedus
Copy link
Contributor

jthegedus commented May 12, 2021

Is your feature request related to a problem? Please describe.

The Firebase adapter reads a provided firebase.json configuration to determine destination dirs for utils.copy_{static/client}_files etc.

If the destination dir defined in firebase.json is the same as the svelte.config.js:kit.files.assets dir then we end up with a mess of a dir similar to the issue I am experiencing from #587

Describe the solution you'd like

Either:

  • preferred solution utils.copy_{static/client}_files error when the destination dir is the same as the source dir (notably this misses utils.prerender, but calling prerender after the other copies would be enough)
  • the adapter receives the SvelteKit config object so these types of checks can be made within the adapter without having to read in the config file itself

Describe alternatives you've considered

How important is this feature to you?

It will help reduce noise from known causes in the adapter workflow if I can nudge my users properly

Additional context

jthegedus/svelte-adapter-firebase#56 is the tracking issue for identifying this conflict of a matching source:dest for static assets.

[update] I have temporarily worked around this by reading the svelte.config.js in the adapter, though obviously not ideal as it's the source config and not the computed final config.

@jthegedus jthegedus changed the title [adapter api]: pass svelte.config object to adapter. [adapter api]: pass svelte.config.js config object to adapter May 12, 2021
@benmccann
Copy link
Member

@jthegedus any chance you'd want to send a PR for this?

I think we could do something like:

return {
  adapt(utils, config) {
    ...
  }
};

@jthegedus
Copy link
Contributor Author

Happy to create the PR 😁

Would an object be preferable?

-adapt(utils, config) {
+adapt({ utils, config }) {

Would break all adapters once, then never again should something like this come up

@benmccann
Copy link
Member

Yes, that's a good idea. We've tried to follow that pattern generally, but I guess we missed doing it here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants