@idevconn/create-icore 0.6.0 → 0.6.1
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/dist/cli.js +73 -18
- package/dist/index.cjs +73 -18
- package/dist/index.js +73 -18
- package/package.json +1 -1
- package/templates/apps/api/package.json +1 -0
- package/templates/apps/api/webpack.config.js +20 -0
- package/templates/apps/microservices/auth/webpack.config.js +30 -0
- package/templates/apps/microservices/jobs/webpack.config.js +30 -0
- package/templates/apps/microservices/notes/webpack.config.js +30 -0
- package/templates/apps/microservices/payment/webpack.config.js +30 -0
- package/templates/apps/microservices/upload/webpack.config.js +30 -0
- package/templates/apps/templates/client-shadcn/src/routes/login.tsx +8 -15
- package/templates/libs/auth-client/package.json +1 -1
- package/templates/libs/auth-strategies/firebase/package.json +1 -1
- package/templates/libs/auth-strategies/supabase/package.json +1 -1
- package/templates/libs/db-strategies/firestore/package.json +1 -1
- package/templates/libs/db-strategies/supabase/package.json +1 -1
- package/templates/libs/firebase-admin/package.json +1 -1
- package/templates/libs/jobs-client/package.json +1 -1
- package/templates/libs/notes-client/package.json +1 -1
- package/templates/libs/payment-client/package.json +1 -1
- package/templates/libs/shared/package.json +3 -3
- package/templates/libs/storage-strategies/cloudinary/package.json +1 -1
- package/templates/libs/storage-strategies/firebase/package.json +1 -1
- package/templates/libs/storage-strategies/supabase/package.json +1 -1
- package/templates/libs/template-shared/package.json +1 -1
- package/templates/libs/upload-client/package.json +1 -1
- package/templates/package.json +2 -1
- package/templates/tools/create-icore/_template-shell/package.json +2 -1
- 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
|
-
|
|
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) {
|
|
@@ -478,7 +472,10 @@ async function removeNotesStack(targetDir) {
|
|
|
478
472
|
await writeFile(appModulePath, next);
|
|
479
473
|
} catch {
|
|
480
474
|
}
|
|
481
|
-
await stripDeps(join2(targetDir, "apps/api/package.json"), [
|
|
475
|
+
await stripDeps(join2(targetDir, "apps/api/package.json"), [
|
|
476
|
+
"@icore/notes-client",
|
|
477
|
+
"@casl/ability"
|
|
478
|
+
]);
|
|
482
479
|
await stripGatewayTransport(targetDir, "NOTES");
|
|
483
480
|
const tsconfigPath = join2(targetDir, "tsconfig.base.json");
|
|
484
481
|
try {
|
|
@@ -642,7 +639,7 @@ async function removeUnusedDbStrategies(targetDir, dbProvider) {
|
|
|
642
639
|
await stripTsconfigPath(targetDir, "@icore/db-supabase");
|
|
643
640
|
try {
|
|
644
641
|
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(
|
|
642
|
+
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
643
|
/if \(provider === 'supabase'\) return makeSupabaseDB\(cfg\);\n\s*return makeFirestoreDB\(cfg\);/m,
|
|
647
644
|
"return makeFirestoreDB(cfg);"
|
|
648
645
|
);
|
|
@@ -775,11 +772,69 @@ async function scaffold(opts, templatesDir2) {
|
|
|
775
772
|
await rm(join2(opts.targetDir, ".yarn"), { recursive: true, force: true });
|
|
776
773
|
await rm(join2(opts.targetDir, ".yarnrc.yml"), { force: true });
|
|
777
774
|
}
|
|
775
|
+
if (opts.packageManager === "pnpm") {
|
|
776
|
+
await writePnpmWorkspace(opts.targetDir);
|
|
777
|
+
await rewritePnpmWorkspaceDeps(opts.targetDir);
|
|
778
|
+
}
|
|
778
779
|
await patchGitignoreForPm(opts.targetDir, opts.packageManager);
|
|
779
780
|
await writeAiFiles(opts.targetDir, opts);
|
|
780
781
|
if (opts.install) runInstall(opts.targetDir, opts.packageManager);
|
|
781
782
|
if (opts.initGit) gitInit(opts.targetDir, opts.projectName);
|
|
782
783
|
}
|
|
784
|
+
async function writePnpmWorkspace(targetDir) {
|
|
785
|
+
const pkgPath = join2(targetDir, "package.json");
|
|
786
|
+
const pkg = JSON.parse(await readFile2(pkgPath, "utf8"));
|
|
787
|
+
const workspaces = pkg.workspaces ?? [];
|
|
788
|
+
const packagesBlock = workspaces.map((p3) => ` - '${p3}'`).join("\n");
|
|
789
|
+
const allowBuilds = [
|
|
790
|
+
"@firebase/util",
|
|
791
|
+
"@nestjs/core",
|
|
792
|
+
"@parcel/watcher",
|
|
793
|
+
"@scarf/scarf",
|
|
794
|
+
"@swc/core",
|
|
795
|
+
"less",
|
|
796
|
+
"msgpackr-extract",
|
|
797
|
+
"nx",
|
|
798
|
+
"protobufjs",
|
|
799
|
+
"unrs-resolver"
|
|
800
|
+
].map((p3) => ` '${p3}': true`).join("\n");
|
|
801
|
+
const content = `packages:
|
|
802
|
+
${packagesBlock}
|
|
803
|
+
|
|
804
|
+
allowBuilds:
|
|
805
|
+
${allowBuilds}
|
|
806
|
+
`;
|
|
807
|
+
await writeFile(join2(targetDir, "pnpm-workspace.yaml"), content);
|
|
808
|
+
}
|
|
809
|
+
async function rewritePnpmWorkspaceDeps(targetDir) {
|
|
810
|
+
const { readdir: rd } = await import("fs/promises");
|
|
811
|
+
async function walk(dir) {
|
|
812
|
+
const found = [];
|
|
813
|
+
let entries;
|
|
814
|
+
try {
|
|
815
|
+
entries = await rd(dir, { withFileTypes: true });
|
|
816
|
+
} catch {
|
|
817
|
+
return found;
|
|
818
|
+
}
|
|
819
|
+
for (const e of entries) {
|
|
820
|
+
if (e.isDirectory() && e.name !== "node_modules") {
|
|
821
|
+
found.push(...await walk(join2(dir, e.name)));
|
|
822
|
+
} else if (e.isFile() && e.name === "package.json") {
|
|
823
|
+
found.push(join2(dir, e.name));
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
return found;
|
|
827
|
+
}
|
|
828
|
+
const pkgFiles = await walk(targetDir);
|
|
829
|
+
for (const f of pkgFiles) {
|
|
830
|
+
try {
|
|
831
|
+
const raw = await readFile2(f, "utf8");
|
|
832
|
+
const next = raw.replace(/"(@icore\/[^"]+)":\s*"\*"/g, '"$1": "workspace:*"');
|
|
833
|
+
if (next !== raw) await writeFile(f, next);
|
|
834
|
+
} catch {
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
}
|
|
783
838
|
async function patchGitignoreForPm(targetDir, pm) {
|
|
784
839
|
const giPath = join2(targetDir, ".gitignore");
|
|
785
840
|
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
|
-
|
|
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) {
|
|
@@ -284,7 +278,10 @@ async function removeNotesStack(targetDir) {
|
|
|
284
278
|
await (0, import_promises.writeFile)(appModulePath, next);
|
|
285
279
|
} catch {
|
|
286
280
|
}
|
|
287
|
-
await stripDeps((0, import_node_path.join)(targetDir, "apps/api/package.json"), [
|
|
281
|
+
await stripDeps((0, import_node_path.join)(targetDir, "apps/api/package.json"), [
|
|
282
|
+
"@icore/notes-client",
|
|
283
|
+
"@casl/ability"
|
|
284
|
+
]);
|
|
288
285
|
await stripGatewayTransport(targetDir, "NOTES");
|
|
289
286
|
const tsconfigPath = (0, import_node_path.join)(targetDir, "tsconfig.base.json");
|
|
290
287
|
try {
|
|
@@ -448,7 +445,7 @@ async function removeUnusedDbStrategies(targetDir, dbProvider) {
|
|
|
448
445
|
await stripTsconfigPath(targetDir, "@icore/db-supabase");
|
|
449
446
|
try {
|
|
450
447
|
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(
|
|
448
|
+
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
449
|
/if \(provider === 'supabase'\) return makeSupabaseDB\(cfg\);\n\s*return makeFirestoreDB\(cfg\);/m,
|
|
453
450
|
"return makeFirestoreDB(cfg);"
|
|
454
451
|
);
|
|
@@ -581,11 +578,69 @@ async function scaffold(opts, templatesDir) {
|
|
|
581
578
|
await (0, import_promises.rm)((0, import_node_path.join)(opts.targetDir, ".yarn"), { recursive: true, force: true });
|
|
582
579
|
await (0, import_promises.rm)((0, import_node_path.join)(opts.targetDir, ".yarnrc.yml"), { force: true });
|
|
583
580
|
}
|
|
581
|
+
if (opts.packageManager === "pnpm") {
|
|
582
|
+
await writePnpmWorkspace(opts.targetDir);
|
|
583
|
+
await rewritePnpmWorkspaceDeps(opts.targetDir);
|
|
584
|
+
}
|
|
584
585
|
await patchGitignoreForPm(opts.targetDir, opts.packageManager);
|
|
585
586
|
await writeAiFiles(opts.targetDir, opts);
|
|
586
587
|
if (opts.install) runInstall(opts.targetDir, opts.packageManager);
|
|
587
588
|
if (opts.initGit) gitInit(opts.targetDir, opts.projectName);
|
|
588
589
|
}
|
|
590
|
+
async function writePnpmWorkspace(targetDir) {
|
|
591
|
+
const pkgPath = (0, import_node_path.join)(targetDir, "package.json");
|
|
592
|
+
const pkg = JSON.parse(await (0, import_promises.readFile)(pkgPath, "utf8"));
|
|
593
|
+
const workspaces = pkg.workspaces ?? [];
|
|
594
|
+
const packagesBlock = workspaces.map((p2) => ` - '${p2}'`).join("\n");
|
|
595
|
+
const allowBuilds = [
|
|
596
|
+
"@firebase/util",
|
|
597
|
+
"@nestjs/core",
|
|
598
|
+
"@parcel/watcher",
|
|
599
|
+
"@scarf/scarf",
|
|
600
|
+
"@swc/core",
|
|
601
|
+
"less",
|
|
602
|
+
"msgpackr-extract",
|
|
603
|
+
"nx",
|
|
604
|
+
"protobufjs",
|
|
605
|
+
"unrs-resolver"
|
|
606
|
+
].map((p2) => ` '${p2}': true`).join("\n");
|
|
607
|
+
const content = `packages:
|
|
608
|
+
${packagesBlock}
|
|
609
|
+
|
|
610
|
+
allowBuilds:
|
|
611
|
+
${allowBuilds}
|
|
612
|
+
`;
|
|
613
|
+
await (0, import_promises.writeFile)((0, import_node_path.join)(targetDir, "pnpm-workspace.yaml"), content);
|
|
614
|
+
}
|
|
615
|
+
async function rewritePnpmWorkspaceDeps(targetDir) {
|
|
616
|
+
const { readdir: rd } = await import("fs/promises");
|
|
617
|
+
async function walk(dir) {
|
|
618
|
+
const found = [];
|
|
619
|
+
let entries;
|
|
620
|
+
try {
|
|
621
|
+
entries = await rd(dir, { withFileTypes: true });
|
|
622
|
+
} catch {
|
|
623
|
+
return found;
|
|
624
|
+
}
|
|
625
|
+
for (const e of entries) {
|
|
626
|
+
if (e.isDirectory() && e.name !== "node_modules") {
|
|
627
|
+
found.push(...await walk((0, import_node_path.join)(dir, e.name)));
|
|
628
|
+
} else if (e.isFile() && e.name === "package.json") {
|
|
629
|
+
found.push((0, import_node_path.join)(dir, e.name));
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
return found;
|
|
633
|
+
}
|
|
634
|
+
const pkgFiles = await walk(targetDir);
|
|
635
|
+
for (const f of pkgFiles) {
|
|
636
|
+
try {
|
|
637
|
+
const raw = await (0, import_promises.readFile)(f, "utf8");
|
|
638
|
+
const next = raw.replace(/"(@icore\/[^"]+)":\s*"\*"/g, '"$1": "workspace:*"');
|
|
639
|
+
if (next !== raw) await (0, import_promises.writeFile)(f, next);
|
|
640
|
+
} catch {
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
589
644
|
async function patchGitignoreForPm(targetDir, pm) {
|
|
590
645
|
const giPath = (0, import_node_path.join)(targetDir, ".gitignore");
|
|
591
646
|
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
|
-
|
|
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) {
|
|
@@ -242,7 +236,10 @@ async function removeNotesStack(targetDir) {
|
|
|
242
236
|
await writeFile(appModulePath, next);
|
|
243
237
|
} catch {
|
|
244
238
|
}
|
|
245
|
-
await stripDeps(join(targetDir, "apps/api/package.json"), [
|
|
239
|
+
await stripDeps(join(targetDir, "apps/api/package.json"), [
|
|
240
|
+
"@icore/notes-client",
|
|
241
|
+
"@casl/ability"
|
|
242
|
+
]);
|
|
246
243
|
await stripGatewayTransport(targetDir, "NOTES");
|
|
247
244
|
const tsconfigPath = join(targetDir, "tsconfig.base.json");
|
|
248
245
|
try {
|
|
@@ -406,7 +403,7 @@ async function removeUnusedDbStrategies(targetDir, dbProvider) {
|
|
|
406
403
|
await stripTsconfigPath(targetDir, "@icore/db-supabase");
|
|
407
404
|
try {
|
|
408
405
|
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(
|
|
406
|
+
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
407
|
/if \(provider === 'supabase'\) return makeSupabaseDB\(cfg\);\n\s*return makeFirestoreDB\(cfg\);/m,
|
|
411
408
|
"return makeFirestoreDB(cfg);"
|
|
412
409
|
);
|
|
@@ -539,11 +536,69 @@ async function scaffold(opts, templatesDir) {
|
|
|
539
536
|
await rm(join(opts.targetDir, ".yarn"), { recursive: true, force: true });
|
|
540
537
|
await rm(join(opts.targetDir, ".yarnrc.yml"), { force: true });
|
|
541
538
|
}
|
|
539
|
+
if (opts.packageManager === "pnpm") {
|
|
540
|
+
await writePnpmWorkspace(opts.targetDir);
|
|
541
|
+
await rewritePnpmWorkspaceDeps(opts.targetDir);
|
|
542
|
+
}
|
|
542
543
|
await patchGitignoreForPm(opts.targetDir, opts.packageManager);
|
|
543
544
|
await writeAiFiles(opts.targetDir, opts);
|
|
544
545
|
if (opts.install) runInstall(opts.targetDir, opts.packageManager);
|
|
545
546
|
if (opts.initGit) gitInit(opts.targetDir, opts.projectName);
|
|
546
547
|
}
|
|
548
|
+
async function writePnpmWorkspace(targetDir) {
|
|
549
|
+
const pkgPath = join(targetDir, "package.json");
|
|
550
|
+
const pkg = JSON.parse(await readFile(pkgPath, "utf8"));
|
|
551
|
+
const workspaces = pkg.workspaces ?? [];
|
|
552
|
+
const packagesBlock = workspaces.map((p2) => ` - '${p2}'`).join("\n");
|
|
553
|
+
const allowBuilds = [
|
|
554
|
+
"@firebase/util",
|
|
555
|
+
"@nestjs/core",
|
|
556
|
+
"@parcel/watcher",
|
|
557
|
+
"@scarf/scarf",
|
|
558
|
+
"@swc/core",
|
|
559
|
+
"less",
|
|
560
|
+
"msgpackr-extract",
|
|
561
|
+
"nx",
|
|
562
|
+
"protobufjs",
|
|
563
|
+
"unrs-resolver"
|
|
564
|
+
].map((p2) => ` '${p2}': true`).join("\n");
|
|
565
|
+
const content = `packages:
|
|
566
|
+
${packagesBlock}
|
|
567
|
+
|
|
568
|
+
allowBuilds:
|
|
569
|
+
${allowBuilds}
|
|
570
|
+
`;
|
|
571
|
+
await writeFile(join(targetDir, "pnpm-workspace.yaml"), content);
|
|
572
|
+
}
|
|
573
|
+
async function rewritePnpmWorkspaceDeps(targetDir) {
|
|
574
|
+
const { readdir: rd } = await import("fs/promises");
|
|
575
|
+
async function walk(dir) {
|
|
576
|
+
const found = [];
|
|
577
|
+
let entries;
|
|
578
|
+
try {
|
|
579
|
+
entries = await rd(dir, { withFileTypes: true });
|
|
580
|
+
} catch {
|
|
581
|
+
return found;
|
|
582
|
+
}
|
|
583
|
+
for (const e of entries) {
|
|
584
|
+
if (e.isDirectory() && e.name !== "node_modules") {
|
|
585
|
+
found.push(...await walk(join(dir, e.name)));
|
|
586
|
+
} else if (e.isFile() && e.name === "package.json") {
|
|
587
|
+
found.push(join(dir, e.name));
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
return found;
|
|
591
|
+
}
|
|
592
|
+
const pkgFiles = await walk(targetDir);
|
|
593
|
+
for (const f of pkgFiles) {
|
|
594
|
+
try {
|
|
595
|
+
const raw = await readFile(f, "utf8");
|
|
596
|
+
const next = raw.replace(/"(@icore\/[^"]+)":\s*"\*"/g, '"$1": "workspace:*"');
|
|
597
|
+
if (next !== raw) await writeFile(f, next);
|
|
598
|
+
} catch {
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
}
|
|
547
602
|
async function patchGitignoreForPm(targetDir, pm) {
|
|
548
603
|
const giPath = join(targetDir, ".gitignore");
|
|
549
604
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idevconn/create-icore",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
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",
|
|
@@ -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
|
],
|
|
@@ -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
|
],
|
|
@@ -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
|
],
|
|
@@ -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
|
],
|
|
@@ -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
|
],
|