@diviswap/sdk 1.7.9 → 1.7.11

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.
Files changed (2) hide show
  1. package/dist/cli/index.js +26 -17
  2. package/package.json +3 -2
package/dist/cli/index.js CHANGED
@@ -72,37 +72,46 @@ async function detectFramework() {
72
72
  return null;
73
73
  }
74
74
  function getPackageRoot() {
75
+ try {
76
+ const bundleDir = __dirname;
77
+ if (fs.existsSync(path.join(bundleDir, "templates"))) {
78
+ return path.dirname(path.dirname(bundleDir));
79
+ }
80
+ let packageRoot = bundleDir;
81
+ for (let i = 0; i < 5; i++) {
82
+ if (fs.existsSync(path.join(packageRoot, "dist", "cli", "templates"))) {
83
+ return packageRoot;
84
+ }
85
+ if (fs.existsSync(path.join(packageRoot, "src", "cli", "templates"))) {
86
+ return packageRoot;
87
+ }
88
+ packageRoot = path.dirname(packageRoot);
89
+ }
90
+ } catch {
91
+ }
75
92
  if (fs.existsSync(path.join(process.cwd(), "src", "cli", "templates"))) {
76
93
  return process.cwd();
77
94
  }
78
95
  try {
79
- const npmBinPath = process.env.npm_execpath || "";
80
- if (npmBinPath) {
81
- const nodeModulesPath = path.dirname(path.dirname(npmBinPath));
82
- const packagePath = path.join(nodeModulesPath, "@99darwin", "diviswap-sdk");
83
- if (fs.existsSync(path.join(packagePath, "dist", "cli", "templates"))) {
84
- return packagePath;
85
- }
96
+ const packageJsonPath = __require.resolve("@diviswap/sdk/package.json");
97
+ const packageRoot = path.dirname(packageJsonPath);
98
+ if (fs.existsSync(path.join(packageRoot, "dist", "cli", "templates"))) {
99
+ return packageRoot;
86
100
  }
87
101
  } catch {
88
102
  }
89
103
  const cwd = process.cwd();
90
104
  const pathsToCheck = [
91
- path.join(cwd, "node_modules", "@99darwin", "diviswap-sdk"),
92
- path.join(path.dirname(cwd), "node_modules", "@99darwin", "diviswap-sdk"),
93
- path.join(path.dirname(path.dirname(cwd)), "node_modules", "@99darwin", "diviswap-sdk")
105
+ path.join(cwd, "node_modules", "@diviswap", "sdk"),
106
+ path.join(path.dirname(cwd), "node_modules", "@diviswap", "sdk"),
107
+ path.join(path.dirname(path.dirname(cwd)), "node_modules", "@diviswap", "sdk")
94
108
  ];
95
109
  for (const packagePath of pathsToCheck) {
96
110
  if (fs.existsSync(path.join(packagePath, "dist", "cli", "templates"))) {
97
111
  return packagePath;
98
112
  }
99
113
  }
100
- try {
101
- const packageJsonPath = __require.resolve("@diviswap/sdk/package.json");
102
- return path.dirname(packageJsonPath);
103
- } catch {
104
- return path.join(cwd, "node_modules", "@99darwin", "diviswap-sdk");
105
- }
114
+ return path.join(cwd, "node_modules", "@diviswap", "sdk");
106
115
  }
107
116
 
108
117
  // src/cli/templates/index.ts
@@ -1922,7 +1931,7 @@ async function uninstall(options = {}) {
1922
1931
  }
1923
1932
 
1924
1933
  // package.json
1925
- var version = "1.7.9";
1934
+ var version = "1.7.11";
1926
1935
 
1927
1936
  // src/cli/index.ts
1928
1937
  var program = new commander.Command();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diviswap/sdk",
3
- "version": "1.7.9",
3
+ "version": "1.7.11",
4
4
  "description": "Official Diviswap SDK - Crypto rails made simple",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -25,7 +25,8 @@
25
25
  "types": "./dist/services/index.d.ts",
26
26
  "import": "./dist/services/index.mjs",
27
27
  "require": "./dist/services/index.js"
28
- }
28
+ },
29
+ "./package.json": "./package.json"
29
30
  },
30
31
  "scripts": {
31
32
  "build": "tsup && node scripts/copy-templates.js",