monowalk 1.1.0 → 1.1.1-fix

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.
@@ -21,7 +21,7 @@ const child_process_1 = require("child_process");
21
21
  const config_1 = require("../utils/config");
22
22
  const cwd = process.cwd();
23
23
  function newCommand(_a) {
24
- return __awaiter(this, arguments, void 0, function* ({ installCommand, allInstallCommand, manager, }) {
24
+ return __awaiter(this, arguments, void 0, function* ({ initCommand, manager }) {
25
25
  let name = yield (0, input_1.default)({
26
26
  message: "Project name:",
27
27
  validate(value) {
@@ -53,12 +53,12 @@ function newCommand(_a) {
53
53
  return;
54
54
  }
55
55
  const { content, configPath } = (0, config_1.findNearestConfigPath)();
56
- content.projects[name] = name;
56
+ content.projects[name] = `./${name}`;
57
57
  // Save the updated configuration file
58
58
  (0, fs_1.writeFileSync)(configPath, JSON.stringify(content, null, 2));
59
59
  (0, fs_1.mkdirSync)(projectPath);
60
60
  // Initialize the package.json file
61
- (0, child_process_1.execSync)(`${allInstallCommand}`, { cwd: projectPath, stdio: "inherit" });
61
+ (0, child_process_1.execSync)(`cd ${projectPath} && ${initCommand}`, { stdio: "inherit" });
62
62
  });
63
63
  }
64
64
  exports.description = "Create a project inside the Monowalk monorepo.";
package/bin/index.js CHANGED
@@ -21,6 +21,7 @@ const path_1 = __importDefault(require("path"));
21
21
  let installCommand = "";
22
22
  let allInstallCommand = "";
23
23
  let packageManager = "";
24
+ let initCommand = "";
24
25
  function askAndSavePackageManager() {
25
26
  return __awaiter(this, void 0, void 0, function* () {
26
27
  packageManager = yield (0, input_1.default)({
@@ -43,18 +44,22 @@ function askAndSavePackageManager() {
43
44
  case "npm":
44
45
  installCommand = "npm i";
45
46
  allInstallCommand = "npm install";
47
+ initCommand = "npm init -y";
46
48
  break;
47
49
  case "yarn":
48
50
  installCommand = "yarn add";
49
51
  allInstallCommand = "yarn install";
52
+ initCommand = "yarn init -y";
50
53
  break;
51
54
  case "pnpm":
52
55
  installCommand = "pnpm add";
53
56
  allInstallCommand = "pnpm install";
57
+ initCommand = "pnpm init -y";
54
58
  break;
55
59
  case "bun":
56
60
  installCommand = "bun add";
57
61
  allInstallCommand = "bun install";
62
+ initCommand = "bun init -y";
58
63
  break;
59
64
  default:
60
65
  console.log(`Unsupported package manager: ${packageManager}. Supported managers are npm, yarn, pnpm, and bun.`);
@@ -82,6 +87,7 @@ function askAndSavePackageManager() {
82
87
  installCommand,
83
88
  allInstallCommand,
84
89
  manager: packageManager.trim(),
90
+ initCommand,
85
91
  args: args.slice(1),
86
92
  });
87
93
  }
@@ -47,13 +47,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
47
47
  Object.defineProperty(exports, "__esModule", { value: true });
48
48
  exports.getCommands = getCommands;
49
49
  const fs_1 = require("fs");
50
- const win32_1 = __importDefault(require("path/win32"));
51
- let files = (0, fs_1.readdirSync)(win32_1.default.join(__dirname, "..", "commands")).filter((file) => file.endsWith(".ts"));
50
+ const path_1 = __importDefault(require("path"));
51
+ let files = (0, fs_1.readdirSync)(path_1.default.join(__dirname, "..", "commands"));
52
52
  function getCommands() {
53
53
  return __awaiter(this, void 0, void 0, function* () {
54
54
  let commands = [];
55
55
  for (let file of files) {
56
- let { default: command, description } = yield Promise.resolve(`${win32_1.default.join(__dirname, "..", "commands", file)}`).then(s => __importStar(require(s)));
56
+ let { default: command, description } = yield Promise.resolve(`${path_1.default.join(__dirname, "..", "commands", file)}`).then(s => __importStar(require(s)));
57
57
  commands.push({
58
58
  exec: command,
59
59
  description: description,
@@ -7,7 +7,10 @@ exports.getPackageInfo = getPackageInfo;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  function getPackageInfo() {
10
- const packagePath = path_1.default.join(__dirname, "..", "..", "package.json");
10
+ const dev = fs_1.default.existsSync(path_1.default.join(__dirname, "..", "package.json"));
11
+ const packagePath = dev
12
+ ? path_1.default.join(__dirname, "..", "package.json")
13
+ : path_1.default.join(__dirname, "..", "..", "package.json");
11
14
  const packageData = fs_1.default.readFileSync(packagePath, "utf-8");
12
15
  return JSON.parse(packageData);
13
16
  }
package/package.json CHANGED
@@ -26,9 +26,8 @@
26
26
  "type": "github",
27
27
  "url": "git+https://github.com/nekoniyah/monowalk.git"
28
28
  },
29
- "private": false,
30
- "version": "1.1.0",
29
+ "version": "1.1.1-fix",
31
30
  "scripts": {
32
31
  "prepublish": "tsc"
33
32
  }
34
- }
33
+ }