@ttianqii/takaui 0.0.5 ā 0.0.7
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 +56 -6
- package/dist/takaui.cjs +5 -5
- package/dist/takaui.css +1 -1
- package/dist/takaui.js +1553 -1471
- package/package.json +7 -2
- package/src/cli/setup.js +135 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttianqii/takaui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/takaui.cjs",
|
|
7
7
|
"module": "./dist/takaui.js",
|
|
@@ -15,8 +15,12 @@
|
|
|
15
15
|
"./styles.css": "./dist/takaui.css"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
|
-
"dist"
|
|
18
|
+
"dist",
|
|
19
|
+
"src/cli"
|
|
19
20
|
],
|
|
21
|
+
"bin": {
|
|
22
|
+
"takaui-setup": "./src/cli/setup.js"
|
|
23
|
+
},
|
|
20
24
|
"sideEffects": [
|
|
21
25
|
"**/*.css"
|
|
22
26
|
],
|
|
@@ -46,6 +50,7 @@
|
|
|
46
50
|
"class-variance-authority": "^0.7.1",
|
|
47
51
|
"clsx": "^2.1.1",
|
|
48
52
|
"date-fns": "^4.1.0",
|
|
53
|
+
"date-holidays": "^3.26.5",
|
|
49
54
|
"lucide-react": "^0.554.0",
|
|
50
55
|
"react-day-picker": "^9.11.1",
|
|
51
56
|
"react-router-dom": "^7.9.6",
|
package/src/cli/setup.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { readFileSync, writeFileSync, existsSync } from 'fs';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
import { dirname } from 'path';
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = dirname(__filename);
|
|
10
|
+
|
|
11
|
+
console.log('\nšØ TakaUI Setup Wizard\n');
|
|
12
|
+
|
|
13
|
+
const cwd = process.cwd();
|
|
14
|
+
|
|
15
|
+
// 1. Check for Tailwind config
|
|
16
|
+
const tailwindConfigFiles = [
|
|
17
|
+
'tailwind.config.js',
|
|
18
|
+
'tailwind.config.ts',
|
|
19
|
+
'tailwind.config.mjs',
|
|
20
|
+
'tailwind.config.cjs'
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
let tailwindConfigPath = null;
|
|
24
|
+
for (const file of tailwindConfigFiles) {
|
|
25
|
+
if (existsSync(join(cwd, file))) {
|
|
26
|
+
tailwindConfigPath = file;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (!tailwindConfigPath) {
|
|
32
|
+
console.log('ā ļø No Tailwind config found!');
|
|
33
|
+
console.log('\nPlease install Tailwind CSS first:');
|
|
34
|
+
console.log(' npm install -D tailwindcss postcss autoprefixer');
|
|
35
|
+
console.log(' npx tailwindcss init');
|
|
36
|
+
console.log('\nThen run this setup again: npx takaui-setup\n');
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
console.log(`ā
Found Tailwind config: ${tailwindConfigPath}`);
|
|
41
|
+
|
|
42
|
+
// 2. Update Tailwind config
|
|
43
|
+
try {
|
|
44
|
+
let configContent = readFileSync(join(cwd, tailwindConfigPath), 'utf-8');
|
|
45
|
+
|
|
46
|
+
const takaUIPath = './node_modules/@ttianqii/takaui/dist/**/*.{js,mjs,cjs}';
|
|
47
|
+
|
|
48
|
+
if (configContent.includes(takaUIPath)) {
|
|
49
|
+
console.log('ā
TakaUI already configured in Tailwind');
|
|
50
|
+
} else {
|
|
51
|
+
// Add TakaUI to content array
|
|
52
|
+
const contentRegex = /content:\s*\[([\s\S]*?)\]/;
|
|
53
|
+
const match = configContent.match(contentRegex);
|
|
54
|
+
|
|
55
|
+
if (match) {
|
|
56
|
+
const currentContent = match[1];
|
|
57
|
+
const updatedContent = currentContent.trim()
|
|
58
|
+
? `${currentContent.trim()},\n "${takaUIPath}"`
|
|
59
|
+
: `"${takaUIPath}"`;
|
|
60
|
+
|
|
61
|
+
configContent = configContent.replace(
|
|
62
|
+
contentRegex,
|
|
63
|
+
`content: [\n ${updatedContent}\n ]`
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
writeFileSync(join(cwd, tailwindConfigPath), configContent, 'utf-8');
|
|
67
|
+
console.log('ā
Updated Tailwind config with TakaUI paths');
|
|
68
|
+
} else {
|
|
69
|
+
console.log('ā ļø Could not auto-update Tailwind config');
|
|
70
|
+
console.log(`\nPlease manually add to ${tailwindConfigPath}:`);
|
|
71
|
+
console.log(` content: [`);
|
|
72
|
+
console.log(` "${takaUIPath}"`);
|
|
73
|
+
console.log(` ]`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
} catch (error) {
|
|
77
|
+
console.log('ā ļø Could not update Tailwind config:', error.message);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// 3. Check for CSS import
|
|
81
|
+
const possibleEntryPoints = [
|
|
82
|
+
'src/main.tsx',
|
|
83
|
+
'src/main.ts',
|
|
84
|
+
'src/main.jsx',
|
|
85
|
+
'src/main.js',
|
|
86
|
+
'src/index.tsx',
|
|
87
|
+
'src/index.ts',
|
|
88
|
+
'src/index.jsx',
|
|
89
|
+
'src/index.js',
|
|
90
|
+
'src/App.tsx',
|
|
91
|
+
'src/App.ts',
|
|
92
|
+
'src/App.jsx',
|
|
93
|
+
'src/App.js',
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
let entryPoint = null;
|
|
97
|
+
for (const file of possibleEntryPoints) {
|
|
98
|
+
if (existsSync(join(cwd, file))) {
|
|
99
|
+
entryPoint = file;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
console.log('\nš Next Steps:\n');
|
|
105
|
+
|
|
106
|
+
if (entryPoint) {
|
|
107
|
+
const entryContent = readFileSync(join(cwd, entryPoint), 'utf-8');
|
|
108
|
+
|
|
109
|
+
if (entryContent.includes("@ttianqii/takaui/styles.css")) {
|
|
110
|
+
console.log(`ā
CSS already imported in ${entryPoint}`);
|
|
111
|
+
} else {
|
|
112
|
+
console.log(`Add this import to your ${entryPoint}:`);
|
|
113
|
+
console.log(` import '@ttianqii/takaui/styles.css'`);
|
|
114
|
+
|
|
115
|
+
// Auto-add if it's a simple case
|
|
116
|
+
if (entryContent.includes('import')) {
|
|
117
|
+
const lines = entryContent.split('\n');
|
|
118
|
+
const lastImportIndex = lines.findLastIndex(line => line.trim().startsWith('import'));
|
|
119
|
+
|
|
120
|
+
if (lastImportIndex !== -1) {
|
|
121
|
+
lines.splice(lastImportIndex + 1, 0, "import '@ttianqii/takaui/styles.css'");
|
|
122
|
+
writeFileSync(join(cwd, entryPoint), lines.join('\n'), 'utf-8');
|
|
123
|
+
console.log(` ā
Auto-added CSS import to ${entryPoint}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
console.log('Add this import to your main entry file (e.g., main.tsx or App.tsx):');
|
|
129
|
+
console.log(" import '@ttianqii/takaui/styles.css'");
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
console.log('\n⨠Setup Complete!\n');
|
|
133
|
+
console.log('You can now use TakaUI components:');
|
|
134
|
+
console.log(" import { DatePicker, DataTable, Calendar } from '@ttianqii/takaui'\n");
|
|
135
|
+
console.log('š Documentation: https://github.com/ttianqii/takaui\n');
|