create-tauri-vue-app 0.0.1

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.
Files changed (42) hide show
  1. package/README.md +38 -0
  2. package/index.js +113 -0
  3. package/package.json +20 -0
  4. package/template/README.md +31 -0
  5. package/template/index.html +13 -0
  6. package/template/package-lock.json +1564 -0
  7. package/template/package.json +25 -0
  8. package/template/public/dclaw.png +0 -0
  9. package/template/public/favicon.svg +1 -0
  10. package/template/public/icons.svg +24 -0
  11. package/template/src/App.vue +3 -0
  12. package/template/src/assets/hero.png +0 -0
  13. package/template/src/assets/vite.svg +1 -0
  14. package/template/src/assets/vue.svg +1 -0
  15. package/template/src/components/HelloWorld.vue +93 -0
  16. package/template/src/main.js +11 -0
  17. package/template/src/router/index.js +22 -0
  18. package/template/src/style.css +23 -0
  19. package/template/src/views/Home.vue +18 -0
  20. package/template/src-tauri/Cargo.toml +26 -0
  21. package/template/src-tauri/build.rs +3 -0
  22. package/template/src-tauri/capabilities/default.json +49 -0
  23. package/template/src-tauri/icons/128x128.png +0 -0
  24. package/template/src-tauri/icons/128x128@2x.png +0 -0
  25. package/template/src-tauri/icons/32x32.png +0 -0
  26. package/template/src-tauri/icons/Square107x107Logo.png +0 -0
  27. package/template/src-tauri/icons/Square142x142Logo.png +0 -0
  28. package/template/src-tauri/icons/Square150x150Logo.png +0 -0
  29. package/template/src-tauri/icons/Square284x284Logo.png +0 -0
  30. package/template/src-tauri/icons/Square30x30Logo.png +0 -0
  31. package/template/src-tauri/icons/Square310x310Logo.png +0 -0
  32. package/template/src-tauri/icons/Square44x44Logo.png +0 -0
  33. package/template/src-tauri/icons/Square71x71Logo.png +0 -0
  34. package/template/src-tauri/icons/Square89x89Logo.png +0 -0
  35. package/template/src-tauri/icons/StoreLogo.png +0 -0
  36. package/template/src-tauri/icons/icon.icns +0 -0
  37. package/template/src-tauri/icons/icon.ico +0 -0
  38. package/template/src-tauri/icons/icon.png +0 -0
  39. package/template/src-tauri/src/lib.rs +12 -0
  40. package/template/src-tauri/src/main.rs +6 -0
  41. package/template/src-tauri/tauri.conf.json +38 -0
  42. package/template/vite.config.js +7 -0
