@dasidev/dasi-ui 1.0.0 → 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.
Files changed (3) hide show
  1. package/README.md +72 -16
  2. package/bin/dasi-cli.cjs +98 -27
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Framework Web
1
+ # @dasidev/dasi-ui
2
2
 
3
3
  A starter Vue 3 + TypeScript framework for building configurable, enterprise-ready web apps. It ships with a configuration-driven architecture, unified components, and type-safe development. Forms are powered by Vueform, which serves as the built-in form builder across the project.
4
4
 
@@ -6,34 +6,73 @@ A starter Vue 3 + TypeScript framework for building configurable, enterprise-rea
6
6
 
7
7
  Make sure you guys use node v20 or above
8
8
 
9
- ### Installation
9
+ ### Create New Project
10
10
 
11
11
  ```sh
12
- npm install
13
- ```
12
+ # Using npm (recommended)
13
+ npx @dasidev/dasi-ui create my-admin-app
14
14
 
15
- ### Development
15
+ # Using yarn
16
+ yarn create @dasidev/dasi-ui my-admin-app
16
17
 
17
- ```sh
18
- npm run dev
18
+ # Using pnpm
19
+ pnpm create @dasidev/dasi-ui my-admin-app
19
20
  ```
20
21
 
21
- ### Production Build
22
+ ### Install as Library
22
23
 
23
24
  ```sh
24
- npm run build
25
- ```
25
+ # Using npm
26
+ npm install @dasidev/dasi-ui
26
27
 
27
- ### Testing
28
+ # Using yarn
29
+ yarn add @dasidev/dasi-ui
28
30
 
29
- ```sh
30
- npm run test:unit
31
+ # Using pnpm
32
+ pnpm add @dasidev/dasi-ui
31
33
  ```
32
34
 
33
- ### Linting
35
+ ### Requirements
36
+ - Node.js: v20 or above
37
+ -Package Manager: npm v10+, yarn, or pnpm
38
+
39
+ ## 📦 Usage
34
40
 
35
41
  ```sh
36
- npm run lint
42
+ # Create new project with interactive setup
43
+ npx @dasidev/dasi-ui create my-admin-app
44
+
45
+ # Follow the prompts to configure:
46
+ # - Project title and description
47
+ # - Template (default/minimal/full)
48
+ # - Features (auth, charts, maps, forms)
49
+ # - Package manager
50
+ # - TypeScript support
51
+ # - API configuration
52
+ # - Dark mode
53
+
54
+ # Navigate to project directory
55
+ cd my-admin-app
56
+
57
+ # Install dependencies
58
+ npm install
59
+
60
+ # Run development server
61
+ npm run dev
62
+ ```
63
+
64
+ ### As Component Library
65
+ ``` typescript
66
+ <template>
67
+ <DasiApp>
68
+ <PageActivity endpoint="/users" />
69
+ </DasiApp>
70
+ </template>
71
+
72
+ <script setup>
73
+ import { DasiApp, PageActivity } from '@dasidev/dasi-ui'
74
+ import '@dasidev/dasi-ui/style.css'
75
+ </script>
37
76
  ```
38
77
 
39
78
  ## 🏗️ Architecture Overview
@@ -66,7 +105,7 @@ Create your app configuration in `src/config/my-app.config.ts`:
66
105
  export default {
67
106
  app: {
68
107
  name: "My Application",
69
- version: "1.0.0"
108
+ version: "1.0.2"
70
109
  },
71
110
  api: {
72
111
  baseUrl: process.env.VITE_API_URL || "http://localhost:3000/api",
@@ -291,6 +330,21 @@ Components are styled with Tailwind classes and support:
291
330
  - **Disabled States**: Proper disabled styling
292
331
  - **Loading States**: Loading indicators
293
332
 
333
+ ## 🎯 CLI Features
334
+
335
+ The CLI provides interactive setup with:
336
+ - Template Selection: Default, Minimal, or Full-featured
337
+ - Feature Toggles: Authentication, Charts, Maps, Forms
338
+ - Package Manager: npm, yarn, or pnpm
339
+ - TypeScript: Optional TypeScript support
340
+ - API Configuration: Custom API endpoints
341
+ - Theming: Dark mode support
342
+
343
+ Available Templates
344
+ - Default - Complete admin dashboard with all core features
345
+ - Minimal - Basic admin setup with essential components
346
+ - Full - All features including charts, maps, and advanced forms
347
+
294
348
  ## 📚 Key Libraries
295
349
 
296
350
  - **Vue 3** - Main framework with Composition API
@@ -337,6 +391,8 @@ VITE_APP_NAME=My Application
337
391
  VITE_COMPANY_NAME=My Company
338
392
  ```
339
393
 
394
+ 🚀 Ready to build your next admin dashboard? Start with npx @dasidev/dasi-ui create my-app!
395
+
340
396
  ### Vite Configuration
341
397
 
342
398
  See [Vite Configuration Reference](https://vitejs.dev/config/) for advanced configuration options.
package/bin/dasi-cli.cjs CHANGED
@@ -125,33 +125,102 @@ program
125
125
 
126
126
  fs.mkdirSync(projectPath, { recursive: true });
127
127
 
128
- const templatePath = path.join(__dirname, '../templates', answers.template);
129
- await fs.copy(templatePath, projectPath);
130
-
131
- const packagejsonPath = path.join(projectPath, 'package.json');
132
- const packagejson = await fs.readJson(packagejsonPath);
133
-
134
- packagejson.name = projectName;
135
- packagejson.description = answers.description;
136
- packagejson.author = answers.author;
137
- packagejson.email = answers.email;
138
- packagejson.version = '0.1.0';
139
-
140
- await fs.writeJson(packagejsonPath, packagejson, { spaces: 2 });
141
-
142
- const envExamplePath = path.join(projectPath, '.env.example');
143
- let envContent = await fs.readFile(envExamplePath, 'utf-8');
144
-
145
- envContent = envContent.replace(/VITE_APP_TITLE=.*/, `VITE_APP_TITLE=${answers.title}`);
146
- envContent = envContent.replace(/VITE_APP_DESCRIPTION=.*/, `VITE_APP_DESCRIPTION=${answers.description}`);
147
- envContent = envContent.replace(/VITE_APP_AUTHOR=.*/, `VITE_APP_AUTHOR=${answers.author}`);
148
- envContent = envContent.replace(/VITE_APP_EMAIL=.*/, `VITE_APP_EMAIL=${answers.email}`);
149
- envContent = envContent.replace(/VITE_API_URL=.*/, `VITE_API_URL=${answers.apiUrl}`);
150
- envContent = envContent.replace(/VITE_API_KEY=.*/, `VITE_API_KEY=${answers.apiKey}`);
151
- envContent = envContent.replace(/VITE_DARK_MODE=.*/, `VITE_DARK_MODE=${answers.darkMode}`);
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.writeFile(envPath, envContent);
154
- await fs.copyFile(envExamplePath, path.join(projectPath, '.env'));
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:', 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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dasidev/dasi-ui",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",