Skip to content

Commit

Permalink
remove comment about adapter-auto
Browse files Browse the repository at this point in the history
...once a specific sveltekit adapter is chosen

Fixes sveltejs#430
  • Loading branch information
ranjan-purbey committed Feb 4, 2025
1 parent e325bb2 commit b20cb61
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
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 b20cb61

Please sign in to comment.