@spaced-out/ui-design-system 0.5.34-beta.2 → 0.5.35

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.
@@ -70,72 +70,69 @@ function getAllFilesRecursively(dirPath, filesList = [], baseDir = dirPath) {
70
70
 
71
71
  /**
72
72
  * Extract all components with their files (including sub-components)
73
+ * For main component files and sub-components, we use .d.ts files from lib/
74
+ * to avoid exposing source code in the public npm package
73
75
  */
74
76
  function buildComponentsData() {
75
77
  console.log('šŸ“¦ Extracting components...');
76
- const componentsPath = join(DESIGN_SYSTEM_PATH, 'src/components');
78
+ const srcComponentsPath = join(DESIGN_SYSTEM_PATH, 'src/components');
79
+ const libComponentsPath = join(DESIGN_SYSTEM_PATH, 'lib/components');
77
80
  const components = {};
78
81
 
79
- if (!existsSync(componentsPath)) {
82
+ if (!existsSync(srcComponentsPath)) {
80
83
  console.warn('āš ļø Components path not found');
81
84
  return components;
82
85
  }
83
86
 
84
- const componentDirs = getDirectories(componentsPath).filter(name => name !== 'index.ts');
87
+ const componentDirs = getDirectories(srcComponentsPath).filter(name => name !== 'index.ts');
85
88
 
86
89
  for (const componentName of componentDirs) {
87
- const componentDir = join(componentsPath, componentName);
90
+ const srcComponentDir = join(srcComponentsPath, componentName);
91
+ const libComponentDir = join(libComponentsPath, componentName);
88
92
 
89
- // Get all files in the component directory
90
- const allFiles = getAllFilesRecursively(componentDir);
93
+ // Get all files in the component directory (from src for reference)
94
+ const allFiles = getAllFilesRecursively(srcComponentDir);
91
95
 
92
- // Extract main component files
93
- const mainTsx = join(componentDir, `${componentName}.tsx`);
94
- const mainTs = join(componentDir, `${componentName}.ts`);
95
- const mainContent = safeReadFile(mainTsx) || safeReadFile(mainTs);
96
+ // Extract main component .d.ts file from lib/ (type definitions only)
97
+ const mainDts = join(libComponentDir, `${componentName}.d.ts`);
98
+ const mainContent = safeReadFile(mainDts);
96
99
 
97
- // Extract story files
98
- const storyTsx = join(componentDir, `${componentName}.stories.tsx`);
99
- const storyTs = join(componentDir, `${componentName}.stories.ts`);
100
+ // Extract story files (keep from src - useful for usage examples)
101
+ const storyTsx = join(srcComponentDir, `${componentName}.stories.tsx`);
102
+ const storyTs = join(srcComponentDir, `${componentName}.stories.ts`);
100
103
  const storyContent = safeReadFile(storyTsx) || safeReadFile(storyTs);
101
104
 
102
- // Extract CSS file
103
- const cssFile = join(componentDir, `${componentName}.module.css`);
105
+ // Extract CSS file (keep from src - needed for styling reference)
106
+ const cssFile = join(srcComponentDir, `${componentName}.module.css`);
104
107
  const cssContent = safeReadFile(cssFile);
105
108
 
106
- // Extract index file
107
- const indexFile = join(componentDir, 'index.ts');
108
- const indexContent = safeReadFile(indexFile);
109
+ // Extract index .d.ts file from lib/
110
+ const indexDts = join(libComponentDir, 'index.d.ts');
111
+ const indexContent = safeReadFile(indexDts);
109
112
 
110
- // Extract all additional TypeScript/TSX files (sub-components)
113
+ // Extract all additional sub-component .d.ts files from lib/
111
114
  const additionalFiles = {};
112
- for (const file of allFiles) {
115
+ const libAllFiles = existsSync(libComponentDir) ? getAllFilesRecursively(libComponentDir) : [];
116
+
117
+ for (const file of libAllFiles) {
113
118
  // Skip main files we already extracted
114
119
  if (
115
- file === `${componentName}.tsx` ||
116
- file === `${componentName}.ts` ||
117
- file === `${componentName}.stories.tsx` ||
118
- file === `${componentName}.stories.ts` ||
119
- file === `${componentName}.module.css` ||
120
- file === 'index.ts' ||
121
- file.endsWith('.module.css') ||
122
- file.endsWith('.stories.tsx') ||
123
- file.endsWith('.stories.ts') ||
124
- file.endsWith('.stories.module.css')
120
+ file === `${componentName}.d.ts` ||
121
+ file === 'index.d.ts' ||
122
+ !file.endsWith('.d.ts') ||
123
+ file.endsWith('.d.ts.map')
125
124
  ) {
126
125
  continue;
127
126
  }
128
127
 
129
- // Only include .tsx and .ts files (sub-components)
130
- if (file.endsWith('.tsx') || file.endsWith('.ts')) {
131
- const fullPath = join(componentDir, file);
132
- const content = safeReadFile(fullPath);
133
- if (content) {
134
- additionalFiles[file] = {
135
- path: file,
136
- content: content
137
- };
138
- }
128
+ // Include .d.ts files for sub-components
129
+ const fullPath = join(libComponentDir, file);
130
+ const content = safeReadFile(fullPath);
131
+ if (content) {
132
+ additionalFiles[file] = {
133
+ path: file,
134
+ content: content
135
+ };
139
136
  }
140
137
  }
141
138
 
@@ -143,10 +140,10 @@ function buildComponentsData() {
143
140
  name: componentName,
144
141
  path: `src/components/${componentName}`,
145
142
  files: {
146
- main: mainContent ? { path: `${componentName}.tsx`, content: mainContent } : null,
143
+ main: mainContent ? { path: `${componentName}.d.ts`, content: mainContent } : null,
147
144
  story: storyContent ? { path: `${componentName}.stories.tsx`, content: storyContent } : null,
148
145
  css: cssContent ? { path: `${componentName}.module.css`, content: cssContent } : null,
149
- index: indexContent ? { path: 'index.ts', content: indexContent } : null,
146
+ index: indexContent ? { path: 'index.d.ts', content: indexContent } : null,
150
147
  additional: additionalFiles,
151
148
  },
152
149
  allFiles,
@@ -159,48 +156,50 @@ function buildComponentsData() {
159
156
 
160
157
  /**
161
158
  * Extract all hooks
159
+ * For main hook files, we use .d.ts files from lib/
160
+ * to avoid exposing source code in the public npm package
162
161
  */
163
162
  function buildHooksData() {
164
163
  console.log('šŸŖ Extracting hooks...');
165
- const hooksPath = join(DESIGN_SYSTEM_PATH, 'src/hooks');
164
+ const srcHooksPath = join(DESIGN_SYSTEM_PATH, 'src/hooks');
165
+ const libHooksPath = join(DESIGN_SYSTEM_PATH, 'lib/hooks');
166
166
  const hooks = {};
167
167
 
168
- if (!existsSync(hooksPath)) {
168
+ if (!existsSync(srcHooksPath)) {
169
169
  console.warn('āš ļø Hooks path not found');
170
170
  return hooks;
171
171
  }
172
172
 
173
- const hookDirs = getDirectories(hooksPath).filter(name => name !== 'index.ts');
173
+ const hookDirs = getDirectories(srcHooksPath).filter(name => name !== 'index.ts');
174
174
 
175
175
  for (const hookName of hookDirs) {
176
- const hookDir = join(hooksPath, hookName);
177
-
178
- // Read main hook file
179
- const mainTs = join(hookDir, `${hookName}.ts`);
180
- const mainTsx = join(hookDir, `${hookName}.tsx`);
176
+ const srcHookDir = join(srcHooksPath, hookName);
177
+ const libHookDir = join(libHooksPath, hookName);
181
178
 
182
- // Read story file
183
- const storyTsx = join(hookDir, `${hookName}.stories.tsx`);
184
- const storyTs = join(hookDir, `${hookName}.stories.ts`);
179
+ // Read main hook .d.ts file from lib/ (type definitions only)
180
+ const mainDts = join(libHookDir, `${hookName}.d.ts`);
181
+ const mainContent = safeReadFile(mainDts);
185
182
 
186
- // Read index file
187
- const indexFile = join(hookDir, 'index.ts');
188
-
189
- const mainContent = safeReadFile(mainTs) || safeReadFile(mainTsx);
183
+ // Read story file (keep from src - useful for usage examples)
184
+ const storyTsx = join(srcHookDir, `${hookName}.stories.tsx`);
185
+ const storyTs = join(srcHookDir, `${hookName}.stories.ts`);
190
186
  const storyContent = safeReadFile(storyTsx) || safeReadFile(storyTs);
191
- const indexContent = safeReadFile(indexFile);
192
187
 
193
- const allFiles = existsSync(hookDir)
194
- ? readdirSync(hookDir).filter(f => !f.startsWith('.'))
188
+ // Read index .d.ts file from lib/
189
+ const indexDts = join(libHookDir, 'index.d.ts');
190
+ const indexContent = safeReadFile(indexDts);
191
+
192
+ const allFiles = existsSync(srcHookDir)
193
+ ? readdirSync(srcHookDir).filter(f => !f.startsWith('.'))
195
194
  : [];
196
195
 
197
196
  hooks[hookName] = {
198
197
  name: hookName,
199
198
  path: `src/hooks/${hookName}`,
200
199
  files: {
201
- main: mainContent ? { path: `${hookName}.ts`, content: mainContent } : null,
200
+ main: mainContent ? { path: `${hookName}.d.ts`, content: mainContent } : null,
202
201
  story: storyContent ? { path: `${hookName}.stories.tsx`, content: storyContent } : null,
203
- index: indexContent ? { path: 'index.ts', content: indexContent } : null,
202
+ index: indexContent ? { path: 'index.d.ts', content: indexContent } : null,
204
203
  },
205
204
  allFiles,
206
205
  };
@@ -254,30 +253,37 @@ function buildTokensData() {
254
253
 
255
254
  /**
256
255
  * Extract all utils
256
+ * For util files, we use .d.ts files from lib/
257
+ * to avoid exposing source code in the public npm package
257
258
  */
258
259
  function buildUtilsData() {
259
260
  console.log('šŸ”§ Extracting utils...');
260
- const utilsPath = join(DESIGN_SYSTEM_PATH, 'src/utils');
261
+ const srcUtilsPath = join(DESIGN_SYSTEM_PATH, 'src/utils');
262
+ const libUtilsPath = join(DESIGN_SYSTEM_PATH, 'lib/utils');
261
263
  const utils = {};
262
264
 
263
- if (!existsSync(utilsPath)) {
265
+ if (!existsSync(srcUtilsPath)) {
264
266
  console.warn('āš ļø Utils path not found');
265
267
  return utils;
266
268
  }
267
269
 
268
- const utilDirs = getDirectories(utilsPath);
270
+ const utilDirs = getDirectories(srcUtilsPath);
269
271
 
270
272
  for (const utilName of utilDirs) {
271
- const utilDir = join(utilsPath, utilName);
273
+ const srcUtilDir = join(srcUtilsPath, utilName);
274
+ const libUtilDir = join(libUtilsPath, utilName);
272
275
 
273
- // Get all files in the util directory
274
- const allFiles = getAllFilesRecursively(utilDir);
276
+ // Get all files in the util directory (from src for reference)
277
+ const allFiles = getAllFilesRecursively(srcUtilDir);
275
278
 
276
- // Read all TypeScript files
279
+ // Read all .d.ts files from lib/
277
280
  const files = {};
278
- for (const file of allFiles) {
279
- if ((file.endsWith('.ts') || file.endsWith('.tsx')) && !file.endsWith('.d.ts')) {
280
- const fullPath = join(utilDir, file);
281
+ const libAllFiles = existsSync(libUtilDir) ? getAllFilesRecursively(libUtilDir) : [];
282
+
283
+ for (const file of libAllFiles) {
284
+ // Only include .d.ts files (skip .js and .d.ts.map)
285
+ if (file.endsWith('.d.ts') && !file.endsWith('.d.ts.map')) {
286
+ const fullPath = join(libUtilDir, file);
281
287
  const content = safeReadFile(fullPath);
282
288
  if (content) {
283
289
  files[file] = {
package/mcp/index.js CHANGED
@@ -11,7 +11,7 @@
11
11
  * "mcpServers": {
12
12
  * "genesis-design-system": {
13
13
  * "command": "npx",
14
- * "args": ["-y", "@spaced-out/genesis-mcp-server@latest"]
14
+ * "args": ["-y", "@spaced-out/genesis-mcp@latest"]
15
15
  * }
16
16
  * }
17
17
  * }
package/mcp/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "@spaced-out/genesis-mcp-server",
3
- "version": "1.0.15",
2
+ "name": "@spaced-out/genesis-mcp",
3
+ "version": "1.0.0",
4
4
  "description": "MCP server for Genesis UI Design System - provides AI assistants with access to components, hooks, and design tokens",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -55,7 +55,7 @@ try {
55
55
  console.log('\nšŸ“ Next steps:');
56
56
  console.log(' 1. Update package.json version if needed');
57
57
  console.log(' 2. Publish: npm publish');
58
- console.log(' 3. Users can run: npx @spaced-out/genesis-mcp-server@latest');
58
+ console.log(' 3. Users can run: npx @spaced-out/genesis-mcp@latest');
59
59
  console.log('\nšŸŽ‰ MCP server is ready to use!\n');
60
60
 
61
61
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.5.34-beta.2",
3
+ "version": "0.5.35",
4
4
  "description": "Sense UI components library",
5
5
  "author": {
6
6
  "name": "Spaced Out"