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: vite plugin VueDevtools #460

Merged
merged 14 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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-vue-devtools: ['', '--vue-devtools']

# 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-vue-devtools: 'vue-devtools'
Yordan-Ramchev marked this conversation as resolved.
Show resolved Hide resolved

- 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-vue-devtools: 'vue-devtools'

- 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-vue-devtools: 'vue-devtools'

- 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-vue-devtools: 'vue-devtools'
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-vue-devtools }}
Yordan-Ramchev marked this conversation as resolved.
Show resolved Hide resolved
# Sometimes the Linux runner can't verify Cypress in 30s
CYPRESS_VERIFY_TIMEOUT: 60000
steps:
Expand Down
21 changes: 19 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ async function init() {
// --playwright
// --eslint
// --eslint-with-prettier (only support prettier through eslint for simplicity)
// --vue-devtools
Yordan-Ramchev marked this conversation as resolved.
Show resolved Hide resolved
// --force (for force overwriting)

const args = process.argv.slice(2)
Expand Down Expand Up @@ -116,7 +117,8 @@ async function init() {
argv.cypress ??
argv.nightwatch ??
argv.playwright ??
argv.eslint
argv.eslint ??
argv['vue-devtools']
) === 'boolean'

let targetDir = args[0]
Expand All @@ -138,6 +140,7 @@ async function init() {
needsE2eTesting?: false | 'cypress' | 'nightwatch' | 'playwright'
needsEslint?: boolean
needsPrettier?: boolean
needsVueDevtools?: boolean
} = {}

try {
Expand All @@ -154,6 +157,7 @@ async function init() {
// - Add Playwright for end-to-end testing?
// - Add ESLint for code quality?
// - Add Prettier for code formatting?
// - Add VueDevtools extension for debugging? (experimental)
Yordan-Ramchev marked this conversation as resolved.
Show resolved Hide resolved
result = await prompts(
[
{
Expand Down Expand Up @@ -285,6 +289,14 @@ async function init() {
initial: false,
active: language.defaultToggleOptions.active,
inactive: language.defaultToggleOptions.inactive
},
{
name: 'needsVueDevtools',
type: () => (isFeatureFlagsUsed ? null : 'toggle'),
message: language.needsVueDevtools.message,
initial: false,
active: language.defaultToggleOptions.active,
inactive: language.defaultToggleOptions.inactive
}
],
{
Expand All @@ -310,7 +322,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'],
needsVueDevtools = argv['vue-devtools']
} = result

const { needsE2eTesting } = result
Expand Down Expand Up @@ -453,6 +466,10 @@ async function init() {
if (needsPrettier) {
render('config/prettier')
}

if (needsVueDevtools) {
render('config/vue-devtools')
}
// Render code template.
// prettier-ignore
const codeTemplate =
Expand Down
3 changes: 3 additions & 0 deletions locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
"needsPrettier": {
"message": "Add Prettier for code formatting?"
},
"needsVueDevtools": {
"message": "Add VueDevtools extension for debugging? (experimental)"
},
"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 @@ -50,6 +50,9 @@
"needsPrettier": {
"message": "Ajouter Prettier pour le formatage du code\u00a0?"
},
"needsVueDevtools": {
"message": "Add VueDevtools extension for debugging? (experimental)"
Yordan-Ramchev marked this conversation as resolved.
Show resolved Hide resolved
},
"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 @@ -50,6 +50,9 @@
"needsPrettier": {
"message": "Kod formatlama için Prettier eklensin mi?"
},
"needsVueDevtools": {
"message": "Add VueDevtools extension for debugging? (experimental)"
},
"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 @@ -50,6 +50,9 @@
"needsPrettier": {
"message": "是否引入 Prettier 用于代码格式化?"
},
"needsVueDevtools": {
"message": "Add VueDevtools extension for debugging? (experimental)"
},
"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 @@ -54,6 +54,9 @@
"needsPrettier": {
"message": "是否引入 Prettier 用於程式碼格式化?"
},
"needsVueDevtools": {
"message": "Add VueDevtools extension for debugging? (experimental)"
},
"errors": {
"operationCancelled": "操作取消"
},
Expand Down
Loading
Loading