@dsai-io/tools 0.0.1 → 1.1.0

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 (44) hide show
  1. package/README.md +438 -186
  2. package/bin/dsai-tools.mjs +13 -13
  3. package/dist/cli/index.cjs +8192 -2757
  4. package/dist/cli/index.cjs.map +1 -1
  5. package/dist/cli/index.d.cts +4 -0
  6. package/dist/cli/index.d.ts +4 -0
  7. package/dist/cli/index.js +8190 -2757
  8. package/dist/cli/index.js.map +1 -1
  9. package/dist/config/index.cjs +264 -63
  10. package/dist/config/index.cjs.map +1 -1
  11. package/dist/config/index.d.cts +537 -1759
  12. package/dist/config/index.d.ts +537 -1759
  13. package/dist/config/index.js +259 -63
  14. package/dist/config/index.js.map +1 -1
  15. package/dist/icons/index.cjs +1 -1
  16. package/dist/icons/index.cjs.map +1 -1
  17. package/dist/icons/index.d.cts +1 -1
  18. package/dist/icons/index.d.ts +1 -1
  19. package/dist/icons/index.js +1 -1
  20. package/dist/icons/index.js.map +1 -1
  21. package/dist/index.cjs +8093 -3024
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +214 -5
  24. package/dist/index.d.ts +214 -5
  25. package/dist/index.js +8033 -3012
  26. package/dist/index.js.map +1 -1
  27. package/dist/tokens/index.cjs +4457 -737
  28. package/dist/tokens/index.cjs.map +1 -1
  29. package/dist/tokens/index.d.cts +1258 -17
  30. package/dist/tokens/index.d.ts +1258 -17
  31. package/dist/tokens/index.js +4368 -683
  32. package/dist/tokens/index.js.map +1 -1
  33. package/dist/{types-Idj08nad.d.cts → types-CtE9f0G0.d.cts} +293 -3
  34. package/dist/{types-Idj08nad.d.ts → types-CtE9f0G0.d.ts} +293 -3
  35. package/dist/utils/circuit-breaker.cjs +173 -0
  36. package/dist/utils/circuit-breaker.cjs.map +1 -0
  37. package/dist/utils/circuit-breaker.d.cts +123 -0
  38. package/dist/utils/circuit-breaker.d.ts +123 -0
  39. package/dist/utils/circuit-breaker.js +169 -0
  40. package/dist/utils/circuit-breaker.js.map +1 -0
  41. package/package.json +102 -97
  42. package/templates/.dsairc.json +37 -37
  43. package/templates/dsai-config.schema.json +618 -554
  44. package/templates/dsai.config.mjs +281 -221
