Comparing version 0.1.0 to 0.1.1
@@ -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 | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
AI-detected potential security risk
Supply chain riskAI has determined that this package may contain potential security issues or vulnerabilities.
Found 1 instance in 1 package
15262
52
1
320