diff --git a/dist/esm-to-plain-js.d.ts b/dist/esm-to-plain-js.d.ts index ed609dd..36ce642 100644 --- a/dist/esm-to-plain-js.d.ts +++ b/dist/esm-to-plain-js.d.ts @@ -1,9 +1,8 @@ -//! esm-to-plain-js v1.1.0 ~~ https://github.com/center-key/esm-to-plain-js ~~ MIT License +//! esm-to-plain-js v1.1.1 ~~ https://github.com/center-key/esm-to-plain-js ~~ MIT License export type Settings = { cd: string; }; -export type Options = Partial; export type Result = { origin: string; dest: string; @@ -11,6 +10,7 @@ export type Result = { duration: number; }; declare const esmToPlainJs: { - transform(sourceFile: string, targetFile: string, options: Options): Result; + transform(sourceFile: string, targetFile: string, options?: Partial): Result; + reporter(result: Result): void; }; export { esmToPlainJs }; diff --git a/dist/esm-to-plain-js.js b/dist/esm-to-plain-js.js index 25ccb5d..4db081c 100644 --- a/dist/esm-to-plain-js.js +++ b/dist/esm-to-plain-js.js @@ -1,6 +1,8 @@ -//! esm-to-plain-js v1.1.0 ~~ https://github.com/center-key/esm-to-plain-js ~~ MIT License +//! esm-to-plain-js v1.1.1 ~~ https://github.com/center-key/esm-to-plain-js ~~ MIT License +import chalk from 'chalk'; import fs from 'fs'; +import log from 'fancy-log'; import path from 'path'; import slash from 'slash'; const esmToPlainJs = { @@ -8,7 +10,7 @@ const esmToPlainJs = { const defaults = { cd: null, }; - const settings = Object.assign(Object.assign({}, defaults), options); + const settings = { ...defaults, ...options }; const startTime = Date.now(); const normalize = (folder) => !folder ? '' : slash(path.normalize(folder)).replace(/\/$/, ''); const startFolder = settings.cd ? normalize(settings.cd) + '/' : ''; @@ -49,5 +51,13 @@ const esmToPlainJs = { duration: Date.now() - startTime, }; }, + reporter(result) { + const name = chalk.gray('esm-to-plain-js'); + const origin = chalk.blue.bold(result.origin); + const dest = chalk.magenta(result.dest); + const arrow = chalk.gray.bold('→'); + const info = chalk.white(`(${result.duration}ms)`); + log(name, origin, arrow, dest, info); + }, }; export { esmToPlainJs }; diff --git a/package.json b/package.json index fc6ea18..85c3d34 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "esm-to-plain-js", - "version": "1.1.0", + "version": "1.1.1", "description": "Simplistic string substitution to replace export with a globalThis assignment (CLI tool designed for use in npm scripts)", "license": "MIT", "type": "module", @@ -85,13 +85,13 @@ }, "devDependencies": { "@types/fancy-log": "~2.0", - "@types/node": "~20.6", - "@typescript-eslint/eslint-plugin": "~6.7", - "@typescript-eslint/parser": "~6.7", + "@types/node": "~20.8", + "@typescript-eslint/eslint-plugin": "~6.9", + "@typescript-eslint/parser": "~6.9", "add-dist-header": "~1.3", "assert-deep-strict-equal": "~1.1", "copy-file-util": "~1.1", - "eslint": "~8.50", + "eslint": "~8.53", "jshint": "~2.13", "mocha": "~10.2", "rimraf": "~5.0", diff --git a/task-runner.sh.command b/task-runner.sh.command index 8a0f1c7..adeca87 100755 --- a/task-runner.sh.command +++ b/task-runner.sh.command @@ -57,7 +57,7 @@ releaseInstructions() { echo "When ready to do the next release:" echo echo " === Increment version ===" - echo " Edit pacakge.json to bump $version to next version number" + echo " Edit package.json to bump $version to next version number" echo " $projectHome/package.json" } nextActionCommitTagPub() {