Skip to content

Commit

Permalink
change var to boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
ndelangen committed Feb 19, 2024
1 parent 1307cd3 commit 4ee0478
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions code/lib/cli/src/automigrate/fixes/vite-config-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ export const viteConfigFile = {
id: 'viteConfigFile',

async check({ mainConfig, packageManager }) {
let viteConfigPath = await findUp([
let isViteConfigFileFound = !!(await findUp([
'vite.config.js',
'vite.config.mjs',
'vite.config.cjs',
'vite.config.ts',
]);
]));

const rendererToVitePluginMap: Record<string, string> = {
preact: '@preact/preset-vite',
Expand All @@ -46,15 +46,15 @@ export const viteConfigFile = {
const rendererName = frameworkToRenderer[frameworkName as keyof typeof frameworkToRenderer];

if (
!viteConfigFile &&
!isViteConfigFileFound &&
mainConfig.core?.builder &&
typeof mainConfig.core?.builder !== 'string' &&
mainConfig.core?.builder.options
) {
viteConfigPath = mainConfig.core?.builder.options.viteConfigPath;
isViteConfigFileFound = !!mainConfig.core?.builder.options.viteConfigPath;
}

if (!viteConfigPath && isUsingViteBuilder) {
if (!isViteConfigFileFound && isUsingViteBuilder) {
const plugins = [];

if (rendererToVitePluginMap[rendererName]) {
Expand All @@ -63,7 +63,7 @@ export const viteConfigFile = {

return {
plugins,
existed: !!viteConfigPath,
existed: isViteConfigFileFound,
};
}

Expand All @@ -75,7 +75,7 @@ export const viteConfigFile = {

const pluginVersion = await packageManager.getPackageVersion(plugin);

if (viteConfigPath && isUsingViteBuilder && !pluginVersion) {
if (isViteConfigFileFound && isUsingViteBuilder && !pluginVersion) {
const plugins = [];

if (plugin) {
Expand All @@ -84,7 +84,7 @@ export const viteConfigFile = {

return {
plugins,
existed: !viteConfigPath,
existed: !isViteConfigFileFound,
};
}

Expand Down

0 comments on commit 4ee0478

Please sign in to comment.