diff --git a/index.ts b/index.ts index 40f70304b..89b65145c 100755 --- a/index.ts +++ b/index.ts @@ -140,6 +140,7 @@ async function init() { needsEslint?: false | 'eslintOnly' | 'speedUpWithOxlint' needsOxlint?: boolean needsPrettier?: boolean + bare?: boolean } = {} try { @@ -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: () => { @@ -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) @@ -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) { @@ -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). diff --git a/locales/en-US.json b/locales/en-US.json index d1f8a1698..b337292bb 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -59,6 +59,9 @@ "needsPrettier": { "message": "Add Prettier for code formatting?" }, + "bare": { + "message": "Scaffold project without beginner instructions?" + }, "errors": { "operationCancelled": "Operation cancelled" }, diff --git a/locales/fr-FR.json b/locales/fr-FR.json index 9ff6d1313..cdc7123d5 100644 --- a/locales/fr-FR.json +++ b/locales/fr-FR.json @@ -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" }, diff --git a/locales/tr-TR.json b/locales/tr-TR.json index 323acac1d..aeb8e61f0 100644 --- a/locales/tr-TR.json +++ b/locales/tr-TR.json @@ -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" }, diff --git a/locales/zh-Hans.json b/locales/zh-Hans.json index c74002f01..4bb2ecfe8 100644 --- a/locales/zh-Hans.json +++ b/locales/zh-Hans.json @@ -59,6 +59,9 @@ "needsPrettier": { "message": "是否引入 Prettier 用于代码格式化?" }, + "bare": { + "message": "Scaffold project without beginner instructions?" + }, "errors": { "operationCancelled": "操作取消" }, diff --git a/locales/zh-Hant.json b/locales/zh-Hant.json index 4837230e7..b5c954f91 100644 --- a/locales/zh-Hant.json +++ b/locales/zh-Hant.json @@ -63,6 +63,9 @@ "needsPrettier": { "message": "是否引入 Prettier 用於程式碼格式化?" }, + "bare": { + "message": "Scaffold project without beginner instructions?" + }, "errors": { "operationCancelled": "操作取消" }, diff --git a/template/bare-base/.vscode/extensions.json b/template/bare-base/.vscode/extensions.json new file mode 100644 index 000000000..a7cea0b06 --- /dev/null +++ b/template/bare-base/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["Vue.volar"] +} diff --git a/template/bare-base/.vscode/settings.json b/template/bare-base/.vscode/settings.json new file mode 100644 index 000000000..985128aa5 --- /dev/null +++ b/template/bare-base/.vscode/settings.json @@ -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" + } +} diff --git a/template/bare-base/_gitignore b/template/bare-base/_gitignore new file mode 100644 index 000000000..8ee54e8d3 --- /dev/null +++ b/template/bare-base/_gitignore @@ -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 diff --git a/template/bare-base/index.html b/template/bare-base/index.html new file mode 100644 index 000000000..b19040a0e --- /dev/null +++ b/template/bare-base/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite App + + +
+ + + diff --git a/template/bare-base/jsconfig.json b/template/bare-base/jsconfig.json new file mode 100644 index 000000000..5a1f2d222 --- /dev/null +++ b/template/bare-base/jsconfig.json @@ -0,0 +1,8 @@ +{ + "compilerOptions": { + "paths": { + "@/*": ["./src/*"] + } + }, + "exclude": ["node_modules", "dist"] +} diff --git a/template/bare-base/package.json b/template/bare-base/package.json new file mode 100644 index 000000000..dcdd2d781 --- /dev/null +++ b/template/bare-base/package.json @@ -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" + } +} diff --git a/template/bare-base/public/favicon.ico b/template/bare-base/public/favicon.ico new file mode 100644 index 000000000..df36fcfb7 Binary files /dev/null and b/template/bare-base/public/favicon.ico differ diff --git a/template/bare-base/src/assets/logo.svg b/template/bare-base/src/assets/logo.svg new file mode 100644 index 000000000..756566035 --- /dev/null +++ b/template/bare-base/src/assets/logo.svg @@ -0,0 +1 @@ + diff --git a/template/bare-base/src/assets/main.css b/template/bare-base/src/assets/main.css new file mode 100644 index 000000000..e69de29bb diff --git a/template/bare-base/vite.config.js.data.mjs b/template/bare-base/vite.config.js.data.mjs new file mode 100644 index 000000000..12714be65 --- /dev/null +++ b/template/bare-base/vite.config.js.data.mjs @@ -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()', + } + ], + } +} diff --git a/template/bare-base/vite.config.js.ejs b/template/bare-base/vite.config.js.ejs new file mode 100644 index 000000000..3851c4279 --- /dev/null +++ b/template/bare-base/vite.config.js.ejs @@ -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)) + }, + }, +}) diff --git a/template/code/bare/src/App.vue b/template/code/bare/src/App.vue new file mode 100644 index 000000000..9a4b82aa6 --- /dev/null +++ b/template/code/bare/src/App.vue @@ -0,0 +1,3 @@ + diff --git a/utils/getLanguage.ts b/utils/getLanguage.ts index c96f7c7ec..cdee1c208 100644 --- a/utils/getLanguage.ts +++ b/utils/getLanguage.ts @@ -30,6 +30,7 @@ interface Language { needsE2eTesting: LanguageItem needsEslint: LanguageItem needsPrettier: LanguageItem + bare: LanguageItem errors: { operationCancelled: string }