From 6ced86ae72b4f68c65ff309b45f97f6036915ff6 Mon Sep 17 00:00:00 2001 From: dpilafian Date: Wed, 14 Aug 2024 10:25:33 -0700 Subject: [PATCH] Release v1.3.1 --- README.md | 4 ++-- dist/run-scripts.d.ts | 2 +- dist/run-scripts.js | 13 +++++++------ package.json | 4 ++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 1537917..679da1a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # run-scripts-util logo -_Organize npm package.json scripts into named groups of easy to manage commands (CLI tool designed for use in npm package.json scripts)_ +_Organize npm package.json scripts into groups of easy to manage commands (CLI tool designed for use in npm package.json scripts)_ [![License:MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/center-key/run-scripts-util/blob/main/LICENSE.txt) [![npm](https://img.shields.io/npm/v/run-scripts-util.svg)](https://www.npmjs.com/package/run-scripts-util) @@ -141,7 +141,7 @@ See the **TypeScript Declarations** at the top of [run-scripts.ts](run-scripts.t - 🪺 [recursive-exec](https://github.com/center-key/recursive-exec):  _Run a command on each file in a folder and its subfolders_ - 🔍 [replacer-util](https://github.com/center-key/replacer-util):  _Find and replace strings or template outputs in text files_ - 🔢 [rev-web-assets](https://github.com/center-key/rev-web-assets):  _Revision web asset filenames with cache busting content hash fingerprints_ - - 🚆 [run-scripts-util](https://github.com/center-key/run-scripts-util):  _Organize npm package.json scripts into named groups of easy to manage commands_ + - 🚆 [run-scripts-util](https://github.com/center-key/run-scripts-util):  _Organize npm package.json scripts into groups of easy to manage commands_ - 🚦 [w3c-html-validator](https://github.com/center-key/w3c-html-validator):  _Check the markup validity of HTML files using the W3C validator_ Feel free to submit questions at:
diff --git a/dist/run-scripts.d.ts b/dist/run-scripts.d.ts index faa3e2d..0092053 100644 --- a/dist/run-scripts.d.ts +++ b/dist/run-scripts.d.ts @@ -1,4 +1,4 @@ -//! run-scripts-util v1.3.0 ~~ https://github.com/center-key/run-scripts-util ~~ MIT License +//! run-scripts-util v1.3.1 ~~ https://github.com/center-key/run-scripts-util ~~ MIT License export type Settings = { continueOnError: boolean; diff --git a/dist/run-scripts.js b/dist/run-scripts.js index 2d0706c..9166502 100644 --- a/dist/run-scripts.js +++ b/dist/run-scripts.js @@ -1,4 +1,4 @@ -//! run-scripts-util v1.3.0 ~~ https://github.com/center-key/run-scripts-util ~~ MIT License +//! run-scripts-util v1.3.1 ~~ https://github.com/center-key/run-scripts-util ~~ MIT License import { spawn, spawnSync } from 'node:child_process'; import chalk from 'chalk'; @@ -19,7 +19,7 @@ const runScripts = { const commands = pkg.runScriptsConfig?.[group] ?? [pkg.scripts?.[group]]; const logger = createLogger(settings); if (!Array.isArray(commands) || commands.some(command => typeof command !== 'string')) - throw Error('[run-scripts-util] Cannot find commands: ' + group); + throw new Error('[run-scripts-util] Cannot find commands: ' + group); const execCommand = (step, command) => { const startTime = Date.now(); if (!settings.quiet) @@ -33,7 +33,7 @@ const runScripts = { if (task.status !== 0 && settings.continueOnError) logger(chalk.red('ERROR'), chalk.white('-->'), errorMessage()); if (task.status !== 0 && !settings.continueOnError) - throw Error('[run-scripts-util] ' + errorMessage() + '\nCommand: ' + command); + throw new Error('[run-scripts-util] ' + errorMessage() + '\nCommand: ' + command); logger(...logItems, chalk.green('done'), chalk.white(`(${Date.now() - startTime}ms)`)); }; const skip = (step, command) => { @@ -43,7 +43,8 @@ const runScripts = { logger(chalk.yellow('skipping:'), command); return !active || commentedOut; }; - commands.forEach((command, index) => !skip(index + 1, command) && execCommand(index + 1, command)); + const processCommand = (command, index) => !skip(index + 1, command) && execCommand(index + 1, command); + commands.forEach(processCommand); }, execParallel(group, options) { const defaults = { @@ -56,7 +57,7 @@ const runScripts = { const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8')); const commands = pkg.runScriptsConfig?.[group] ?? [pkg.scripts?.[group]]; if (!Array.isArray(commands) || commands.some(command => typeof command !== 'string')) - throw Error('[run-scripts-util] Cannot find commands: ' + group); + throw new Error('[run-scripts-util] Cannot find commands: ' + group); const logger = createLogger(settings); const active = (step) => settings.only === null || step === settings.only; const process = (step, command) => new Promise((resolve) => { @@ -65,7 +66,7 @@ const runScripts = { const pid = task.pid ?? null; const logItems = [chalk.white(group), chalk.yellow(step)]; if (settings.verbose) - logItems.push(chalk.magenta('pid: ' + pid), arrow); + logItems.push(chalk.magenta('pid: ' + String(pid)), arrow); logger(...logItems, chalk.cyanBright(command)); const processInfo = (code, ms) => ({ group, step, pid, start, code, ms }); task.on('close', (code) => resolve(processInfo(code, Date.now() - start))); diff --git a/package.json b/package.json index 54107ed..6a55909 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "run-scripts-util", - "version": "1.3.0", + "version": "1.3.1", "description": "Organize npm package.json scripts into groups of easy to manage commands (CLI tool designed for use in npm package.json scripts)", "license": "MIT", "type": "module", @@ -97,7 +97,7 @@ "devDependencies": { "@eslint/js": "~9.9", "@types/fancy-log": "~2.0", - "@types/node": "~22.2", + "@types/node": "~22.3", "add-dist-header": "~1.4", "assert-deep-strict-equal": "~1.2", "copy-file-util": "~1.2",