Skip to content

Commit 31a65db

Browse files
committed
let's see like this
1 parent 1aa2062 commit 31a65db

File tree

6 files changed

+14
-16
lines changed

6 files changed

+14
-16
lines changed

packages/addons/devtools-json/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ export default defineAddon({
88
homepage: 'https://github.com/ChromeDevTools/vite-plugin-devtools-json',
99
options: {},
1010

11-
run: ({ sv, viteConfigPath }) => {
11+
run: ({ sv, viteConfigFile }) => {
1212
sv.devDependency('vite-plugin-devtools-json', '^1.0.0');
1313

1414
// add the vite plugin
15-
sv.file(viteConfigPath, (content) => {
15+
sv.file(viteConfigFile, (content) => {
1616
const { ast, generateCode } = parseScript(content);
1717

1818
const vitePluginName = 'devtoolsJson';

packages/addons/paraglide/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default defineAddon({
5555
setup: ({ kit, unsupported }) => {
5656
if (!kit) unsupported('Requires SvelteKit');
5757
},
58-
run: ({ sv, options, viteConfigPath, typescript, kit }) => {
58+
run: ({ sv, options, viteConfigFile, typescript, kit }) => {
5959
const ext = typescript ? 'ts' : 'js';
6060
if (!kit) throw new Error('SvelteKit is required');
6161

@@ -81,7 +81,7 @@ export default defineAddon({
8181
});
8282

8383
// add the vite plugin
84-
sv.file(viteConfigPath, (content) => {
84+
sv.file(viteConfigFile, (content) => {
8585
const { ast, generateCode } = parseScript(content);
8686

8787
const vitePluginName = 'paraglideVitePlugin';

packages/addons/tailwindcss/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default defineAddon({
4141
shortDescription: 'css framework',
4242
homepage: 'https://tailwindcss.com',
4343
options,
44-
run: ({ sv, options, viteConfigPath, typescript, kit, dependencyVersion }) => {
44+
run: ({ sv, options, viteConfigFile, typescript, kit, dependencyVersion }) => {
4545
const prettierInstalled = Boolean(dependencyVersion('prettier'));
4646

4747
sv.devDependency('tailwindcss', '^4.0.0');
@@ -56,7 +56,7 @@ export default defineAddon({
5656
}
5757

5858
// add the vite plugin
59-
sv.file(viteConfigPath, (content) => {
59+
sv.file(viteConfigFile, (content) => {
6060
const { ast, generateCode } = parseScript(content);
6161

6262
const vitePluginName = 'tailwindcss';

packages/addons/vitest-addon/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default defineAddon({
2020
shortDescription: 'unit testing',
2121
homepage: 'https://vitest.dev',
2222
options,
23-
run: ({ sv, viteConfigPath, typescript, kit, options }) => {
23+
run: ({ sv, viteConfigFile, typescript, kit, options }) => {
2424
const ext = typescript ? 'ts' : 'js';
2525
const unitTesting = options.usages.includes('unit');
2626
const componentTesting = options.usages.includes('component');
@@ -96,11 +96,11 @@ export default defineAddon({
9696
`;
9797
});
9898
}
99-
sv.file(viteConfigPath, (content) => {
99+
sv.file(viteConfigFile, (content) => {
100100
const { ast, generateCode } = parseScript(content);
101101

102102
const clientObjectExpression = object.create({
103-
extends: `./${viteConfigPath}`,
103+
extends: `./${viteConfigFile}`,
104104
test: {
105105
name: 'client',
106106
environment: 'browser',
@@ -116,7 +116,7 @@ export default defineAddon({
116116
});
117117

118118
const serverObjectExpression = object.create({
119-
extends: `./${viteConfigPath}`,
119+
extends: `./${viteConfigFile}`,
120120
test: {
121121
name: 'server',
122122
environment: 'node',

packages/cli/commands/add/workspace.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@ export async function createWorkspace({
2020
packageManager
2121
}: CreateWorkspaceOptions): Promise<Workspace<any>> {
2222
const resolvedCwd = path.resolve(cwd);
23-
let viteConfigPath = path.join(resolvedCwd, commonFilePaths.viteConfigTS);
23+
const viteConfigPath = path.join(resolvedCwd, commonFilePaths.viteConfigTS);
2424
let usesTypescript = fs.existsSync(viteConfigPath);
2525

26-
if (!usesTypescript) {
27-
viteConfigPath = path.join(resolvedCwd, commonFilePaths.viteConfig);
28-
}
26+
const viteConfigFile = usesTypescript ? commonFilePaths.viteConfigTS : commonFilePaths.viteConfig;
2927

3028
if (TESTING) {
3129
// while executing tests, we only look into the direct `cwd`
@@ -59,7 +57,7 @@ export async function createWorkspace({
5957
options,
6058
packageManager: packageManager ?? (await detect({ cwd }))?.name ?? getUserAgent() ?? 'npm',
6159
typescript: usesTypescript,
62-
viteConfigPath,
60+
viteConfigFile,
6361
kit: dependencies['@sveltejs/kit'] ? parseKitOptions(resolvedCwd) : undefined,
6462
dependencyVersion: (pkg) => dependencies[pkg]
6563
};

packages/core/addon/workspace.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export type Workspace<Args extends OptionDefinition> = {
1313
*/
1414
dependencyVersion: (pkg: string) => string | undefined;
1515
typescript: boolean;
16-
viteConfigPath: string;
16+
viteConfigFile: string;
1717
kit: { libDirectory: string; routesDirectory: string } | undefined;
1818
packageManager: PackageManager;
1919
};

0 commit comments

Comments
 (0)