@idevconn/create-icore 0.6.0 → 0.6.2

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 (38) hide show
  1. package/dist/cli.js +87 -18
  2. package/dist/index.cjs +87 -18
  3. package/dist/index.js +87 -18
  4. package/package.json +1 -1
  5. package/templates/apps/api/package.json +1 -0
  6. package/templates/apps/api/src/main.ts +0 -2
  7. package/templates/apps/api/webpack.config.js +20 -0
  8. package/templates/apps/microservices/auth/webpack.config.js +30 -0
  9. package/templates/apps/microservices/jobs/package.json +16 -0
  10. package/templates/apps/microservices/jobs/webpack.config.js +30 -0
  11. package/templates/apps/microservices/notes/package.json +19 -0
  12. package/templates/apps/microservices/notes/webpack.config.js +30 -0
  13. package/templates/apps/microservices/payment/package.json +16 -0
  14. package/templates/apps/microservices/payment/webpack.config.js +30 -0
  15. package/templates/apps/microservices/upload/package.json +1 -1
  16. package/templates/apps/microservices/upload/webpack.config.js +30 -0
  17. package/templates/apps/templates/client-antd/package.json +9 -0
  18. package/templates/apps/templates/client-mui/package.json +11 -0
  19. package/templates/apps/templates/client-shadcn/package.json +18 -0
  20. package/templates/apps/templates/client-shadcn/src/routes/login.tsx +8 -15
  21. package/templates/libs/auth-client/package.json +1 -1
  22. package/templates/libs/auth-strategies/firebase/package.json +1 -1
  23. package/templates/libs/auth-strategies/supabase/package.json +1 -1
  24. package/templates/libs/db-strategies/firestore/package.json +1 -1
  25. package/templates/libs/db-strategies/supabase/package.json +1 -1
  26. package/templates/libs/firebase-admin/package.json +1 -1
  27. package/templates/libs/jobs-client/package.json +1 -1
  28. package/templates/libs/notes-client/package.json +1 -1
  29. package/templates/libs/payment-client/package.json +1 -1
  30. package/templates/libs/shared/package.json +3 -3
  31. package/templates/libs/storage-strategies/cloudinary/package.json +1 -1
  32. package/templates/libs/storage-strategies/firebase/package.json +1 -1
  33. package/templates/libs/storage-strategies/supabase/package.json +1 -1
  34. package/templates/libs/template-shared/package.json +1 -1
  35. package/templates/libs/upload-client/package.json +1 -1
  36. package/templates/package.json +2 -27
  37. package/templates/tools/create-icore/_template-shell/package.json +2 -27
  38. package/templates/.yarn/releases/yarn-4.5.0.cjs +0 -925
package/dist/cli.js CHANGED
@@ -301,23 +301,17 @@ async function rewriteRootPackageJson(targetDir, opts) {
301
301
  }
302
302
  if (opts.packageManager !== "yarn") {
303
303
  delete pkg.packageManager;
304
+ } else {
305
+ try {
306
+ const yarnrc = await readFile2(join2(targetDir, ".yarnrc.yml"), "utf8");
307
+ const match = yarnrc.match(/^yarnPath:\s*.+yarn-(\d+\.\d+\.\d+)\.cjs/m);
308
+ if (match?.[1]) {
309
+ pkg["packageManager"] = `yarn@${match[1]}`;
310
+ }
311
+ } catch {
312
+ }
304
313
  }
305
- if (opts.packageManager === "pnpm") {
306
- pkg["pnpm"] = {
307
- onlyBuiltDependencies: [
308
- "@firebase/util",
309
- "@nestjs/core",
310
- "@parcel/watcher",
311
- "@scarf/scarf",
312
- "@swc/core",
313
- "less",
314
- "msgpackr-extract",
315
- "nx",
316
- "protobufjs",
317
- "unrs-resolver"
318
- ]
319
- };
320
- }
314
+ delete pkg.pnpm;
321
315
  await writeFile(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
322
316
  }
323
317
  async function writeAuthEnv(targetDir, opts) {
@@ -458,6 +452,13 @@ async function removePaymentStack(targetDir) {
458
452
  "@idevconn/payment"
459
453
  ]);
460
454
  await stripGatewayTransport(targetDir, "PAYMENT");
