@oss-autopilot/core 3.22.1 → 3.22.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/cli.bundle.cjs +19 -19
- package/dist/core/paths.d.ts +4 -1
- package/dist/core/paths.js +6 -2
- package/package.json +1 -1
package/dist/core/paths.d.ts
CHANGED
|
@@ -76,7 +76,10 @@ export declare function getStateCachePath(): string;
|
|
|
76
76
|
export declare function stateFileExists(): boolean;
|
|
77
77
|
/**
|
|
78
78
|
* Read the CLI package version from package.json relative to the running CLI bundle.
|
|
79
|
-
* Resolves `../package.json` from `process.argv[1]` (the bundle
|
|
79
|
+
* Resolves `../package.json` from the real path of `process.argv[1]` (the bundle
|
|
80
|
+
* entry point). An npm install runs the CLI through the `node_modules/.bin/oss-autopilot`
|
|
81
|
+
* symlink, and Node leaves `process.argv[1]` as the symlink, so without `realpathSync`
|
|
82
|
+
* the lookup lands on `node_modules/package.json` and every caller sees `0.0.0` (#1664).
|
|
80
83
|
* Falls back to '0.0.0' if the file is unreadable.
|
|
81
84
|
*/
|
|
82
85
|
export declare function getCLIVersion(): string;
|
package/dist/core/paths.js
CHANGED
|
@@ -116,12 +116,16 @@ export function stateFileExists() {
|
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
118
|
* Read the CLI package version from package.json relative to the running CLI bundle.
|
|
119
|
-
* Resolves `../package.json` from `process.argv[1]` (the bundle
|
|
119
|
+
* Resolves `../package.json` from the real path of `process.argv[1]` (the bundle
|
|
120
|
+
* entry point). An npm install runs the CLI through the `node_modules/.bin/oss-autopilot`
|
|
121
|
+
* symlink, and Node leaves `process.argv[1]` as the symlink, so without `realpathSync`
|
|
122
|
+
* the lookup lands on `node_modules/package.json` and every caller sees `0.0.0` (#1664).
|
|
120
123
|
* Falls back to '0.0.0' if the file is unreadable.
|
|
121
124
|
*/
|
|
122
125
|
export function getCLIVersion() {
|
|
123
126
|
try {
|
|
124
|
-
const
|
|
127
|
+
const entry = fs.realpathSync(process.argv[1]);
|
|
128
|
+
const pkgPath = path.join(path.dirname(entry), '..', 'package.json');
|
|
125
129
|
return JSON.parse(fs.readFileSync(pkgPath, 'utf8')).version;
|
|
126
130
|
}
|
|
127
131
|
catch {
|