@dasidev/dasi-ui 1.0.21 → 1.0.22

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.
@@ -1,225 +0,0 @@
1
- #!/usr/bin/env node
2
- const { program } = require('commander');
3
- const inquirer = require('inquirer');
4
- const fs = require('fs-extra');
5
- const path = require('path');
6
- const chalk = require('chalk');
7
- const ora = require('ora');
8
-
9
- program
10
- .name('dasi-ui')
11
- .description('DASI UI - Complete Admin Template Setup')
12
- .version('1.0.10');
13
-
14
- program
15
- .command('create [project-name]')
16
- .description('Initialize DASI UI admin template')
17
- .action(async (projectName) => {
18
- console.log(chalk.blue.bold('šŸš€ Welcome to DASI UI Admin Template Setup'));
19
- console.log(chalk.gray('This will set up a complete admin dashboard in your current directory\n'));
20
-
21
- console.log(chalk.blue.bold(`
22
- ╔══════════════════════════════════════════════════════════════╗
23
- ā•‘ ā•‘
24
- ā•‘ šŸš€ DASI UI - Complete Admin Template Generator ā•‘
25
- ā•‘ ā•‘
26
- ā•‘ Creating: ${chalk.cyan(projectName.padEnd(35))} ā•‘
27
- ā•‘ ā•‘
28
- ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•
29
- `));
30
-
31
- const questions = [
32
- {
33
- type: 'input',
34
- name: 'projectName',
35
- message: 'šŸ“¦ Project name:',
36
- default: projectName,
37
- validate: (input) => input.length > 0 || 'Project name is required'
38
- },
39
- {
40
- type: 'input',
41
- name: 'appTitle',
42
- message: 'šŸ“± App title:',
43
- default: 'DASI Admin Dashboard'
44
- },
45
- {
46
- type: 'input',
47
- name: 'appDescription',
48
- message: 'šŸ“ App description:',
49
- default: 'Complete admin dashboard built with DASI UI'
50
- },
51
- {
52
- type: 'input',
53
- name: 'author',
54
- message: 'šŸ‘¤ Author name:',
55
- default: 'DASI Developer'
56
- },
57
- {
58
- type: 'list',
59
- name: 'packageManager',
60
- message: 'šŸ“¦ Choose package manager:',
61
- choices: ['npm', 'yarn', 'pnpm'],
62
- default: 'npm'
63
- },
64
- {
65
- type: 'input',
66
- name: 'apiUrl',
67
- message: 'šŸ”— API base URL:',
68
- default: 'http://localhost:8080/api'
69
- },
70
- {
71
- type: 'confirm',
72
- name: 'darkMode',
73
- message: 'šŸŒ™ Enable dark mode?',
74
- default: true
75
- },
76
- {
77
- type: 'confirm',
78
- name: 'gitInit',
79
- message: 'šŸ“š Initialize git repository?',
80
- default: true
81
- },
82
- {
83
- type: 'confirm',
84
- name: 'installDeps',
85
- message: 'šŸ“„ Install dependencies now?',
86
- default: true
87
- }
88
- ];
89
-
90
- const answers = await inquirer.prompt(questions);
91
- const spinner = ora('Setting up DASI UI Admin Template...').start();
92
-
93
- try {
94
- const projectPath = path.join(process.cwd(), projectName);
95
- const templatePath = path.join(__dirname, '../');
96
-
97
- if (fs.existsSync(projectPath)) {
98
- spinner.fail('Project directory already exists');
99
- return;
100
- }
101
-
102
- spinner.text = 'šŸ“ Creating project directory...';
103
- fs.mkdirSync(projectPath, { recursive: true });
104
- console.log(chalk.green(`āœ… Directory created: ${projectPath}`));
105
-
106
- spinner.text = 'šŸ“‹ Copying template files...';
107
-
108
- const templatePackageJson = path.join(templatePath, 'package.json');
109
- console.log(chalk.white(` Template package.json exists: ${fs.existsSync(templatePackageJson)}`));
110
-
111
- await fs.copy(templatePath, projectPath, {
112
- filter: (src) => {
113
- const relativePath = path.relative(templatePath, src);
114
-
115
- const excludePatterns = [
116
- 'node_modules',
117
- 'dist',
118
- '.git',
119
- 'package-lock.json',
120
- 'yarn.lock',
121
- '.DS_Store'
122
- ];
123
-
124
- const shouldExclude = excludePatterns.some(pattern =>
125
- relativePath.includes(pattern) || src.includes(pattern)
126
- );
127
-
128
- if (!shouldExclude) {
129
- console.log(chalk.gray(` Copying: ${relativePath}`));
130
- }
131
-
132
- return !shouldExclude;
133
- }
134
- });
135
-
136
- const copiedPackageJson = path.join(projectPath, 'package.json');
137
- console.log(chalk.white(` Copied package.json exists: ${fs.existsSync(copiedPackageJson)}`));
138
-
139
- if (!fs.existsSync(copiedPackageJson)) {
140
- throw new Error('Template copy failed - package.json not found');
141
- }
142
-
143
- spinner.text = 'āš™ļø Updating configuration...';
144
- const packageJsonPath = path.join(projectPath, 'package.json');
145
- let packageJson = await fs.readJson(packageJsonPath);
146
-
147
- packageJson.name = answers.projectName;
148
- packageJson.description = answers.appDescription;
149
- packageJson.author = answers.author;
150
- packageJson.version = '0.1.0';
151
-
152
- const envContent = `VITE_APP_TITLE=${answers.appTitle}
153
- VITE_APP_DESCRIPTION=${answers.appDescription}
154
- VITE_APP_AUTHOR=${answers.author}
155
- VITE_API_URL=${answers.apiUrl}
156
- VITE_DARK_MODE=${answers.darkMode}
157
- VITE_INCLUDE_AUTH=${answers.includeAuth}
158
- VITE_INCLUDE_CHARTS=${answers.includeCharts}
159
- VITE_INCLUDE_MAPS=${answers.includeMaps}`;
160
-
161
- await fs.writeFile(path.join(projectPath, '.env.example'), envContent);
162
- await fs.copyFile(path.join(projectPath, '.env.example'), path.join(projectPath, '.env'));
163
-
164
- await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
165
-
166
- if (answers.gitInit) {
167
- spinner.text = 'šŸ“š Initializing git repository...';
168
- try {
169
- const { execSync } = require('child_process');
170
- execSync('git init', { stdio: 'ignore' });
171
- execSync('git add .', { stdio: 'ignore' });
172
- execSync('git commit -m "Initial commit: DASI UI Admin Template"', { stdio: 'ignore' });
173
- } catch (error) {
174
- console.log(chalk.yellow('āš ļø Git initialization failed, continuing...'));
175
- }
176
- }
177
-
178
- if (answers.installDeps) {
179
- spinner.text = 'šŸ“¦ Installing dependencies...';
180
- try {
181
- const { execSync } = require('child_process');
182
- execSync(`${answers.packageManager} install`, { stdio: 'pipe' });
183
- } catch (error) {
184
- spinner.warn('āš ļø Dependencies installation failed');
185
- console.log(chalk.yellow(`Please run manually: ${answers.packageManager} install`));
186
- }
187
- }
188
-
189
- console.log(chalk.green(`
190
- ╔══════════════════════════════════════════════════════════════╗
191
- ā•‘ ā•‘
192
- ā•‘ šŸŽ‰ Success! Your admin dashboard is ready! ā•‘
193
- ā•‘ ā•‘
194
- ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•
195
- `));
196
-
197
- console.log(chalk.green('\nšŸŽ‰ Setup Complete! Your admin dashboard is ready.'));
198
- console.log(chalk.green('\nšŸ“‹ What you get:'));
199
- console.log(chalk.white(' • Complete admin dashboard'));
200
- console.log(chalk.white(' • Authentication system' + (answers.includeAuth ? ' āœ…' : ' āŒ')));
201
- console.log(chalk.white(' • Chart components' + (answers.includeCharts ? ' āœ…' : ' āŒ')));
202
- console.log(chalk.white(' • Map components' + (answers.includeMaps ? ' āœ…' : ' āŒ')));
203
- console.log(chalk.white(' • Dark mode' + (answers.darkMode ? ' āœ…' : ' āŒ')));
204
- console.log(chalk.white(' • TypeScript support'));
205
- console.log(chalk.white(' • Tailwind CSS styling'));
206
- console.log(chalk.white(' • Vue 3 + Pinia + Vue Router'));
207
-
208
- console.log(chalk.green('\nšŸš€ Next steps:'));
209
- console.log(chalk.white(` ${answers.packageManager} run dev`));
210
- console.log(chalk.gray(' Open http://localhost:3000 to view your admin dashboard'));
211
-
212
- console.log(chalk.green('\nšŸ“š Documentation:'));
213
- console.log(chalk.white(' • README.md for detailed setup'));
214
- console.log(chalk.white(' • src/ folder for all components'));
215
- console.log(chalk.white(' • .env file for configuration'));
216
-
217
- } catch (error) {
218
- spinner.fail('āŒ Setup failed!');
219
- console.error(chalk.red('Error Details:'));
220
- console.error(chalk.red(error.message));
221
- process.exit(1);
222
- }
223
- });
224
-
225
- program.parse();
@@ -1,260 +0,0 @@
1
- #!/usr/bin/env node
2
- const { program } = require('commander');
3
- const inquirer = require('inquirer');
4
- const fs = require('fs-extra');
5
- const path = require('path');
6
- const chalk = require('chalk');
7
- const ora = require('ora');
8
-
9
- const { execSync } = require('child_process');
10
- program
11
- .name('dasi-ui')
12
- .description('DASI UI - Create admin dashboard projects')
13
- .version('1.0.4')
14
-
15
- program
16
- .command('create <project-name>')
17
- .description('Create a new DASI UI project')
18
- .option('-t --template <template>', 'Template to use', 'default')
19
- .option('-p, --package-manager <pm>', 'Package manager to use', 'npm')
20
- .option('--no-git', 'Skip git initialization')
21
- .option('--no-install', 'Skip package installation')
22
- .action(async (projectName, options) => {
23
- console.log(chalk.blue.bold('šŸš€ Creating DASI UI project...'));
24
-
25
- const questions = [
26
- {
27
- type: 'input',
28
- name: 'title',
29
- message: 'Enter project title:',
30
- default: projectName
31
- },
32
- {
33
- type: 'input',
34
- name: 'description',
35
- message: 'Enter project description:',
36
- default: 'Admin dashboard built with DASI UI'
37
- },
38
- {
39
- type: 'input',
40
- name: 'author',
41
- message: 'Author name:',
42
- default: 'DASI Developer'
43
- },
44
- {
45
- type: 'input',
46
- name: 'email',
47
- message: 'Author email:',
48
- default: 'hello@dasi.co.id'
49
- },
50
- {
51
- type: 'list',
52
- name: 'packageManager',
53
- message: 'Choose package manager:',
54
- choices: ['npm', 'yarn', 'pnpm'],
55
- default: options.packageManager
56
- },
57
- {
58
- type: 'list',
59
- name: 'template',
60
- message: 'Choose template:',
61
- choices: [
62
- { name: 'Default - Complete admin dashboard', value: 'default' },
63
- { name: 'Minimal - Basic admin setup', value: 'minimal' },
64
- { name: 'Full - All features included', value: 'full' }
65
- ],
66
- default: options.template
67
- },
68
- {
69
- type: 'confirm',
70
- name: 'includeAuth',
71
- message: 'Include authentication module?',
72
- default: true
73
- },
74
- {
75
- type: 'confirm',
76
- name: 'includeCharts',
77
- message: 'Include chart components?',
78
- default: true
79
- },
80
- {
81
- type: 'confirm',
82
- name: 'includeForms',
83
- message: 'Include advanced form components?',
84
- default: true
85
- },
86
- {
87
- type: 'list',
88
- name: 'typescript',
89
- message: 'Use TypeScript?',
90
- choices: [
91
- { name: 'Yes - Recommended', value: true },
92
- { name: 'No', value: false }
93
- ],
94
- default: true
95
- },
96
- {
97
- type: 'input',
98
- name: 'apiUrl',
99
- message: 'API base URL:',
100
- default: 'http://localhost:8080/api'
101
- },
102
- {
103
- type: 'confirm',
104
- name: 'darkMode',
105
- message: 'Enable dark mode?',
106
- default: true
107
- }
108
- ];
109
-
110
- const answers = await inquirer.prompt(questions);
111
- const spinner = ora('Creating project...').start();
112
-
113
- try {
114
- const projectPath = path.join(process.cwd(), projectName);
115
-
116
- if (fs.existsSync(projectPath)) {
117
- spinner.fail(`Directory ${projectName} already exists!`);
118
- process.exit(1);
119
- }
120
-
121
- fs.mkdirSync(projectPath, { recursive: true });
122
-
123
- await fs.ensureDir(path.join(projectPath, 'src'));
124
- await fs.ensureDir(path.join(projectPath, 'public'));
125
- const templatePath = path.join(__dirname, '../templates', answers.template);
126
- await fs.copy(templatePath, projectPath);
127
-
128
- const packagejson = {
129
- name: projectName,
130
- version: "0.1.0",
131
- private: true,
132
- type: "module",
133
- description: answers.description,
134
- author: answers.author,
135
- scripts: {
136
- dev: "vite",
137
- build: "vite build",
138
- preview: "vite preview"
139
- },
140
- dependencies: {
141
- "@dasidev/dasi-ui": "^1.0.4",
142
- "vue": "^3.4.0",
143
- "vue-router": "^4.2.0",
144
- "pinia": "^2.1.0"
145
- },
146
- devDependencies: {
147
- "@vitejs/plugin-vue": "^5.0.0",
148
- "vite": "^5.0.0"
149
- }
150
- }
151
-
152
- await fs.writeJson(path.join(projectPath, 'package.json'), packagejson, { spaces: 2 });
153
-
154
- const envContent = `VITE_APP_TITLE=${answers.title}
155
- VITE_APP_DESCRIPTION=${answers.description}
156
- VITE_APP_AUTHOR=${answers.author}
157
- VITE_APP_EMAIL=${answers.email}
158
- VITE_API_URL=${answers.apiUrl}
159
- VITE_API_KEY=
160
- VITE_DARK_MODE=${answers.darkMode}`;
161
-
162
- await fs.writeFile(path.join(projectPath, '.env.example'), envContent);
163
- await fs.copyFile(path.join(projectPath, '.env.example'), path.join(projectPath, '.env'));
164
-
165
- await fs.ensureDir(path.join(projectPath, 'src/components'));
166
- await fs.ensureDir(path.join(projectPath, 'src/views'));
167
- await fs.ensureDir(path.join(projectPath, 'src/router'));
168
- await fs.ensureDir(path.join(projectPath, 'src/stores'));
169
- await fs.ensureDir(path.join(projectPath, 'src/config'));
170
- await fs.ensureDir(path.join(projectPath, 'src/vueform'));
171
- await fs.ensureDir(path.join(projectPath, 'src/vueform/config'));
172
- await fs.ensureDir(path.join(projectPath, 'src/vueform/schemas'));
173
-
174
- const mainJs = `import { createApp } from 'vue'
175
- import { createRouter, createWebHistory } from 'vue-router'
176
- import { createPinia } from 'pinia'
177
- import { DasiApp, PageActivity } from '@dasidev/dasi-ui'
178
- import '@dasidev/dasi-ui/style.css'
179
- const app = createApp(DasiApp)
180
- const router = createRouter({
181
- history: createWebHistory(),
182
- routes: [
183
- {
184
- path: '/',
185
- component: () => import('./views/Dashboard.vue')
186
- }
187
- ]
188
- })
189
- const pinia = createPinia()
190
- app.use(router)
191
- app.use(pinia)
192
- app.mount('#app')`;
193
-
194
- await fs.writeFile(path.join(projectPath, 'src/main.js'), mainJs);
195
-
196
- const indexHtml = `<!DOCTYPE html>
197
- <html lang="en">
198
- <head>
199
- <meta charset="UTF-8">
200
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
201
- <title>${answers.title}</title>
202
- </head>
203
- <body>
204
- <div id="app"></div>
205
- <script type="module" src="/src/main.js"></script>
206
- </body>
207
- </html>`;
208
- await fs.writeFile(path.join(projectPath, 'index.html'), indexHtml);
209
-
210
- const viteConfig = `import { defineConfig } from 'vite'
211
- import vue from '@vitejs/plugin-vue'
212
- export default defineConfig({
213
- plugins: [vue()],
214
- server: {
215
- port: 3000
216
- }
217
- })`;
218
- await fs.writeFile(path.join(projectPath, 'vite.config.js'), viteConfig);
219
-
220
- if (options.git) {
221
- execSync('git init', { cwd: projectPath, stdio: 'ignore' });
222
- execSync('git add .', { cwd: projectPath, stdio: 'ignore' });
223
- execSync('git commit -m "Initial commit"', { cwd: projectPath, stdio: 'ignore' });
224
- }
225
-
226
- if (options.install) {
227
- spinner.text = 'Installing dependencies...';
228
- try {
229
- execSync(`${answers.packageManager} install`, { cwd: projectPath, stdio: 'ignore' });
230
- } catch (error) {
231
- spinner.fail('Dependencies installation failed. Please install manually.');
232
- console.error(chalk.red('Error Details:'));
233
- console.error(chalk.red(error.message));
234
- console.error(chalk.red(error.stack));
235
- process.exit(1);
236
- }
237
- }
238
-
239
- spinner.succeed(`Project ${projectName} created successfully!`);
240
-
241
- console.log(chalk.green('\nāœ… Next steps:'));
242
- console.log(chalk.green(` cd ${projectName}`));
243
-
244
- if (!options.install) {
245
- console.log(chalk.green(` ${answers.packageManager} install`));
246
- }
247
-
248
- console.log(chalk.green(` ${answers.packageManager} run dev`));
249
- console.log(chalk.green('\nHappy coding! šŸš€ Your admin dashboard is ready!'));
250
- } catch (error) {
251
- spinner.fail('Failed to create project!');
252
- console.error(chalk.red('Error Details:'));
253
- console.error(chalk.red(error.message));
254
- console.error(chalk.red(error.stack));
255
- process.exit(1);
256
- }
257
-
258
- })
259
-
260
- program.parse();