455
+ const mainTsPath = join2(targetDir, "apps/api/src/main.ts");
456
+ try {
457
+ const src = await readFile2(mainTsPath, "utf8");
458
+ const next = src.replace(/\n\s*\{ name: 'payment', prefix: 'PAYMENT' \},/, "");
459
+ await writeFile(mainTsPath, next);
460
+ } catch {
461
+ }
461
462
  }
462
463
  async function removeNotesStack(targetDir) {
463
464
  for (const p3 of [
@@ -478,8 +479,18 @@ async function removeNotesStack(targetDir) {
478
479
  await writeFile(appModulePath, next);
479
480
  } catch {
480
481
  }
481
- await stripDeps(join2(targetDir, "apps/api/package.json"), ["@icore/notes-client"]);
482
+ await stripDeps(join2(targetDir, "apps/api/package.json"), [
483
+ "@icore/notes-client",
484
+ "@casl/ability"
485
+ ]);
482
486
  await stripGatewayTransport(targetDir, "NOTES");
487
+ const mainTsPath = join2(targetDir, "apps/api/src/main.ts");
488
+ try {
489
+ const src = await readFile2(mainTsPath, "utf8");
490
+ const next = src.replace(/\n\s*\{ name: 'notes', prefix: 'NOTES' \},/, "");
491
+ await writeFile(mainTsPath, next);
492
+ } catch {
493
+ }
483
494
  const tsconfigPath = join2(targetDir, "tsconfig.base.json");
484
495
  try {
485
496
  const src = await readFile2(tsconfigPath, "utf8");
@@ -642,7 +653,7 @@ async function removeUnusedDbStrategies(targetDir, dbProvider) {
642
653
  await stripTsconfigPath(targetDir, "@icore/db-supabase");
643
654
  try {
644
655
  const src = await readFile2(modulePath, "utf8");
645
- const next = src.replace(/^import \{ createClient \} from '@supabase\/supabase-js';\n/m, "").replace(/^import \{[^}]*SupabaseDBStrategy[^}]*\} from '@icore\/db-supabase';\n/m, "").replace(/\nfunction makeSupabaseDB[\s\S]*?\n}\n/m, "").replace(
656
+ const next = src.replace(/^import \{ createClient \} from '@supabase\/supabase-js';\n/m, "").replace(/^import \{[^}]*SupabaseDBStrategy[^}]*\} from '@icore\/db-supabase';\n/m, "").replace(/\nfunction makeSupabaseDB[\s\S]*?\n}\n/m, "").replace(/\nfunction requireEnv[\s\S]*?\n}\n/m, "").replace(
646
657
  /if \(provider === 'supabase'\) return makeSupabaseDB\(cfg\);\n\s*return makeFirestoreDB\(cfg\);/m,
647
658
  "return makeFirestoreDB(cfg);"
648
659
  );
@@ -775,11 +786,69 @@ async function scaffold(opts, templatesDir2) {
775
786
  await rm(join2(opts.targetDir, ".yarn"), { recursive: true, force: true });
776
787
  await rm(join2(opts.targetDir, ".yarnrc.yml"), { force: true });
777
788
  }
789
+ if (opts.packageManager === "pnpm") {
790
+ await writePnpmWorkspace(opts.targetDir);
791
+ await rewritePnpmWorkspaceDeps(opts.targetDir);
792
+ }
778
793
  await patchGitignoreForPm(opts.targetDir, opts.packageManager);
779
794
  await writeAiFiles(opts.targetDir, opts);
780
795
  if (opts.install) runInstall(opts.targetDir, opts.packageManager);
781
796
  if (opts.initGit) gitInit(opts.targetDir, opts.projectName);
782
797
  }
