create-canaima-app 1.0.0
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/index.js +168 -0
- package/package.json +28 -0
- package/tauri-materialize/.prettierignore +8 -0
- package/tauri-materialize/.prettierrc +9 -0
- package/tauri-materialize/.vscode/extensions.json +3 -0
- package/tauri-materialize/README.md +7 -0
- package/tauri-materialize/index.html +24 -0
- package/tauri-materialize/package-lock.json +2331 -0
- package/tauri-materialize/package.json +30 -0
- package/tauri-materialize/public/tauri.svg +6 -0
- package/tauri-materialize/public/vite.svg +1 -0
- package/tauri-materialize/src/App.vue +20 -0
- package/tauri-materialize/src/assets/image.png +0 -0
- package/tauri-materialize/src/components/Bienvenido.vue +424 -0
- package/tauri-materialize/src/css/style.css +106 -0
- package/tauri-materialize/src/main.ts +15 -0
- package/tauri-materialize/src/router/index.ts +16 -0
- package/tauri-materialize/src/stores/useAppStore.ts +34 -0
- package/tauri-materialize/src/views/HomeView.vue +8 -0
- package/tauri-materialize/src/vite-env.d.ts +7 -0
- package/tauri-materialize/src-tauri/Cargo.lock +5471 -0
- package/tauri-materialize/src-tauri/Cargo.toml +31 -0
- package/tauri-materialize/src-tauri/build.rs +3 -0
- package/tauri-materialize/src-tauri/capabilities/default.json +7 -0
- package/tauri-materialize/src-tauri/icons/128x128.png +0 -0
- package/tauri-materialize/src-tauri/icons/128x128@2x.png +0 -0
- package/tauri-materialize/src-tauri/icons/32x32.png +0 -0
- package/tauri-materialize/src-tauri/icons/Square107x107Logo.png +0 -0
- package/tauri-materialize/src-tauri/icons/Square142x142Logo.png +0 -0
- package/tauri-materialize/src-tauri/icons/Square150x150Logo.png +0 -0
- package/tauri-materialize/src-tauri/icons/Square284x284Logo.png +0 -0
- package/tauri-materialize/src-tauri/icons/Square30x30Logo.png +0 -0
- package/tauri-materialize/src-tauri/icons/Square310x310Logo.png +0 -0
- package/tauri-materialize/src-tauri/icons/Square44x44Logo.png +0 -0
- package/tauri-materialize/src-tauri/icons/Square71x71Logo.png +0 -0
- package/tauri-materialize/src-tauri/icons/Square89x89Logo.png +0 -0
- package/tauri-materialize/src-tauri/icons/StoreLogo.png +0 -0
- package/tauri-materialize/src-tauri/icons/icon.icns +0 -0
- package/tauri-materialize/src-tauri/icons/icon.ico +0 -0
- package/tauri-materialize/src-tauri/icons/icon.png +0 -0
- package/tauri-materialize/src-tauri/src/lib.rs +17 -0
- package/tauri-materialize/src-tauri/src/main.rs +12 -0
- package/tauri-materialize/src-tauri/tauri.conf.json +29 -0
- package/tauri-materialize/tsconfig.json +29 -0
- package/tauri-materialize/tsconfig.node.json +10 -0
- package/tauri-materialize/vite.config.ts +32 -0
package/index.js
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import prompts from 'prompts';
|
|
4
|
+
import { promises as fs } from 'fs';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
|
|
8
|
+
// Resolver __dirname en módulos ES
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = path.dirname(__filename);
|
|
11
|
+
|
|
12
|
+
// Colores ANSI sin dependencias extra
|
|
13
|
+
const c = {
|
|
14
|
+
reset : (t) => `\x1b[0m${t}\x1b[0m`,
|
|
15
|
+
bold : (t) => `\x1b[1m${t}\x1b[0m`,
|
|
16
|
+
dim : (t) => `\x1b[2m${t}\x1b[0m`,
|
|
17
|
+
cyan : (t) => `\x1b[36m${t}\x1b[0m`,
|
|
18
|
+
green : (t) => `\x1b[32m${t}\x1b[0m`,
|
|
19
|
+
yellow : (t) => `\x1b[33m${t}\x1b[0m`,
|
|
20
|
+
red : (t) => `\x1b[31m${t}\x1b[0m`,
|
|
21
|
+
white : (t) => `\x1b[97m${t}\x1b[0m`,
|
|
22
|
+
bgGreen: (t) => `\x1b[42m\x1b[30m${t}\x1b[0m`,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Tus carpetas locales exactas
|
|
26
|
+
const TEMPLATES = {
|
|
27
|
+
'tauri-materialize': {
|
|
28
|
+
label : 'Materialize CSS (Clásico / Estable)',
|
|
29
|
+
folder : 'tauri-materialize',
|
|
30
|
+
},
|
|
31
|
+
'tauri-material-tailwind': {
|
|
32
|
+
label : 'Material Tailwind (Moderno / Utility-First)',
|
|
33
|
+
folder : 'tauri-material-tailwind',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
function printBanner() {
|
|
38
|
+
const banner = `
|
|
39
|
+
██████╗ █████╗ ███╗ ██╗ █████╗ ██╗███╗ ███╗ █████╗ ██████╗██╗ ██╗
|
|
40
|
+
██╔════╝██╔══██╗████╗ ██║██╔══██╗██║████╗ ████║██╔══██╗ ██╔════╝██║ ██║
|
|
41
|
+
██║ ███████║██╔██╗ ██║███████║██║██╔████╔██║███████║ ██║ ██║ ██║
|
|
42
|
+
██║ ██╔══██║██║╚██╗██║██╔══██║██║██║╚██╔╝██║██╔══██║ ██║ ██║ ██║
|
|
43
|
+
╚██████╗██║ ██║██║ ╚████║██║ ██║██║██║ ╚═╝ ██║██║ ██║ ╚██████╗███████╗██║
|
|
44
|
+
╚═════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚══════╝╚═╝
|
|
45
|
+
`;
|
|
46
|
+
console.log(c.cyan(banner));
|
|
47
|
+
console.log(c.bold(c.white(' 🚀 Generador de proyectos CanaimaApp (Tauri + Vue + Rust)\n')));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async function askQuestions() {
|
|
51
|
+
return await prompts([
|
|
52
|
+
{
|
|
53
|
+
type : 'text',
|
|
54
|
+
name : 'projectName',
|
|
55
|
+
message : '¿Nombre de tu nuevo proyecto?',
|
|
56
|
+
initial : 'mi-app-tauri',
|
|
57
|
+
validate: (value) => value.trim().length > 0 ? true : 'El nombre no puede estar vacío.',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
type : 'select',
|
|
61
|
+
name : 'templateType',
|
|
62
|
+
message: '¿Qué framework de diseño prefieres?',
|
|
63
|
+
choices: Object.entries(TEMPLATES).map(([value, { label }]) => ({ title: label, value })),
|
|
64
|
+
},
|
|
65
|
+
], {
|
|
66
|
+
onCancel: () => {
|
|
67
|
+
console.log(c.yellow('\n ⚠ Operación cancelada.\n'));
|
|
68
|
+
process.exit(0);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function copyTemplate(folderName, targetDir) {
|
|
74
|
+
console.log(c.cyan(`\n 📦 Generando archivos del proyecto...`));
|
|
75
|
+
|
|
76
|
+
const templateDir = path.join(__dirname, folderName);
|
|
77
|
+
|
|
78
|
+
await fs.cp(templateDir, targetDir, {
|
|
79
|
+
recursive: true,
|
|
80
|
+
// Ignoramos carpetas pesadas o de git si quedaron en tu entorno local
|
|
81
|
+
filter: (source) => {
|
|
82
|
+
const basename = path.basename(source);
|
|
83
|
+
return !['node_modules', 'target', '.git', 'package-lock.json', 'dist'].includes(basename);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// NPM renombra .gitignore a .npmignore a veces. Esto lo soluciona si pasa.
|
|
88
|
+
const npmignorePath = path.join(targetDir, '.npmignore');
|
|
89
|
+
if (true) {
|
|
90
|
+
try {
|
|
91
|
+
await fs.rename(npmignorePath, path.join(targetDir, '.gitignore'));
|
|
92
|
+
} catch (e) {} // Ignorar si no existe
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
console.log(c.green(' ✔ Archivos base copiados.'));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async function personalizeProject(targetDir, projectName) {
|
|
99
|
+
console.log(c.cyan(' 🔧 Configurando dependencias y Rust...'));
|
|
100
|
+
|
|
101
|
+
// 1. package.json
|
|
102
|
+
const pkgPath = path.join(targetDir, 'package.json');
|
|
103
|
+
try {
|
|
104
|
+
const pkgRaw = await fs.readFile(pkgPath, 'utf-8');
|
|
105
|
+
const pkgJson = JSON.parse(pkgRaw);
|
|
106
|
+
pkgJson.name = projectName;
|
|
107
|
+
await fs.writeFile(pkgPath, JSON.stringify(pkgJson, null, 2) + '\n');
|
|
108
|
+
} catch (err) {}
|
|
109
|
+
|
|
110
|
+
// 2. Cargo.toml
|
|
111
|
+
const cargoPath = path.join(targetDir, 'src-tauri', 'Cargo.toml');
|
|
112
|
+
try {
|
|
113
|
+
let cargo = await fs.readFile(cargoPath, 'utf-8');
|
|
114
|
+
cargo = cargo.replace(/^(name\s*=\s*)"[^"]*"/m, `$1"${projectName}"`);
|
|
115
|
+
await fs.writeFile(cargoPath, cargo);
|
|
116
|
+
} catch (err) {}
|
|
117
|
+
|
|
118
|
+
// 3. tauri.conf.json
|
|
119
|
+
const tauriConfPath = path.join(targetDir, 'src-tauri', 'tauri.conf.json');
|
|
120
|
+
try {
|
|
121
|
+
const confRaw = await fs.readFile(tauriConfPath, 'utf-8');
|
|
122
|
+
const confJson = JSON.parse(confRaw);
|
|
123
|
+
|
|
124
|
+
if (confJson.productName !== undefined) confJson.productName = projectName;
|
|
125
|
+
if (confJson.identifier !== undefined) confJson.identifier = `com.canaima.${projectName}`;
|
|
126
|
+
|
|
127
|
+
// Soporte Tauri v2
|
|
128
|
+
if (confJson.bundle?.identifier) confJson.bundle.identifier = `com.canaima.${projectName}`;
|
|
129
|
+
|
|
130
|
+
await fs.writeFile(tauriConfPath, JSON.stringify(confJson, null, 2) + '\n');
|
|
131
|
+
} catch (err) {}
|
|
132
|
+
|
|
133
|
+
console.log(c.green(' ✔ Proyecto personalizado con éxito.'));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
async function main() {
|
|
137
|
+
printBanner();
|
|
138
|
+
|
|
139
|
+
const { projectName, templateType } = await askQuestions();
|
|
140
|
+
if (!projectName || !templateType) process.exit(1);
|
|
141
|
+
|
|
142
|
+
const targetDir = path.resolve(process.cwd(), projectName);
|
|
143
|
+
const template = TEMPLATES[templateType];
|
|
144
|
+
|
|
145
|
+
try {
|
|
146
|
+
await fs.access(targetDir);
|
|
147
|
+
console.log(c.red(`\n ✖ La carpeta "${projectName}" ya existe. Elige otro nombre.\n`));
|
|
148
|
+
process.exit(1);
|
|
149
|
+
} catch {}
|
|
150
|
+
|
|
151
|
+
try {
|
|
152
|
+
await copyTemplate(template.folder, targetDir);
|
|
153
|
+
await personalizeProject(targetDir, projectName);
|
|
154
|
+
|
|
155
|
+
console.log('\n' + c.bgGreen(c.white(' ✅ ¡Proyecto creado con éxito! ')));
|
|
156
|
+
console.log(c.bold('\n Siguientes pasos:\n'));
|
|
157
|
+
console.log(c.white(` ${c.cyan('$')} cd ${projectName}`));
|
|
158
|
+
console.log(c.white(` ${c.cyan('$')} npm install`));
|
|
159
|
+
console.log(c.white(` ${c.cyan('$')} npm run tauri dev`));
|
|
160
|
+
console.log(c.dim('\n ¡A programar! 🦅\n'));
|
|
161
|
+
|
|
162
|
+
} catch (err) {
|
|
163
|
+
console.error(c.red(`\n ✖ Error: ${err.message}\n`));
|
|
164
|
+
process.exit(1);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-canaima-app",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "CLI para scaffolding de proyectos de escritorio con Tauri, Vue 3 y Rust.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"create-canaima-app": "index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"index.js",
|
|
12
|
+
"tauri-materialize",
|
|
13
|
+
"tauri-material-tailwind"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
17
|
+
"start": "node index.js"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"tauri",
|
|
21
|
+
"vue",
|
|
22
|
+
"rust",
|
|
23
|
+
"canaima",
|
|
24
|
+
"template"
|
|
25
|
+
],
|
|
26
|
+
"author": "Sam Urbina",
|
|
27
|
+
"license": "ISC"
|
|
28
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Tauri + Vue + TypeScript
|
|
2
|
+
|
|
3
|
+
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
|
4
|
+
|
|
5
|
+
## Recommended IDE Setup
|
|
6
|
+
|
|
7
|
+
- [VS Code](https://code.visualstudio.com/) + [Vue - Official](https://marketplace.visualstudio.com/items?itemName=Vue.volar) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="es">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link
|
|
6
|
+
rel="icon"
|
|
7
|
+
type="image/svg+xml"
|
|
8
|
+
href="/vite.svg"
|
|
9
|
+
/>
|
|
10
|
+
<meta
|
|
11
|
+
name="viewport"
|
|
12
|
+
content="width=device-width, initial-scale=1.0"
|
|
13
|
+
/>
|
|
14
|
+
<title>Plantilla de Aplicación Canaima</title>
|
|
15
|
+
</head>
|
|
16
|
+
|
|
17
|
+
<body>
|
|
18
|
+
<div id="app"></div>
|
|
19
|
+
<script
|
|
20
|
+
type="module"
|
|
21
|
+
src="/src/main.ts"
|
|
22
|
+
></script>
|
|
23
|
+
</body>
|
|
24
|
+
</html>
|