Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
706111f8ba | |||
b0a56bec64 | |||
5ee8ea9b60 |
@ -1038,6 +1038,12 @@
|
||||
// TODO why are redirects broken?
|
||||
var redirectHtml = Mustache.render(desi.partials.redirect, view);
|
||||
entity.redirects.forEach(function (redirect) {
|
||||
if ("" === path.extname(redirect)) {
|
||||
redirect += "/";
|
||||
}
|
||||
if ("/" === redirect[redirect.length - 1]) {
|
||||
redirect += "index.html";
|
||||
}
|
||||
compiled.push({
|
||||
contents: redirectHtml,
|
||||
path: redirect,
|
||||
|
@ -98,7 +98,7 @@ function walkDir(parent, sub, opts) {
|
||||
|
||||
// TODO stream sha1 (for assets)
|
||||
return fs
|
||||
.readFileAsync(path.join(root, stat.name), null)
|
||||
.readFile(path.join(root, stat.name), null)
|
||||
.then(function (buffer) {
|
||||
var contents = buffer.toString("utf8");
|
||||
file.sha1 = sha1sum(contents);
|
||||
@ -144,7 +144,7 @@ function getfs(blogdir, filepaths) {
|
||||
return forEachAsync(filepaths, function (filepath) {
|
||||
var pathname = safeResolve(blogdir, filepath);
|
||||
return fs
|
||||
.lstatAsync(pathname)
|
||||
.lstat(pathname)
|
||||
.then(function (stat) {
|
||||
return fs.readFile(pathname, null).then(function (buffer) {
|
||||
files.push({
|
||||
@ -223,8 +223,7 @@ function copyfs(blogdir, files) {
|
||||
.then(function () {
|
||||
// TODO allow delete?
|
||||
return forEachAsync(sources, function (source) {
|
||||
return fsExtra
|
||||
.copyAll(
|
||||
return copyAll(
|
||||
safeResolve(blogdir, source),
|
||||
safeResolve(blogdir, files[source]),
|
||||
{ replace: true }
|
||||
@ -304,13 +303,9 @@ function putfs(blogdir, files, options) {
|
||||
return forEachAsync(files, function (file) {
|
||||
// TODO use lastModifiedDate as per client request?
|
||||
// TODO compare sha1 sums for integrity
|
||||
// NOTE existsAsync is backwards
|
||||
return fs
|
||||
.existsAsync(file.realPath)
|
||||
.access(file.realPath)
|
||||
.then(function () {
|
||||
return fs.writeFile(file.realPath, file.contents, "utf8");
|
||||
})
|
||||
.catch(function (/*exists*/) {
|
||||
if (file.delete || !file.contents) {
|
||||
return fs.unlink(file.realPath);
|
||||
}
|
||||
@ -321,6 +316,9 @@ function putfs(blogdir, files, options) {
|
||||
|
||||
return fs.writeFile(file.realPath, file.contents, "utf8");
|
||||
})
|
||||
.catch(function () {
|
||||
return fs.writeFile(file.realPath, file.contents, "utf8");
|
||||
})
|
||||
.catch(function (e) {
|
||||
putfsResults.errors.push({
|
||||
type: "file",
|
||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "desirae",
|
||||
"version": "0.12.2",
|
||||
"version": "0.12.4",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "desirae",
|
||||
"version": "0.12.2",
|
||||
"version": "0.12.4",
|
||||
"description": "An in-browser static blog library and static site generator. Similar to Jekyll, Octopress, Nanoc, etc",
|
||||
"main": "desirae.js",
|
||||
"scripts": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user