798
+ async function writePnpmWorkspace(targetDir) {
799
+ const pkgPath = join2(targetDir, "package.json");
800
+ const pkg = JSON.parse(await readFile2(pkgPath, "utf8"));
801
+ const workspaces = pkg.workspaces ?? [];
802
+ const packagesBlock = workspaces.map((p3) => ` - '${p3}'`).join("\n");
803
+ const allowBuilds = [
804
+ "@firebase/util",
805
+ "@nestjs/core",
806
+ "@parcel/watcher",
807
+ "@scarf/scarf",
808
+ "@swc/core",
809
+ "less",
810
+ "msgpackr-extract",
811
+ "nx",
812
+ "protobufjs",
813
+ "unrs-resolver"
814
+ ].map((p3) => ` '${p3}': true`).join("\n");
815
+ const content = `packages:
816
+ ${packagesBlock}
817
+
818
+ allowBuilds:
819
+ ${allowBuilds}
820
+ `;
821
+ await writeFile(join2(targetDir, "pnpm-workspace.yaml"), content);
822
+ }
823
+ async function rewritePnpmWorkspaceDeps(targetDir) {
824
+ const { readdir: rd } = await import("fs/promises");
825
+ async function walk(dir) {
826
+ const found = [];
827
+ let entries;
828
+ try {
829
+ entries = await rd(dir, { withFileTypes: true });
830
+ } catch {
831
+ return found;
832
+ }
833
+ for (const e of entries) {
834
+ if (e.isDirectory() && e.name !== "node_modules") {
835
+ found.push(...await walk(join2(dir, e.name)));
836
+ } else if (e.isFile() && e.name === "package.json") {
837
+ found.push(join2(dir, e.name));
838
+ }
839
+ }
840
+ return found;
841
+ }
842
+ const pkgFiles = await walk(targetDir);
843
+ for (const f of pkgFiles) {
844
+ try {
845
+ const raw = await readFile2(f, "utf8");
846
+ const next = raw.replace(/"(@icore\/[^"]+)":\s*"\*"/g, '"$1": "workspace:*"');
847
+ if (next !== raw) await writeFile(f, next);
848
+ } catch {
849
+ }
850
+ }
851
+ }
783
852
  async function patchGitignoreForPm(targetDir, pm) {
784
853
  const giPath = join2(targetDir, ".gitignore");
785
854
  try {
package/dist/index.cjs CHANGED
@@ -107,23 +107,17 @@ async function rewriteRootPackageJson(targetDir, opts) {
107
107
  }
108
108
  if (opts.packageManager !== "yarn") {
109
109
  delete pkg.packageManager;
110
+ } else {
111
+ try {
112
+ const yarnrc = await (0, import_promises.readFile)((0, import_node_path.join)(targetDir, ".yarnrc.yml"), "utf8");
113
+ const match = yarnrc.match(/^yarnPath:\s*.+yarn-(\d+\.\d+\.\d+)\.cjs/m);
114
+ if (match?.[1]) {
115
+ pkg["packageManager"] = `yarn@${match[1]}`;
116
+ }
117
+ } catch {
118
+ }
110
119
  }
111
- if (opts.packageManager === "pnpm") {
112
- pkg["pnpm"] = {
113
- onlyBuiltDependencies: [
114
- "@firebase/util",
115
- "@nestjs/core",
116
- "@parcel/watcher",
117
- "@scarf/scarf",
118
- "@swc/core",
119
- "less",
120
- "msgpackr-extract",
121
- "nx",
122
- "protobufjs",
123
- "unrs-resolver"
124
- ]
125
- };
126
- }
120
+ delete pkg.pnpm;
127
121
  await (0, import_promises.writeFile)(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
128
122
  }
129
123
  async function writeAuthEnv(targetDir, opts) {
@@ -264,6 +258,13 @@ async function removePaymentStack(targetDir) {
264
258
  "@idevconn/payment"
265
259
  ]);
266
260
  await stripGatewayTransport(targetDir, "PAYMENT");
261
+ const mainTsPath = (0, import_node_path.join)(targetDir, "apps/api/src/main.ts");
262
+ try {
263
+ const src = await (0, import_promises.readFile)(mainTsPath, "utf8");
264
+ const next = src.replace(/\n\s*\{ name: 'payment', prefix: 'PAYMENT' \},/, "");
265
+ await (0, import_promises.writeFile)(mainTsPath, next);
266
+ } catch {
267
+ }
267
268
  }
268
269
  async function removeNotesStack(targetDir) {
269
270
  for (const p2 of [
@@ -284,8 +285,18 @@ async function removeNotesStack(targetDir) {
284
285
  await (0, import_promises.writeFile)(appModulePath, next);
285
286
  } catch {
286
287
  }
287
- await stripDeps((0, import_node_path.join)(targetDir, "apps/api/package.json"), ["@icore/notes-client"]);
288
+ await stripDeps((0, import_node_path.join)(targetDir, "apps/api/package.json"), [
289
+ "@icore/notes-client",
290
+ "@casl/ability"
291
+ ]);
288
292
  await stripGatewayTransport(targetDir, "NOTES");
293
+ const mainTsPath = (0, import_node_path.join)(targetDir, "apps/api/src/main.ts");
294
+ try {
295
+ const src = await (0, import_promises.readFile)(mainTsPath, "utf8");
296
+ const next = src.replace(/\n\s*\{ name: 'notes', prefix: 'NOTES' \},/, "");
297
+ await (0, import_promises.writeFile)(mainTsPath, next);
298
+ } catch {
299
+ }
289
300
  const tsconfigPath = (0, import_node_path.join)(targetDir, "tsconfig.base.json");
290
301
  try {
291
302
  const src = await (0, import_promises.readFile)(tsconfigPath, "utf8");
@@ -448,7 +459,7 @@ async function removeUnusedDbStrategies(targetDir, dbProvider) {
448
459
  await stripTsconfigPath(targetDir, "@icore/db-supabase");
449
460
  try {
450
461
  const src = await (0, import_promises.readFile)(modulePath, "utf8");
451
- const next = src.replace(/^import \{ createClient \} from '@supabase\/supabase-js';\n/m, "").replace(/^import \{[^}]*SupabaseDBStrategy[^}]*\} from '@icore\/db-supabase';\n/m, "").replace(/\nfunction makeSupabaseDB[\s\S]*?\n}\n/m, "").replace(
462
+ const next = src.replace(/^import \{ createClient \} from '@supabase\/supabase-js';\n/m, "").replace(/^import \{[^}]*SupabaseDBStrategy[^}]*\} from '@icore\/db-supabase';\n/m, "").replace(/\nfunction makeSupabaseDB[\s\S]*?\n}\n/m, "").replace(/\nfunction requireEnv[\s\S]*?\n}\n/m, "").replace(
452
463
  /if \(provider === 'supabase'\) return makeSupabaseDB\(cfg\);\n\s*return makeFirestoreDB\(cfg\);/m,
453
464
  "return makeFirestoreDB(cfg);"
454
465
  );
@@ -581,11 +592,69 @@ async function scaffold(opts, templatesDir) {
581
592
  await (0, import_promises.rm)((0, import_node_path.join)(opts.targetDir, ".yarn"), { recursive: true, force: true });
582
593
  await (0, import_promises.rm)((0, import_node_path.join)(opts.targetDir, ".yarnrc.yml"), { force: true });
583
594
  }
595
+ if (opts.packageManager === "pnpm") {
596
+ await writePnpmWorkspace(opts.targetDir);
597
+ await rewritePnpmWorkspaceDeps(opts.targetDir);
598
+ }
584
599
  await patchGitignoreForPm(opts.targetDir, opts.packageManager);
585
600
  await writeAiFiles(opts.targetDir, opts);
586
601
  if (opts.install) runInstall(opts.targetDir, opts.packageManager);
587
602
  if (opts.initGit) gitInit(opts.targetDir, opts.projectName);
588
603
  }
