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

blake

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blake - npm Package Compare versions

Comparing version 0.8.1 to 0.8.2

40

index.js
// blake - generate site
var generate = require('./lib/generate.js')
var Transform = require('stream').Transform
, fs = require('fs')
, write = require('./lib/write.js')
, reader = require('./lib/read.js')
, getProps = require('./lib/getProps.js')
module.exports = function (source, target) {
var props = getProps(source, target)
return generate(props)
module.exports = function (s, target) {
var props = s && target ? getProps(s, target) : s
var stream = new Transform({ objectMode:true })
, read = reader(props).read
stream._transform = function (chunk, encoding, cb) {
var filename = chunk.toString()
read(filename, function (err, item) {
process(item, function (err) {
stream.push(item.path)
cb(err)
})
})
}
function process (item, cb) {
if (!item.bake) {
cb(new Error('Undefined bake function for ' + item.name))
return
}
item.read = read
item.bake(item, function (err, result) {
if (err) {
stream.emit('error', err)
return
}
write(item.path, result, cb)
})
}
return stream
}

23

lib/paths.js

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

// paths - default paths

@@ -8,23 +9,23 @@

if (me) return me
source = source || '/'
target = target || '/'
var me = Object.create(null)
me.target = target
me.resources = config.paths.resources
? join(source, config.paths.resources)
me.resources = config.paths.resources
? join(source, config.paths.resources)
: null
me.data = config.paths.data
? join(source, config.paths.data)
me.data = config.paths.data
? join(source, config.paths.data)
: null
me.templates = config.paths.templates
? join(source, config.paths.templates)
me.templates = config.paths.templates
? join(source, config.paths.templates)
: null
me.posts = config.paths.posts
me.posts = config.paths.posts
? join(source, config.paths.posts)
: null
return me
}

@@ -8,5 +8,5 @@

, Writable = require('stream').Writable
, hash = require('./hash.js')
, cache = require('./cache.js')
, StringDecoder = require('string_decoder').StringDecoder
, createHash = require('crypto').createHash
, LRU = require("lru-cache")

@@ -17,2 +17,3 @@ var me = null

if (me) return me
me = Object.create(null)

@@ -33,5 +34,6 @@ me.read = function (path, cb) {

var cache = LRU({ max: 50, maxAge: 1000 * 60 * 3 })
var decoder = new StringDecoder('utf8')
function readFile (filename, cb) {
var key = hash(filename)
var key = createHash('md5').update(filename).digest('hex')
if ((cached = cache.get(key))) {

@@ -69,3 +71,4 @@ cb(null, cached)

}
return me
}
{
"name": "blake",
"version": "0.8.1",
"version": "0.8.2",
"description": "Simple, blog aware infrastructure to generate static sites",

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

@@ -108,3 +108,3 @@ # blake - generate site

`blake` requires a configuration module at `source_directory/config.js`, which exports `paths`, and `views`, a map of generator functions:
`blake` requires a configuration module at `source_directory/config.js`, which exports `paths`, and `views` (a map of generator functions):
```js

@@ -134,10 +134,10 @@ exports.paths = {

```js
{
"title": "Example",
"description": "An example article",
"template": "article.jade",
"date": "2012-03-21"
}
{
"title": "Example",
"description": "An example article",
"template": "article.jade",
"date": "2012-03-21"
}
<The content of the example article.>
Your highness, when I said that you are like a stream of bat's piss, I only mean that you shine out like a shaft of gold when all around it is dark.
```

@@ -231,3 +231,3 @@ The end of the header is marked by an empty line. Everything that follows is interpreted as content and is passed to the views untouched.

```
To evaluate a more elaborate example, you might generate my [blog](http://michaelnisi.com), for which I use [Jade](http://jade-lang.com/) and [Markdown](http://daringfireball.net/projects/markdown/):
To evaluate a more elaborate example, you might generate my [blog](http://troubled.pro), for which I use [Jade](http://jade-lang.com/) and [Markdown](http://daringfireball.net/projects/markdown/):
```

@@ -248,3 +248,3 @@ npm install -g blake

To use the CLI (as in the above examples):
To use the command-line interface:
```

@@ -251,0 +251,0 @@ npm install -g blake

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