@swizzyweb/swerve-manager 0.3.1 → 0.3.2
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/utils/getPackageJson.js +0 -11
- package/package.json +1 -1
|
@@ -15,16 +15,11 @@ function isPath(input) {
|
|
|
15
15
|
export function getPackageJson(packageNameOrPath) {
|
|
16
16
|
try {
|
|
17
17
|
// Step 1: Resolve to an absolute path
|
|
18
|
-
// const resolvedEntry = isPath(packageNameOrPath)
|
|
19
|
-
// ? require.resolve(path.resolve(packageNameOrPath))
|
|
20
|
-
// : // : require.resolve(packageNameOrPath);
|
|
21
|
-
// require.resolve(packageNameOrPath, { paths: [process.cwd()] });
|
|
22
18
|
const resolvedEntry = isPath(packageNameOrPath)
|
|
23
19
|
? pathToFileURL(path.resolve(packageNameOrPath)).href
|
|
24
20
|
: import.meta.resolve(packageNameOrPath);
|
|
25
21
|
// Step 2: Traverse upward to find the nearest package.json
|
|
26
22
|
let dir = fileURLToPath(resolvedEntry); //path.dirname(resolvedEntry);
|
|
27
|
-
// console.log(dir);
|
|
28
23
|
while (dir !== path.parse(dir).root) {
|
|
29
24
|
const pkgPath = path.join(dir, "package.json");
|
|
30
25
|
if (fs.existsSync(pkgPath)) {
|
|
@@ -36,12 +31,7 @@ export function getPackageJson(packageNameOrPath) {
|
|
|
36
31
|
else if (dir.startsWith(".")) {
|
|
37
32
|
dir = path.join(process.cwd(), dir);
|
|
38
33
|
}
|
|
39
|
-
// console.log(dir);
|
|
40
34
|
const entrypoint = path.join(dir, packageJson.main);
|
|
41
|
-
// console.log(entrypoint);
|
|
42
|
-
// console.error(`Entrypoint is ${entrypoint}`);
|
|
43
|
-
// throw `Entrypoint is ${entrypoint}`;
|
|
44
|
-
console.log(`dir name in ${entrypoint}`);
|
|
45
35
|
return { packageJson, servicePath: entrypoint };
|
|
46
36
|
}
|
|
47
37
|
dir = path.dirname(dir);
|
|
@@ -73,7 +63,6 @@ export function getPackageJsonOrig(packageName) {
|
|
|
73
63
|
return null;
|
|
74
64
|
}
|
|
75
65
|
catch (error) {
|
|
76
|
-
//console.error(`Failed to resolve package "${packageName}":`, error);
|
|
77
66
|
return null;
|
|
78
67
|
}
|
|
79
68
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swizzyweb/swerve-manager",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "swizzy-swerve is a bootstrapper for swizzy web services. This package will bootstrap and run independent swizzy web services.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|