From d67e6515951132713c2a2a4a645f695015a1262b Mon Sep 17 00:00:00 2001 From: Mathias Maes Date: Mon, 16 Dec 2019 10:29:29 +0100 Subject: [PATCH] ADD: Packager --- .gitignore | 3 ++- test/test.js => code/filesystem.js | 17 ++++++++++------- code/package.js | 13 +++++++++++++ code/test.js | 12 ++++++++++++ package.json | 3 ++- 5 files changed, 39 insertions(+), 9 deletions(-) rename test/test.js => code/filesystem.js (76%) create mode 100644 code/package.js create mode 100644 code/test.js diff --git a/.gitignore b/.gitignore index b4c0e5b..09e8f1b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ *.scss.map node_modules/ -css/ \ No newline at end of file +css/ +package/ \ No newline at end of file diff --git a/test/test.js b/code/filesystem.js similarity index 76% rename from test/test.js rename to code/filesystem.js index aeb24e6..7d6c9e2 100644 --- a/test/test.js +++ b/code/filesystem.js @@ -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; @@ -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}; \ No newline at end of file diff --git a/code/package.js b/code/package.js new file mode 100644 index 0000000..07ffb40 --- /dev/null +++ b/code/package.js @@ -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")); \ No newline at end of file diff --git a/code/test.js b/code/test.js new file mode 100644 index 0000000..d1c5eb0 --- /dev/null +++ b/code/test.js @@ -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")); \ No newline at end of file diff --git a/package.json b/package.json index c5ad505..3226266 100644 --- a/package.json +++ b/package.json @@ -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",