Skip to content

Add tailwind as an option #245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions index.ts
Original file line number Diff line number Diff line change
@@ -78,6 +78,7 @@ async function init() {
// --playwright
// --eslint
// --eslint-with-prettier (only support prettier through eslint for simplicity)
// --tailwind
// --force (for force overwriting)
const argv = minimist(process.argv.slice(2), {
alias: {
@@ -102,7 +103,8 @@ async function init() {
argv.vitest ??
argv.cypress ??
argv.playwright ??
argv.eslint
argv.eslint ??
argv.tailwind
) === 'boolean'

let targetDir = argv._[0]
@@ -122,6 +124,7 @@ async function init() {
needsE2eTesting?: false | 'cypress' | 'playwright'
needsEslint?: boolean
needsPrettier?: boolean
needsTailwind?: boolean
} = {}

try {
@@ -137,6 +140,7 @@ async function init() {
// - Add Playwright for end-to-end testing?
// - Add ESLint for code quality?
// - Add Prettier for code formatting?
// - Add Tailwind for styling?
result = await prompts(
[
{
@@ -252,6 +256,14 @@ async function init() {
initial: false,
active: 'Yes',
inactive: 'No'
},
{
name: 'needsTailwind',
type: () => (isFeatureFlagsUsed ? null : 'toggle'),
message: 'Add TailwindCss for styling?',
initial: false,
active: 'Yes',
inactive: 'No'
}
],
{
@@ -277,7 +289,8 @@ async function init() {
needsPinia = argv.pinia,
needsVitest = argv.vitest || argv.tests,
needsEslint = argv.eslint || argv['eslint-with-prettier'],
needsPrettier = argv['eslint-with-prettier']
needsPrettier = argv['eslint-with-prettier'],
needsTailwind = argv['tailwind']
} = result

const { needsE2eTesting } = result
@@ -357,6 +370,11 @@ async function init() {
renderEslint(root, { needsTypeScript, needsCypress, needsCypressCT, needsPrettier })
}

// Render tailwind config
if (needsTailwind) {
render('config/tailwind')
}

// Render code template.
// prettier-ignore
const codeTemplate =
@@ -440,14 +458,17 @@ async function init() {
needsCypress,
needsPlaywright,
needsCypressCT,
needsEslint
needsEslint,
needsTailwind
})
)

console.log(`\nDone. Now run:\n`)
if (root !== cwd) {
const cdProjectName = path.relative(cwd, root)
console.log(` ${bold(green(`cd ${cdProjectName.includes(' ') ? `"${cdProjectName}"` : cdProjectName}`))}`)
console.log(
` ${bold(green(`cd ${cdProjectName.includes(' ') ? `"${cdProjectName}"` : cdProjectName}`))}`
)
}
console.log(` ${bold(green(getCommand(packageManager, 'install')))}`)
if (needsPrettier) {
Loading
Oops, something went wrong.