Skip to content
Discussion options

You must be logged in to vote

I was able to get a working version. If anyone is interested here is the project: https://github.com/samedwardes/fixmyspelling

#!/usr/bin/env node

// Injected at build time via --define flag
declare const __VERSION__: string;

// Fallback for when running unbundled (during development/testing)
async function getVersion(): Promise<string> {
  // Check if __VERSION__ is defined (it will be in bundled code)
  if (typeof __VERSION__ !== "undefined") {
    return __VERSION__;
  }

  // When running unbundled, read from package.json
  const packageJsonPath = new URL("../package.json", import.meta.url);
  const text = await Bun.file(packageJsonPath).text();
  const packageJson = JSON.parse(text);

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@hippietrail
Comment options

@SamEdwardes
Comment options

Answer selected by elijah-potter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants