@idevconn/create-icore 0.4.0 → 0.4.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 CHANGED
@@ -225,6 +225,7 @@ Re-run with @latest to refresh:
225
225
 
226
226
  // src/lib/scaffold.ts
227
227
  import { copyFile, mkdir, readdir, readFile as readFile2, stat, writeFile, rm } from "fs/promises";
228
+ import { readFileSync } from "fs";
228
229
  import { join as join2 } from "path";
229
230
  import { spawnSync } from "child_process";
230
231
  var IGNORE_TOP = /* @__PURE__ */ new Set([
@@ -662,9 +663,23 @@ function gitInit(cwd, projectName) {
662
663
  { cwd, stdio: "inherit" }
663
664
  );
664
665
  }
666
+ function resolveYarnBin(cwd) {
667
+ try {
668
+ const yarnrc = readFileSync(join2(cwd, ".yarnrc.yml"), "utf8");
669
+ const match = yarnrc.match(/^yarnPath:\s*(.+)$/m);
670
+ if (match?.[1]) return join2(cwd, match[1].trim());
671
+ } catch {
672
+ }
673
+ return join2(cwd, ".yarn", "releases", "yarn-4.5.0.cjs");
674
+ }
665
675
  function runInstall(cwd, pm) {
666
- const [cmd, ...args] = pm === "npm" ? ["npm", "install"] : pm === "pnpm" ? ["pnpm", "install"] : ["yarn", "install"];
667
- spawnSync(cmd, args, { cwd, stdio: "inherit" });
676
+ if (pm === "yarn") {
677
+ spawnSync("node", [resolveYarnBin(cwd), "install"], { cwd, stdio: "inherit" });
678
+ } else if (pm === "npm") {
679
+ spawnSync("npm", ["install"], { cwd, stdio: "inherit" });
680
+ } else {
681
+ spawnSync("pnpm", ["install"], { cwd, stdio: "inherit" });
682
+ }
668
683
  }
669
684
  async function scaffold(opts, templatesDir2) {
670
685
  await copyTree(templatesDir2, opts.targetDir);
package/dist/index.cjs CHANGED
@@ -41,6 +41,7 @@ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
41
41
 
42
42
  // src/lib/scaffold.ts
43
43
  var import_promises = require("fs/promises");
44
+ var import_node_fs = require("fs");
44
45
  var import_node_path = require("path");
45
46
  var import_node_child_process = require("child_process");
46
47
  var IGNORE_TOP = /* @__PURE__ */ new Set([
@@ -478,9 +479,23 @@ function gitInit(cwd, projectName) {
478
479
  { cwd, stdio: "inherit" }
479
480
  );
480
481
  }
482
+ function resolveYarnBin(cwd) {
483
+ try {
484
+ const yarnrc = (0, import_node_fs.readFileSync)((0, import_node_path.join)(cwd, ".yarnrc.yml"), "utf8");
485
+ const match = yarnrc.match(/^yarnPath:\s*(.+)$/m);
486
+ if (match?.[1]) return (0, import_node_path.join)(cwd, match[1].trim());
487
+ } catch {
488
+ }
489
+ return (0, import_node_path.join)(cwd, ".yarn", "releases", "yarn-4.5.0.cjs");
490
+ }
481
491
  function runInstall(cwd, pm) {
482
- const [cmd, ...args] = pm === "npm" ? ["npm", "install"] : pm === "pnpm" ? ["pnpm", "install"] : ["yarn", "install"];
483
- (0, import_node_child_process.spawnSync)(cmd, args, { cwd, stdio: "inherit" });
492
+ if (pm === "yarn") {
493
+ (0, import_node_child_process.spawnSync)("node", [resolveYarnBin(cwd), "install"], { cwd, stdio: "inherit" });
494
+ } else if (pm === "npm") {
495
+ (0, import_node_child_process.spawnSync)("npm", ["install"], { cwd, stdio: "inherit" });
496
+ } else {
497
+ (0, import_node_child_process.spawnSync)("pnpm", ["install"], { cwd, stdio: "inherit" });
498
+ }
484
499
  }
485
500
  async function scaffold(opts, templatesDir) {
486
501
  await copyTree(templatesDir, opts.targetDir);
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // src/lib/scaffold.ts
2
2
  import { copyFile, mkdir, readdir, readFile, stat, writeFile, rm } from "fs/promises";
3
+ import { readFileSync } from "fs";
3
4
  import { join } from "path";
4
5
  import { spawnSync } from "child_process";
5
6
  var IGNORE_TOP = /* @__PURE__ */ new Set([
@@ -437,9 +438,23 @@ function gitInit(cwd, projectName) {
437
438
  { cwd, stdio: "inherit" }
438
439
  );
439
440
  }
441
+ function resolveYarnBin(cwd) {
442
+ try {
443
+ const yarnrc = readFileSync(join(cwd, ".yarnrc.yml"), "utf8");
444
+ const match = yarnrc.match(/^yarnPath:\s*(.+)$/m);
445
+ if (match?.[1]) return join(cwd, match[1].trim());
446
+ } catch {
447
+ }
448
+ return join(cwd, ".yarn", "releases", "yarn-4.5.0.cjs");
449
+ }
440
450
  function runInstall(cwd, pm) {
441
- const [cmd, ...args] = pm === "npm" ? ["npm", "install"] : pm === "pnpm" ? ["pnpm", "install"] : ["yarn", "install"];
442
- spawnSync(cmd, args, { cwd, stdio: "inherit" });
451
+ if (pm === "yarn") {
452
+ spawnSync("node", [resolveYarnBin(cwd), "install"], { cwd, stdio: "inherit" });
453
+ } else if (pm === "npm") {
454
+ spawnSync("npm", ["install"], { cwd, stdio: "inherit" });
455
+ } else {
456
+ spawnSync("pnpm", ["install"], { cwd, stdio: "inherit" });
457
+ }
443
458
  }
444
459
  async function scaffold(opts, templatesDir) {
445
460
  await copyTree(templatesDir, opts.targetDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idevconn/create-icore",
3
- "version": "0.4.0",
3
+ "version": "0.4.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",