Skip to content

Commit

Permalink
Add tailwind as an option
Browse files Browse the repository at this point in the history
  • Loading branch information
medaminefh committed Apr 4, 2023
1 parent ca59ce9 commit 4413ee3
Show file tree
Hide file tree
Showing 7 changed files with 1,082 additions and 761 deletions.
29 changes: 25 additions & 4 deletions index.ts
Expand Up @@ -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: {
Expand All @@ -102,7 +103,8 @@ async function init() {
argv.vitest ??
argv.cypress ??
argv.playwright ??
argv.eslint
argv.eslint ??
argv.tailwind
) === 'boolean'

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

try {
Expand All @@ -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(
[
{
Expand Down Expand Up @@ -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'
}
],
{
Expand All @@ -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
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 4413ee3

Please sign in to comment.