@dasidev/dasi-ui 1.0.1 → 1.0.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 +1 -1
- package/bin/dasi-cli.cjs +98 -27
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -105,7 +105,7 @@ Create your app configuration in `src/config/my-app.config.ts`:
|
|
|
105
105
|
export default {
|
|
106
106
|
app: {
|
|
107
107
|
name: "My Application",
|
|
108
|
-
version: "1.0.
|
|
108
|
+
version: "1.0.2"
|
|
109
109
|
},
|
|
110
110
|
api: {
|
|
111
111
|
baseUrl: process.env.VITE_API_URL || "http://localhost:3000/api",
|
package/bin/dasi-cli.cjs
CHANGED
|
@@ -125,33 +125,102 @@ program
|
|
|
125
125
|
|
|
126
126
|
fs.mkdirSync(projectPath, { recursive: true });
|
|
127
127
|
|
|
128
|
-
|
|
129
|
-
await fs.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
128
|
+
await fs.ensureDir(path.join(projectPath, 'src'));
|
|
129
|
+
await fs.ensureDir(path.join(projectPath, 'public'));
|
|
130
|
+
// const templatePath = path.join(__dirname, '../templates', answers.template);
|
|
131
|
+
// await fs.copy(templatePath, projectPath);
|
|
132
|
+
|
|
133
|
+
const packagejson = {
|
|
134
|
+
name: projectName,
|
|
135
|
+
version: "0.1.0",
|
|
136
|
+
private: true,
|
|
137
|
+
type: "module",
|
|
138
|
+
description: answers.description,
|
|
139
|
+
author: answers.author,
|
|
140
|
+
scripts: {
|
|
141
|
+
dev: "vite",
|
|
142
|
+
build: "vite build",
|
|
143
|
+
preview: "vite preview"
|
|
144
|
+
},
|
|
145
|
+
dependencies: {
|
|
146
|
+
"@dasidev/dasi-ui": "^1.0.1",
|
|
147
|
+
"vue": "^3.4.0",
|
|
148
|
+
"vue-router": "^4.2.0",
|
|
149
|
+
"pinia": "^2.1.0"
|
|
150
|
+
},
|
|
151
|
+
devDependencies: {
|
|
152
|
+
"@vitejs/plugin-vue": "^5.0.0",
|
|
153
|
+
"vite": "^5.0.0"
|
|
154
|
+
}
|
|
155
|
+
}
|
|
152
156
|
|
|
153
|
-
await fs.
|
|
154
|
-
|
|
157
|
+
await fs.writeJson(path.join(projectPath, 'package.json'), packagejson, { spaces: 2 });
|
|
158
|
+
|
|
159
|
+
const envContent = `VITE_APP_TITLE=${answers.title}
|
|
160
|
+
VITE_APP_DESCRIPTION=${answers.description}
|
|
161
|
+
VITE_APP_AUTHOR=${answers.author}
|
|
162
|
+
VITE_APP_EMAIL=${answers.email}
|
|
163
|
+
VITE_API_URL=${answers.apiUrl}
|
|
164
|
+
VITE_API_KEY=
|
|
165
|
+
VITE_DARK_MODE=${answers.darkMode}`;
|
|
166
|
+
|
|
167
|
+
await fs.writeFile(path.join(projectPath, '.env.example'), envContent);
|
|
168
|
+
await fs.copyFile(path.join(projectPath, '.env.example'), path.join(projectPath, '.env'));
|
|
169
|
+
|
|
170
|
+
await fs.ensureDir(path.join(projectPath, 'src/components'));
|
|
171
|
+
await fs.ensureDir(path.join(projectPath, 'src/views'));
|
|
172
|
+
await fs.ensureDir(path.join(projectPath, 'src/router'));
|
|
173
|
+
await fs.ensureDir(path.join(projectPath, 'src/stores'));
|
|
174
|
+
await fs.ensureDir(path.join(projectPath, 'src/config'));
|
|
175
|
+
await fs.ensureDir(path.join(projectPath, 'src/vueform'));
|
|
176
|
+
await fs.ensureDir(path.join(projectPath, 'src/vueform/config'));
|
|
177
|
+
await fs.ensureDir(path.join(projectPath, 'src/vueform/schemas'));
|
|
178
|
+
|
|
179
|
+
const mainJs = `import { createApp } from 'vue'
|
|
180
|
+
import { createRouter, createWebHistory } from 'vue-router'
|
|
181
|
+
import { createPinia } from 'pinia'
|
|
182
|
+
import { DasiApp, PageActivity } from '@dasidev/dasi-ui'
|
|
183
|
+
import '@dasidev/dasi-ui/style.css'
|
|
184
|
+
const app = createApp(DasiApp)
|
|
185
|
+
const router = createRouter({
|
|
186
|
+
history: createWebHistory(),
|
|
187
|
+
routes: [
|
|
188
|
+
{
|
|
189
|
+
path: '/',
|
|
190
|
+
component: () => import('./views/Dashboard.vue')
|
|
191
|
+
}
|
|
192
|
+
]
|
|
193
|
+
})
|
|
194
|
+
const pinia = createPinia()
|
|
195
|
+
app.use(router)
|
|
196
|
+
app.use(pinia)
|
|
197
|
+
app.mount('#app')`;
|
|
198
|
+
|
|
199
|
+
await fs.writeFile(path.join(projectPath, 'src/main.js'), mainJs);
|
|
200
|
+
|
|
201
|
+
const indexHtml = `<!DOCTYPE html>
|
|
202
|
+
<html lang="en">
|
|
203
|
+
<head>
|
|
204
|
+
<meta charset="UTF-8">
|
|
205
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
206
|
+
<title>${answers.title}</title>
|
|
207
|
+
</head>
|
|
208
|
+
<body>
|
|
209
|
+
<div id="app"></div>
|
|
210
|
+
<script type="module" src="/src/main.js"></script>
|
|
211
|
+
</body>
|
|
212
|
+
</html>`;
|
|
213
|
+
await fs.writeFile(path.join(projectPath, 'index.html'), indexHtml);
|
|
214
|
+
|
|
215
|
+
const viteConfig = `import { defineConfig } from 'vite'
|
|
216
|
+
import vue from '@vitejs/plugin-vue'
|
|
217
|
+
export default defineConfig({
|
|
218
|
+
plugins: [vue()],
|
|
219
|
+
server: {
|
|
220
|
+
port: 3000
|
|
221
|
+
}
|
|
222
|
+
})`;
|
|
223
|
+
await fs.writeFile(path.join(projectPath, 'vite.config.js'), viteConfig);
|
|
155
224
|
|
|
156
225
|
if (options.git) {
|
|
157
226
|
execSync('git init', { cwd: projectPath, stdio: 'ignore' });
|
|
@@ -177,7 +246,9 @@ program
|
|
|
177
246
|
console.log(chalk.green('\nHappy coding! 🚀 Your admin dashboard is ready!'));
|
|
178
247
|
} catch (error) {
|
|
179
248
|
spinner.fail('Failed to create project!');
|
|
180
|
-
console.error('Error:'
|
|
249
|
+
console.error(chalk.red('Error Details:'));
|
|
250
|
+
console.error(chalk.red(error.message));
|
|
251
|
+
console.error(chalk.red(error.stack));
|
|
181
252
|
process.exit(1);
|
|
182
253
|
}
|
|
183
254
|
|