604
+ async function writePnpmWorkspace(targetDir) {
605
+ const pkgPath = (0, import_node_path.join)(targetDir, "package.json");
606
+ const pkg = JSON.parse(await (0, import_promises.readFile)(pkgPath, "utf8"));
607
+ const workspaces = pkg.workspaces ?? [];
608
+ const packagesBlock = workspaces.map((p2) => ` - '${p2}'`).join("\n");
609
+ const allowBuilds = [
610
+ "@firebase/util",
611
+ "@nestjs/core",
612
+ "@parcel/watcher",
613
+ "@scarf/scarf",
614
+ "@swc/core",
615
+ "less",
616
+ "msgpackr-extract",
617
+ "nx",
618
+ "protobufjs",
619
+ "unrs-resolver"
620
+ ].map((p2) => ` '${p2}': true`).join("\n");
621
+ const content = `packages:
622
+ ${packagesBlock}
623
+
624
+ allowBuilds:
625
+ ${allowBuilds}
626
+ `;
627
+ await (0, import_promises.writeFile)((0, import_node_path.join)(targetDir, "pnpm-workspace.yaml"), content);
628
+ }
629
+ async function rewritePnpmWorkspaceDeps(targetDir) {
630
+ const { readdir: rd } = await import("fs/promises");
631
+ async function walk(dir) {
632
+ const found = [];
633
+ let entries;
634
+ try {
635
+ entries = await rd(dir, { withFileTypes: true });
636
+ } catch {
637
+ return found;
638
+ }
639
+ for (const e of entries) {
640
+ if (e.isDirectory() && e.name !== "node_modules") {
641
+ found.push(...await walk((0, import_node_path.join)(dir, e.name)));
642
+ } else if (e.isFile() && e.name === "package.json") {
643
+ found.push((0, import_node_path.join)(dir, e.name));
644
+ }
645
+ }
646
+ return found;
647
+ }
648
+ const pkgFiles = await walk(targetDir);
649
+ for (const f of pkgFiles) {
650
+ try {
651
+ const raw = await (0, import_promises.readFile)(f, "utf8");
652
+ const next = raw.replace(/"(@icore\/[^"]+)":\s*"\*"/g, '"$1": "workspace:*"');
653
+ if (next !== raw) await (0, import_promises.writeFile)(f, next);
654
+ } catch {
655
+ }
656
+ }
657
+ }
589
658
  async function patchGitignoreForPm(targetDir, pm) {
590
659
  const giPath = (0, import_node_path.join)(targetDir, ".gitignore");
591
660
  try {
package/dist/index.js CHANGED
@@ -65,23 +65,17 @@ async function rewriteRootPackageJson(targetDir, opts) {
65
65
  }
66
66
  if (opts.packageManager !== "yarn") {
67
67
  delete pkg.packageManager;
68
+ } else {
69
+ try {
70
+ const yarnrc = await readFile(join(targetDir, ".yarnrc.yml"), "utf8");
71
+ const match = yarnrc.match(/^yarnPath:\s*.+yarn-(\d+\.\d+\.\d+)\.cjs/m);
72
+ if (match?.[1]) {
73
+ pkg["packageManager"] = `yarn@${match[1]}`;
74
+ }
75
+ } catch {
76
+ }
68
77
  }
69
- if (opts.packageManager === "pnpm") {
70
- pkg["pnpm"] = {
71
- onlyBuiltDependencies: [
72
- "@firebase/util",
73
- "@nestjs/core",
74
- "@parcel/watcher",
75
- "@scarf/scarf",
76
- "@swc/core",
77
- "less",
78
- "msgpackr-extract",
79
- "nx",
80
- "protobufjs",
81
- "unrs-resolver"
82
- ]
83
- };
84
- }
78
+ delete pkg.pnpm;
85
79
  await writeFile(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
86
80
  }
87
81
  async function writeAuthEnv(targetDir, opts) {
@@ -222,6 +216,13 @@ async function removePaymentStack(targetDir) {
222
216
  "@idevconn/payment"
223
217
  ]);
224
218
  await stripGatewayTransport(targetDir, "PAYMENT");
219
+ const mainTsPath = join(targetDir, "apps/api/src/main.ts");
220
+ try {
221
+ const src = await readFile(mainTsPath, "utf8");
222
+ const next = src.replace(/\n\s*\{ name: 'payment', prefix: 'PAYMENT' \},/, "");
223
+ await writeFile(mainTsPath, next);
224
+ } catch {
225
+ }
225
226
  }
226
227
  async function removeNotesStack(targetDir) {
227
228
  for (const p2 of [
@@ -242,8 +243,18 @@ async function removeNotesStack(targetDir) {
242
243
  await writeFile(appModulePath, next);
243
244
  } catch {
244
245
  }
245
- await stripDeps(join(targetDir, "apps/api/package.json"), ["@icore/notes-client"]);
246
+ await stripDeps(join(targetDir, "apps/api/package.json"), [
247
+ "@icore/notes-client",
248
+ "@casl/ability"
249
+ ]);
246
250
  await stripGatewayTransport(targetDir, "NOTES");
251
+ const mainTsPath = join(targetDir, "apps/api/src/main.ts");
252
+ try {
253
+ const src = await readFile(mainTsPath, "utf8");
254
+ const next = src.replace(/\n\s*\{ name: 'notes', prefix: 'NOTES' \},/, "");
255
+ await writeFile(mainTsPath, next);
256
+ } catch {
257
+ }
247
258
  const tsconfigPath = join(targetDir, "tsconfig.base.json");
248
259
  try {
249
260
  const src = await readFile(tsconfigPath, "utf8");
@@ -406,7 +417,7 @@ async function removeUnusedDbStrategies(targetDir, dbProvider) {
406
417
  await stripTsconfigPath(targetDir, "@icore/db-supabase");
407
418
  try {
408
419
  const src = await readFile(modulePath, "utf8");
409
- const next = src.replace(/^import \{ createClient \} from '@supabase\/supabase-js';\n/m, "").replace(/^import \{[^}]*SupabaseDBStrategy[^}]*\} from '@icore\/db-supabase';\n/m, "").replace(/\nfunction makeSupabaseDB[\s\S]*?\n}\n/m, "").replace(
420
+ const next = src.replace(/^import \{ createClient \} from '@supabase\/supabase-js';\n/m, "").replace(/^import \{[^}]*SupabaseDBStrategy[^}]*\} from '@icore\/db-supabase';\n/m, "").replace(/\nfunction makeSupabaseDB[\s\S]*?\n}\n/m, "").replace(/\nfunction requireEnv[\s\S]*?\n}\n/m, "").replace(
410
421
  /if \(provider === 'supabase'\) return makeSupabaseDB\(cfg\);\n\s*return makeFirestoreDB\(cfg\);/m,
411
422
  "return makeFirestoreDB(cfg);"
412
423
  );
@@ -539,11 +550,69 @@ async function scaffold(opts, templatesDir) {
539
550
  await rm(join(opts.targetDir, ".yarn"), { recursive: true, force: true });
540
551
  await rm(join(opts.targetDir, ".yarnrc.yml"), { force: true });
541
552
  }
553
+ if (opts.packageManager === "pnpm") {
554
+ await writePnpmWorkspace(opts.targetDir);
555
+ await rewritePnpmWorkspaceDeps(opts.targetDir);
556
+ }
542
557
  await patchGitignoreForPm(opts.targetDir, opts.packageManager);
543
558
  await writeAiFiles(opts.targetDir, opts);
544
559
  if (opts.install) runInstall(opts.targetDir, opts.packageManager);
545
560
  if (opts.initGit) gitInit(opts.targetDir, opts.projectName);
546
561
  }
