feat: update

This commit is contained in:
sadeghbarati 2023-10-15 13:03:06 +03:30
parent ca9bf9149c
commit f611d264de
4 changed files with 11 additions and 5 deletions

View File

@ -111,6 +111,7 @@ export async function promptForConfig(
{ title: 'Vite', value: 'vite' },
{ title: 'Nuxt', value: 'nuxt' },
{ title: 'Laravel', value: 'laravel' },
{ title: 'Astro', value: 'astro' },
],
},
{
@ -137,7 +138,7 @@ export async function promptForConfig(
type: 'text',
name: 'tailwindCss',
message: `Where is your ${highlight('Tailwind CSS')} file?`,
initial: (prev, values) => defaultConfig?.tailwind.css ?? TAILWIND_CSS_PATH[values.framework as 'vite' | 'nuxt' | 'laravel'],
initial: (prev, values) => defaultConfig?.tailwind.css ?? TAILWIND_CSS_PATH[values.framework as 'vite' | 'nuxt' | 'laravel' | 'astro'],
},
{
type: 'toggle',
@ -152,8 +153,8 @@ export async function promptForConfig(
{
type: 'text',
name: 'tailwindConfig',
message: `Where is your ${highlight('tailwind.config.js')} located?`,
initial: defaultConfig?.tailwind.config ?? DEFAULT_TAILWIND_CONFIG,
message: `Where is your ${highlight('tailwind.config')} located?`,
initial: (prev, values) => defaultConfig?.tailwind.config ?? values.framework === 'astro' ? 'tailwind.config.mjs' : DEFAULT_TAILWIND_CONFIG,
},
{
type: 'text',

View File

@ -16,6 +16,7 @@ export const TAILWIND_CSS_PATH = {
nuxt: 'assets/css/tailwind.css',
vite: 'src/assets/index.css',
laravel: 'resources/css/app.css',
astro: 'src/styles/globals.css',
}
// TODO: Figure out if we want to support all cosmiconfig formats.

View File

@ -67,6 +67,10 @@ module.exports = {
"./resources/views/**/*.blade.php",
"./resources/js/**/*.{<%- extension %>,<%- extension %>x,vue}",
],
<% } else if (framework === 'astro') { %>
content: [
'./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}',
],
<% } %>
theme: {
container: {
@ -133,5 +137,5 @@ module.exports = {
},
},
},
plugins: [],
plugins: [animate],
}`

View File

@ -1,5 +1,5 @@
export function transformCJSToESM(filename: string, code: string) {
if (!filename.endsWith('.mjs')) {
if (filename.endsWith('.mjs')) {
return code
.replace(/const\s([\w\d_]+)\s*=\s*require\((.*)\);?/g, 'import $1 from $2')
.replace(/module\.exports = /g, 'export default ')