Skip to content

Commit

Permalink
ADD: Packager
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias Maes committed Dec 16, 2019
1 parent e43a0ad commit d67e651
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
*.scss.map

node_modules/
css/
css/
package/
17 changes: 10 additions & 7 deletions test/test.js → code/filesystem.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
const testServerPath = "../easywiki-test";
const themes = "config";
const css = "css";

const fs = require("fs");
const path = require("path");

CopyInto(themes, path.join(testServerPath, "themes"));
CopyInto(css, path.join(testServerPath, "public", "css"));

async function CopyInto(srcFolder, destFolder)
{
if(!fs.existsSync(srcFolder)) return;
Expand All @@ -30,3 +23,13 @@ async function CopyInto(srcFolder, destFolder)
}
}
}

function Mkdir(folderPath)
{
if(!fs.existsSync(folderPath))
{
fs.mkdirSync(folderPath);
}
}

module.exports = {CopyInto:CopyInto, Mkdir:Mkdir};
13 changes: 13 additions & 0 deletions code/package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const themes = "config";
const css = "css";

const path = require("path");
const fs = require('./filesystem');

fs.Mkdir("package")
fs.Mkdir(path.join("package","themes"));
fs.Mkdir(path.join("package", "public"));
fs.Mkdir(path.join("package", "public", "css"));

fs.CopyInto(themes, path.join("package","themes"));
fs.CopyInto(css, path.join("package", "public", "css"));
12 changes: 12 additions & 0 deletions code/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const testServerPath = "../easywiki-test";
const themes = "config";
const css = "css";

const path = require("path");
const fs = require('./filesystem');

fs.Mkdir(path.join(testServerPath, "themes"));
fs.Mkdir(path.join(testServerPath, "public", "css"));

fs.CopyInto(themes, path.join(testServerPath, "themes"));
fs.CopyInto(css, path.join(testServerPath, "public", "css"));
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"build": "node-sass -r -x exports -o css",
"watch": "node-sass --watch -r -x exports -o css",
"test": "node test/test.js"
"test": "node code/test.js",
"pack": "node code/package.js"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit d67e651

Please sign in to comment.