Skip to content

feat: bare config #637

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

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
22 changes: 19 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ async function init() {
needsEslint?: false | 'eslintOnly' | 'speedUpWithOxlint'
needsOxlint?: boolean
needsPrettier?: boolean
bare?: boolean
} = {}

try {
Expand Down Expand Up @@ -300,6 +301,14 @@ async function init() {
active: language.defaultToggleOptions.active,
inactive: language.defaultToggleOptions.inactive,
},
{
name: 'bare',
type: () => (isFeatureFlagsUsed ? null : 'toggle'),
message: language.bare.message,
initial: false,
active: language.defaultToggleOptions.active,
inactive: language.defaultToggleOptions.inactive,
},
],
{
onCancel: () => {
Expand All @@ -324,6 +333,7 @@ async function init() {
needsPinia = argv.pinia,
needsVitest = argv.vitest || argv.tests,
needsPrettier = argv['eslint-with-prettier'],
bare,
} = result

const needsEslint = Boolean(argv.eslint || argv['eslint-with-prettier'] || result.needsEslint)
Expand Down Expand Up @@ -360,7 +370,11 @@ async function init() {
renderTemplate(templateDir, root, callbacks)
}
// Render base template
render('base')
if (bare) {
render('bare-base')
} else {
render('base')
}

// Add configs.
if (needsJsx) {
Expand Down Expand Up @@ -476,8 +490,10 @@ async function init() {
// Render code template.
// prettier-ignore
const codeTemplate =
(needsTypeScript ? 'typescript-' : '') +
(needsRouter ? 'router' : 'default')
bare
? 'bare'
: (needsTypeScript ? 'typescript-' : '') +
(needsRouter ? 'router' : 'default')
render(`code/${codeTemplate}`)

// Render entry file (main.js/ts).
Expand Down
3 changes: 3 additions & 0 deletions locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
"needsPrettier": {
"message": "Add Prettier for code formatting?"
},
"bare": {
"message": "Scaffold project without beginner instructions?"
},
"errors": {
"operationCancelled": "Operation cancelled"
},
Expand Down
3 changes: 3 additions & 0 deletions locales/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
"needsPrettier": {
"message": "Ajouter Prettier pour le formatage du code\u00a0?"
},
"bare": {
"message": "Scaffold project without beginner instructions?"
},
"errors": {
"operationCancelled": "Operation annulée"
},
Expand Down
3 changes: 3 additions & 0 deletions locales/tr-TR.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
"needsPrettier": {
"message": "Kod formatlama için Prettier eklensin mi?"
},
"bare": {
"message": "Scaffold project without beginner instructions?"
},
"errors": {
"operationCancelled": "İşlem iptal edildi"
},
Expand Down
3 changes: 3 additions & 0 deletions locales/zh-Hans.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
"needsPrettier": {
"message": "是否引入 Prettier 用于代码格式化?"
},
"bare": {
"message": "Scaffold project without beginner instructions?"
},
"errors": {
"operationCancelled": "操作取消"
},
Expand Down
3 changes: 3 additions & 0 deletions locales/zh-Hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
"needsPrettier": {
"message": "是否引入 Prettier 用於程式碼格式化?"
},
"bare": {
"message": "Scaffold project without beginner instructions?"
},
"errors": {
"operationCancelled": "操作取消"
},
Expand Down
3 changes: 3 additions & 0 deletions template/bare-base/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar"]
}
8 changes: 8 additions & 0 deletions template/bare-base/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.patterns": {
"tsconfig.json": "tsconfig.*.json, env.d.ts",
"vite.config.*": "jsconfig*, vitest.config.*, cypress.config.*, playwright.config.*",
"package.json": "package-lock.json, pnpm*, .yarnrc*, yarn*, .eslint*, eslint*, .prettier*, prettier*, .editorconfig"
}
}
30 changes: 30 additions & 0 deletions template/bare-base/_gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
coverage
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

*.tsbuildinfo
13 changes: 13 additions & 0 deletions template/bare-base/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
8 changes: 8 additions & 0 deletions template/bare-base/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
},
"exclude": ["node_modules", "dist"]
}
17 changes: 17 additions & 0 deletions template/bare-base/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"vue": "^3.5.13"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.2.1",
"vite": "^6.0.3",
"vite-plugin-vue-devtools": "^7.6.7"
}
}
Binary file added template/bare-base/public/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions template/bare-base/src/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
17 changes: 17 additions & 0 deletions template/bare-base/vite.config.js.data.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export default function getData() {
return {
plugins: [
{
id: 'vue',
importer: "import vue from '@vitejs/plugin-vue'",
initializer: 'vue()',
},

{
id: 'vite-plugin-vue-devtools',
importer: "import vueDevTools from 'vite-plugin-vue-devtools'",
initializer: 'vueDevTools()',
}
],
}
}
20 changes: 20 additions & 0 deletions template/bare-base/vite.config.js.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
<%_ for (const { importer } of plugins) { _%>
<%- importer %>
<%_ } _%>

// https://vite.dev/config/
export default defineConfig({
plugins: [
<%_ for (const { initializer } of plugins) { _%>
<%- initializer _%>,
<%_ } _%>
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
},
},
})
3 changes: 3 additions & 0 deletions template/code/bare/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<p>Hello World!</p>
</template>
1 change: 1 addition & 0 deletions utils/getLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ interface Language {
needsE2eTesting: LanguageItem
needsEslint: LanguageItem
needsPrettier: LanguageItem
bare: LanguageItem
errors: {
operationCancelled: string
}
Expand Down
Loading