@apps-in-toss/cli 0.0.0-dev.1741074661952 → 0.0.0-dev.1741080574713

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.cjs CHANGED
@@ -37604,6 +37604,33 @@ async function setupPnpm(cwd) {
37604
37604
  stdio: "inherit"
37605
37605
  });
37606
37606
  }
37607
+ async function setupNpm(cwd) {
37608
+ p2.log.step(".npmrc \uD30C\uC77C\uC744 \uC5C5\uB370\uC774\uD2B8\uD558\uB294 \uC911...");
37609
+ const npmrcPath = import_path3.default.join(cwd, ".npmrc");
37610
+ let config = {};
37611
+ try {
37612
+ const fileContent = await import_fs4.default.promises.readFile(npmrcPath, "utf-8");
37613
+ for (const line of fileContent.split("\n")) {
37614
+ const trimmed = line.trim();
37615
+ if (trimmed && !trimmed.startsWith("#")) {
37616
+ const [key, ...rest] = trimmed.split("=");
37617
+ if (!key) {
37618
+ continue;
37619
+ }
37620
+ config[key.trim()] = rest.join("=").trim();
37621
+ }
37622
+ }
37623
+ } catch (err) {
37624
+ config = {};
37625
+ }
37626
+ config["legacy-peer-deps"] = "true";
37627
+ const newContent = Object.entries(config).map(([key, value]) => `${key}=${value}`).join("\n");
37628
+ await import_fs4.default.promises.writeFile(npmrcPath, newContent, { encoding: "utf-8" });
37629
+ await execa("npm", ["install"], {
37630
+ cwd,
37631
+ stdio: "inherit"
37632
+ });
37633
+ }
37607
37634
  async function setupYarn(cwd) {
37608
37635
  const yarnrcPath = import_path3.default.join(cwd, ".yarnrc.yml");
37609
37636
  let yarnrc = {};
@@ -37736,7 +37763,8 @@ var InitCommand = class extends import_clipanion2.Command {
37736
37763
  const workspaceRoot = (0, import_workspace_tools.getWorkspaceRoot)(cwd) ?? cwd;
37737
37764
  const lockFile = [
37738
37765
  { path: import_path3.default.join(workspaceRoot, "pnpm-lock.yaml"), type: "pnpm" },
37739
- { path: import_path3.default.join(workspaceRoot, "yarn.lock"), type: "yarn" }
37766
+ { path: import_path3.default.join(workspaceRoot, "yarn.lock"), type: "yarn" },
37767
+ { path: import_path3.default.join(workspaceRoot, "package-lock.json"), type: "npm" }
37740
37768
  ].find(({ path: path9 }) => import_fs4.default.existsSync(path9));
37741
37769
  switch (lockFile?.type) {
37742
37770
  case "pnpm": {
@@ -37747,6 +37775,10 @@ var InitCommand = class extends import_clipanion2.Command {
37747
37775
  await setupYarn(workspaceRoot);
37748
37776
  return;
37749
37777
  }
37778
+ case "npm": {
37779
+ await setupNpm(workspaceRoot);
37780
+ return;
37781
+ }
37750
37782
  }
37751
37783
  p2.outro("\u2728 \uCD08\uAE30\uD654\uAC00 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4!");
37752
37784
  }
package/dist/index.js CHANGED
@@ -37612,6 +37612,33 @@ async function setupPnpm(cwd) {
37612
37612
  stdio: "inherit"
37613
37613
  });
37614
37614
  }
37615
+ async function setupNpm(cwd) {
37616
+ p2.log.step(".npmrc \uD30C\uC77C\uC744 \uC5C5\uB370\uC774\uD2B8\uD558\uB294 \uC911...");
37617
+ const npmrcPath = path9.join(cwd, ".npmrc");
37618
+ let config = {};
37619
+ try {
37620
+ const fileContent = await fs4.promises.readFile(npmrcPath, "utf-8");
37621
+ for (const line of fileContent.split("\n")) {
37622
+ const trimmed = line.trim();
37623
+ if (trimmed && !trimmed.startsWith("#")) {
37624
+ const [key, ...rest] = trimmed.split("=");
37625
+ if (!key) {
37626
+ continue;
37627
+ }
37628
+ config[key.trim()] = rest.join("=").trim();
37629
+ }
37630
+ }
37631
+ } catch (err) {
37632
+ config = {};
37633
+ }
37634
+ config["legacy-peer-deps"] = "true";
37635
+ const newContent = Object.entries(config).map(([key, value]) => `${key}=${value}`).join("\n");
37636
+ await fs4.promises.writeFile(npmrcPath, newContent, { encoding: "utf-8" });
37637
+ await execa("npm", ["install"], {
37638
+ cwd,
37639
+ stdio: "inherit"
37640
+ });
37641
+ }
37615
37642
  async function setupYarn(cwd) {
37616
37643
  const yarnrcPath = path9.join(cwd, ".yarnrc.yml");
37617
37644
  let yarnrc = {};
@@ -37744,7 +37771,8 @@ var InitCommand = class extends Command2 {
37744
37771
  const workspaceRoot = (0, import_workspace_tools.getWorkspaceRoot)(cwd) ?? cwd;
37745
37772
  const lockFile = [
37746
37773
  { path: path9.join(workspaceRoot, "pnpm-lock.yaml"), type: "pnpm" },
37747
- { path: path9.join(workspaceRoot, "yarn.lock"), type: "yarn" }
37774
+ { path: path9.join(workspaceRoot, "yarn.lock"), type: "yarn" },
37775
+ { path: path9.join(workspaceRoot, "package-lock.json"), type: "npm" }
37748
37776
  ].find(({ path: path10 }) => fs4.existsSync(path10));
37749
37777
  switch (lockFile?.type) {
37750
37778
  case "pnpm": {
@@ -37755,6 +37783,10 @@ var InitCommand = class extends Command2 {
37755
37783
  await setupYarn(workspaceRoot);
37756
37784
  return;
37757
37785
  }
37786
+ case "npm": {
37787
+ await setupNpm(workspaceRoot);
37788
+ return;
37789
+ }
37758
37790
  }
37759
37791
  p2.outro("\u2728 \uCD08\uAE30\uD654\uAC00 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4!");
37760
37792
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apps-in-toss/cli",
3
3
  "type": "module",
4
- "version": "0.0.0-dev.1741074661952",
4
+ "version": "0.0.0-dev.1741080574713",
5
5
  "description": "CLI for Apps In Toss",
6
6
  "scripts": {
7
7
  "prepack": "yarn build",
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "7d7d7bf25013d89da285b5d81559f6de154eb111"
49
+ "gitHead": "1b262dc22061eb637e83b15e0ae248f93a90bda3"
50
50
  }