Various demonstrations of SecretSantaJS.
- JavaScript Secret Santa Pairing System Demo
- Table of Contents
- Usage Example - Website
- Usage Example - Apps Script
- Test using Node.js
URL: https://skeletony007.github.io/SecretSantaJSDemo/
Using Google Apps Script and clasp.
-
Clone this repo
git clone --recurse-submodules --depth 1 https://github.com/skeletony007/SecretSantaJSDemo.git cd SecretSantaJSDemo
-
Create new Apps Script project using clasp
clasp create --type standalone \ && cp .clasp.json .clasp.json.backup \ && jq --arg pwd "$PWD" '. + { "rootDir": $pwd, "filePushOrder": [ $pwd + "/SecretSantaJS/utils/validateJson.js", $pwd + "/SecretSantaJS/Hat.js", $pwd + "/SecretSantaJS/SecretSantaParticipant.js", $pwd + "/SecretSantaJS/SecretSanta.js", $pwd + "/main.js" ], }' .clasp.json > .clasp.json.tmp && mv .clasp.json.tmp .clasp.json \ && cp appsscript.json appsscript.json.backup \ && jq '. + { "timeZone": "Europe/London", "exceptionLogging": "STACKDRIVER", "runtimeVersion": "V8", "oauthScopes": [ "https://www.googleapis.com/auth/drive.readonly", "https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/script.send_mail" ] }' appsscript.json > appsscript.json.tmp && mv appsscript.json.tmp appsscript.json \ && clasp push -f
Using Node.js, execute the following command:
node <( \
echo 'var data = '; \
cat \
example-data.json \
SecretSantaJS/utils/validateJson.js \
SecretSantaJS/Hat.js \
SecretSantaJS/SecretSantaParticipant.js \
SecretSantaJS/SecretSanta.js \
main.js; \
echo 'console.log(JSON.stringify(test(100)))' \
)