@yoms/create-monorepo 1.0.3 → 1.1.0
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/index.js +21 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -460,6 +460,10 @@ async function mergeEnvFile(baseDir, additionsPath) {
|
|
|
460
460
|
|
|
461
461
|
// src/generators/backend.generator.ts
|
|
462
462
|
var __dirname = path4.dirname(fileURLToPath(import.meta.url));
|
|
463
|
+
var getPackageRoot = () => {
|
|
464
|
+
const dirname = __dirname;
|
|
465
|
+
return path4.resolve(dirname, "..");
|
|
466
|
+
};
|
|
463
467
|
var BackendGenerator = class extends BaseGenerator {
|
|
464
468
|
config;
|
|
465
469
|
constructor(options) {
|
|
@@ -475,17 +479,18 @@ var BackendGenerator = class extends BaseGenerator {
|
|
|
475
479
|
__HAS_REDIS__: String(this.config.includeRedis),
|
|
476
480
|
__HAS_SMTP__: String(this.config.includeSmtp)
|
|
477
481
|
});
|
|
482
|
+
const packageRoot = getPackageRoot();
|
|
478
483
|
let templatePath;
|
|
479
484
|
if (this.config.type === "web") {
|
|
480
|
-
templatePath = path4.join(
|
|
485
|
+
templatePath = path4.join(packageRoot, "templates", `backend-${this.config.framework}`, "base");
|
|
481
486
|
} else if (this.config.type === "worker") {
|
|
482
|
-
templatePath = path4.join(
|
|
487
|
+
templatePath = path4.join(packageRoot, "templates", "backend-worker", "base");
|
|
483
488
|
} else {
|
|
484
|
-
templatePath = path4.join(
|
|
489
|
+
templatePath = path4.join(packageRoot, "templates", "backend-cli", "base");
|
|
485
490
|
}
|
|
486
491
|
await copyDirRecursive(templatePath, backendDir, tokens);
|
|
487
492
|
if (this.config.type === "web") {
|
|
488
|
-
const featuresPath = path4.join(
|
|
493
|
+
const featuresPath = path4.join(packageRoot, "templates", `backend-${this.config.framework}`, "features");
|
|
489
494
|
if (this.config.database) {
|
|
490
495
|
const dbFeaturePath = path4.join(featuresPath, `${this.config.database}-prisma`);
|
|
491
496
|
await mergeFeature(backendDir, dbFeaturePath, tokens);
|
|
@@ -510,6 +515,10 @@ var BackendGenerator = class extends BaseGenerator {
|
|
|
510
515
|
import path5 from "path";
|
|
511
516
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
512
517
|
var __dirname2 = path5.dirname(fileURLToPath2(import.meta.url));
|
|
518
|
+
var getPackageRoot2 = () => {
|
|
519
|
+
const dirname = __dirname2;
|
|
520
|
+
return path5.resolve(dirname, "..");
|
|
521
|
+
};
|
|
513
522
|
var FrontendGenerator = class extends BaseGenerator {
|
|
514
523
|
config;
|
|
515
524
|
constructor(options) {
|
|
@@ -522,7 +531,8 @@ var FrontendGenerator = class extends BaseGenerator {
|
|
|
522
531
|
const tokens = this.getTokens({
|
|
523
532
|
__API_URL__: this.config.apiUrl
|
|
524
533
|
});
|
|
525
|
-
const
|
|
534
|
+
const packageRoot = getPackageRoot2();
|
|
535
|
+
const templatePath = path5.join(packageRoot, "templates", "frontend-nextjs", "base");
|
|
526
536
|
await copyDirRecursive(templatePath, frontendDir, tokens);
|
|
527
537
|
}
|
|
528
538
|
};
|
|
@@ -531,12 +541,17 @@ var FrontendGenerator = class extends BaseGenerator {
|
|
|
531
541
|
import path6 from "path";
|
|
532
542
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
533
543
|
var __dirname3 = path6.dirname(fileURLToPath3(import.meta.url));
|
|
544
|
+
var getPackageRoot3 = () => {
|
|
545
|
+
const dirname = __dirname3;
|
|
546
|
+
return path6.resolve(dirname, "..");
|
|
547
|
+
};
|
|
534
548
|
var SharedGenerator = class extends BaseGenerator {
|
|
535
549
|
async generate() {
|
|
536
550
|
const sharedDir = path6.join(this.options.projectDir, "packages", "shared");
|
|
537
551
|
await ensureDir(sharedDir);
|
|
538
552
|
const tokens = this.getTokens();
|
|
539
|
-
const
|
|
553
|
+
const packageRoot = getPackageRoot3();
|
|
554
|
+
const templatePath = path6.join(packageRoot, "templates", "shared", "base");
|
|
540
555
|
await copyDirRecursive(templatePath, sharedDir, tokens);
|
|
541
556
|
}
|
|
542
557
|
};
|