Conversation
Agent-Logs-Url: https://github.com/Doist/outline-cli/sessions/a21bf25d-511b-4332-bccf-b1d6b6a28e0a Co-authored-by: AfzalivE <436057+AfzalivE@users.noreply.github.com>
doistbot
left a comment
There was a problem hiding this comment.
Thank you for this update to dynamically pull the CLI version directly from package.json, which is a great maintainability improvement that ensures the runtime version always stays perfectly in sync with published releases. However, the current JSON import approach will cause a TypeScript build failure due to rootDir constraints, so the implementation will need to be adjusted to use a runtime file read instead.
| import { registerSearchCommand } from './commands/search.js' | ||
| import { registerSkillCommand } from './commands/skill.js' | ||
| import { registerUpdateCommand } from './commands/update/index.js' | ||
| import packageJson from '../package.json' with { type: 'json' } |
There was a problem hiding this comment.
[P0] Build failure due to missing resolveJsonModule and rootDir violation
Importing JSON modules directly requires resolveJsonModule: true in tsconfig.json. Even if that were enabled, importing ../package.json from src/index.ts violates the rootDir: "src" compiler option, as TypeScript expects all compiled files to reside within the source directory. This will cause tsc to fail the build.
To resolve this while remaining compatible with TypeScript and ESM module resolution, read and parse the file at runtime using readFileSync and import.meta.url instead of an import statement.
| import packageJson from '../package.json' with { type: 'json' } | |
| import { readFileSync } from 'node:fs' | |
| const packageJson = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf-8')) |
ol --version shows the wrong version
ol --versionwas reporting a stale hardcoded value fromsrc/index.tsinstead of the package’s actual release version. This caused version output drift wheneverpackage.jsonwas updated.Version source correction
src/index.tsto readversionfrompackage.jsonrather than a literal string.Impact
ol --versionnow reflects the current package version consistently across releases.