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

vite-plugin-watch-and-run

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-watch-and-run - npm Package Compare versions

Comparing version 1.1.3 to 1.2.0

19

cjs/index.js

@@ -14,3 +14,3 @@ "use strict";

function checkConf(params) {
var _a, _b;
var _a, _b, _c;
if (!Array.isArray(params)) {

@@ -29,2 +29,3 @@ throw new Error('plugin watchAndRun, `params` needs to be an array.');

watch: paramRow.watch,
shell: (_c = paramRow.shell) !== null && _c !== void 0 ? _c : true,
watchFile: paramRow.watchFile,

@@ -71,3 +72,3 @@ formatErrors: paramRow.formatErrors,

function formatLog(str, name) {
return `${name ? (0, helper_1.logMagneta)(`[${name}]`) : ''} ${str}`;
return `${name ? (0, helper_1.magneta)(`[${name}]`) : ''} ${str}`;
}

@@ -80,10 +81,10 @@ async function watcher(absolutePath, watchKind, watchAndRunConf) {

if (!info.quiet) {
let message = `${(0, helper_1.logGreen)('✔')} Watch ${(0, helper_1.logCyan)(watchKind)}`;
let message = `${(0, helper_1.green)('✔')} Watch ${(0, helper_1.cyan)(watchKind)}`;
if (info.watch && absolutePath) {
message += (0, helper_1.logGreen)(' ' + absolutePath.replaceAll(process.cwd(), ''));
message += (0, helper_1.green)(' ' + absolutePath.replaceAll(process.cwd(), ''));
}
if (typeof info.run === 'string') {
message += ` and run ${(0, helper_1.logGreen)(info.run)} `;
message += ` and run ${(0, helper_1.green)(info.run)} `;
}
message += ` ${(0, helper_1.logCyan)(info.delay + 'ms')}`;
message += ` ${(0, helper_1.cyan)(info.delay + 'ms')}`;
log.info(message);

@@ -112,3 +113,3 @@ }

}
const child = (0, node_child_process_1.spawn)(info.run, [], { shell: true });
const child = (0, node_child_process_1.spawn)(info.run, [], { shell: info.shell });
//spit stdout to screen

@@ -126,6 +127,6 @@ child.stdout.on('data', data => {

if (code === 0) {
log.info(`${(0, helper_1.logGreen)('✔')} finished ${(0, helper_1.logGreen)('successfully')}`);
log.info(`${(0, helper_1.green)('✔')} finished ${(0, helper_1.green)('successfully')}`);
}
else {
log.error(`finished with some ${(0, helper_1.logRed)('errors')}`);
log.error(`finished with some ${(0, helper_1.red)('errors')}`);
}

@@ -132,0 +133,0 @@ info.isRunning = false;

@@ -1,2 +0,2 @@

import { Log, logCyan, logGreen, logMagneta, logRed } from '@kitql/helper';
import { cyan, green, Log, magneta, red } from '@kitql/helper';
import micromatch from 'micromatch';

@@ -10,3 +10,3 @@ import { spawn } from 'node:child_process';

function checkConf(params) {
var _a, _b;
var _a, _b, _c;
if (!Array.isArray(params)) {

@@ -25,2 +25,3 @@ throw new Error('plugin watchAndRun, `params` needs to be an array.');

watch: paramRow.watch,
shell: (_c = paramRow.shell) !== null && _c !== void 0 ? _c : true,
watchFile: paramRow.watchFile,

@@ -67,3 +68,3 @@ formatErrors: paramRow.formatErrors,

function formatLog(str, name) {
return `${name ? logMagneta(`[${name}]`) : ''} ${str}`;
return `${name ? magneta(`[${name}]`) : ''} ${str}`;
}

@@ -76,10 +77,10 @@ async function watcher(absolutePath, watchKind, watchAndRunConf) {

if (!info.quiet) {
let message = `${logGreen('✔')} Watch ${logCyan(watchKind)}`;
let message = `${green('✔')} Watch ${cyan(watchKind)}`;
if (info.watch && absolutePath) {
message += logGreen(' ' + absolutePath.replaceAll(process.cwd(), ''));
message += green(' ' + absolutePath.replaceAll(process.cwd(), ''));
}
if (typeof info.run === 'string') {
message += ` and run ${logGreen(info.run)} `;
message += ` and run ${green(info.run)} `;
}
message += ` ${logCyan(info.delay + 'ms')}`;
message += ` ${cyan(info.delay + 'ms')}`;
log.info(message);

@@ -108,3 +109,3 @@ }

}
const child = spawn(info.run, [], { shell: true });
const child = spawn(info.run, [], { shell: info.shell });
//spit stdout to screen

@@ -122,6 +123,6 @@ child.stdout.on('data', data => {

if (code === 0) {
log.info(`${logGreen('✔')} finished ${logGreen('successfully')}`);
log.info(`${green('✔')} finished ${green('successfully')}`);
}
else {
log.error(`finished with some ${logRed('errors')}`);
log.error(`finished with some ${red('errors')}`);
}

@@ -128,0 +129,0 @@ info.isRunning = false;

{
"name": "vite-plugin-watch-and-run",
"version": "1.1.3",
"version": "1.2.0",
"description": "vite-plugin that will watch some files and run a package.json script on change",
"dependencies": {
"micromatch": "4.0.5",
"@kitql/helper": "0.6.1"
"@kitql/helper": "0.7.0"
},

@@ -9,0 +9,0 @@ "repository": {

@@ -33,2 +33,6 @@ import type { Plugin } from 'vite';

/**
* Add shell option to spawn, set "powershell.exe" for example to use it there.
*/
shell?: string | null;
/**
* formatErrors instead of throwing an error

@@ -52,2 +56,3 @@ */

name?: string | null;
shell: string | boolean;
formatErrors?: (e: unknown, afterError?: (e: Error) => void) => void;

@@ -54,0 +59,0 @@ };

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