From 0333d5f781204817d5834d0cabf55bd366555332 Mon Sep 17 00:00:00 2001 From: Runyasak Chaengnaimuang Date: Mon, 9 Dec 2024 22:06:56 +0700 Subject: [PATCH 1/3] feat: add bare prompt with template --- index.ts | 16 ++++++++++++++-- locales/en-US.json | 3 +++ template/code/bare/src/App.vue | 3 +++ utils/getLanguage.ts | 1 + 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 template/code/bare/src/App.vue diff --git a/index.ts b/index.ts index 40f70304b..a9d22e7e0 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) @@ -476,8 +486,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/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 } From 39ed6b66e1c72cf4cb1ad9b94193a3f361e829a0 Mon Sep 17 00:00:00 2001 From: Runyasak Chaengnaimuang Date: Thu, 12 Dec 2024 22:26:07 +0700 Subject: [PATCH 2/3] feat: add bare-base template --- index.ts | 6 ++++- template/bare-base/.vscode/extensions.json | 3 +++ template/bare-base/.vscode/settings.json | 8 ++++++ template/bare-base/_gitignore | 30 +++++++++++++++++++++ template/bare-base/index.html | 13 +++++++++ template/bare-base/jsconfig.json | 8 ++++++ template/bare-base/package.json | 17 ++++++++++++ template/bare-base/public/favicon.ico | Bin 0 -> 4286 bytes template/bare-base/src/assets/logo.svg | 1 + template/bare-base/src/assets/main.css | 0 template/bare-base/vite.config.js.data.mjs | 17 ++++++++++++ template/bare-base/vite.config.js.ejs | 20 ++++++++++++++ 12 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 template/bare-base/.vscode/extensions.json create mode 100644 template/bare-base/.vscode/settings.json create mode 100644 template/bare-base/_gitignore create mode 100644 template/bare-base/index.html create mode 100644 template/bare-base/jsconfig.json create mode 100644 template/bare-base/package.json create mode 100644 template/bare-base/public/favicon.ico create mode 100644 template/bare-base/src/assets/logo.svg create mode 100644 template/bare-base/src/assets/main.css create mode 100644 template/bare-base/vite.config.js.data.mjs create mode 100644 template/bare-base/vite.config.js.ejs diff --git a/index.ts b/index.ts index a9d22e7e0..89b65145c 100755 --- a/index.ts +++ b/index.ts @@ -370,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) { 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 0000000000000000000000000000000000000000..df36fcfb72584e00488330b560ebcf34a41c64c2 GIT binary patch literal 4286 zcmds*O-Phc6o&64GDVCEQHxsW(p4>LW*W<827=Unuo8sGpRux(DN@jWP-e29Wl%wj zY84_aq9}^Am9-cWTD5GGEo#+5Fi2wX_P*bo+xO!)p*7B;iKlbFd(U~_d(U?#hLj56 zPhFkj-|A6~Qk#@g^#D^U0XT1cu=c-vu1+SElX9NR;kzAUV(q0|dl0|%h|dI$%VICy zJnu2^L*Te9JrJMGh%-P79CL0}dq92RGU6gI{v2~|)p}sG5x0U*z<8U;Ij*hB9z?ei z@g6Xq-pDoPl=MANPiR7%172VA%r)kevtV-_5H*QJKFmd;8yA$98zCxBZYXTNZ#QFk2(TX0;Y2dt&WitL#$96|gJY=3xX zpCoi|YNzgO3R`f@IiEeSmKrPSf#h#Qd<$%Ej^RIeeYfsxhPMOG`S`Pz8q``=511zm zAm)MX5AV^5xIWPyEu7u>qYs?pn$I4nL9J!=K=SGlKLXpE<5x+2cDTXq?brj?n6sp= zphe9;_JHf40^9~}9i08r{XM$7HB!`{Ys~TK0kx<}ZQng`UPvH*11|q7&l9?@FQz;8 zx!=3<4seY*%=OlbCbcae?5^V_}*K>Uo6ZWV8mTyE^B=DKy7-sdLYkR5Z?paTgK-zyIkKjIcpyO z{+uIt&YSa_$QnN_@t~L014dyK(fOOo+W*MIxbA6Ndgr=Y!f#Tokqv}n<7-9qfHkc3 z=>a|HWqcX8fzQCT=dqVbogRq!-S>H%yA{1w#2Pn;=e>JiEj7Hl;zdt-2f+j2%DeVD zsW0Ab)ZK@0cIW%W7z}H{&~yGhn~D;aiP4=;m-HCo`BEI+Kd6 z={Xwx{TKxD#iCLfl2vQGDitKtN>z|-AdCN|$jTFDg0m3O`WLD4_s#$S literal 0 HcmV?d00001 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)) + }, + }, +}) From ee023f8255324f6e508ce0ddad96bdb1bee25b9a Mon Sep 17 00:00:00 2001 From: Runyasak Chaengnaimuang Date: Thu, 12 Dec 2024 22:38:48 +0700 Subject: [PATCH 3/3] update locales --- locales/fr-FR.json | 3 +++ locales/tr-TR.json | 3 +++ locales/zh-Hans.json | 3 +++ locales/zh-Hant.json | 3 +++ 4 files changed, 12 insertions(+) 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": "操作取消" },