| 161 | // Reads the CLI's own version from the package.json baked next to the bundle |
| 162 | // by pkg_json(version = DF_VERSION). Returns "0.0.0" when unreadable. |
| 163 | function readCliVersion(): string { |
| 164 | try { |
| 165 | const pkg = JSON.parse( |
| 166 | fs.readFileSync(path.join(__dirname, "package.json"), "utf8") |
| 167 | ); |
| 168 | return pkg.version || "0.0.0"; |
| 169 | } catch { |
| 170 | return "0.0.0"; |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | // @dataform/core <= 3.0.56 has no `global.__dataform_current_file` fallback in |
| 175 | // getCallerFile(), so paired with CLI >= 3.0.57 (which uses vm2 with path |