@schandlergarcia/sf-web-components 1.9.7 → 1.9.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schandlergarcia/sf-web-components",
3
- "version": "1.9.7",
3
+ "version": "1.9.9",
4
4
  "description": "Reusable Salesforce web components library with Tailwind CSS v4 and shadcn/ui",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -65,7 +65,7 @@
65
65
  "world-atlas": "^2.0.0"
66
66
  },
67
67
  "dependencies": {
68
- "@schandlergarcia/sf-web-components": "^1.9.6",
68
+ "@schandlergarcia/sf-web-components": "^1.9.7",
69
69
  "class-variance-authority": "^0.7.1",
70
70
  "clsx": "^2.1.1",
71
71
  "glob": "^13.0.6",
@@ -198,34 +198,19 @@ if (fs.existsSync(templatesDir)) {
198
198
  }
199
199
  }
200
200
 
201
- // Update routes.tsx to use the installed templates
201
+ // Copy routes.tsx template with full configuration
202
+ const routesTemplatePath = path.join(packageRoot, 'src/templates/config/routes.tsx.template');
202
203
  const routesPath = path.join(cwd, 'src/routes.tsx');
203
- if (fs.existsSync(routesPath) && installedTemplates.length > 0) {
204
- console.log('\nšŸ”„ Updating routes.tsx...\n');
205
204
 
206
- try {
207
- let routesContent = fs.readFileSync(routesPath, 'utf-8');
208
- let routesUpdated = false;
209
-
210
- for (const pageName of installedTemplates) {
211
- // Match import statements like: import Home from './features/.../Home' or import Home from './pages/Home'
212
- const importRegex = new RegExp(`import ${pageName} from ['"]\\./(features|pages)/[^'"]+/${pageName}['"];?`, 'g');
213
-
214
- if (importRegex.test(routesContent)) {
215
- routesContent = routesContent.replace(
216
- importRegex,
217
- `import ${pageName} from './pages/${pageName}';`
218
- );
219
- routesUpdated = true;
220
- console.log(` āœ“ Updated ${pageName} import`);
221
- }
222
- }
205
+ if (fs.existsSync(routesTemplatePath) && fs.existsSync(path.join(cwd, 'src'))) {
206
+ console.log('\nšŸ”„ Installing routes configuration...\n');
223
207
 
224
- if (routesUpdated) {
225
- fs.writeFileSync(routesPath, routesContent, 'utf-8');
226
- }
208
+ try {
209
+ const routesContent = fs.readFileSync(routesTemplatePath, 'utf-8');
210
+ fs.writeFileSync(routesPath, routesContent, 'utf-8');
211
+ console.log(' āœ“ Installed complete routes.tsx with Account search and detail pages');
227
212
  } catch (error) {
228
- console.error(` āœ— Failed to update routes.tsx: ${error.message}`);
213
+ console.error(` āœ— Failed to install routes.tsx: ${error.message}`);
229
214
  }
230
215
  }
231
216
 
@@ -0,0 +1,33 @@
1
+ import type { RouteObject } from 'react-router';
2
+ import AppLayout from './appLayout';
3
+ import Home from './pages/Home';
4
+ import AccountSearch from './features/object-search/__examples__/pages/AccountSearch';
5
+ import AccountObjectDetailPage from './features/object-search/__examples__/pages/AccountObjectDetailPage';
6
+ import NotFound from './pages/NotFound';
7
+
8
+ export const routes: RouteObject[] = [
9
+ {
10
+ path: "/",
11
+ element: <AppLayout />,
12
+ children: [
13
+ {
14
+ index: true,
15
+ element: <Home />,
16
+ handle: { showInNavigation: true, label: "Home" }
17
+ },
18
+ {
19
+ path: 'accounts',
20
+ element: <AccountSearch />,
21
+ handle: { showInNavigation: true, label: "Accounts" }
22
+ },
23
+ {
24
+ path: 'accounts/:recordId',
25
+ element: <AccountObjectDetailPage />
26
+ },
27
+ {
28
+ path: '*',
29
+ element: <NotFound />
30
+ }
31
+ ]
32
+ }
33
+ ];