Skip to content

Commit

Permalink
refactor: Remove WindiCSS configuration and related files
Browse files Browse the repository at this point in the history
  • Loading branch information
adhamfarrag committed Sep 19, 2024
1 parent 73305bb commit 2c4228a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 72 deletions.
67 changes: 5 additions & 62 deletions src/commands/CSS.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
import { window } from 'vscode'
import { tailwindCSSFile, tailwindCSSJSConfig, tailwindCSSTSConfig, unoCSSConfig, vuetifyConfigFile, windiCSSConfig } from '../templates'
import { tailwindCSSFile, tailwindCSSJSConfig, tailwindCSSTSConfig, unoCSSConfig, vuetifyConfigFile } from '../templates'
import { createFile, getInstallationCommand, isNuxtTwo, openExternalLink, projectRootDirectory, projectSrcDirectory, runCommand, updateNuxtConfig } from '../utils'

const frameworks = ['TailwindCSS', 'WindiCSS', 'UnoCSS', 'Vuetify']
const frameworks = ['TailwindCSS', 'UnoCSS', 'Vuetify']

enum TailwindOptions {
installModule = 'Install @nuxtjs/tailwindcss module and add it to nuxt config',
createConfigFile = 'Create TailwindCSS config file',
createTailwindCSSFile = 'Create tailwind.css file inside assets/css',
}

enum WindiOptions {
installModule = 'Install nuxt-windicss module and add it to nuxt config',
createConfigFile = 'Create WindiCSS config file',
}

enum UnoCSSOptions {
installModule = 'Install unocss/nuxt module and add it to nuxt config',
createConfigFile = 'Create uno.config.ts file',
Expand All @@ -35,22 +30,17 @@ function configureCSS() {
switch (selection) {
case 'TailwindCSS': {
configureTailwind()

break;
}
case 'WindiCSS': {
configureWindi()


break;
}
case 'UnoCSS': {
configureUno()

break;
}
case 'Vuetify': {
configureVuetify()

break;
}
// No default
Expand Down Expand Up @@ -126,53 +116,6 @@ const configureTailwind = () => {
}
}

const configureWindi = async () => {
try {
const filePath = `${await projectSrcDirectory()}/windi.config.${isNuxtTwo() ? 'js' : 'ts'}`

const windiOptions = Object.values(WindiOptions)

window
.showQuickPick(windiOptions, {
canPickMany: true,
placeHolder: 'Select files to create',
})
.then(async (selections) => {
if (selections !== undefined && selections.length > 0) {
if (selections.includes(WindiOptions.installModule)) {
const moduleName = 'nuxt-windicss'
const command = await getInstallationCommand(moduleName, true)

await runCommand({
command,
message: 'Installing WindiCSS',
successMessage: 'WindiCSS installed successfully',
errorMessage: 'WindiCSS installation failed',
})

await updateNuxtConfig('add-module', moduleName)
}

if (selections.includes(WindiOptions.createConfigFile)) {
await createFile({
fileName: `windi.config.${isNuxtTwo() ? 'js' : 'ts'}`,
content: windiCSSConfig,
fullPath: filePath,
})
window
.showInformationMessage('WindiCSS configured successfully.', 'Open documentation')
.then((value) => {
if (value) {
openExternalLink('https://windicss.org/integrations/nuxt.html')
}
})
}
}
})
} catch (error: any) {
console.log(error)
}
}

const configureUno = async () => {
try {
Expand Down
9 changes: 0 additions & 9 deletions src/templates/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ export default defineConfig({
})
`

const windiCSSConfig = `import { defineConfig } from 'windicss/helpers'
export default defineConfig({
})
`

const tailwindCSSJSConfig = `/** @type {import('tailwindcss').Config} */
module.exports = {
content: [],
Expand Down Expand Up @@ -50,7 +42,6 @@ export default {

export {
unoCSSConfig,
windiCSSConfig,
tailwindCSSJSConfig,
tailwindCSSTSConfig,
tailwindCSSFile,
Expand Down
1 change: 0 additions & 1 deletion src/templates/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export {

export {
unoCSSConfig,
windiCSSConfig,
tailwindCSSJSConfig,
tailwindCSSTSConfig,
tailwindCSSFile,
Expand Down

0 comments on commit 2c4228a

Please sign in to comment.