Skip to content

Commit

Permalink
Remove comment about adapter-auto once a specific sveltekit adapter i…
Browse files Browse the repository at this point in the history
…s chosen (#436)

* remove comment about adapter-auto

...once a specific sveltekit adapter is chosen

Fixes #430

* add changeset
  • Loading branch information
ranjan-purbey authored Feb 7, 2025
1 parent 9bf0372 commit a75ffdd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/happy-news-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'sv': patch
---

Remove comment about adapter-auto once a specific sveltekit adapter is chosen
6 changes: 4 additions & 2 deletions packages/addons/_tests/sveltekit-adapter/test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { expect } from '@playwright/test';
import { setupTest } from '../_setup/suite.ts';
import { readFile } from 'node:fs/promises';
import { join } from 'node:path';
import sveltekitAdapter from '../../sveltekit-adapter/index.ts';
import { setupTest } from '../_setup/suite.ts';

const addonId = sveltekitAdapter.id;
const { test, variants, prepareServer } = setupTest({ [addonId]: sveltekitAdapter });
Expand All @@ -13,5 +15,5 @@ test.concurrent.for(kitOnly)('core - %s', async (variant, { page, ...ctx }) => {
// kill server process when we're done
ctx.onTestFinished(async () => await close());

expect(true).toBe(true);
expect(await readFile(join(cwd, 'svelte.config.js'), 'utf8')).not.toMatch('adapter-auto');
});
8 changes: 8 additions & 0 deletions packages/addons/sveltekit-adapter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ export default defineAddon({
) as AstTypes.ObjectProperty | undefined;

if (kitConfig && kitConfig.value.type === 'ObjectExpression') {
const adapterProp = kitConfig.value.properties.find(
(p) =>
p.type === 'ObjectProperty' && p.key.type === 'Identifier' && p.key.name === 'adapter'
);
if (adapterProp) {
adapterProp.comments = [];
}

// only overrides the `adapter` property so we can reset it's args
object.overrideProperties(kitConfig.value, {
adapter: functions.callByIdentifier(adapterName, [])
Expand Down

0 comments on commit a75ffdd

Please sign in to comment.