Skip to content

Commit

Permalink
fixed: Require main detection
Browse files Browse the repository at this point in the history
  • Loading branch information
GianlucaGuarini committed Jul 31, 2023
1 parent 916f99d commit eddb3e9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import process from 'node:process'
import run, * as cli from './src/index.js'
import { basename } from 'node:path'
import { pathToFileURL } from 'node:url'

export default cli

// Auto-Run the CLI if this file is not imported
if (process.mainModule) {
if (basename(pathToFileURL(process.argv[1]).href) === 'riot') {
/* c8 ignore next */
run(process.argv)
}

0 comments on commit eddb3e9

Please sign in to comment.