mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
very broken :(
This commit is contained in:
parent
bbd09e2ace
commit
59ce0b316b
1374
package-lock.json
generated
1374
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -35,14 +35,15 @@
|
||||
},
|
||||
"homepage": "https://www.jspsych.org/latest/developers/configuration",
|
||||
"dependencies": {
|
||||
"@rollup/plugin-commonjs": "25.0.7",
|
||||
"@rollup/plugin-commonjs": "26.0.1",
|
||||
"@rollup/plugin-json": "^6.1.0",
|
||||
"@rollup/plugin-node-resolve": "15.2.3",
|
||||
"@sucrase/jest-plugin": "3.0.0",
|
||||
"@types/gulp": "4.0.17",
|
||||
"@types/jest": "29.5.8",
|
||||
"alias-hq": "6.2.3",
|
||||
"canvas": "^2.11.2",
|
||||
"esbuild": "0.15.14",
|
||||
"esbuild": "0.23.1",
|
||||
"gulp": "5.0.0",
|
||||
"gulp-cli": "3.0.0",
|
||||
"gulp-file": "0.4.0",
|
||||
@ -52,10 +53,10 @@
|
||||
"jest": "29.7.0",
|
||||
"jest-environment-jsdom": "29.7.0",
|
||||
"merge-stream": "2.0.0",
|
||||
"rollup": "4.3.0",
|
||||
"rollup-plugin-dts": "5.0.0",
|
||||
"rollup-plugin-esbuild": "5.0.0",
|
||||
"rollup-plugin-node-externals": "5.0.2",
|
||||
"rollup": "4.21.2",
|
||||
"rollup-plugin-dts": "6.1.1",
|
||||
"rollup-plugin-esbuild": "6.1.1",
|
||||
"rollup-plugin-node-externals": "7.1.3",
|
||||
"sucrase": "3.34.0",
|
||||
"tslib": "2.6.2",
|
||||
"typescript": "^5.2.2"
|
||||
@ -66,7 +67,4 @@
|
||||
"inquirer": "10.1.6"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,44 +1,55 @@
|
||||
const fs = require("node:fs");
|
||||
const path = require("path");
|
||||
require("@citation-js/plugin-software-formats");
|
||||
const { Cite } = require("@citation-js/core");
|
||||
import "@citation-js/plugin-software-formats";
|
||||
|
||||
import fs from "node:fs";
|
||||
import { extname } from "path";
|
||||
|
||||
import { Cite } from "@citation-js/core";
|
||||
import { createFilter } from "@rollup/pluginutils";
|
||||
import MagicString from "magic-string";
|
||||
|
||||
export default function cffToJsonPlugin() {
|
||||
const options = { include: ["**/index*"], exclude: [], sourcemap: false };
|
||||
let filter = createFilter(options.include, options.exclude);
|
||||
|
||||
const citationCff = fs.readFileSync("./CITATION.cff", "utf-8").toString();
|
||||
const citationJson = () => {
|
||||
try {
|
||||
return JSON.stringify(
|
||||
Cite(citationCff).format("data", {
|
||||
format: "object",
|
||||
lang: "en-us",
|
||||
}),
|
||||
null,
|
||||
2
|
||||
);
|
||||
} catch (error) {
|
||||
this.error(`Error building citation from CITATION.cff: ${error.message}`);
|
||||
}
|
||||
};
|
||||
|
||||
function cffToJsonPlugin(options = {}) {
|
||||
return {
|
||||
name: "rollup-plugin-cff-to-json",
|
||||
version: "1.0.0",
|
||||
|
||||
generateBundle() {
|
||||
const srcDir = options.srcDir || __dirname;
|
||||
const indexFilePath = path.join(srcDir, "index.js"); // Assume index.js is in src
|
||||
|
||||
const updateCitations = (indexFilePath, citationJson) => {
|
||||
let fileContent = fs.readFileSync(indexFilePath, "utf-8");
|
||||
fileContent = fileContent.replace(/`{citationJson}`/g, citationJson);
|
||||
fs.writeFileSync(indexFilePath, fileContent, "utf-8");
|
||||
};
|
||||
|
||||
const templateDir = path.dirname(srcDir);
|
||||
const cffFilePath = path.join(templateDir, "CITATION.cff"); // Assume CITATION.cff is top level
|
||||
|
||||
try {
|
||||
let cffCitation = fs.readFileSync(cffFilePath, "utf-8").toString();
|
||||
Cite.async(cffCitation).then((data) => {
|
||||
const citationJson = JSON.stringify(
|
||||
data.format("data", {
|
||||
format: "object",
|
||||
lang: "en-US",
|
||||
}),
|
||||
null,
|
||||
2
|
||||
);
|
||||
updateCitations(indexFilePath, citationJson);
|
||||
});
|
||||
} catch (error) {
|
||||
this.error(`Error building citation from CITATION.cff: ${error.message}`);
|
||||
transform: function (code, id) {
|
||||
//console.log(typeof id);
|
||||
console.log(options.include);
|
||||
console.log(id);
|
||||
console.log(filter(id));
|
||||
if (!filter(id) || (extname(id) !== ".js" && extname(id) !== ".ts")) return;
|
||||
console.log("transforming: " + id);
|
||||
const magicString = new MagicString(code);
|
||||
const targetString = "citation: []";
|
||||
const citationString = "citation: " + citationJson();
|
||||
const startIndex = code.indexOf(targetString);
|
||||
if (startIndex !== -1) {
|
||||
magicString.overwrite(startIndex, startIndex + targetString.length, citationString);
|
||||
} else {
|
||||
this.error(`Error replacing citation string in ${id}`);
|
||||
}
|
||||
|
||||
return {
|
||||
code: magicString.toString(),
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = cffToJsonPlugin;
|
||||
|
@ -9,7 +9,7 @@ import esbuild from "rollup-plugin-esbuild";
|
||||
import externals from "rollup-plugin-node-externals";
|
||||
import ts from "typescript";
|
||||
|
||||
import cffToJsonPlugin from "./rollup-plugin-build-citation";
|
||||
import cffToJsonPlugin from "./rollup-plugin-build-citation.js";
|
||||
|
||||
const getTsCompilerOptions = () => {
|
||||
const cwd = process.cwd();
|
||||
|
@ -1,8 +1,3 @@
|
||||
import "@citation-js/plugin-software-formats";
|
||||
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
import { Cite } from "@citation-js/core";
|
||||
import autoBind from "auto-bind";
|
||||
// To work with citations
|
||||
@ -14,7 +9,6 @@ import { JsPsychData, JsPsychDataDependencies } from "./modules/data";
|
||||
import { JsPsychExtension } from "./modules/extensions";
|
||||
import { PluginAPI, createJointPluginAPIObject } from "./modules/plugin-api";
|
||||
import { JsPsychPlugin } from "./modules/plugins";
|
||||
import { PluginInfo } from "./modules/plugins";
|
||||
import * as randomization from "./modules/randomization";
|
||||
import * as turk from "./modules/turk";
|
||||
import * as utils from "./modules/utils";
|
||||
|
47
packages/plugin-html-keyboard-response/CITATION.cff
Normal file
47
packages/plugin-html-keyboard-response/CITATION.cff
Normal file
@ -0,0 +1,47 @@
|
||||
cff-version: "1.2.0"
|
||||
authors:
|
||||
- family-names: Leeuw
|
||||
given-names: Joshua R.
|
||||
name-particle: de
|
||||
orcid: "https://orcid.org/0000-0003-4815-2364"
|
||||
- family-names: Gilbert
|
||||
given-names: Rebecca A.
|
||||
orcid: "https://orcid.org/0000-0003-4574-7792"
|
||||
- family-names: Luchterhandt
|
||||
given-names: Björn
|
||||
orcid: "https://orcid.org/0000-0002-9225-2787"
|
||||
contact:
|
||||
- family-names: Leeuw
|
||||
given-names: Joshua R.
|
||||
name-particle: de
|
||||
orcid: "https://orcid.org/0000-0003-4815-2364"
|
||||
doi: 10.5281/zenodo.7702307
|
||||
message: If you use this software, please cite our article in the
|
||||
Journal of Open Source Software.
|
||||
preferred-citation:
|
||||
authors:
|
||||
- family-names: Leeuw
|
||||
given-names: Joshua R.
|
||||
name-particle: de
|
||||
orcid: "https://orcid.org/0000-0003-4815-2364"
|
||||
- family-names: Gilbert
|
||||
given-names: Rebecca A.
|
||||
orcid: "https://orcid.org/0000-0003-4574-7792"
|
||||
- family-names: Luchterhandt
|
||||
given-names: Björn
|
||||
orcid: "https://orcid.org/0000-0002-9225-2787"
|
||||
date-published: 2023-05-11
|
||||
doi: 10.21105/joss.05351
|
||||
issn: 2475-9066
|
||||
issue: 85
|
||||
journal: Journal of Open Source Software
|
||||
publisher:
|
||||
name: Open Journals
|
||||
start: 5351
|
||||
title: "jsPsych: Enabling an Open-Source Collaborative Ecosystem of
|
||||
Behavioral Experiments"
|
||||
type: article
|
||||
url: "https://joss.theoj.org/papers/10.21105/joss.05351"
|
||||
volume: 8
|
||||
title: "jsPsych: Enabling an Open-Source Collaborative Ecosystem of
|
||||
Behavioral Experiments"
|
Loading…
Reference in New Issue
Block a user