create-tsrouter-app 0.3.0-alpha.5 → 0.3.0-alpha.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.
Files changed (67) hide show
  1. package/README.md +2 -2
  2. package/dist/add-ons.js +8 -4
  3. package/dist/create-app.js +22 -14
  4. package/dist/options.js +5 -10
  5. package/dist/package-manager.js +1 -0
  6. package/package.json +1 -1
  7. package/src/add-ons.ts +10 -2
  8. package/src/create-app.ts +25 -17
  9. package/src/options.ts +10 -13
  10. package/src/package-manager.ts +1 -0
  11. package/templates/react/add-on/clerk/info.json +1 -0
  12. package/templates/react/add-on/convex/info.json +1 -0
  13. package/templates/react/add-on/form/info.json +1 -0
  14. package/templates/react/add-on/module-federation/assets/module-federation.config.js.ejs +31 -0
  15. package/templates/react/add-on/module-federation/assets/src/demo-mf-component.tsx +3 -0
  16. package/templates/react/add-on/module-federation/assets/src/demo-mf-self-contained.tsx +11 -0
  17. package/templates/react/add-on/module-federation/info.json +7 -0
  18. package/templates/react/add-on/module-federation/package.json +5 -0
  19. package/templates/react/add-on/netlify/info.json +2 -1
  20. package/templates/react/add-on/sentry/assets/src/app/global-middleware.ts +25 -0
  21. package/templates/react/add-on/sentry/assets/src/routes/demo.sentry.testing.tsx +480 -0
  22. package/templates/react/add-on/sentry/info.json +3 -2
  23. package/templates/react/add-on/sentry/package.json +3 -1
  24. package/templates/react/add-on/shadcn/info.json +1 -0
  25. package/templates/react/add-on/start/info.json +1 -0
  26. package/templates/react/add-on/store/info.json +1 -0
  27. package/templates/react/add-on/tanstack-query/info.json +1 -0
  28. package/templates/react/base/src/App.tsx.ejs +1 -1
  29. package/templates/react/base/vite.config.js.ejs +5 -4
  30. package/templates/react/example/tanchat/README.md +37 -0
  31. package/templates/react/example/tanchat/assets/_dot_env.local.append +2 -0
  32. package/templates/react/example/tanchat/assets/src/components/demo.SettingsDialog.tsx +148 -0
  33. package/templates/react/example/tanchat/assets/src/demo.index.css +220 -0
  34. package/templates/react/example/tanchat/assets/src/routes/example.chat.tsx.ejs +375 -0
  35. package/templates/react/example/tanchat/assets/src/store/demo.hooks.ts +21 -0
  36. package/templates/react/example/tanchat/assets/src/store/demo.store.ts +133 -0
  37. package/templates/react/example/tanchat/assets/src/utils/demo.ai.ts +108 -0
  38. package/templates/react/example/tanchat/info.json +15 -0
  39. package/templates/react/example/tanchat/package.json +10 -0
  40. package/templates/solid/add-on/form/info.json +1 -0
  41. package/templates/solid/add-on/module-federation/assets/module-federation.config.js.ejs +27 -0
  42. package/templates/solid/add-on/module-federation/assets/src/demo-mf-component.tsx +3 -0
  43. package/templates/solid/add-on/module-federation/assets/src/demo-mf-self-contained.tsx +9 -0
  44. package/templates/solid/add-on/module-federation/info.json +7 -0
  45. package/templates/solid/add-on/module-federation/package.json +5 -0
  46. package/templates/solid/add-on/sentry/info.json +1 -0
  47. package/templates/solid/add-on/solid-ui/info.json +1 -0
  48. package/templates/solid/add-on/store/info.json +1 -0
  49. package/templates/solid/add-on/tanstack-query/info.json +1 -0
  50. package/templates/solid/base/vite.config.js.ejs +6 -6
  51. package/templates/react/add-on/sentry/assets/src/routes/demo.sentry.bad-server-func.tsx +0 -29
  52. package/templates/react/example/ai-chat/assets/.env.local.append +0 -2
  53. package/templates/react/example/ai-chat/assets/src/routes/example.ai-chat.tsx.ejs +0 -81
  54. package/templates/react/example/ai-chat/info.json +0 -27
  55. package/templates/react/example/ai-chat/package.json +0 -1
  56. /package/templates/react/add-on/clerk/assets/{.env.local.append → _dot_env.local.append} +0 -0
  57. /package/templates/react/add-on/convex/assets/{.cursorrules.append → _dot_cursorrules.append} +0 -0
  58. /package/templates/react/add-on/convex/assets/{.env.local.append → _dot_env.local.append} +0 -0
  59. /package/templates/react/add-on/sentry/assets/{.cursorrules → _dot_cursorrules.append} +0 -0
  60. /package/templates/react/add-on/sentry/assets/{.env.local.append → _dot_env.local.append} +0 -0
  61. /package/templates/react/base/{gitignore → _dot_gitignore} +0 -0
  62. /package/templates/react/base/{.vscode → _dot_vscode}/settings.json +0 -0
  63. /package/templates/solid/add-on/sentry/assets/{.cursorrules → _dot_cursorrules.append} +0 -0
  64. /package/templates/solid/add-on/sentry/assets/{.env.local.append → _dot_env.local.append} +0 -0
  65. /package/templates/solid/base/{.cursorrules → _dot_cursorrules.append} +0 -0
  66. /package/templates/solid/base/{gitignore → _dot_gitignore} +0 -0
  67. /package/templates/solid/base/{.vscode → _dot_vscode}/settings.json +0 -0
