Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate citation strings from citation.cff file as part of build process #3385

Merged
merged 49 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
47d57f0
delete braces from root package.json
cherriechang Aug 12, 2024
1c5f826
add rollup plugin for building citation
cherriechang Aug 27, 2024
bbd09e2
move citation rollup plugin to config folder
cherriechang Aug 27, 2024
59ce0b3
very broken :(
jodeleeuw Aug 31, 2024
7ca68ea
Merge branch 'main' into add-citation-module
jodeleeuw Sep 11, 2024
62d3427
This fixes build errors, but warnings are still present. Adds rollup/…
jodeleeuw Sep 11, 2024
c8ad1db
Merge branch 'update-config-dependencies' into add-citation-module
bjoluc Sep 11, 2024
e7abded
Update package.json
bjoluc Sep 11, 2024
fd07de6
Merge branch 'update-config-dependencies' into add-citation-module
bjoluc Sep 11, 2024
e2039c4
pulling bjorn fixes
cherriechang Sep 12, 2024
d2ae26c
pulling bjorn fixes
cherriechang Sep 12, 2024
715ed2a
pull bjorn fixes
cherriechang Sep 12, 2024
7963fdc
move additionalPlugin out of outputOptions
cherriechang Sep 12, 2024
bab33ea
fix: error handling chain in building citations
cherriechang Sep 12, 2024
909cb9a
fix build citation rollup plugin to actually generate citation
cherriechang Sep 13, 2024
bceacab
i really hate this library
cherriechang Sep 16, 2024
a2e7918
fix browser tool for citations
cherriechang Sep 19, 2024
8bbf9b7
move citation build logic from rollup to esbuild
cherriechang Oct 23, 2024
00d60fb
remove generateCitation from node scripts and directly call
cherriechang Oct 23, 2024
1365dcc
just not replacing the var
cherriechang Oct 23, 2024
81fd767
fix some config options
jodeleeuw Oct 23, 2024
eace9bf
merge with josh
cherriechang Oct 23, 2024
ef89a80
define works now
cherriechang Oct 23, 2024
99392b4
citation stuff done
cherriechang Oct 30, 2024
2cdf231
clean up dependencies
cherriechang Oct 30, 2024
d02f625
delete console logs
cherriechang Oct 30, 2024
9d5215e
clean up errors
cherriechang Oct 30, 2024
f0bc8ae
add jest tests for citation tool
cherriechang Nov 1, 2024
5753468
update plugins index.ts
cherriechang Nov 1, 2024
b63d8b6
fix double quotes in plugin src to single quotes
cherriechang Dec 6, 2024
df588e9
change prettier to allow single quotes
cherriechang Dec 6, 2024
a28ca04
localize prettier to apply only to lines
cherriechang Dec 6, 2024
1b08438
citation documentation + delete CITATION.cff files
cherriechang Dec 6, 2024
5e878d3
update getCitations() to always print jsPsych + no duplicates; update…
cherriechang Dec 9, 2024
e42ba99
modifiy citation test to check for built version
jodeleeuw Dec 17, 2024
f2d1a03
fix citation logic
cherriechang Dec 18, 2024
466b44c
Merge branch 'add-citation-module' of github.com:jspsych/jsPsych into…
cherriechang Dec 18, 2024
5b64a47
change citations test to include default jspsych citation
cherriechang Dec 18, 2024
81e7473
add prettier-ignore to jspsych.ts
cherriechang Dec 18, 2024
909ac91
update docs
cherriechang Dec 18, 2024
ca6c4eb
add docstring in JsPsych.ts for getCitations()
cherriechang Dec 18, 2024
90ee2c5
add prettier-ignore for IIFE builds
cherriechang Dec 18, 2024
f364931
change contributing.md
cherriechang Dec 18, 2024
f8e454e
delete console spies and mocks
cherriechang Dec 18, 2024
8ffe64a
add changeset
cherriechang Dec 18, 2024
3948fdc
add changeset
cherriechang Dec 18, 2024
5611b3c
remove the overrides
jodeleeuw Dec 18, 2024
4834c96
add getCitations() doc in jspsych.md under reference; delete extra ch…
cherriechang Dec 18, 2024
faf6cce
Merge branch 'add-citation-module' of github.com:jspsych/jsPsych into…
cherriechang Dec 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .changeset/violet-tools-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
"@jspsych/plugin-serial-reaction-time-mouse": minor
"@jspsych/plugin-canvas-keyboard-response": minor
"@jspsych/plugin-audio-keyboard-response": minor
"@jspsych/plugin-image-keyboard-response": minor
"@jspsych/plugin-video-keyboard-response": minor
"@jspsych/plugin-canvas-button-response": minor
"@jspsych/plugin-canvas-slider-response": minor
"@jspsych/plugin-html-keyboard-response": minor
"@jspsych/plugin-audio-button-response": minor
"@jspsych/plugin-audio-slider-response": minor
"@jspsych/plugin-image-button-response": minor
"@jspsych/plugin-image-slider-response": minor
"@jspsych/plugin-initialize-microphone": minor
"@jspsych/plugin-video-button-response": minor
"@jspsych/plugin-video-slider-response": minor
"@jspsych/plugin-categorize-animation": minor
"@jspsych/plugin-html-button-response": minor
"@jspsych/plugin-html-slider-response": minor
"@jspsych/plugin-same-different-image": minor
"@jspsych/plugin-serial-reaction-time": minor
"@jspsych/plugin-visual-search-circle": minor
"@jspsych/plugin-webgazer-init-camera": minor
"@jspsych/plugin-html-audio-response": minor
"@jspsych/plugin-html-video-response": minor
"@jspsych/plugin-same-different-html": minor
"@jspsych/plugin-survey-multi-choice": minor
"@jspsych/plugin-survey-multi-select": minor
"@jspsych/plugin-webgazer-calibrate": minor
"@jspsych/extension-mouse-tracking": minor
"@jspsych/plugin-initialize-camera": minor
"@jspsych/plugin-webgazer-validate": minor
"@jspsych/plugin-categorize-image": minor
"@jspsych/plugin-survey-html-form": minor
"@jspsych/plugin-virtual-chinrest": minor
"@jspsych/extension-record-video": minor
"@jspsych/plugin-categorize-html": minor
"@jspsych/plugin-reconstruction": minor
"@jspsych/plugin-browser-check": minor
"@jspsych/plugin-call-function": minor
"@jspsych/plugin-external-html": minor
"@jspsych/plugin-mirror-camera": minor
"@jspsych/plugin-survey-likert": minor
"@jspsych/plugin-instructions": minor
"@jspsych/extension-webgazer": minor
"@jspsych/plugin-survey-text": minor
"@jspsych/plugin-fullscreen": minor
"@jspsych/plugin-animation": minor
"@jspsych/plugin-free-sort": minor
"@jspsych/plugin-iat-image": minor
"@jspsych/plugin-sketchpad": minor
"@jspsych/plugin-iat-html": minor
"@jspsych/plugin-maxdiff": minor
"@jspsych/plugin-preload": minor
"@jspsych/plugin-resize": minor
"@jspsych/plugin-survey": minor
"@jspsych/plugin-cloze": minor
"jspsych": minor
"@jspsych/config": minor
---

Added citations property to info field of all plugins/extensions in two citation formats (apa, bibtex); added getCitations() as function in jsPsych package allowing user to generate citations by passing an array of plugins/extensions by name as first input and citation format as string as second input; changed template of plugins/extensions to contain citations field by default; citations for each plugin/extension are automatically generated from .cff file (if any) at its folder's root during build process; getCitations() prints out citations in the form of a string separating each citation with newline character, and always prints the jsPsych library citation first.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ coverage/
dist.zip
packages/jspsych/README.md
.turbo
.env
14 changes: 12 additions & 2 deletions docs/about/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,20 @@ jsPsych was created by [Josh de Leeuw](https://www.vassar.edu/faculty/jdeleeuw).

If you use this library in academic work, the preferred citation is:

de Leeuw, J.R., Gilbert, R.A., & Luchterhandt, B. (2023). jsPsych: Enabling an open-source collaborative ecosystem of behavioral experiments. *Journal of Open Source Software*, *8*(85), 5351, [https://joss.theoj.org/papers/10.21105/joss.05351](https://joss.theoj.org/papers/10.21105/joss.05351).
> de Leeuw, J.R., Gilbert, R.A., & Luchterhandt, B. (2023). jsPsych: Enabling an open-source collaborative ecosystem of behavioral experiments. *Journal of Open Source Software*, *8*(85), 5351, [https://joss.theoj.org/papers/10.21105/joss.05351](https://joss.theoj.org/papers/10.21105/joss.05351).

This paper is an updated description of jsPsych and includes all current core team members. It replaces the earlier paper that described jsPsych:

de Leeuw, J.R. (2015). jsPsych: A JavaScript library for creating behavioral experiments in a Web browser. *Behavior Research Methods*, _47_(1), 1-12. doi:[10.3758/s13428-014-0458-y](http://link.springer.com/article/10.3758%2Fs13428-014-0458-y)
> de Leeuw, J.R. (2015). jsPsych: A JavaScript library for creating behavioral experiments in a Web browser. *Behavior Research Methods*, _47_(1), 1-12. doi:[10.3758/s13428-014-0458-y](http://link.springer.com/article/10.3758%2Fs13428-014-0458-y)

Citations help us demonstrate that this library is used and valued, which allows us to continue working on it.

#### Citation tool for third-party plugins/extensions

jsPsych is an open-source, collaborative ecosystem, and many of the plugins/extensions you end up using may be contributed by third-party developers! We want to make sure they get recognition for their good work, so we made a command-line citation tool that you should use to cite this library and the plugins/extensions used in your experiment. You can see this tool in action by following these steps:

1. Launch a jsPsych experiment in your browser
2. Open up the browser console using Ctrl + ⇧ + J (Windows) or ⌘ + ⌥ + J (Mac)
3. Type `jsPsych.getCitations()`

This should print the APA format citation for the jsPsych library, which you can then copy and paste into your working document. To cite the plugins/extensions in your experiment, you should pass in an array containing the name of each plugin/extension to generate a list of citations, e.g. `jsPsych.getCitations([jsPsychHtmlKeyboardResponse, jsPsychMouseTrackingExtension])`. You can also pass in the desired output citation format as the second argument, e.g. `jsPsych.getCitations([jsPsychHtmlKeyboardResponse, jsPsychMouseTrackingExtension], "apa")`. We currently support APA formatting (`"apa"`) and BibTex formatting (`"bibtex"`).
2 changes: 2 additions & 0 deletions docs/developers/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ We welcome contributions of any scope. Before we can merge changes into the main

* **An example file should be included if applicable.** If you are contributing a new feature, new plugin, or new extension, or contributing a modification that changes the behavior of the library in some important way, consider adding an example file to the `/examples` folder in the repository.

* **If you are contributing a plugin/extension, we strongly encourage including a file containing citation information.** This file should be named `CITATION.cff` and placed at the root of your repository. This allows people who use your plugin/extension in their code to easily cite your work by calling `jsPsych.getCitations([<yourPlugin>])` from their command line. More information on `.cff` files can be found [here](https://citation-file-format.github.io/).

* **A changeset must be included in the pull request**. We use [changesets](https://github.com/atlassian/changesets/blob/main/docs/adding-a-changeset.md) to generate new releases and their corresponding release notes. [This is a good overview of changesets](https://github.com/atlassian/changesets/blob/main/docs/adding-a-changeset.md) that explains how to add one to your pull request. Feel free to ask for help with this!

* **Update the contributors.md file**. If you are a first time contributor to jsPsych please add your name to our [contributors file](https://github.com/jspsych/jsPsych/blob/main/contributors.md). And thanks!
Expand Down
28 changes: 28 additions & 0 deletions docs/reference/jspsych.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,34 @@ This method tells jsPsych that the current trial is over. It is used in all of t
jsPsych.finishTrial({correct_response: true});
```

---
## jsPsych.getCitations

```javascript
jsPsych.getCitations(plugins, format)
```
### Parameters
| Parameter | Type | Description |
| --------- | ------ | ---------------------------------------------------- |
| plugins | array | Array containing list of plugins/extensions by name. |
| format | string | Output citation format ("apa" | "bibtex") |

### Return value

String of generated citations in the specified format for the jsPsych library, followed by that for each input plugin/extension, separated with a "\n" character.

### Description

Get citations in a specified format for the jsPsych library and input list of plugins/extensions, usually those used within an experiment.

### Example

```javascript
// in browser console
jsPsych.getCitations() // prints citation for jsPsych library in APA format
jsPsych.getCitations([TestPlugin], "bibtex") // prints citation for jsPsych library and TestPlugin (if different) in BibTex format
```

---
## jsPsych.getCurrentTrial

Expand Down
Loading
Loading