@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.
package/bin/dasi-cli.cjs DELETED
@@ -1,314 +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
- const { execSync } = require('child_process');
9
-
10
- program
11
- .name('dasi-ui')
12
- .description('šŸš€ DASI UI - Admin Dashboard Template')
13
- .version('1.0.14');
14
-
15
- program
16
- .command('create [project-name]')
17
- .description('Create a new DASI UI admin dashboard')
18
- .action(async (projectName) => {
19
- console.log(chalk.blue.bold('šŸš€ Welcome to DASI UI Admin Template Setup'));
20
- console.log(chalk.gray('This will set up a admin dashboard in your current directory\n'));
21
-
22
- console.log(chalk.blue.bold(`
23
- ╔══════════════════════════════════════════════════════════════╗
24
- ā•‘ ā•‘
25
- ā•‘ šŸš€ DASI UI - Complete Admin Template Generator ā•‘
26
- ā•‘ ā•‘
27
- ā•‘ Creating: ${chalk.cyan(projectName.padEnd(35))} ā•‘
28
- ā•‘ ā•‘
29
- ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•
30
- `));
31
-
32
- const questions = [
33
- {
34
- type: 'input',
35
- name: 'projectName',
36
- message: 'šŸ“¦ Project name:',
37
- default: projectName,
38
- validate: (input) => input.length > 0 || 'Project name is required'
39
- },
40
- {
41
- type: 'input',
42
- name: 'appTitle',
43
- message: 'šŸ“± App title:',
44
- default: projectName ? projectName.charAt(0).toUpperCase() + projectName.slice(1).replace(/-/g, ' ') : 'DASI Admin Dashboard'
45
- },
46
- {
47
- type: 'input',
48
- name: 'appDescription',
49
- message: 'šŸ“ App description:',
50
- default: 'Complete admin dashboard built with DASI UI'
51
- },
52
- {
53
- type: 'input',
54
- name: 'author',
55
- message: 'šŸ‘¤ Author name:',
56
- default: 'DASI Developer'
57
- },
58
- {
59
- type: 'list',
60
- name: 'packageManager',
61
- message: 'šŸ“¦ Choose package manager:',
62
- choices: ['npm', 'yarn', 'pnpm'],
63
- default: 'npm'
64
- },
65
- {
66
- type: 'input',
67
- name: 'apiUrl',
68
- message: 'šŸ”— API base URL:',
69
- default: 'http://localhost:8080/api'
70
- },
71
- {
72
- type: 'confirm',
73
- name: 'darkMode',
74
- message: 'šŸŒ™ Enable dark mode?',
75
- default: true
76
- },
77
- {
78
- type: 'confirm',
79
- name: 'gitInit',
80
- message: 'šŸ“š Initialize git repository?',
81
- default: true
82
- },
83
- {
84
- type: 'confirm',
85
- name: 'installDeps',
86
- message: 'šŸ“„ Install dependencies now?',
87
- default: true
88
- }
89
- ];
90
-
91
- const answers = await inquirer.prompt(questions);
92
-
93
- const spinner = ora({
94
- text: 'šŸ—ļø Building your admin dashboard...',
95
- spinner: 'dots',
96
- color: 'cyan',
97
- hideCursor: true,
98
- interval: 100
99
- }).start();
100
-
101
- try {
102
- const projectPath = path.join(process.cwd(), answers.projectName);
103
-
104
- if (fs.existsSync(projectPath)) {
105
- spinner.fail('āŒ Project directory already exists');
106
- return;
107
- }
108
-
109
- spinner.text = 'šŸ“ Creating project directory...';
110
- await new Promise(resolve => setTimeout(resolve, 300));
111
- fs.mkdirSync(projectPath, { recursive: true });
112
- console.log(chalk.green(`\nāœ… Directory created: ${projectPath}`));
113
- spinner.start();
114
-
115
- spinner.text = 'šŸ“‹ Copying template files...';
116
- let copiedFiles = 0;
117
- const templatePath = path.join(__dirname, '../template');
118
-
119
- if (!fs.existsSync(templatePath)) {
120
- throw new Error('Template folder not found. Please ensure this package is installed correctly.');
121
- }
122
-
123
- const totalFiles = await countFiles(templatePath);
124
-
125
- const copyInterval = setInterval(() => {
126
- spinner.render();
127
- }, 100);
128
-
129
- await fs.copy(templatePath, projectPath, {
130
- filter: (src) => {
131
- const relativePath = path.relative(templatePath, src);
132
- const excludePatterns = [
133
- 'node_modules',
134
- 'dist',
135
- '.git',
136
- 'package-lock.json',
137
- 'yarn.lock',
138
- '.DS_Store'
139
- ];
140
-
141
- const shouldExclude = excludePatterns.some(pattern =>
142
- relativePath.includes(pattern)
143
- );
144
-
145
- if (!shouldExclude) {
146
- copiedFiles++;
147
- const progress = Math.round((copiedFiles / totalFiles) * 100);
148
- spinner.text = `šŸ“‹ Copying template files... ${progress}% (${copiedFiles}/${totalFiles})`;
149
- }
150
-
151
- return !shouldExclude;
152
- }
153
- });
154
-
155
- clearInterval(copyInterval);
156
-
157
- spinner.text = 'āš™ļø Updating configuration...';
158
-
159
- const configInterval = setInterval(() => {
160
- spinner.render();
161
- }, 100);
162
-
163
- await new Promise(resolve => setTimeout(resolve, 500));
164
-
165
- const templatePackageJsonPath = path.join(projectPath, 'package.json.template');
166
- const packageJsonPath = path.join(projectPath, 'package.json');
167
-
168
- if (fs.existsSync(templatePackageJsonPath)) {
169
- spinner.text = 'šŸ“ Setting up package.json...';
170
- await new Promise(resolve => setTimeout(resolve, 300));
171
- await fs.move(templatePackageJsonPath, packageJsonPath);
172
- }
173
-
174
- spinner.text = 'šŸ”§ Configuring project settings...';
175
- await new Promise(resolve => setTimeout(resolve, 300));
176
- let packageJson = await fs.readJson(packageJsonPath);
177
-
178
- packageJson.name = answers.projectName;
179
- packageJson.description = answers.appDescription;
180
- packageJson.author = answers.author;
181
- packageJson.version = '0.1.0';
182
-
183
- await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
184
-
185
- spinner.text = 'šŸŒ Setting up environment variables...';
186
- await new Promise(resolve => setTimeout(resolve, 300));
187
- const envContent = `VITE_APP_TITLE=${answers.appTitle}
188
- VITE_APP_DESCRIPTION=${answers.appDescription}
189
- VITE_APP_AUTHOR=${answers.author}
190
- VITE_API_URL=${answers.apiUrl}
191
- VITE_DARK_MODE=${answers.darkMode}`;
192
-
193
- await fs.writeFile(path.join(projectPath, '.env.example'), envContent);
194
- await fs.copyFile(path.join(projectPath, '.env.example'), path.join(projectPath, '.env'));
195
-
196
- clearInterval(configInterval);
197
-
198
- if (answers.gitInit) {
199
- spinner.text = 'šŸ“š Initializing git repository...';
200
-
201
- const gitInterval = setInterval(() => {
202
- spinner.render();
203
- }, 100);
204
-
205
- await new Promise(resolve => setTimeout(resolve, 500));
206
- try {
207
- execSync('git init', { cwd: projectPath, stdio: 'ignore' });
208
-
209
- spinner.text = 'šŸ“ Adding files to git...';
210
- await new Promise(resolve => setTimeout(resolve, 400));
211
- execSync('git add .', { cwd: projectPath, stdio: 'ignore' });
212
-
213
- spinner.text = 'šŸ’¾ Creating initial commit...';
214
- await new Promise(resolve => setTimeout(resolve, 400));
215
-
216
- try {
217
- execSync('git commit -m "šŸš€ Initial commit: DASI UI Admin Template"', {
218
- cwd: projectPath,
219
- stdio: 'ignore',
220
- timeout: 10000
221
- });
222
- } catch (commitError) {
223
- console.log(chalk.yellow('\nāš ļø Git commit skipped, continuing...'));
224
- }
225
-
226
- } catch (error) {
227
- console.log(chalk.yellow('\nāš ļø Git initialization failed, continuing...'));
228
- spinner.start();
229
- }
230
-
231
- clearInterval(gitInterval);
232
- }
233
-
234
- if (answers.installDeps) {
235
- spinner.text = 'šŸ“¦ Installing dependencies...';
236
- spinner.color = 'yellow';
237
-
238
- const installInterval = setInterval(() => {
239
- spinner.render();
240
- }, 100);
241
-
242
- try {
243
- execSync(`${answers.packageManager} install`, {
244
- cwd: projectPath,
245
- stdio: 'pipe'
246
- });
247
- spinner.color = 'green';
248
- } catch (error) {
249
- spinner.color = 'red';
250
- spinner.warn('āš ļø Dependencies installation failed');
251
- console.log(chalk.yellow(`Please run manually: cd ${answers.projectName} && ${answers.packageManager} install`));
252
- }
253
-
254
- clearInterval(installInterval);
255
- }
256
-
257
- spinner.text = 'šŸŽ‰ Finalizing setup...';
258
- spinner.color = 'green';
259
- await new Promise(resolve => setTimeout(resolve, 500));
260
-
261
- spinner.succeed('āœ… Admin dashboard created successfully!');
262
-
263
- console.log(chalk.green(`
264
- ╔══════════════════════════════════════════════════════════════╗
265
- ā•‘ ā•‘
266
- ā•‘ šŸŽ‰ Success! Your admin dashboard is ready! ā•‘
267
- ā•‘ ā•‘
268
- ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•
269
- `));
270
-
271
- console.log(chalk.cyan('\nšŸ“‹ Project Summary:'));
272
- console.log(chalk.white(` šŸ“ Location: ${projectPath}`));
273
- console.log(chalk.white(` šŸ“± Title: ${answers.appTitle}`));
274
- console.log(chalk.white(` šŸ“¦ Package Manager: ${answers.packageManager}`));
275
- console.log(chalk.white(` šŸŒ™ Dark Mode: ${answers.darkMode ? 'āœ…' : 'āŒ'}`));
276
-
277
- console.log(chalk.green('\nšŸš€ Next Steps:'));
278
- console.log(chalk.white(` 1ļøāƒ£ cd ${answers.projectName}`));
279
- if (!answers.installDeps) {
280
- console.log(chalk.white(` 2ļøāƒ£ ${answers.packageManager} install`));
281
- console.log(chalk.white(` 3ļøāƒ£ ${answers.packageManager} run dev`));
282
- } else {
283
- console.log(chalk.white(` 2ļøāƒ£ ${answers.packageManager} run dev`));
284
- }
285
- console.log(chalk.gray(` 🌐 Open http://localhost:3000`));
286
-
287
- } catch (error) {
288
- spinner.fail('āŒ Setup failed!');
289
- console.error(chalk.red('Error Details:'));
290
- console.error(chalk.red(error.message));
291
- console.error(chalk.red(error.stack));
292
- process.exit(1);
293
- }
294
- });
295
-
296
- async function countFiles(dir) {
297
- let count = 0;
298
- const items = await fs.readdir(dir);
299
-
300
- for (const item of items) {
301
- const fullPath = path.join(dir, item);
302
- const stat = await fs.stat(fullPath);
303
-
304
- if (stat.isDirectory()) {
305
- count += await countFiles(fullPath);
306
- } else {
307
- count++;
308
- }
309
- }
310
-
311
- return count;
312
- }
313
-
314
- program.parse();
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={schema:{testDate:{type:"DateSelectorElement",label:"Test Date",placeholder:"Select a date",pickerType:"date",rules:["required"]},testDateRange:{type:"DateSelectorElement",label:"Test Date Range",placeholder:"Select date range",pickerType:"date",range:!0},testDateTime:{type:"DateSelectorElement",label:"Test DateTime",placeholder:"Select date and time",pickerType:"datetime",timePickerInline:!0},testDateTimeRange:{type:"DateSelectorElement",label:"Test DateTime Range",placeholder:"Select date time range",pickerType:"datetime",range:!0,timePickerInline:!0},testMonth:{type:"DateSelectorElement",label:"Test Month",placeholder:"Select month",pickerType:"month",locale:"id"},testMonthRange:{type:"DateSelectorElement",label:"Test Month Range",placeholder:"Select month range",pickerType:"month",range:!0,locale:"id"},testYear:{type:"DateSelectorElement",label:"Test Year",placeholder:"Select year",pickerType:"year",yearRange:[2020,2030]},testYearRange:{type:"DateSelectorElement",label:"Test Year Range",placeholder:"Select year range",pickerType:"year",range:!0,yearRange:[2020,2030]},testCustomFormat:{type:"DateSelectorElement",label:"Test Custom Format",placeholder:"Select date",pickerType:"date",displayFormat:"DD-MM-YYYY"},testDisabled:{type:"DateSelectorElement",label:"Test Disabled",placeholder:"This is disabled",pickerType:"date",disabled:!0,default:"2024-01-01"}}};exports.dateSelectorTestSchema=e;