Skip to content

🛠 Tooling: Figure out strategy with resolveBin #1992

Open
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

Tooling Report Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have pulled the latest main branch of the repository.
  • I have searched for related issues and found none that matched my issue.

Overview

Right now in CTA, this resolveBin function is used to get the paths to binaries to execute:

// TODO: try to see if we can avoid this altogether...
// ...or failing that, create a package
export function resolveBin(bin: string) {
// This can't be tested yet in Vitest :(
// https://github.com/vitest-dev/vitest/issues/6953
return import.meta.resolve(bin).replace(/^file:\/\//gu, "");
}

scripts: [
{
commands: [
`node ${resolveBin("cspell-populate-words/bin/index.mjs")} ${wordArgs}`,
],
phase: CommandPhase.Process,
},
],

I don't love having a weird, rather-untestable function sitting around in the commands. It would be nice to figure out a cleaner approach than this... but I don't know what that would look like. 🤔

Additional Info

IIRC I'd added the resolveBin in there to work even if the project wasn't able to install its own dependencies. As in, it should use create-typescript-app/node_modules/ as the resolution root, not the generated package's.

Whatever solution is resolved here will likely need to be pushed up to Bingo. Other templates will have this issue as well.

🎁

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: toolingManaging the repository's maintenancestatus: in discussionNot yet ready for implementation or a pull request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions