forge-sql-orm 1.0.17 → 1.0.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forge-sql-orm",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "type": "module",
5
5
  "description": "Mikro-ORM integration for Forge-SQL in Atlassian Forge applications.",
6
6
  "main": "dist/ForgeSQLORM.js",
@@ -1,14 +1,13 @@
1
1
  #!/usr/bin/env node
2
- const { execSync } = require("child_process");
3
- const path = require("path");
4
- const fs = require("fs");
5
- const os = require("os");
2
+ import { execSync } from "child_process";
3
+ import path from "node:path";
6
4
 
7
- // Get CLI arguments (excluding "node" and script path)
5
+ // Get CLI arguments
8
6
  const args = process.argv.slice(2).join(" ");
9
7
 
10
- // Resolve the path to cli.ts (your TypeScript entry file)
11
- const cliPath = path.resolve(__dirname, "cli.ts");
8
+ // Resolve the path to cli.ts
9
+ const cliPath = path.resolve(new URL(".", import.meta.url), "cli.ts");
10
+
12
11
 
13
12
  // Function to run a command
14
13
  const runCommand = (cmd) => {
@@ -16,6 +15,7 @@ const runCommand = (cmd) => {
16
15
  execSync(cmd, { stdio: "inherit", shell: true });
17
16
  process.exit(0);
18
17
  } catch (e) {
18
+ console.error("⚠️ Command execution failed:", e.message);
19
19
  process.exit(1);
20
20
  }
21
21
  };
@@ -23,7 +23,7 @@ const runCommand = (cmd) => {
23
23
  // **1. Check if `ts-node` is globally installed**
24
24
  const isGlobalTsNodeInstalled = (() => {
25
25
  try {
26
- execSync("ts-node --version", { stdio: "ignore" }); // Check if `ts-node` runs without error
26
+ execSync("ts-node --version", { stdio: "ignore" });
27
27
  return true;
28
28
  } catch {
29
29
  return false;
@@ -32,9 +32,9 @@ const isGlobalTsNodeInstalled = (() => {
32
32
 
33
33
  if (isGlobalTsNodeInstalled) {
34
34
  console.log("✅ Using global ts-node");
35
- runCommand(`node -r ts-node/register ${cliPath} ${args}`);
35
+ runCommand(`node --loader ts-node/esm "${cliPath}" ${args}`);
36
36
  }
37
37
 
38
- // **3. fallback to npx**
38
+ // ** fallback to npx**
39
39
  console.warn("⚠️ Neither global nor local ts-node found, using npx...");
40
- runCommand(`npx node -r ts-node/register ${cliPath} ${args}`);
40
+ runCommand(`npx node --loader ts-node/esm "${cliPath}" ${args}`);