Skip to content

Commit

Permalink
fix: 🐛 show message and exit, after clearing cache
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Dec 9, 2020
1 parent b160807 commit 91aafc0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ function get(filename: string, transpiler: () => string) {
return fs.readFileSync(compiledPath, { encoding: "utf-8" })
}

export default { get, clear }
export default { get, clear, tmpPath }
9 changes: 5 additions & 4 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable no-process-exit */
import fs from "fs"
import Module from "module"
import path from "path"
import { install } from "./hook"
import fs from "fs"
import cache from "./cache"
import { install } from "./hook"

function help() {
console.log(`Usage: esr [options] <source-file> [file-options]
Expand All @@ -11,7 +12,6 @@ function help() {
--clearCache Clear transform cache
--help|-h Display this help message
`)
// eslint-disable-next-line no-process-exit
process.exit(1)
}

Expand All @@ -35,7 +35,8 @@ function parseArgs(args: string[] = process.argv) {
case "--clearCache":
case "--clear-cache":
cache.clear()
continue
console.log(`Cleared ${cache.tmpPath}`)
process.exit(0)

case "--cache":
options.cache = true
Expand Down

0 comments on commit 91aafc0

Please sign in to comment.