package/README.md CHANGED
@@ -43,7 +43,7 @@ Available options:
43
43
 
44
44
  - `--template <type>`: Choose between `file-router`, `typescript`, or `javascript`
45
45
  - `--tailwind`: Enable Tailwind CSS
46
- - `--package-manager`: Specify your preferred package manager (`npm`, `yarn`, `pnpm`, or `bun`)
46
+ - `--package-manager`: Specify your preferred package manager (`npm`, `yarn`, `pnpm`, `bun`, or `deno`)
47
47
  - `--no-git`: Do not initialize a git repository
48
48
 
49
49
  When using flags, the CLI will display which options were provided and only prompt for the remaining choices.
@@ -88,7 +88,7 @@ Enable Tailwind CSS either through the interactive CLI or by adding the `--tailw
88
88
 
89
89
  ### Package Manager
90
90
 
91
- Choose your preferred package manager (`npm`, `bun`, `yarn`, or `pnpm`) either through the interactive CLI or using the `--package-manager` flag.
91
+ Choose your preferred package manager (`npm`, `bun`, `yarn`, `pnpm`, or `deno`) either through the interactive CLI or using the `--package-manager` flag.
92
92
 
93
93
  Extensive documentation on using the TanStack Router, migrating to a File Base Routing approach, as well as integrating [@tanstack/react-query](https://tanstack.com/query/latest) and [@tanstack/store](https://tanstack.com/store/latest) can be found in the generated `README.md` for your project.
94
94
 
package/dist/add-ons.js CHANGED
@@ -5,7 +5,7 @@ import { fileURLToPath } from 'node:url';
5
5
  function isDirectory(path) {
6
6
  return statSync(path).isDirectory();
7
7
  }
8
- export async function getAllAddOns(framework) {
8
+ export async function getAllAddOns(framework, template) {
9
9
  const addOns = [];
10
10
  for (const type of ['add-on', 'example']) {
11
11
  const addOnsBase = fileURLToPath(new URL(`../templates/${framework}/${type}`, import.meta.url));
@@ -15,6 +15,10 @@ export async function getAllAddOns(framework) {
15
15
  for (const dir of await readdirSync(addOnsBase).filter((file) => isDirectory(resolve(addOnsBase, file)))) {
16
16
  const filePath = resolve(addOnsBase, dir, 'info.json');
17
17
  const fileContent = await readFile(filePath, 'utf-8');
18
+ const info = JSON.parse(fileContent);
19
+ if (!info.templates.includes(template)) {
20
+ continue;
21
+ }
18
22
  let packageAdditions = {};
19
23
  if (existsSync(resolve(addOnsBase, dir, 'package.json'))) {
20
24
  packageAdditions = JSON.parse(await readFile(resolve(addOnsBase, dir, 'package.json'), 'utf-8'));
@@ -24,9 +28,9 @@ export async function getAllAddOns(framework) {
24
28
  readme = await readFile(resolve(addOnsBase, dir, 'README.md'), 'utf-8');
25
29
  }
26
30
  addOns.push({
31
+ ...info,
27
32
  id: dir,
28
33
  type,
29
- ...JSON.parse(fileContent),
30
34
  directory: resolve(addOnsBase, dir),
31
35
  packageAdditions,
32
36
  readme,
@@ -36,9 +40,9 @@ export async function getAllAddOns(framework) {
36
40
  return addOns;
37
41
  }
38
42
  // Turn the list of chosen add-on IDs into a final list of add-ons by resolving dependencies
39
- export async function finalizeAddOns(framework, chosenAddOnIDs) {
43
+ export async function finalizeAddOns(framework, template, chosenAddOnIDs) {
40
44
  const finalAddOnIDs = new Set(chosenAddOnIDs);
41
- const addOns = await getAllAddOns(framework);
45
+ const addOns = await getAllAddOns(framework, template);
42
46
  for (const addOnID of finalAddOnIDs) {
43
47
  const addOn = addOns.find((a) => a.id === addOnID);
44
48
  if (!addOn) {
@@ -124,22 +124,30 @@ async function copyFilesRecursively(source, target, copyFile, templateFile) {
124
124
  }
125
125
  }
126
126
  else {
127
- if (source.endsWith('.ejs')) {
128
- const targetPath = target.replace('.ejs', '');
129
- await mkdir(dirname(targetPath), {
130
- recursive: true,
131
- });
127
+ let targetFile = basename(target).replace(/_dot_/, '.');
128
+ let isTemplate = false;
129
+ if (targetFile.endsWith('.ejs')) {
130
+ targetFile = targetFile.replace('.ejs', '');
131
+ isTemplate = true;
132
+ }
133
+ let isAppend = false;
134
+ if (targetFile.endsWith('.append')) {
135
+ targetFile = targetFile.replace('.append', '');
136
+ isAppend = true;
137
+ }
138
+ const targetPath = resolve(dirname(target), targetFile);
139
+ await mkdir(dirname(targetPath), {
140
+ recursive: true,
141
+ });
142
+ if (isTemplate) {
132
143
  await templateFile(source, targetPath);
133
144
  }
134
145
  else {
135
- await mkdir(dirname(target), {
136
- recursive: true,
137
- });
138
- if (source.endsWith('.append')) {
139
- await appendFile(target.replace('.append', ''), (await readFile(source)).toString());
146
+ if (isAppend) {
147
+ await appendFile(targetPath, (await readFile(source)).toString());
140
148
  }
141
149
  else {
142
- await copyFile(source, target);
150
+ await copyFile(source, targetPath);
143
151
  }
144
152
  }
145
153
  }
@@ -160,7 +168,7 @@ export async function createApp(options) {
160
168
  await mkdir(targetDir, { recursive: true });
161
169
  // Setup the .vscode directory
162
170
  await mkdir(resolve(targetDir, '.vscode'), { recursive: true });
163
- await copyFile(resolve(templateDirBase, '.vscode/settings.json'), resolve(targetDir, '.vscode/settings.json'));
171
+ await copyFile(resolve(templateDirBase, '_dot_vscode/settings.json'), resolve(targetDir, '.vscode/settings.json'));
164
172
  // Fill the public directory
165
173
  await mkdir(resolve(targetDir, 'public'), { recursive: true });
166
174
  copyFiles(templateDirBase, [
@@ -267,7 +275,7 @@ export async function createApp(options) {
267
275
  }
268
276
  }
269
277
  // Add .gitignore
270
- await copyFile(resolve(templateDirBase, 'gitignore'), resolve(targetDir, '.gitignore'));
278
+ await copyFile(resolve(templateDirBase, '_dot_gitignore'), resolve(targetDir, '.gitignore'));
271
279
  // Create the README.md
272
280
  await templateFile(templateDirBase, 'README.md.ejs');
273
281
  // Install dependencies
@@ -286,7 +294,7 @@ export async function createApp(options) {
286
294
 
287
295
  Use the following commands to start your app:
288
296
  % cd ${options.projectName}
289
- % ${options.packageManager} ${isAddOnEnabled('start') ? 'dev' : 'start'}
297
+ % ${options.packageManager === 'deno' ? 'deno start' : options.packageManager} ${isAddOnEnabled('start') ? 'dev' : 'start'}
290
298
 
291
299
  Please read README.md for more information on testing, styling, adding routes, react-query, etc.
292
300
  `);
