Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/danielroe/uppt. A composite GitHub Action that turns conventional commits into a draft release PR, tags the PR on merge, and stages publishing to npm via OIDC trusted publishing.
github-action npm npmjs oidc staged-publish trusted-publishing
Something went wrong. Try again.
123456789101112131415161718192021222324import process from 'node:process'
/** * Run `main` only when the module is the process entrypoint, so tests can * import a script for its exports without triggering a release. * * @param url the calling module's `import.meta.url` * @param main entrypoint; sync throws and rejections both exit non-zero */export function runMain (url: string, main: () => unknown): void { if (url !== `file://${process.argv[1]}`) return const fail = (err: unknown) => { console.error(err) process.exit(1) } try { const result = main() if (result instanceof Promise) result.catch(fail) } catch (err) { fail(err) }}