create-jspsych-experiment
v0.1.0
Published
Scaffold jsPsych experiments with consent, instructions, and exit survey boilerplate
Downloads
13
Maintainers
Readme
create-jspsych-experiment
Make boilerplate jsPsych experiment with consent, instructions, comprehension checks, exit survey, and DataPipe integration.
Uses plain JS files loaded from CDN.
Usage
Interactive
create-jspsych-experimentPrompts for experiment name, project name, DataPipe ID, Prolific completion code, and extra plugin URLs.
Non-interactive
create-jspsych-experiment --name s1_design_inference --project environment_design --datapipe XXXXXX --completion-code XXXWith extra plugin scripts:
create-jspsych-experiment --name s1_design_inference --project environment_design \
--plugins "https://unpkg.com/[email protected],https://unpkg.com/[email protected]"Options
| Flag | Description |
|------|-------------|
| --name <name> | Experiment name (used as output directory) |
| --project <project> | Project name |
| --title <title> | Page title (defaults to experiment name) |
| --datapipe <id> | DataPipe experiment ID |
| --completion-code <code> | Prolific completion code |
| --plugins <urls> | Comma-separated extra plugin script URLs |
Generated output
my-experiment/
├── index.html # CDN script tags, right-click prevention
├── GUIDE.md # Dev guide with examples for filling in TODOs
├── js/
│ ├── config.js # Maps, constants, settings object
│ ├── setup.js # Populates settings, creates jsPsych, assembles timeline
│ ├── loading-sequence.js # Landing page, consent form, browser check, preload
│ ├── instructions.js # Instruction pages + comprehension check loop
│ └── exit-sequence.js # Exit survey, DataPipe save, Prolific redirect
├── assets/
│ ├── favicon.ico
│ ├── instructions/.gitkeep
│ └── stims/.gitkeepAfter generating
Fill in the TODOs:
js/config.js— DefineCONDITION_MAP,TIME_ESTIMATES, DataPipe/completion IDsjs/instructions.js— Add entries toCOMPREHENSIONdict, write instruction pages ingetInstructionPages()js/setup.js— Load stimuli, build task trialsindex.html— Set title, add any extra plugin<script>tags
Setup
cd create-experiment
npm install
npm run build
npm linkThis makes create-jspsych-experiment available as a global command.
