Skip to content

Commit

Permalink
Release v1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Aug 14, 2024
1 parent 1e9c8d3 commit 6ced86a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# run-scripts-util
<img src=https://centerkey.com/graphics/center-key-logo.svg align=right width=200 alt=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)
Expand Down Expand Up @@ -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):&nbsp; _Run a command on each file in a folder and its subfolders_
- 🔍 [replacer-util](https://github.com/center-key/replacer-util):&nbsp; _Find and replace strings or template outputs in text files_
- 🔢 [rev-web-assets](https://github.com/center-key/rev-web-assets):&nbsp; _Revision web asset filenames with cache busting content hash fingerprints_
- 🚆 [run-scripts-util](https://github.com/center-key/run-scripts-util):&nbsp; _Organize npm package.json scripts into named groups of easy to manage commands_
- 🚆 [run-scripts-util](https://github.com/center-key/run-scripts-util):&nbsp; _Organize npm package.json scripts into groups of easy to manage commands_
- 🚦 [w3c-html-validator](https://github.com/center-key/w3c-html-validator):&nbsp; _Check the markup validity of HTML files using the W3C validator_

Feel free to submit questions at:<br>
Expand Down
2 changes: 1 addition & 1 deletion dist/run-scripts.d.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
13 changes: 7 additions & 6 deletions dist/run-scripts.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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)
Expand All @@ -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) => {
Expand All @@ -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 = {
Expand All @@ -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) => {
Expand All @@ -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)));
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 6ced86a

Please sign in to comment.