Skip to content

Commit

Permalink
Merge pull request #2 from AwesomeDocs/fix-symlink
Browse files Browse the repository at this point in the history
v2.0.1
  • Loading branch information
iamtraction committed Jun 30, 2019
2 parents 7be5824 + 38f0d02 commit 8498030
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
19 changes: 17 additions & 2 deletions commands/init.js
@@ -1,3 +1,5 @@
const fs = require("fs");
const path = require("path");
const shell = require("shelljs");

exports.command = "init";
Expand Down Expand Up @@ -35,8 +37,21 @@ exports.handler = function (argv) {
shell.cd("..");

// Create symlinks for internal directories
shell.ln("-sf", ".awesome/content/", "content/");
shell.ln("-sf", ".awesome/static/", "static/");
let contentDir = path.resolve("content");
let staticDir = path.resolve("static");

if (fs.existsSync(contentDir) && !fs.lstatSync(contentDir).isSymbolicLink()) {
shell.rm("-rf", ".awesome/content");
shell.ln("-sf", contentDir, ".awesome/content/");
} else {
shell.ln("-sf", ".awesome/content/", "content/");
}
if (fs.existsSync(staticDir) && !fs.lstatSync(staticDir).isSymbolicLink()) {
shell.rm("-rf", ".awesome/static");
shell.ln("-sf", staticDir, ".awesome/static/");
} else {
shell.ln("-sf", ".awesome/static/", "static/");
}

shell.echo("Success: Initialized AwesomeDocs");
};
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "awesomedocs",
"version": "2.0.0",
"version": "2.0.1",
"description": "An awesome documentation site generator!",
"main": "index.js",
"bin": {
Expand Down

0 comments on commit 8498030

Please sign in to comment.