New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rollup-plugin-command

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-command - npm Package Compare versions

Comparing version 1.0.7 to 1.1.0

13

dist/index.cjs.js

@@ -57,2 +57,7 @@ 'use strict';

var defaultCommandOptions = {
exitOnFail: false,
wait: false,
};
var run = (function (command, options) { return __awaiter(void 0, void 0, void 0, function () {

@@ -69,2 +74,4 @@ return __generator(this, function (_a) {

return [4 /*yield*/, new Promise(function (resolve) {
if (!options.wait)
resolve();
child_process.spawn(command, {

@@ -91,2 +98,5 @@ shell: true,

var index = (function (command, options) {
options = Object.assign({}, options, defaultCommandOptions);
console.log(options);
var called = false;
return {

@@ -99,2 +109,5 @@ name: 'command',

case 0:
if (called && options.once)
return [2 /*return*/];
called = true;
inputs = [];

@@ -101,0 +114,0 @@ if (!Array.isArray(command)) {

@@ -55,2 +55,7 @@ import { spawn } from 'child_process';

var defaultCommandOptions = {
exitOnFail: false,
wait: false,
};
var run = (function (command, options) { return __awaiter(void 0, void 0, void 0, function () {

@@ -67,2 +72,4 @@ return __generator(this, function (_a) {

return [4 /*yield*/, new Promise(function (resolve) {
if (!options.wait)
resolve();
spawn(command, {

@@ -89,2 +96,5 @@ shell: true,

var index = (function (command, options) {
options = Object.assign({}, options, defaultCommandOptions);
console.log(options);
var called = false;
return {

@@ -97,2 +107,5 @@ name: 'command',

case 0:
if (called && options.once)
return [2 /*return*/];
called = true;
inputs = [];

@@ -99,0 +112,0 @@ if (!Array.isArray(command)) {

2

package.json
{
"name": "rollup-plugin-command",
"version": "1.0.7",
"version": "1.1.0",
"description": "Run commands and call functions when bundles are generated",

@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js",

@@ -21,3 +21,3 @@ # rollup-plugin-command

// ...
command(`node tests.js`),
command(`node tests.js`, options),
],

@@ -28,2 +28,4 @@ // ...

The [options](#options) are, of course, optional.
```js

@@ -36,9 +38,31 @@ command(require('tests.js'));

[
`npm test`, // The next command will not be executed until this one is finished
require('./scripts/cleanup'), // If this returns a promise, this plugin will wait for it to be resolved before moving on to the next
`npm test`, // The next command will not be executed until this
// one is finished.
require('./scripts/cleanup').someFunc, // If this returns a
// promise, and `options.wait` is true (which is default), this
// plugin will wait for it to be resolved before moving on to the
// next command or finishing the build.
],
{ quitOnFail: true }
); // Default for options.quitOnDefault is false.
{ exitOnFail: true }
); // Default for options.exitOnFail is false.
```
### options
```ts
interface CommandOptions {
exitOnFail?: boolean; // (Only applies when one of the given commands
// is a string) Exit the current process when the child process fails.
// Default is false.
once?: boolean; // (Only valid when rollup is in watch mode) If the
// commands should be executed only the first time a bundle is built.
// Default is false.
wait?: boolean; // If the the build should wait for the commands to
// be executed. Default is true.
}
```
I hope you find this package usefull!

@@ -45,0 +69,0 @@

export declare type CommandCaller = string | Function;
export declare type CommandOptions = {
exitOnFail?: boolean;
once?: boolean;
wait?: boolean;
};
export declare type Command = [CommandCaller, CommandOptions];
export declare const defaultCommandOptions: CommandOptions;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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