Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

runner

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

runner - npm Package Compare versions

Comparing version 3.0.0 to 4.0.0

.eslintrc.cjs

62

bin/cli.js

@@ -8,20 +8,17 @@ #!/usr/bin/env node

'use strict';
import path from 'path';
import {Command} from 'commander/esm.mjs';
import log from 'runner-logger';
import runner from '../index.js';
const
path = require('path'),
program = require('commander'),
log = require('runner-logger'),
runner = require('../index'),
packageData = require('../package.json');
const program = new Command();
program
.version(packageData.version)
.version('4.0.0')
.usage('[options] [<task>]')
.description(packageData.description)
.description('Simple task runner')
.option('-c, --config [file]', 'configuration file with tasks', 'runner.js')
.option('-s, --serial', 'run all given tasks sequentially (instead of in parallel)');
program.on('--help', function () {
program.on('--help', () => {
console.log([

@@ -40,27 +37,32 @@ '',

program.parse(process.argv);
const options = program.opts();
// config absolute path
program.config = path.normalize(path.join(process.cwd(), program.config));
options.config = path.normalize(path.join(process.cwd(), options.config));
// load config
log.info('config file: ' + log.colors.green(program.config));
require(program.config);
(async () => {
// load config
log.info('config file: ' + log.colors.green(options.config));
await import(options.config);
// run
if ( program.args.length === 1 ) {
// just a single task
runner.run(program.args[0]);
} else {
if ( program.args.length > 1 ) {
// list of tasks
log.info('run mode: ' + (program.serial ? 'serial' : 'parallel'));
// run
if ( program.args.length === 1 ) {
// just a single task
runner.run(program.args[0]);
} else {
if ( program.args.length > 1 ) {
// list of tasks
log.info('run mode: ' + (options.serial ? 'serial' : 'parallel'));
if ( program.serial ) {
runner.task('default', runner.serial.apply(runner, program.args));
} else {
runner.task('default', runner.parallel.apply(runner, program.args));
if ( options.serial ) {
//runner.task('default', runner.serial.apply(runner, program.args));
runner.task('default', runner.serial(...program.args));
} else {
//runner.task('default', runner.parallel.apply(runner, program.args));
runner.task('default', runner.parallel(...program.args));
}
}
runner.start();
}
runner.start();
}
})();

@@ -6,11 +6,8 @@ /**

'use strict';
import chokidar from 'chokidar';
import Runner from 'cjs-runner';
import log from 'runner-logger';
const
chokidar = require('chokidar'),
Runner = require('cjs-runner'),
log = require('runner-logger'),
runner = new Runner();
const runner = new Runner();
// should be removed after rework!

@@ -31,9 +28,2 @@ global.DEVELOP = true;

runner.watch = function ( glob, task ) {
let taskId;
function handler ( name ) {
log.info('changed: %s run: %s', log.colors.magenta(name), log.colors.cyan(taskId));
runner.run(task);
}
console.assert(arguments.length === 2, 'wrong arguments number');

@@ -43,4 +33,9 @@ console.assert(typeof task === 'string' || typeof task === 'function', 'task should be a string or a function');

taskId = typeof task === 'string' ? task : task.name || '<noname>';
const taskId = typeof task === 'string' ? task : task.name || '<noname>';
const handler = name => {
log.info('changed: %s run: %s', log.colors.magenta(name), log.colors.cyan(taskId));
runner.run(task);
};
return chokidar.watch(glob, runner.watch.config)

@@ -82,3 +77,3 @@ .on('change', handler)

process.stdin.on('keypress', function ( str, key ) {
process.stdin.on('keypress', ( str, key ) => {
let keystroke = [];

@@ -98,11 +93,11 @@

runner.addListener('start', function ( event ) {
runner.addListener('start', event => {
log.info('starting %s ...', log.colors.cyan(event.id));
});
runner.addListener('finish', function ( event ) {
runner.addListener('finish', event => {
log.info('finished %s after %s ms', log.colors.cyan(event.id), log.colors.magenta(event.time));
});
runner.addListener('error', function ( event ) {
runner.addListener('error', event => {
if ( event.code === 404 ) {

@@ -120,2 +115,2 @@ log.fail('task %s is missing', log.colors.bold(event.id));

// public
module.exports = runner;
export default runner;
{
"name": "runner",
"version": "3.0.0",
"version": "4.0.0",
"description": "Simple task runner.",

@@ -16,2 +16,3 @@ "author": {

},
"type": "module",
"scripts": {

@@ -23,8 +24,8 @@ "lint": "eslint .",

"cjs-runner": "^1.5.1",
"chokidar": "^3.0.0",
"commander": "^2.20.0",
"chokidar": "^3.5.3",
"commander": "^8.3.0",
"runner-logger": "^2.0.0"
},
"devDependencies": {
"cjs-eslint": "^1.2.4"
"cjs-eslint": "^2.1.0"
},

@@ -31,0 +32,0 @@ "keywords": [

@@ -6,4 +6,2 @@ Simple task runner

[![npm version](https://img.shields.io/npm/v/runner.svg?style=flat-square)](https://www.npmjs.com/package/runner)
[![dependencies status](https://img.shields.io/david/runner/runner.svg?style=flat-square)](https://david-dm.org/runner/runner)
[![devDependencies status](https://img.shields.io/david/dev/runner/runner.svg?style=flat-square)](https://david-dm.org/runner/runner?type=dev)
[![Gitter](https://img.shields.io/badge/gitter-join%20chat-blue.svg?style=flat-square)](https://gitter.im/DarkPark/runner)

@@ -75,3 +73,3 @@ [![RunKit](https://img.shields.io/badge/RunKit-try-yellow.svg?style=flat-square)](https://npm.runkit.com/runner)

```js
const runner = require('runner');
import runner from 'runner';
```

@@ -78,0 +76,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc