diff options
author | Alexander Petros <apetros15@gmail.com> | 2023-09-19 12:07:24 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-19 11:07:24 -0500 |
commit | d1288d202aecbe46417e6978615e21ba3c74c8cf (patch) | |
tree | 400b8116eb485d8b076c045db67ac9fb492f3bfb /scripts | |
parent | 66023f21f9f9bb4352adde2673995d2957bbcf2d (diff) | |
download | htmx-d1288d202aecbe46417e6978615e21ba3c74c8cf.tar.gz htmx-d1288d202aecbe46417e6978615e21ba3c74c8cf.zip |
Remove old tests from the website (#1733)
The website used to host every past test suite, copied into the www
directory. We no longer need that on the website (and it makes the
codebase impossible to search) so I removed all the old tests and the
new tests are hosted simply at /test.
I also replaced the www.js script with a simpler www.sh one (since we no
longer need to do anything besides copying, really), which allowed me to
remove a node dependency that was only used in that script.
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" |