package/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # create-tauri-vue-app
2
+
3
+ Scaffold a new Tauri + Vue desktop application.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ npm create tauri-vue-app@latest my-app
9
+ ```
10
+
11
+ Or run directly with npx:
12
+
13
+ ```bash
14
+ npx create-tauri-vue-app my-app
15
+ ```
16
+
17
+ ## Options
18
+
19
+ ```bash
20
+ create-tauri-vue-app <project-name>
21
+ ```
22
+
23
+ ## Features
24
+
25
+ - Tauri 2.x + Vue 3
26
+ - Element Plus UI
27
+ - Vue Router
28
+ - Tauri plugins: log, shell
29
+
30
+ ## Template Customization
31
+
32
+ Edit these files to customize the template:
33
+
34
+ - `template/package.json` - NPM dependencies
35
+ - `template/src-tauri/Cargo.toml` - Rust dependencies
36
+ - `template/src-tauri/tauri.conf.json` - App configuration
37
+ - `template/src/views/Home.vue` - Default view
38
+ - `template/src/router/index.js` - Router config
package/index.js ADDED
@@ -0,0 +1,113 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { cpSync, mkdirSync, readdirSync, readFileSync, writeFileSync, existsSync } from 'node:fs'
4
+ import { join, dirname } from 'node:path'
5
+ import { fileURLToPath } from 'node:url'
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url))
8
+
9
+ // Get project name from command line arguments
10
+ const args = process.argv.slice(2)
11
+ let projectName = args[0]
12
+
13
+ // If no project name provided, prompt user
14
+ if (!projectName) {
15
+ const readline = await import('readline').then(m => m.default)
16
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout })
17
+ projectName = await new Promise(resolve => {
18
+ rl.question('Enter project name: ', answer => {
19
+ rl.close()
20
+ resolve(answer.trim())
21
+ })
22
+ })
23
+ }
24
+
25
+ if (!projectName) {
26
+ console.error('Error: Project name is required')
27
+ process.exit(1)
28
+ }
29
+
30
+ // Validate project name (must be valid npm package name)
31
+ const validName = /^[a-z0-9-]+$/.test(projectName)
32
+ if (!validName) {
33
+ console.error('Error: Project name must contain only lowercase letters, numbers, and hyphens')
34
+ process.exit(1)
35
+ }
36
+
37
+ // Create project directory
38
+ const targetDir = join(process.cwd(), projectName)
39
+
40
+ if (existsSync(targetDir)) {
41
+ console.error(`Error: Directory ${projectName} already exists`)
42
+ process.exit(1)
43
+ }
44
+
45
+ console.log(`Creating project: ${projectName}...`)
46
+ mkdirSync(targetDir, { recursive: true })
47
+
48
+ // Copy template files
49
+ const templateDir = join(__dirname, 'template')
50
+ copyRecursive(templateDir, targetDir)
51
+
52
+ // Replace placeholder with project name
53
+ replaceInFiles(targetDir, '{{PROJECT_NAME}}', projectName)
54
+
55
+ console.log(`Project ${projectName} created successfully!`)
56
+ console.log(`
57
+ Next steps:
58
+ cd ${projectName}
59
+ npm install
60
+ npm run tauri dev
61
+ `)
62
+
63
+ function copyRecursive(src, dest) {
64
+ mkdirSync(dest, { recursive: true })
65
+ const entries = readdirSync(src, { withFileTypes: true })
66
+
67
+ for (const entry of entries) {
68
+ const srcPath = join(src, entry.name)
69
+ const destPath = join(dest, entry.name)
70
+
71
+ if (entry.isDirectory()) {
72
+ copyRecursive(srcPath, destPath)
73
+ } else {
74
+ // Copy file as binary
75
+ const content = readFileSync(srcPath)
76
+ writeFileSync(destPath, content)
77
+ }
78
+ }
79
+ }
80
+
81
+ function replaceInFiles(dir, placeholder, replacement) {
82
+ const entries = readdirSync(dir, { withFileTypes: true })
83
+
84
+ for (const entry of entries) {
85
+ const path = join(dir, entry.name)
86
+
87
+ if (entry.isDirectory()) {
88
+ // Skip certain directories
89
+ if (entry.name === 'node_modules' || entry.name === 'target' || entry.name === 'dist' || entry.name === '.git') {
90
+ continue
91
+ }
92
+ replaceInFiles(path, placeholder, replacement)
93
+ } else {
94
+ // Skip binary files and certain extensions
95
+ const ext = entry.name.split('.').pop()
96
+ if (['png', 'jpg', 'jpeg', 'ico', 'icns', 'svg'].includes(ext)) {
97
+ continue
98
+ }
99
+
100
+ try {
101
+ let content = readFileSync(path, 'utf-8')
102
+
103
+ // Only replace if placeholder exists
104
+ if (content.includes(placeholder)) {
105
+ content = content.split(placeholder).join(replacement)
106
+ writeFileSync(path, content)
107
+ }
108
+ } catch (e) {
109
+ // Skip files that can't be read as UTF-8
110
+ }
111
+ }
112
+ }
113
+ }
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "create-tauri-vue-app",
3
+ "version": "0.0.1",
4
+ "description": "Scaffold a new Tauri + Vue desktop application",
5
+ "type": "module",
6
+ "bin": {
7
+ "create-tauri-vue-app": "./index.js"
8
+ },
9
+ "engines": {
10
+ "node": ">=18"
11
+ },
12
+ "keywords": [
13
+ "tauri",
14
+ "vue",
15
+ "scaffold",
16
+ "template"
17
+ ],
18
+ "author": "",
19
+ "license": "MIT"
20
+ }
@@ -0,0 +1,31 @@
1
+ # {{PROJECT_NAME}}
2
+
3
+ A Tauri + Vue desktop application.
4
+
5
+ ## Setup
6
+
7
+ 1. Install dependencies:
8
+ ```bash
9
+ npm install
10
+ ```
11
+
12
+ 2. Replace all `{{PROJECT_NAME}}` placeholders with your actual project name.
13
+
14
+ 3. Run development server:
15
+ ```bash
16
+ npm run tauri dev
17
+ ```
18
+
19
+ ## Build
20
+
21
+ ```bash
22
+ npm run tauri build
23
+ ```
24
+
25
+ ## Template Usage
26
+
27
+ - `src/views/Home.vue` - Main home view
28
+ - `src/router/index.js` - Router configuration
29
+ - `src-tauri/tauri.conf.json` - Tauri app configuration
30
+ - `package.json` - NPM dependencies and scripts
31
+ - `src-tauri/Cargo.toml` - Rust dependencies
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>{{PROJECT_NAME}}</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/src/main.js"></script>
12
+ </body>
13
+ </html>