Skip to content
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

feat: add tailwind support #416

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
flag-for-router: ['', '--router']
flag-for-pinia: ['', '--pinia']
flag-for-vitest: ['', '--vitest']
flag-for-tailwind: ['', '--tailwind']

# It's quite costly to install Cypress & Playwright even with cache.
# Maybe we can split them into another job so that all the projects
Expand All @@ -68,6 +69,7 @@ jobs:
flag-for-pinia: '--pinia'
flag-for-vitest: '--vitest'
flag-for-e2e: '--cypress'
flag-for-tailwind: '--tailwind'

- node-version: 18
os: macos-latest
Expand All @@ -77,6 +79,7 @@ jobs:
flag-for-pinia: '--pinia'
flag-for-vitest: '--vitest'
flag-for-e2e: '--cypress'
flag-for-tailwind: '--tailwind'

- node-version: 20
os: ubuntu-latest
Expand All @@ -86,6 +89,7 @@ jobs:
flag-for-pinia: '--pinia'
flag-for-vitest: '--vitest'
flag-for-e2e: '--cypress'
flag-for-tailwind: '--tailwind'

- node-version: 16
os: ubuntu-latest
Expand All @@ -95,10 +99,11 @@ jobs:
flag-for-pinia: '--pinia'
flag-for-vitest: '--vitest'
flag-for-e2e: '--cypress'
flag-for-tailwind: '--tailwind'
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.os == 'windows-latest' }}
env:
FEATURE_FLAGS: ${{ matrix.flag-for-ts }} ${{ matrix.flag-for-jsx }} ${{ matrix.flag-for-router }} ${{ matrix.flag-for-pinia }} ${{ matrix.flag-for-vitest }} ${{ matrix.flag-for-e2e }}
FEATURE_FLAGS: ${{ matrix.flag-for-ts }} ${{ matrix.flag-for-jsx }} ${{ matrix.flag-for-router }} ${{ matrix.flag-for-pinia }} ${{ matrix.flag-for-vitest }} ${{ matrix.flag-for-e2e }} ${{ matrix.flag-for-tailwind }}
# Sometimes the Linux runner can't verify Cypress in 30s
CYPRESS_VERIFY_TIMEOUT: 60000
steps:
Expand Down
23 changes: 20 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,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 @@ -107,7 +108,8 @@ async function init() {
argv.cypress ??
argv.nightwatch ??
argv.playwright ??
argv.eslint
argv.eslint ??
argv.tailwind
) === 'boolean'

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

try {
Expand All @@ -145,6 +148,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 @@ -276,6 +280,14 @@ async function init() {
initial: false,
active: language.defaultToggleOptions.active,
inactive: language.defaultToggleOptions.inactive
},
{
name: 'needsTailwind',
type: () => (isFeatureFlagsUsed ? null : 'toggle'),
message: 'Add tailwind for styling?',
initial: false,
active: language.defaultToggleOptions.active,
inactive: language.defaultToggleOptions.inactive
}
],
{
Expand All @@ -301,7 +313,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.needsTailwind
} = result

const { needsE2eTesting } = result
Expand Down Expand Up @@ -429,6 +442,9 @@ async function init() {
'utf-8'
)
}
if (needsTailwind) {
render('config/tailwind')
}

// Render ESLint config
if (needsEslint) {
Expand Down Expand Up @@ -543,7 +559,8 @@ async function init() {
needsPlaywright,
needsNightwatchCT,
needsCypressCT,
needsEslint
needsEslint,
needsTailwind
})
)

Expand Down
Loading