diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/www.js | 33 | ||||
-rwxr-xr-x | scripts/www.sh | 17 |
2 files changed, 17 insertions, 33 deletions
diff --git a/scripts/www.js b/scripts/www.js deleted file mode 100644 index a2d99d27..00000000 --- a/scripts/www.js +++ /dev/null @@ -1,33 +0,0 @@ -var config = require('../package.json'); -var fs = require('fs-extra'); - -console.log(config.version) - -var testRoot = "www/static/test/"; -var currentReleaseRoot = testRoot + config.version; -fs.ensureDirSync(currentReleaseRoot); - -// copy over all test support files -fs.copySync("node_modules/mocha/mocha.js", currentReleaseRoot + "/node_modules/mocha/mocha.js"); -fs.copySync("node_modules/mocha/mocha.css", currentReleaseRoot + "/node_modules/mocha/mocha.css"); -fs.copySync("node_modules/chai/chai.js", currentReleaseRoot + "/node_modules/chai/chai.js"); -fs.copySync("node_modules/chai-dom/chai-dom.js", currentReleaseRoot + "/node_modules/chai-dom/chai-dom.js"); -fs.copySync("node_modules/sinon/pkg/sinon.js", currentReleaseRoot + "/node_modules/sinon/pkg/sinon.js"); -fs.copySync("node_modules/mock-socket/dist/mock-socket.js", currentReleaseRoot + "/node_modules/mock-socket/dist/mock-socket.js"); -fs.copySync("test/", currentReleaseRoot + "/test"); -fs.copySync("src/", currentReleaseRoot + "/src"); - -// update the test index file to include a link for all releases -var testHTML = "<html><body style='font-family: sans-serif'><h1>HTMX TESTS</h1><ul>\n" -fs.readdirSync(testRoot).reverse().forEach(function (file) { - if (file !== "index.html") { - testHTML += "<li><a href='/test/" + file + "/test'>" + file + "</a>\n"; - } -}); -testHTML += "</ul></body>" -fs.writeFileSync(testRoot + "/index.html", testHTML); - -// copy the current htmx to the main website -fs.copySync("src/htmx.js", "www/themes/htmx-theme/static/js/htmx.js"); -fs.copySync("src/ext/class-tools.js", "www/themes/htmx-theme/static/js/class-tools.js"); -fs.copySync("src/ext/preload.js", "www/themes/htmx-theme/static/js/preload.js"); diff --git a/scripts/www.sh b/scripts/www.sh new file mode 100755 index 00000000..0601c181 --- /dev/null +++ b/scripts/www.sh @@ -0,0 +1,17 @@ +#!/bin/bash +set -euo pipefail + +STATIC_ROOT="www/static" +PACKAGE_VERSION=$(cat package.json | grep version | cut -d '"' -f 4) + + +cp node_modules/mocha/mocha.js "$STATIC_ROOT/node_modules/mocha/mocha.js" +cp node_modules/mocha/mocha.css "$STATIC_ROOT/node_modules/mocha/mocha.css" +cp node_modules/chai/chai.js "$STATIC_ROOT/node_modules/chai/chai.js" +cp node_modules/chai-dom/chai-dom.js "$STATIC_ROOT/node_modules/chai-dom/chai-dom.js" +cp node_modules/sinon/pkg/sinon.js "$STATIC_ROOT/node_modules/sinon/pkg/sinon.js" +cp node_modules/mock-socket/dist/mock-socket.js "$STATIC_ROOT/node_modules/mock-socket/dist/mock-socket.js" + +rm -rf "$STATIC_ROOT/test" "$STATIC_ROOT/src" +cp -r "./test" "$STATIC_ROOT/test" +cp -r "./src" "$STATIC_ROOT/src" |