562
+ async function writePnpmWorkspace(targetDir) {
563
+ const pkgPath = join(targetDir, "package.json");
564
+ const pkg = JSON.parse(await readFile(pkgPath, "utf8"));
565
+ const workspaces = pkg.workspaces ?? [];
566
+ const packagesBlock = workspaces.map((p2) => ` - '${p2}'`).join("\n");
567
+ const allowBuilds = [
568
+ "@firebase/util",
569
+ "@nestjs/core",
570
+ "@parcel/watcher",
571
+ "@scarf/scarf",
572
+ "@swc/core",
573
+ "less",
574
+ "msgpackr-extract",
575
+ "nx",
576
+ "protobufjs",
577
+ "unrs-resolver"
578
+ ].map((p2) => ` '${p2}': true`).join("\n");
579
+ const content = `packages:
580
+ ${packagesBlock}
581
+
582
+ allowBuilds:
583
+ ${allowBuilds}
584
+ `;
585
+ await writeFile(join(targetDir, "pnpm-workspace.yaml"), content);
586
+ }
587
+ async function rewritePnpmWorkspaceDeps(targetDir) {
588
+ const { readdir: rd } = await import("fs/promises");
589
+ async function walk(dir) {
590
+ const found = [];
591
+ let entries;
592
+ try {
593
+ entries = await rd(dir, { withFileTypes: true });
594
+ } catch {
595
+ return found;
596
+ }
597
+ for (const e of entries) {
598
+ if (e.isDirectory() && e.name !== "node_modules") {
599
+ found.push(...await walk(join(dir, e.name)));
600
+ } else if (e.isFile() && e.name === "package.json") {
601
+ found.push(join(dir, e.name));
602
+ }
603
+ }
604
+ return found;
605
+ }
606
+ const pkgFiles = await walk(targetDir);
607
+ for (const f of pkgFiles) {
608
+ try {
609
+ const raw = await readFile(f, "utf8");
610
+ const next = raw.replace(/"(@icore\/[^"]+)":\s*"\*"/g, '"$1": "workspace:*"');
611
+ if (next !== raw) await writeFile(f, next);
612
+ } catch {
613
+ }
614
+ }
615
+ }
547
616
  async function patchGitignoreForPm(targetDir, pm) {
548
617
  const giPath = join(targetDir, ".gitignore");
549
618
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idevconn/create-icore",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "Bootstrap a new project from the iCore scaffold (Nx + NestJS + React + Vite + shadcn/Tailwind, swappable auth + storage providers).",
5
5
  "license": "Apache-2.0",
6
6
  "author": "iDEVconn",
@@ -3,6 +3,7 @@
3
3
  "version": "0.0.1",
4
4
  "private": true,
5
5
  "devDependencies": {
6
+ "@types/express": "^4.17.25",
6
7
  "@types/multer": "*"
7
8
  },
8
9
  "dependencies": {
@@ -10,8 +10,6 @@ import pkg from '@icore/package.json';
10
10
  const GATEWAY_SERVICES = [
11
11
  { name: 'auth', prefix: 'AUTH' },
12
12
  { name: 'upload', prefix: 'UPLOAD' },
13
- { name: 'notes', prefix: 'NOTES' },
14
- { name: 'payment', prefix: 'PAYMENT' },
15
13
  ];
16
14
 
17
15
  const DEFAULT_PORT = 3001;
@@ -1,4 +1,5 @@
1
1
  const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
2
+ const { TsconfigPathsPlugin } = require('tsconfig-paths-webpack-plugin');
2
3
  const { join } = require('path');
3
4
 
4
5
  module.exports = {
@@ -9,6 +10,23 @@ module.exports = {
9
10
  devtoolModuleFilenameTemplate: '[absolute-resource-path]',
10
11
  }),
11
12
  },
13
+ resolve: {
14
+ plugins: [new TsconfigPathsPlugin({ configFile: join(__dirname, 'tsconfig.app.json') })],
15
+ },
16
+ // See microservices/*/webpack.config.js for the @icore/* bundling rationale.
17
+ externals: [
18
+ function ({ request }, callback) {
19
+ if (
20
+ !request ||
21
+ request.startsWith('.') ||
22
+ request.startsWith('/') ||
23
+ request.startsWith('@icore/')
24
+ ) {
25
+ return callback();
26
+ }
27
+ return callback(null, 'commonjs ' + request);
28
+ },
29
+ ],
12
30
  plugins: [
13
31
  new NxAppWebpackPlugin({
14
32
  target: 'node',
@@ -19,6 +37,8 @@ module.exports = {
19
37
  optimization: false,
20
38
  outputHashing: 'none',
21
39
  generatePackageJson: true,
40
+ mergeExternals: true,
41
+ externalDependencies: [],
22
42
  sourceMap: true,
23
43
  }),
24
44
  ],
@@ -1,4 +1,5 @@
1
1
  const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
2
+ const { TsconfigPathsPlugin } = require('tsconfig-paths-webpack-plugin');
2
3
  const { join } = require('path');
3
4
 
4
5
  module.exports = {
@@ -9,6 +10,31 @@ module.exports = {
9
10
  devtoolModuleFilenameTemplate: '[absolute-resource-path]',
10
11
  }),
11
12
  },
13
+ resolve: {
14
+ // Resolve @icore/* via tsconfig paths so webpack can bundle them inline.
15
+ // nx skips its own tsconfig-paths plugin on "TS solution" workspaces, so we
16
+ // wire the standalone plugin explicitly (it follows extends → tsconfig.base).
17
+ plugins: [new TsconfigPathsPlugin({ configFile: join(__dirname, 'tsconfig.app.json') })],
18
+ },
19
+ // Keep every npm package external EXCEPT @icore/* workspace packages, which
20
+ // are bundled inline. @icore/* are workspace-internal: at runtime the package
21
+ // manager symlinks them to their TS source dir (not the compiled dist), so an
22
+ // external require('@icore/shared') fails ("Cannot find module './env'").
23
+ // Bundling removes runtime workspace resolution entirely — works identically
24
+ // on yarn / npm / pnpm.
25
+ externals: [
26
+ function ({ request }, callback) {
27
+ if (
28
+ !request ||
29
+ request.startsWith('.') ||
30
+ request.startsWith('/') ||
31
+ request.startsWith('@icore/')
32
+ ) {
33
+ return callback(); // bundle inline
34
+ }
35
+ return callback(null, 'commonjs ' + request); // keep external
36
+ },
37
+ ],
12
38
  plugins: [
13
39
  new NxAppWebpackPlugin({
14
40
  target: 'node',
@@ -19,6 +45,10 @@ module.exports = {
19
45
  optimization: false,
20
46
  outputHashing: 'none',
21
47
  generatePackageJson: true,
48
+ // Keep our externals (above) authoritative — do not let the plugin add
49
+ // its own nodeExternals that would re-externalize @icore/*.
50
+ mergeExternals: true,
51
+ externalDependencies: [],
22
52
  sourceMap: true,
23
53
  }),
24
54
  ],
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "jobs",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "dependencies": {
6
+ "@icore/shared": "*",
7
+ "@nestjs/common": "^11.1.24",
8
+ "@nestjs/config": "^4.0.4",
9
+ "@nestjs/core": "^11.1.24",
10
+ "bullmq": "^5.77.6",
11
+ "ioredis": "^5.11.0",
12
+ "reflect-metadata": "^0.2.2",
13
+ "rxjs": "^7.8.2",
14
+ "tslib": "^2.3.0"
15
+ }
16
+ }
@@ -1,4 +1,5 @@
1
1
  const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
2
+ const { TsconfigPathsPlugin } = require('tsconfig-paths-webpack-plugin');
2
3
  const { join } = require('path');
3
4
 
4
5
  module.exports = {
@@ -9,6 +10,31 @@ module.exports = {
9
10
  devtoolModuleFilenameTemplate: '[absolute-resource-path]',
10
11
  }),
11
12
  },
