@yoms/create-monorepo 1.0.2 → 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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # create-monorepo
2
2
 
3
- [![npm version](https://badge.fury.io/js/create-monorepo.svg)](https://www.npmjs.com/package/create-monorepo)
3
+ [![npm version](https://badge.fury.io/js/@yoms%2Fcreate-monorepo.svg)](https://www.npmjs.com/package/@yoms/create-monorepo)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
6
  A CLI tool to scaffold monorepo projects from templates with type sharing between packages.
@@ -19,23 +19,23 @@ You don't need to install anything! Just run:
19
19
 
20
20
  ```bash
21
21
  # Using npx (recommended)
22
- npx create-monorepo my-project
22
+ npx @yoms/create-monorepo my-project
23
23
 
24
24
  # Using pnpm
25
- pnpm create monorepo my-project
25
+ pnpm create @yoms/monorepo my-project
26
26
 
27
27
  # Using yarn
28
- yarn create monorepo my-project
28
+ yarn create @yoms/monorepo my-project
29
29
 
30
- # Using bun
31
- bunx create-monorepo my-project
30
+ # Using npm
31
+ npm create @yoms/monorepo my-project
32
32
  ```
33
33
 
34
34
  ## Quick Start
35
35
 
36
36
  ```bash
37
37
  # Create a new project
38
- npx create-monorepo my-project
38
+ npx @yoms/create-monorepo my-project
39
39
 
40
40
  # Navigate to project
41
41
  cd my-project
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(__dirname, "../../templates", `backend-${this.config.framework}`, "base");
485
+ templatePath = path4.join(packageRoot, "templates", `backend-${this.config.framework}`, "base");
481
486
  } else if (this.config.type === "worker") {
482
- templatePath = path4.join(__dirname, "../../templates", "backend-worker", "base");
487
+ templatePath = path4.join(packageRoot, "templates", "backend-worker", "base");
483
488
  } else {
484
- templatePath = path4.join(__dirname, "../../templates", "backend-cli", "base");
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(__dirname, "../../templates", `backend-${this.config.framework}`, "features");
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 templatePath = path5.join(__dirname2, "../../templates", "frontend-nextjs", "base");
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 templatePath = path6.join(__dirname3, "../../templates", "shared", "base");
553
+ const packageRoot = getPackageRoot3();
554
+ const templatePath = path6.join(packageRoot, "templates", "shared", "base");
540
555
  await copyDirRecursive(templatePath, sharedDir, tokens);
541
556
  }
542
557
  };
@@ -641,7 +656,7 @@ async function createMonorepo(targetDir) {
641
656
 
642
657
  // src/index.ts
643
658
  var cli = cac("create-monorepo");
644
- cli.command("[dir]", "Create a new monorepo project").action(async (dir) => {
659
+ cli.command("[dir]", "Create a brand new monorepo project").action(async (dir) => {
645
660
  await createMonorepo(dir);
646
661
  });
647
662
  cli.help();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoms/create-monorepo",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "description": "CLI tool to scaffold monorepo projects from templates",
5
5
  "type": "module",
6
6
  "bin": {