+15
-2
| #!/usr/bin/env node | ||
| var findit = require('findit'); | ||
| var fs = require('fs'); | ||
| var path = require('path'); | ||
| var findit = require('findit'); | ||
@@ -22,2 +22,7 @@ var Bolivar = require('../index.js'); | ||
| }) | ||
| .option('force', { | ||
| abbr: 'f', | ||
| flag: true, | ||
| help: 'Run bolivar without aborting on warnings' | ||
| }) | ||
| .parse() | ||
@@ -29,2 +34,3 @@ ; | ||
| var bolivar = new Bolivar(options); | ||
@@ -42,2 +48,9 @@ | ||
| }); | ||
| } | ||
| } | ||
| if(!options.force && !fs.existsSync(path.join(options.root, '.git'))) { | ||
| console.error('No .git found in root. Use -f if you are sure what you are doing.'); | ||
| process.exit(); | ||
| } | ||
| bolivar.start(); |
+11
-7
@@ -33,9 +33,9 @@ var fs = require('fs'); | ||
| this.options = options; | ||
| } | ||
| Bolivar.prototype.start = function() { | ||
| var self = this; | ||
| self.finder = findit(self.options.root); | ||
| this.emit('test'); | ||
| var finder = findit(options.root); | ||
| finder.on('directory', function (dir, stat, stop) { | ||
| self.finder.on('directory', function (dir, stat, stop) { | ||
| var base = path.basename(dir); | ||
@@ -45,3 +45,3 @@ if (base === '.git' || base === 'node_modules') stop(); | ||
| finder.on('file', function (file, stat) { | ||
| self.finder.on('file', function (file, stat) { | ||
| var relFile = path.relative(self.options.root, file); | ||
@@ -53,4 +53,8 @@ if(path.extname(file) === '.html') { | ||
| }); | ||
| } | ||
| }; | ||
| Bolivar.prototype.stop = function() { | ||
| this.finder.stop(); | ||
| }; | ||
| Bolivar.prototype.freeFile = function(root, relFile) { | ||
@@ -57,0 +61,0 @@ var self = this; |
+2
-2
| { | ||
| "name": "bolivar", | ||
| "version": "0.0.1", | ||
| "version": "0.0.2", | ||
| "description": "Get independant from external css, js and images", | ||
@@ -18,3 +18,3 @@ "main": "index.js", | ||
| "license": "MIT", | ||
| "keywords": "independant, external files, offline development, resolve dependencies", | ||
| "keywords": "cli, independant, external files, offline development, resolve dependencies", | ||
| "dependencies": { | ||
@@ -21,0 +21,0 @@ "cheerio": "~0.15.0", |
+44
-5
@@ -11,9 +11,48 @@ # Bolivar | ||
| ## Command Line usage | ||
| ``` | ||
| $ bolivar -h | ||
| Usage: bolivar [options] | ||
| Options: | ||
| -r, --root The root directory to work on [/Users/finn/code/node/npm/bolivar] | ||
| -s, --silent When set no messages will be printed | ||
| -f, --force Run bolivar without aborting on warnings | ||
| Get independant from external css, js and images | ||
| ``` | ||
| ## Script usage | ||
| You can also use bolivar via require. It will not `console.log` messages but emit `file` and `url` events. | ||
| ```javascript | ||
| var bolivar = require('bolivar')({root: '/folder'); | ||
| bolivar.on('file', function(file) { | ||
| console.log('Acting on ' + file.name); | ||
| }) | ||
| ``` | ||
| var bolivar = require('bolivar'); | ||
| bolivar({root: '/folder') | ||
| .on('file', function(file) { | ||
| console.log('Acting on ' + file.name); | ||
| }) | ||
| .start(); | ||
| ``` | ||
| ## License | ||
| The MIT License (MIT) | ||
| Copyright (c) 2014 Finn Pauls | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
| The above copyright notice and this permission notice shall be included in | ||
| all copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| THE SOFTWARE. |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
6524
39.55%119
14.42%57
216.67%