13
+ resolve: {
14
+ // Resolve @icore/* via tsconfig paths so webpack can bundle them inline.
15
+ // nx skips its own tsconfig-paths plugin on "TS solution" workspaces, so we
16
+ // wire the standalone plugin explicitly (it follows extends → tsconfig.base).
17
+ plugins: [new TsconfigPathsPlugin({ configFile: join(__dirname, 'tsconfig.app.json') })],
18
+ },
19
+ // Keep every npm package external EXCEPT @icore/* workspace packages, which
20
+ // are bundled inline. @icore/* are workspace-internal: at runtime the package
21
+ // manager symlinks them to their TS source dir (not the compiled dist), so an
22
+ // external require('@icore/shared') fails ("Cannot find module './env'").
23
+ // Bundling removes runtime workspace resolution entirely — works identically
24
+ // on yarn / npm / pnpm.
25
+ externals: [
26
+ function ({ request }, callback) {
27
+ if (
28
+ !request ||
29
+ request.startsWith('.') ||
30
+ request.startsWith('/') ||
31
+ request.startsWith('@icore/')
32
+ ) {
33
+ return callback(); // bundle inline
34
+ }
35
+ return callback(null, 'commonjs ' + request); // keep external
36
+ },
37
+ ],
12
38
  plugins: [
13
39
  new NxAppWebpackPlugin({
14
40
  target: 'node',
@@ -19,6 +45,10 @@ module.exports = {
19
45
  optimization: false,
20
46
  outputHashing: 'none',
21
47
  generatePackageJson: true,
48
+ // Keep our externals (above) authoritative — do not let the plugin add
49
+ // its own nodeExternals that would re-externalize @icore/*.
50
+ mergeExternals: true,
51
+ externalDependencies: [],
22
52
  sourceMap: true,
23
53
  }),
24
54
  ],
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "notes",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "dependencies": {
6
+ "@icore/db-firestore": "*",
7
+ "@icore/db-supabase": "*",
8
+ "@icore/firebase-admin": "*",
9
+ "@icore/shared": "*",
10
+ "@nestjs/common": "^11.1.24",
11
+ "@nestjs/config": "^4.0.4",
12
+ "@nestjs/core": "^11.1.24",
13
+ "@nestjs/microservices": "^11.1.24",
14
+ "@supabase/supabase-js": "^2.106.2",
15
+ "reflect-metadata": "^0.2.2",
16
+ "rxjs": "^7.8.2",
17
+ "tslib": "^2.3.0"
18
+ }
19
+ }