create-vuetify 0.0.6-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -0
- package/dist/index.mjs +29252 -0
- package/dist/multipart-parser-CbtVsPSq.mjs +175 -0
- package/dist/node-CcjDTqtN.mjs +4007 -0
- package/dist/prompt-CAXcFxNm.mjs +848 -0
- package/package.json +40 -0
- package/src/commands/upgrade.ts +5 -0
- package/src/features/dependencies/package.json +17 -0
- package/src/features/eslint.ts +75 -0
- package/src/features/i18n.ts +108 -0
- package/src/features/index.ts +31 -0
- package/src/features/pinia.ts +84 -0
- package/src/features/router.ts +147 -0
- package/src/features/types.ts +13 -0
- package/src/features/vuetify-nuxt-manual.ts +47 -0
- package/src/features/vuetify-nuxt-module.ts +58 -0
- package/src/index.ts +177 -0
- package/src/prompts.ts +201 -0
- package/src/utils/cli/postinstall/index.ts +1 -0
- package/src/utils/cli/postinstall/pnpm.ts +20 -0
- package/src/utils/cli/preinstall/index.ts +1 -0
- package/src/utils/cli/preinstall/yarn.ts +22 -0
- package/src/utils/convertProjectToJS.ts +98 -0
- package/src/utils/installDependencies.ts +25 -0
- package/src/utils/installFeature.ts +25 -0
- package/test/conflict.test.ts +75 -0
- package/test/index.test.ts +117 -0
- package/tsdown.config.ts +7 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { x } from 'tinyexec'
|
|
4
|
+
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
|
|
5
|
+
|
|
6
|
+
const CLI_PATH = path.resolve(__dirname, '../dist/index.mjs')
|
|
7
|
+
// Assuming templates are at the root of the repo
|
|
8
|
+
const TEMPLATES_PATH = path.resolve(__dirname, '../../../templates')
|
|
9
|
+
const TEMP_DIR = path.resolve(__dirname, '../.test-tmp')
|
|
10
|
+
|
|
11
|
+
const TIMEOUT = 10_000 // 10s
|
|
12
|
+
|
|
13
|
+
describe('create-vuetify matrix', () => {
|
|
14
|
+
beforeAll(() => {
|
|
15
|
+
if (!fs.existsSync(TEMP_DIR)) {
|
|
16
|
+
fs.mkdirSync(TEMP_DIR)
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
afterAll(() => {
|
|
21
|
+
// fs.rmSync(TEMP_DIR, { recursive: true, force: true })
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const runCli = async (args: string[], cwd: string) => {
|
|
25
|
+
try {
|
|
26
|
+
const proc = x('node', [CLI_PATH, ...args], {
|
|
27
|
+
nodeOptions: {
|
|
28
|
+
cwd,
|
|
29
|
+
env: {
|
|
30
|
+
...process.env,
|
|
31
|
+
VUETIFY_CLI_TEMPLATES_PATH: TEMPLATES_PATH,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
throwOnError: true,
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
for await (const line of proc) {
|
|
38
|
+
console.log(line)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return await proc
|
|
42
|
+
} catch (error: any) {
|
|
43
|
+
console.error('Command failed:', error.message)
|
|
44
|
+
console.error('STDOUT:', error.stdout)
|
|
45
|
+
console.error('STDERR:', error.stderr)
|
|
46
|
+
throw error
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const matrix = [
|
|
51
|
+
// Vue + JS
|
|
52
|
+
{ name: 'vue-js', args: ['--type=vue', '--no-typescript', '--features='] },
|
|
53
|
+
// Vue + TS
|
|
54
|
+
{ name: 'vue-ts', args: ['--type=vue', '--typescript', '--features='] },
|
|
55
|
+
// Vue + TS + Router
|
|
56
|
+
{ name: 'vue-ts-router', args: ['--type=vue', '--typescript', '--features=router'] },
|
|
57
|
+
// Vue + TS + Pinia
|
|
58
|
+
{ name: 'vue-ts-pinia', args: ['--type=vue', '--typescript', '--features=pinia'] },
|
|
59
|
+
// Vue + TS + ESLint
|
|
60
|
+
{ name: 'vue-ts-eslint', args: ['--type=vue', '--typescript', '--features=eslint'] },
|
|
61
|
+
// Vue + TS + All
|
|
62
|
+
{ name: 'vue-ts-all', args: ['--type=vue', '--typescript', '--features=router,pinia,eslint'] },
|
|
63
|
+
|
|
64
|
+
// Nuxt
|
|
65
|
+
{ name: 'nuxt', args: ['--type=nuxt', '--features='] },
|
|
66
|
+
// Nuxt + Pinia
|
|
67
|
+
{ name: 'nuxt-pinia', args: ['--type=nuxt', '--features=pinia'] },
|
|
68
|
+
// Nuxt + Vuetify Module
|
|
69
|
+
{ name: 'nuxt-module', args: ['--type=nuxt', '--features=vuetify-nuxt-module'] },
|
|
70
|
+
// Nuxt + All
|
|
71
|
+
{ name: 'nuxt-all', args: ['--type=nuxt', '--features=pinia,eslint,vuetify-nuxt-module'] },
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
for (const { name, args } of matrix) {
|
|
75
|
+
it(`should create project ${name}`, async () => {
|
|
76
|
+
const projectName = `test-${name}`
|
|
77
|
+
const projectPath = path.join(TEMP_DIR, projectName)
|
|
78
|
+
|
|
79
|
+
// Clean up previous run
|
|
80
|
+
if (fs.existsSync(projectPath)) {
|
|
81
|
+
fs.rmSync(projectPath, { recursive: true, force: true })
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const cliArgs = [`--name=${projectName}`, ...args, '--package-manager=pnpm', '--force', '--no-install', '--no-interactive']
|
|
85
|
+
|
|
86
|
+
console.log(`Running: create-vuetify ${cliArgs.join(' ')}`)
|
|
87
|
+
const { stdout, stderr } = await runCli(cliArgs, TEMP_DIR)
|
|
88
|
+
console.log('STDOUT:', stdout)
|
|
89
|
+
if (stderr) {
|
|
90
|
+
console.error('STDERR:', stderr)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
expect(fs.existsSync(projectPath)).toBe(true)
|
|
94
|
+
expect(fs.existsSync(path.join(projectPath, 'package.json'))).toBe(true)
|
|
95
|
+
|
|
96
|
+
// Basic check for file structure
|
|
97
|
+
if (args.includes('vue')) {
|
|
98
|
+
expect(fs.existsSync(path.join(projectPath, 'src/main.ts')) || fs.existsSync(path.join(projectPath, 'src/main.js'))).toBe(true)
|
|
99
|
+
} else if (args.includes('nuxt')) {
|
|
100
|
+
expect(fs.existsSync(path.join(projectPath, 'nuxt.config.ts'))).toBe(true)
|
|
101
|
+
|
|
102
|
+
// Check for modules/vuetify.ts and dependencies
|
|
103
|
+
const hasModuleFeature = args.some(arg => arg.includes('vuetify-nuxt-module'))
|
|
104
|
+
if (hasModuleFeature) {
|
|
105
|
+
expect(fs.existsSync(path.join(projectPath, 'modules/vuetify.ts'))).toBe(false)
|
|
106
|
+
} else {
|
|
107
|
+
expect(fs.existsSync(path.join(projectPath, 'modules/vuetify.ts'))).toBe(true)
|
|
108
|
+
|
|
109
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(projectPath, 'package.json'), 'utf8'))
|
|
110
|
+
expect(pkg.devDependencies).toHaveProperty('vite-plugin-vuetify')
|
|
111
|
+
expect(pkg.devDependencies).toHaveProperty('@vuetify/loader-shared')
|
|
112
|
+
expect(pkg.devDependencies).toHaveProperty('pathe')
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}, TIMEOUT)
|
|
116
|
+
}
|
|
117
|
+
})
|