From 91aafc00b552a7f665f1bce25363c412cf153f92 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 9 Dec 2020 23:10:04 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20show=20message=20and=20ex?= =?UTF-8?q?it,=20after=20clearing=20cache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cache.ts | 2 +- src/cli.ts | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cache.ts b/src/cache.ts index 650b594..12486ea 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -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 } diff --git a/src/cli.ts b/src/cli.ts index a422a49..1d87a6b 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -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] [file-options] @@ -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) } @@ -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