@dasidev/dasi-ui 1.0.1 → 1.0.3

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 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.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
- 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.1",
3
+ "version": "1.0.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",