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

dev-watch

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dev-watch - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

40

lib/modules/sass.js

@@ -0,27 +1,25 @@

function initConfig(config, properties)
{
for(var k in properties)
if(config[properties[k]] === undefined || config[properties[k]] === null)
{
console.error(' [!] \'' + properties[k] + '\' must be specified in \'sass\' config.');
return false;
}
return true;
}
module.exports = function(config) {
return {
prodRun: function(config) {
if(!config.srcFolder)
{
console.error(' [!] \'srcFolder\' must be specified in \'sass\' config.');
if(!initConfig(config, ['srcFolder', 'destFolder']))
return;
}
if(!config.destFolder)
{
console.error(' [!] \'destFolder\' must be specified in \'sass\' config.');
return;
}
config.exec('node-sass --output-style compressed ' + config.srcFolder + ' -o ' + config.destFolder);
},
devRun: function(config) {
if(!config.srcFolder)
{
console.error(' [!] \'srcFolder\' must be specified in \'sass\' config.');
if(!initConfig(config, ['srcFolder', 'destFolder']))
return;
}
if(!config.destFolder)
{
console.error(' [!] \'destFolder\' must be specified in \'sass\' config.');
return;
}
config.exec('node-sass ' + config.srcFolder + ' -o ' + config.destFolder);

@@ -31,7 +29,5 @@ config.exec('node-sass -w ' + config.srcFolder + ' -o ' + config.destFolder);

clean: (config) => {
if(!config.destFolder)
{
console.error(' [!] \'destFolder\' must be specified in \'sass\' config.');
if(!initConfig(config, ['destFolder']))
return;
}
config.rmdir(config.destFolder);

@@ -38,0 +34,0 @@ },

var fs = require('fs'),
watch = require('node-watch');
function initConfig(config, properties)
{
for(var k in properties)
if(config[properties[k]] === undefined || config[properties[k]] === null)
{
console.error(' [!] \'' + properties[k] + '\' must be specified in \'svg-extract-layers\' config.');
return false;
}
return true;
}
module.exports = function(config) {
return {
devRun: function(config) {
if(!config.srcFolder)
{
console.error(' [!] \'srcFolder\' must be specified in \'svg-extract-layers\' config.');
if(!initConfig(config, ['srcFolder', 'destFolder']))
return;
}
if(!config.destFolder)
{
console.error(' [!] \'destFolder\' must be specified in \'svg-extract-layers\' config.');
return;
}

@@ -63,7 +67,5 @@ var path = config.srcFolder;

clean: (config) => {
if(!config.destFolder)
{
console.error(' [!] \'destFolder\' must be specified in \'svg-extract-layers\' config.');
if(!initConfig(config, ['destFolder']))
return;
}
config.rmdir(config.destFolder);

@@ -70,0 +72,0 @@ },

@@ -16,3 +16,3 @@ var watch = require('node-watch');

config.exec('tsc --p ' + config.configFile + ' --watch', () => {
config.exec('tsc --p ' + config.configFile, () => {
var srcFile = config.tempFolder + '/' + config.rootFile + '.js';

@@ -40,3 +40,4 @@ console.log(' [ ] ' + config.dest + ' updating from ' + srcFile);

var srcFile = config.tempFolder + '/' + config.rootFile + '.js';
console.log(' [ ] ' + config.dest + ' updating from ' + srcFile);
console.log(' [o] ' + filename + ' updated');
console.log(' [ ] compiling ' + srcFile + ' to ' + config.dest);
config.exec('browserify -s main ' + srcFile + ' -o ' + config.dest, () => {

@@ -43,0 +44,0 @@ console.log(' [o] ' + config.dest + ' updated');

{
"name": "dev-watch",
"version": "0.1.0",
"version": "0.1.1",
"description": "Watch files and compile/transform them for development purpose",

@@ -5,0 +5,0 @@ "main": "./lib/dev-watch",

# dev-watch
NPM repository for dev-watch - Watch and compile/transform folders/files
## Installation
```
npm install -g dev-watch
```
Add to your JSON configuration file (it can be `package.json`) a property `devWatch` containing an `Object` with the different watchers you want to use.
Here is a sample :
```json
{
"devWatch": {
"cmd": "dev",
"runs": [
{
"type": "typescript",
"tempFolder": "react/bin",
"rootFile": "root",
"dest": "public/react.js"
},
{
"type": "sass",
"srcFolder": "styles",
"destFolder": "public/styles"
}
]
}
}
```
The `cmd` property defines the kind of things to do :
Command | Description
-|-
dev | Compile and transform everytime something changes
prod | Compile and transform, then exit
clean | Clean the destination folders/files (might be unsafe)
The `runs` property defines the watchers. Call `dev-watch` to get a list of the watchers and their properties.
## Usage
```
dev-watch <configuration-file-path> [<cmd>]
dev-watch package.json
dev-watch package.json clean
```
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