package/dist/options.js CHANGED
@@ -173,10 +173,10 @@ export async function promptForOptions(cliOptions) {
173
173
  options.packageManager = cliOptions.packageManager;
174
174
  }
175
175
  // Select any add-ons
176
- const allAddOns = await getAllAddOns(options.framework);
176
+ const allAddOns = await getAllAddOns(options.framework, options.mode);
177
177
  const addOns = allAddOns.filter((addOn) => addOn.type === 'add-on');
178
178
  let selectedAddOns = [];
179
- if (options.mode === FILE_ROUTER && cliOptions.addOns && addOns.length > 0) {
179
+ if (options.typescript && cliOptions.addOns && addOns.length > 0) {
180
180
  const value = await multiselect({
181
181
  message: 'What add-ons would you like for your project:',
182
182
  options: addOns.map((addOn) => ({
@@ -186,7 +186,7 @@ export async function promptForOptions(cliOptions) {
186
186
  })),
187
187
  required: false,
188
188
  });
189
- if (isCancel(selectedAddOns)) {
189
+ if (isCancel(value)) {
190
190
  cancel('Operation cancelled.');
191
191
  process.exit(0);
192
192
  }
@@ -195,9 +195,7 @@ export async function promptForOptions(cliOptions) {
195
195
  // Select any examples
196
196
  const examples = allAddOns.filter((addOn) => addOn.type === 'example');
197
197
  let selectedExamples = [];
198
- if (options.mode === FILE_ROUTER &&
199
- cliOptions.addOns &&
200
- examples.length > 0) {
198
+ if (options.typescript && cliOptions.addOns && examples.length > 0) {
201
199
  const value = await multiselect({
202
200
  message: 'Would you like any examples?',
203
201
  options: examples.map((addOn) => ({
@@ -214,10 +212,7 @@ export async function promptForOptions(cliOptions) {
214
212
  selectedExamples = value;
215
213
  }
216
214
  if (selectedAddOns.length > 0 || selectedExamples.length > 0) {
217
- options.chosenAddOns = await finalizeAddOns(options.framework, [
218
- ...selectedAddOns,
219
- ...selectedExamples,
220
- ]);
215
+ options.chosenAddOns = await finalizeAddOns(options.framework, options.mode, [...selectedAddOns, ...selectedExamples]);
221
216
  options.tailwind = true;
222
217
  }
223
218
  else {
@@ -3,6 +3,7 @@ export const SUPPORTED_PACKAGE_MANAGERS = [
3
3
  'yarn',
4
4
  'pnpm',
5
5
  'bun',
6
+ 'deno',
6
7
  ];
7
8
  export const DEFAULT_PACKAGE_MANAGER = 'npm';
8
9
  export function getPackageManager() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-tsrouter-app",
3
- "version": "0.3.0-alpha.5",
3
+ "version": "0.3.0-alpha.7",
4
4
  "description": "Tanstack Application Builder",
5
5
  "bin": "./dist/index.js",
6
6
  "type": "module",
package/src/add-ons.ts CHANGED
@@ -34,6 +34,7 @@ export type AddOn = {
34
34
  name: string
35
35
  description: string
36
36
  link: string
37
+ templates: Array<string>
37
38
  main?: Array<{
38
39
  imports: Array<string>
39
40
  initialize: Array<string>
@@ -78,6 +79,7 @@ function isDirectory(path: string): boolean {
78
79
 
79
80
  export async function getAllAddOns(
80
81
  framework: Framework,
82
+ template: string,
81
83
  ): Promise<Array<AddOn>> {
82
84
  const addOns: Array<AddOn> = []
83
85
 
@@ -95,6 +97,11 @@ export async function getAllAddOns(
95
97
  )) {
96
98
  const filePath = resolve(addOnsBase, dir, 'info.json')
97
99
  const fileContent = await readFile(filePath, 'utf-8')
100
+ const info = JSON.parse(fileContent)
101
+
102
+ if (!info.templates.includes(template)) {
103
+ continue
104
+ }
98
105
 
99
106
  let packageAdditions: Record<string, string> = {}
100
107
  if (existsSync(resolve(addOnsBase, dir, 'package.json'))) {
@@ -109,9 +116,9 @@ export async function getAllAddOns(
109
116
  }
110
117
 
111
118
  addOns.push({
119
+ ...info,
112
120
  id: dir,
113
121
  type,
114
- ...JSON.parse(fileContent),
115
122
  directory: resolve(addOnsBase, dir),
116
123
  packageAdditions,
117
124
  readme,
@@ -125,11 +132,12 @@ export async function getAllAddOns(
125
132
  // Turn the list of chosen add-on IDs into a final list of add-ons by resolving dependencies
126
133
  export async function finalizeAddOns(
127
134
  framework: Framework,
135
+ template: string,
128
136
  chosenAddOnIDs: Array<string>,
129
137
  ): Promise<Array<AddOn>> {
130
138
  const finalAddOnIDs = new Set(chosenAddOnIDs)
131
139
 
132
- const addOns = await getAllAddOns(framework)
140
+ const addOns = await getAllAddOns(framework, template)
133
141
 
134
142
  for (const addOnID of finalAddOnIDs) {
135
143
  const addOn = addOns.find((a) => a.id === addOnID)
package/src/create-app.ts CHANGED
@@ -195,23 +195,31 @@ async function copyFilesRecursively(
195
195
  )
196
196
  }
197
197
  } else {
198
- if (source.endsWith('.ejs')) {
199
- const targetPath = target.replace('.ejs', '')
200
- await mkdir(dirname(targetPath), {
201
- recursive: true,
202
- })
198
+ let targetFile = basename(target).replace(/_dot_/, '.')
199
+ let isTemplate = false
200
+ if (targetFile.endsWith('.ejs')) {
201
+ targetFile = targetFile.replace('.ejs', '')
202
+ isTemplate = true
203
+ }
204
+ let isAppend = false
205
+ if (targetFile.endsWith('.append')) {
206
+ targetFile = targetFile.replace('.append', '')
207
+ isAppend = true
208
+ }
209
+
210
+ const targetPath = resolve(dirname(target), targetFile)
211
+
212
+ await mkdir(dirname(targetPath), {
213
+ recursive: true,
214
+ })
215
+
216
+ if (isTemplate) {
203
217
  await templateFile(source, targetPath)
204
218
  } else {
205
- await mkdir(dirname(target), {
206
- recursive: true,
207
- })
208
- if (source.endsWith('.append')) {
209
- await appendFile(
210
- target.replace('.append', ''),
211
- (await readFile(source)).toString(),
212
- )
219
+ if (isAppend) {
220
+ await appendFile(targetPath, (await readFile(source)).toString())
213
221
  } else {
214
- await copyFile(source, target)
222
+ await copyFile(source, targetPath)
215
223
  }
216
224
  }
217
225
  }
@@ -252,7 +260,7 @@ export async function createApp(options: Required<Options>) {
252
260
  // Setup the .vscode directory
253
261
  await mkdir(resolve(targetDir, '.vscode'), { recursive: true })
254
262
  await copyFile(
255
- resolve(templateDirBase, '.vscode/settings.json'),
263
+ resolve(templateDirBase, '_dot_vscode/settings.json'),
256
264
  resolve(targetDir, '.vscode/settings.json'),
257
265
  )
258
266
 
@@ -427,7 +435,7 @@ export async function createApp(options: Required<Options>) {
427
435
 
428
436
  // Add .gitignore
429
437
  await copyFile(
430
- resolve(templateDirBase, 'gitignore'),
438
+ resolve(templateDirBase, '_dot_gitignore'),
431
439
  resolve(targetDir, '.gitignore'),
432
440
  )
433
441
 
@@ -453,7 +461,7 @@ export async function createApp(options: Required<Options>) {
453
461
 
454
462
  Use the following commands to start your app:
455
463
  % cd ${options.projectName}
456
- % ${options.packageManager} ${isAddOnEnabled('start') ? 'dev' : 'start'}
464
+ % ${options.packageManager === 'deno' ? 'deno start' : options.packageManager} ${isAddOnEnabled('start') ? 'dev' : 'start'}
457
465
 
458
466
  Please read README.md for more information on testing, styling, adding routes, react-query, etc.
459
467
  `)
package/src/options.ts CHANGED
@@ -203,10 +203,10 @@ export async function promptForOptions(
203
203
  }
204
204
 
205
205
  // Select any add-ons
206
- const allAddOns = await getAllAddOns(options.framework)
206
+ const allAddOns = await getAllAddOns(options.framework, options.mode)
207
207
  const addOns = allAddOns.filter((addOn) => addOn.type === 'add-on')
208
208
  let selectedAddOns: Array<string> = []
209
- if (options.mode === FILE_ROUTER && cliOptions.addOns && addOns.length > 0) {
209
+ if (options.typescript && cliOptions.addOns && addOns.length > 0) {
210
210
  const value = await multiselect({
211
211
  message: 'What add-ons would you like for your project:',
212
212
  options: addOns.map((addOn) => ({
@@ -217,21 +217,17 @@ export async function promptForOptions(
217
217
  required: false,
218
218
  })
219
219
 
220
- if (isCancel(selectedAddOns)) {
220
+ if (isCancel(value)) {
221
221
  cancel('Operation cancelled.')
222
222
  process.exit(0)
223
223
  }
224
- selectedAddOns = value as Array<string>
224
+ selectedAddOns = value
225
225
  }
226
226
 
227
227
  // Select any examples
228
228
  const examples = allAddOns.filter((addOn) => addOn.type === 'example')
229
229
  let selectedExamples: Array<string> = []
230
- if (
231
- options.mode === FILE_ROUTER &&
232
- cliOptions.addOns &&
233
- examples.length > 0
234
- ) {
230
+ if (options.typescript && cliOptions.addOns && examples.length > 0) {
235
231
  const value = await multiselect({
236
232
  message: 'Would you like any examples?',
237
233
  options: examples.map((addOn) => ({
@@ -250,10 +246,11 @@ export async function promptForOptions(
250
246
  }
251
247
 
252
248
  if (selectedAddOns.length > 0 || selectedExamples.length > 0) {
253
- options.chosenAddOns = await finalizeAddOns(options.framework, [
254
- ...selectedAddOns,
255
- ...selectedExamples,
256
- ])
249
+ options.chosenAddOns = await finalizeAddOns(
250
+ options.framework,
251
+ options.mode,
252
+ [...selectedAddOns, ...selectedExamples],
253
+ )
257
254
  options.tailwind = true
258
255
  } else {
259
256
  options.chosenAddOns = []
@@ -3,6 +3,7 @@ export const SUPPORTED_PACKAGE_MANAGERS = [
3
3
  'yarn',
4
4
  'pnpm',
5
5
  'bun',
6
+ 'deno',
6
7
  ] as const
7
8
  export type PackageManager = (typeof SUPPORTED_PACKAGE_MANAGERS)[number]
8
9
  export const DEFAULT_PACKAGE_MANAGER: PackageManager = 'npm'
@@ -2,6 +2,7 @@
2
2
  "name": "Clerk",
3
3
  "description": "Add Clerk authentication to your application.",
4
4
  "phase": "add-on",
5
+ "templates": ["file-router"],
5
6
  "link": "https://clerk.com",
6
7
  "main": {
7
8
  "imports": ["import { ClerkProvider } from '@clerk/clerk-react'"],
@@ -3,6 +3,7 @@
3
3
  "description": "Add the Convex database to your application.",
4
4
  "link": "https://convex.dev",
5
5
  "phase": "add-on",
6
+ "templates": ["file-router"],
6
7
  "main": {
7
8
  "imports": [
8
9
  "import { ConvexProvider } from 'convex/react'",
@@ -2,6 +2,7 @@
2
2
  "name": "Form",
3
3
  "description": "TansStack Form",
4
4
  "phase": "add-on",
5
+ "templates": ["file-router"],
5
6
  "link": "https://tanstack.com/form/latest",
6
7
  "routes": [
7
8
  {
@@ -0,0 +1,31 @@
1
+ import packageJSON from './package.json'
2
+
3
+ function remoteConfig(name, url) {
4
+ return {
5
+ type: 'module',
6
+ name,
7
+ entry: url,
8
+ entryGlobalName: 'remote',
9
+ shareScope: 'default',
10
+ }
11
+ }
12
+
13
+ export default {
14
+ filename: 'remoteEntry.js',
15
+ name: '<%= projectName %>',
16
+ exposes: {
17
+ './DemoMfComponent': './src/demo-mf-component.tsx',
18
+ './DemoMfSelfContained': './src/demo-mf-self-contained.tsx',
19
+ },
20
+ remotes: {},
21
+ shared: {
22
+ react: {
23
+ singleton: true,
24
+ requiredVersion: packageJSON.dependencies.react,
25
+ },
26
+ 'react-dom': {
27
+ singleton: true,
28
+ requiredVersion: packageJSON.dependencies['react-dom'],
29
+ },
30
+ },
31
+ }
@@ -0,0 +1,3 @@
1
+ export function DemoMfComponent() {
2
+ return <div>Demo Mf Component</div>
3
+ }
@@ -0,0 +1,11 @@
1
+ import React from 'react'
2
+ import ReactDOM from 'react-dom/client'
3
+
4
+ function App() {
5
+ return <div>Hello from self-contained module federation</div>
6
+ }
7
+
8
+ export function DemoMfSelfContained(rootElement: HTMLElement) {
9
+ const root = ReactDOM.createRoot(rootElement)
10
+ root.render(<App />)
11
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "Module Federation",
3
+ "description": "Module Federation",
4
+ "phase": "add-on",
5
+ "templates": ["code-router"],
6
+ "link": "https://module-federation.io/"
7
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "dependencies": {
3
+ "@module-federation/vite": "^1.1.9"
4
+ }
5
+ }
@@ -2,5 +2,6 @@
2
2
  "name": "Netlify",
3
3
  "description": "Netlify deployment setup",
4
4
  "link": "https://docs.netlify.com",
5
- "phase": "add-on"
5
+ "phase": "add-on",
6
+ "templates": ["file-router", "code-router"]
6
7
  }
@@ -0,0 +1,25 @@
1
+ import { createIsomorphicFn } from '@tanstack/start'
2
+ import * as Sentry from "@sentry/react";
3
+ import * as SentryServer from "@sentry/node";
4
+
5
+ createIsomorphicFn().server(() => {
6
+ console.log('Sentry init server')
7
+ SentryServer.init({
8
+ dsn: import.meta.env.VITE_SENTRY_DSN,
9
+ tracesSampleRate: 1.0,
10
+ profilesSampleRate: 1.0,
11
+ })
12
+ }).client(() => {
13
+ console.log('Sentry init client')
14
+ Sentry.init({
15
+ dsn: import.meta.env.VITE_SENTRY_DSN,
16
+ tracesSampleRate: 1.0,
17
+ profilesSampleRate: 1.0,
18
+ integrations: [
19
+ Sentry.replayIntegration({
20
+ maskAllText: false,
21
+ blockAllMedia: false,
22
+ })
23
+ ]
24
+ })
25
+ })()