@@ -1,221 +1,281 @@
1
- /**
2
- * @dsai-io/tools Configuration Template
3
- *
4
- * This file provides a starting point for configuring the DSAI tools.
5
- * Copy this file to your project root and customize as needed.
6
- *
7
- * Supported config file names:
8
- * - dsai.config.mjs (ESM, recommended)
9
- * - dsai.config.js (CommonJS)
10
- * - dsai.config.ts (TypeScript)
11
- * - .dsairc (JSON or YAML)
12
- * - .dsairc.json
13
- * - .dsairc.yaml
14
- * - package.json (under "dsai" key)
15
- *
16
- * @type {import('@dsai-io/tools').DsaiConfig}
17
- */
18
- import { defineConfig } from '@dsai-io/tools';
19
-
20
- export default defineConfig({
21
- // =========================================================================
22
- // Token Build Configuration
23
- // =========================================================================
24
- tokens: {
25
- // --- Source Configuration ---
26
-
27
- /**
28
- * Token source type:
29
- * - 'theme': Use combined theme.json from Figma
30
- * - 'collections': Use individual collection files
31
- * - Or provide a custom path to token files
32
- */
33
- source: 'theme',
34
-
35
- /**
36
- * Directory containing Figma export files (relative to this config file)
37
- */
38
- sourceDir: 'figma-exports',
39
-
40
- /**
41
- * Input file patterns for finding token files
42
- * Customize based on your Figma export naming conventions
43
- */
44
- sourcePatterns: ['theme.json', 'tokens.json', '*.tokens.json'],
45
-
46
- // --- Output Configuration ---
47
-
48
- /**
49
- * Output directory for built tokens (relative to this config file)
50
- */
51
- outputDir: 'dist',
52
-
53
- /**
54
- * Output formats to generate
55
- * Available: 'css', 'scss', 'js', 'ts', 'json', 'android', 'ios'
56
- */
57
- formats: ['css', 'scss', 'js', 'ts', 'json'],
58
-
59
- /**
60
- * CSS custom property prefix
61
- */
62
- prefix: '--dsai-',
63
-
64
- // --- Theme Configuration ---
65
- themes: {
66
- /**
67
- * Auto-detect available modes from Figma export
68
- */
69
- autoDetect: true,
70
-
71
- /**
72
- * Default theme mode (uses :root selector)
73
- */
74
- default: 'Light',
75
-
76
- /**
77
- * Theme selector patterns
78
- */
79
- selectorPattern: {
80
- default: ':root',
81
- others: '[data-dsai-theme="{mode}"]',
82
- },
83
- },
84
-
85
- // --- Build Options ---
86
-
87
- /**
88
- * Include token references in output (for debugging)
89
- */
90
- outputReferences: true,
91
-
92
- /**
93
- * Base font size for px to rem conversion
94
- */
95
- baseFontSize: 16,
96
-
97
- /**
98
- * Generate separate files per theme
99
- */
100
- separateThemeFiles: false,
101
-
102
- /**
103
- * Watch source files for changes
104
- */
105
- watch: false,
106
-
107
- // --- Style Bundling (Optional) ---
108
-
109
- /**
110
- * Additional SCSS directories to merge with token output
111
- */
112
- // additionalScssDirectories: ['src/styles/overrides'],
113
-
114
- /**
115
- * Additional CSS directories to merge with token output
116
- */
117
- // additionalCssDirectories: ['src/styles/base'],
118
-
119
- /**
120
- * Whether to create combined bundle files
121
- */
122
- // createBundle: false,
123
-
124
- // --- Build Hooks (Advanced) ---
125
-
126
- /**
127
- * Hook called before token build starts
128
- */
129
- // onBuildStart: async (config) => {
130
- // console.log('Starting build with config:', config);
131
- // return undefined; // Return modified config or undefined
132
- // },
133
-
134
- /**
135
- * Hook called after each format is generated
136
- */
137
- // onFormatComplete: async (format, outputPath, content) => {
138
- // console.log(`Generated ${format} at ${outputPath}`);
139
- // return undefined; // Return modified content or undefined
140
- // },
141
-
142
- /**
143
- * Hook called after build completes
144
- */
145
- // onBuildComplete: async (summary) => {
146
- // console.log(`Build completed in ${summary.duration}ms`);
147
- // console.log(`Generated ${summary.stats.totalTokens} tokens`);
148
- // },
149
- },
150
-
151
- // =========================================================================
152
- // Icon Generation Configuration
153
- // =========================================================================
154
- icons: {
155
- /**
156
- * Source directory containing SVG icons
157
- */
158
- sourceDir: 'icons',
159
-
160
- /**
161
- * Output directory for generated icon components
162
- */
163
- outputDir: 'src/components/icons',
164
-
165
- /**
166
- * Target framework for icon components
167
- * Available: 'react', 'vue', 'svelte', 'angular', 'webcomponent', 'svg'
168
- */
169
- framework: 'react',
170
-
171
- /**
172
- * TypeScript support
173
- */
174
- typescript: true,
175
-
176
- /**
177
- * Optimize SVGs with SVGO before generating components
178
- */
179
- optimize: true,
180
-
181
- /**
182
- * Icon component prefix (e.g., 'Icon' => IconHome)
183
- */
184
- prefix: 'Icon',
185
-
186
- /**
187
- * Icon component suffix (e.g., 'Icon' => HomeIcon)
188
- */
189
- // suffix: 'Icon',
190
-
191
- /**
192
- * Include tree-shakeable index file
193
- */
194
- exportIndex: true,
195
-
196
- /**
197
- * Generate sprite sheet in addition to individual components
198
- */
199
- generateSprite: false,
200
- },
201
-
202
- // =========================================================================
203
- // Global Settings
204
- // =========================================================================
205
- global: {
206
- /**
207
- * Working directory (defaults to process.cwd())
208
- */
209
- // cwd: process.cwd(),
210
-
211
- /**
212
- * Enable debug logging
213
- */
214
- debug: false,
215
-
216
- /**
217
- * Log level: 'silent', 'error', 'warn', 'info', 'debug'
218
- */
219
- logLevel: 'info',
220
- },
221
- });
1
+ /**
2
+ * @dsai-io/tools Configuration Template
3
+ *
4
+ * This file provides a starting point for configuring the DSAI tools.
5
+ * Copy this file to your project root and customize as needed.
6
+ *
7
+ * Supported config file names:
8
+ * - dsai.config.mjs (ESM, recommended)
9
+ * - dsai.config.js (CommonJS)
10
+ * - dsai.config.ts (TypeScript)
11
+ * - .dsairc (JSON or YAML)
12
+ * - .dsairc.json
13
+ * - .dsairc.yaml
14
+ * - package.json (under "dsai" key)
15
+ *
16
+ * @type {import('@dsai-io/tools').DsaiConfig}
17
+ */
18
+ import { defineConfig } from '@dsai-io/tools';
19
+
20
+ export default defineConfig({
21
+ // =========================================================================
22
+ // Token Build Configuration
23
+ // =========================================================================
24
+ tokens: {
25
+ // --- Source Configuration ---
26
+
27
+ /**
28
+ * Token source type:
29
+ * - 'theme': Use combined theme.json from Figma
30
+ * - 'collections': Use individual collection files
31
+ * - Or provide a custom path to token files
32
+ */
33
+ source: 'theme',
34
+
35
+ /**
36
+ * Directory containing Figma export files (relative to this config file)
37
+ */
38
+ sourceDir: 'figma-exports',
39
+
40
+ /**
41
+ * Input file patterns for finding token files
42
+ * Customize based on your Figma export naming conventions
43
+ */
44
+ sourcePatterns: ['theme.json', 'tokens.json', '*.tokens.json'],
45
+
46
+ // --- Output Configuration ---
47
+
48
+ /**
49
+ * Output directory for built tokens (relative to this config file)
50
+ */
51
+ outputDir: 'dist',
52
+
53
+ /**
54
+ * Output formats to generate
55
+ * Available: 'css', 'scss', 'js', 'ts', 'json', 'android', 'ios'
56
+ */
57
+ formats: ['css', 'scss', 'js', 'ts', 'json'],
58
+
59
+ /**
60
+ * CSS custom property prefix
61
+ */
62
+ prefix: '--dsai-',
63
+
64
+ // --- Theme Configuration ---
65
+ themes: {
66
+ /**
67
+ * Auto-detect available modes from Figma export
68
+ */
69
+ autoDetect: true,
70
+
71
+ /**
72
+ * Default theme mode (uses :root selector)
73
+ */
74
+ default: 'Light',
75
+
76
+ /**
77
+ * Theme selector patterns
78
+ */
79
+ selectorPattern: {
80
+ default: ':root',
81
+ others: '[data-dsai-theme="{mode}"]',
82
+ },
83
+ },
84
+
85
+ // --- Build Options ---
86
+
87
+ /**
88
+ * Include token references in output (for debugging)
89
+ */
90
+ outputReferences: true,
91
+
92
+ /**
93
+ * Base font size for px to rem conversion
94
+ */
95
+ baseFontSize: 16,
96
+
97
+ /**
98
+ * Generate separate files per theme
99
+ */
100
+ separateThemeFiles: false,
101
+
102
+ /**
103
+ * Watch source files for changes
104
+ */
105
+ watch: false,
106
+
107
+ // --- Style Bundling (Optional) ---
108
+
109
+ /**
110
+ * Additional SCSS directories to merge with token output
111
+ */
112
+ // additionalScssDirectories: ['src/styles/overrides'],
113
+
114
+ /**
115
+ * Additional CSS directories to merge with token output
116
+ */
117
+ // additionalCssDirectories: ['src/styles/base'],
118
+
119
+ /**
120
+ * Whether to create combined bundle files
121
+ */
122
+ // createBundle: false,
123
+
124
+ // --- Build Hooks (Advanced) ---
125
+
126
+ /**
127
+ * Hook called before token build starts
128
+ */
129
+ // onBuildStart: async (config) => {
130
+ // console.log('Starting build with config:', config);
131
+ // return undefined; // Return modified config or undefined
132
+ // },
133
+
134
+ /**
135
+ * Hook called after each format is generated
136
+ */
137
+ // onFormatComplete: async (format, outputPath, content) => {
138
+ // console.log(`Generated ${format} at ${outputPath}`);
139
+ // return undefined; // Return modified content or undefined
140
+ // },
141
+
142
+ /**
143
+ * Hook called after build completes
144
+ */
145
+ // onBuildComplete: async (summary) => {
146
+ // console.log(`Build completed in ${summary.duration}ms`);
147
+ // console.log(`Generated ${summary.stats.totalTokens} tokens`);
148
+ // },
149
+ },
150
+
151
+ // =========================================================================
152
+ // Icon Generation Configuration
153
+ // =========================================================================
154
+ icons: {
155
+ /**
156
+ * Source directory containing SVG icons
157
+ */
158
+ sourceDir: 'icons',
159
+
160
+ /**
161
+ * Output directory for generated icon components
162
+ */
163
+ outputDir: 'src/components/icons',
164
+
165
+ /**
166
+ * Target framework for icon components
167
+ * Available: 'react', 'vue', 'svelte', 'angular', 'webcomponent', 'svg'
168
+ */
169
+ framework: 'react',
170
+
171
+ /**
172
+ * TypeScript support
173
+ */
174
+ typescript: true,
175
+
176
+ /**
177
+ * Optimize SVGs with SVGO before generating components
178
+ */
179
+ optimize: true,
180
+
181
+ /**
182
+ * Icon component prefix (e.g., 'Icon' => IconHome)
183
+ */
184
+ prefix: 'Icon',
185
+
186
+ /**
187
+ * Icon component suffix (e.g., 'Icon' => HomeIcon)
188
+ */
189
+ // suffix: 'Icon',
190
+
191
+ /**
192
+ * Include tree-shakeable index file
193
+ */
194
+ exportIndex: true,
195
+
196
+ /**
197
+ * Generate sprite sheet in addition to individual components
198
+ */
199
+ generateSprite: false,
200
+ },
201
+
202
+ // =========================================================================
203
+ // Path Aliases Configuration
204
+ // =========================================================================
205
+ aliases: {
206
+ /**
207
+ * Import alias prefix used in tsconfig paths (e.g., "@/", "~/", "@dsai/")
208
+ */
209
+ importAlias: '@/',
210
+
211
+ /**
212
+ * Where UI components are installed by `dsai add`
213
+ */
214
+ ui: 'src/components/ui',
215
+
216
+ /**
217
+ * Where shared hooks are installed
218
+ */
219
+ hooks: 'src/hooks',
220
+
221
+ /**
222
+ * Where utility functions are installed
223
+ */
224
+ utils: 'src/lib/utils',
225
+
226
+ /**
227
+ * Where higher-level composed components go
228
+ */
229
+ components: 'src/components',
230
+
231
+ /**
232
+ * Where lib files go
233
+ */
234
+ lib: 'src/lib',
235
+ },
236
+
237
+ // =========================================================================
238
+ // Component Distribution Configuration
239
+ // =========================================================================
240
+ components: {
241
+ /**
242
+ * Enable component distribution features (shadcn-style `dsai add`)
243
+ */
244
+ enabled: true,
245
+
246
+ /**
247
+ * Registry URL or local path for component resolution
248
+ */
249
+ registryUrl: 'https://registry.dsai.dev',
250
+
251
+ /**
252
+ * Whether to use TypeScript (.tsx) or JavaScript (.jsx)
253
+ */
254
+ tsx: true,
255
+
256
+ /**
257
+ * Overwrite existing files when adding components
258
+ */
259
+ overwrite: false,
260
+ },
261
+
262
+ // =========================================================================
263
+ // Global Settings
264
+ // =========================================================================
265
+ global: {
266
+ /**
267
+ * Working directory (defaults to process.cwd())
268
+ */
269
+ // cwd: process.cwd(),
270
+
271
+ /**
272
+ * Enable debug logging
273
+ */
274
+ debug: false,
275
+
276
+ /**
277
+ * Log level: 'silent', 'error', 'warn', 'info', 'debug'
278
+ */
279
+ logLevel: 'info',
280
+ },
281
+ });