Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import { registerDocumentCommand } from './commands/document.js'
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' }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Suggested change
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'))


const program = new Command()

program
.name('ol')
.version('0.1.0')
.version(packageJson.version)
.description('CLI for the Outline wiki/knowledge base API')
.option('--no-spinner', 'Disable loading animations')
.addHelpText(
Expand Down
Loading