Skip to content

Commit

Permalink
Merge pull request #36 from Watts-Lab/kimberly-render-delib-empirica
Browse files Browse the repository at this point in the history
Render delib empirica
  • Loading branch information
JamesPHoughton authored Jun 21, 2024
2 parents 027361e + bd3e5c8 commit 15bfa5e
Show file tree
Hide file tree
Showing 15 changed files with 9,766 additions and 4,646 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ jobs:
cypress-run:
timeout-minutes: 15
runs-on: ubuntu-latest
# Runs tests in parallel with matrix strategy https://docs.cypress.io/guides/guides/parallelization
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
# Also see warning here https://github.com/cypress-io/github-action#parallel
strategy:
fail-fast: false # https://github.com/cypress-io/github-action/issues/48
matrix:
containers: [1, 2] # Uses 2 parallel instances

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "20"
- name: Cypress run
# Uses the official Cypress GitHub action https://github.com/cypress-io/github-action
uses: cypress-io/github-action@v6
Expand All @@ -22,9 +22,9 @@ jobs:
# https://docs.cypress.io/guides/continuous-integration/introduction#Boot-your-server
build: npm run build
start: npm run start
wait-on: 'http://localhost:3000' # Waits for above
wait-on: "http://localhost:3000" # Waits for above
wait-on-timeout: 600
# Records to Cypress Cloud
# Records to Cypress Cloud
# https://docs.cypress.io/guides/cloud/projects#Set-up-a-project-to-record
record: true
parallel: true # Runs test in parallel using settings above
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "deliberation-empirica"]
path = deliberation-empirica
url = https://github.com/Watts-Lab/deliberation-empirica.git
75 changes: 75 additions & 0 deletions @empirica-mocks/core/mocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
export function usePlayer() {
// This is a mock function that returns a mock player object
console.log("loaded usePlayer() from react-mocks.js");
const player = {
isMock: true,
introDone: true,
exitStep: 0, //TODO,
position: 0, //TODO - set with toggle
get: function (varName) {
return this[varName];
},
set: function (varName, value) {
this[varName] = value;
},
};

return player;
}

export function useGame() {
// This is a mock function that returns a mock game object
const game = {
isMock: true,
ended: false,
get: function (varName) {
return this[varName];
},
set: function (varName, value) {
this[varName] = value;
},
};

return game;
}

export function useStageTimer() {
//TODO implement?
// This is a mock function that returns a mock stage timer object
const stageTimer = {
isMock: true,
};

return stageTimer;
}

export function useStage() {
// This is a mock function that returns a mock stage object
const stage = {
isMock: true,
index: 0, //TODO
get: function (varName) {
return this[varName];
},
set: function (varName, value) {
this[varName] = value;
},
};

return stage;
}

export function usePlayers() {
// This is a mock function that returns a mock players object
const players = {
isMock: true,
get: function (varName) {
return this[varName];
},
set: function (varName, value) {
this[varName] = value;
},
};

return players;
}
202 changes: 202 additions & 0 deletions @empirica-mocks/core/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
{
"name": "@empirica/core",
"version": "1.9.6",
"description": "Empirica Core",
"author": "Nicolas Paton <nicolas.paton@gmail.com>",
"license": "Apache-2.0",
"homepage": "https://github.com/empiricaly/empirica#readme",
"bugs": {
"url": "https://github.com/empiricaly/empirica/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/empiricaly/empirica.git"
},
"keywords": [
"empirica",
"experiment",
"research",
"multiplayer",
"real-time",
"behavioral",
"social-science",
"psychology"
],
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
},
"./console": {
"types": "./dist/console.d.ts",
"import": "./dist/console.js",
"require": "./dist/console.cjs"
},
"./player": {
"types": "./dist/player.d.ts",
"import": "./dist/player.js",
"require": "./dist/player.cjs"
},
"./player/react": {
"import": "./react-mocks.js"
},
"./player/classic": {
"types": "./dist/player-classic.d.ts",
"import": "./dist/player-classic.js",
"require": "./dist/player-classic.cjs"
},
"./player/classic/react": {
"import": "./mocks.js"
},
"./user": {
"types": "./dist/user.d.ts",
"import": "./dist/user.js",
"require": "./dist/user.cjs"
},
"./admin": {
"types": "./dist/admin.d.ts",
"import": "./dist/admin.js",
"require": "./dist/admin.cjs"
},
"./admin/classic": {
"types": "./dist/admin-classic.d.ts",
"import": "./dist/admin-classic.js",
"require": "./dist/admin-classic.cjs"
}
},
"types": "dist/index.d.ts",
"main": "dist/index.js",
"player": "dist/player.js",
"player-react": "dist/player-react.js",
"player-classic": "dist/player-classic.js",
"player-classic-react": "dist/player-classic-react.js",
"admin": "dist/admin.js",
"admin-classic": "dist/admin-classic.js",
"console": "dist/console.js",
"targets": {
"main": {
"source": "src/index.ts",
"isLibrary": true,
"outputFormat": "esmodule",
"sourceMap": true
},
"player": {
"source": "src/player/index.ts",
"isLibrary": true,
"outputFormat": "esmodule",
"sourceMap": true
},
"player-react": {
"source": "src/player/react/index.ts",
"isLibrary": true,
"outputFormat": "esmodule",
"sourceMap": true
},
"player-classic": {
"source": "src/player/classic/index.ts",
"isLibrary": true,
"outputFormat": "esmodule",
"sourceMap": true
},
"player-classic-react": {
"source": "src/player/classic/react/index.ts",
"isLibrary": true,
"outputFormat": "esmodule",
"sourceMap": true
},
"admin": {
"source": "src/admin/index.ts",
"isLibrary": true,
"outputFormat": "esmodule",
"sourceMap": true
},
"admin-classic": {
"source": "src/admin/classic/index.ts",
"isLibrary": true,
"outputFormat": "esmodule",
"sourceMap": true
},
"console": {
"source": "src/utils/console.ts",
"isLibrary": true,
"outputFormat": "esmodule",
"sourceMap": true
}
},
"volta": {
"node": "20.10.0",
"npm": "10.2.3"
},
"engines": {
"node": ">= 16.17.0"
},
"browserslist": "> 0.5%, last 2 versions, not dead",
"ava": {
"files": [
"src/**/*_test.ts",
"src/**/*_test.tsx"
],
"extensions": {
"ts": "module",
"tsx": "module"
},
"nodeArguments": [
"--loader=ts-node/esm",
"--experimental-specifier-resolution=node"
]
},
"files": [
"dist/*"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "tsup",
"check": "tsc --noEmit",
"test:real": "NODE_NO_WARNINGS=1 TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true c8 -r lcov -r html ava -v",
"test": "echo 'tests temporarily disabled'",
"test:watch": "NODE_NO_WARNINGS=1 TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true ava --watch -v",
"prerelease:legacy": "npm run build",
"prepublish": "npm run build"
},
"devDependencies": {
"@julr/unocss-preset-forms": "0.0.5",
"@testing-library/react": "13.3.0",
"@types/archiver": "5.3.1",
"@types/node": "18.0.0",
"@types/react": "18.0.14",
"@types/sinon": "10.0.11",
"@types/stream-buffers": "3.0.4",
"@types/tmp": "0.2.3",
"@unocss/postcss": "0.51.4",
"ava": "4.3.0",
"c8": "7.11.3",
"global-jsdom": "8.4.0",
"jsdom": "20.0.0",
"postcss": "8.4.21",
"prettier": "2.7.1",
"sinon": "14.0.0",
"tmp": "0.2.1",
"ts-node": "10.8.1",
"tsup": "6.7.0",
"typedoc": "0.24.6",
"typedoc-plugin-markdown": "4.0.0-next.10",
"typescript": "4.7.4",
"unocss": "0.51.4"
},
"dependencies": {
"@empirica/tajriba": "1.6.0",
"@swc/helpers": "0.4.2",
"@unocss/reset": "^0.51.4",
"archiver": "5.3.1",
"async-mutex": "0.4.1",
"rxjs": "7.5.5",
"stream-buffers": "3.0.2",
"zod": "3.17.3"
},
"peerDependencies": {
"react": "18.2.0"
}
}
18 changes: 18 additions & 0 deletions @empirica-mocks/core/package.json.backup
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@empirica/core",
"version": "1.9.6",
"description": "Empirica Core MOCK",
"type": "module",
"exports": {
"./player/react": {
"import": "./react-mocks.js"
},
"./player/classic/react": {
"import": "./mocks.js"
}
},
"scripts": {},
"devDependencies": {},
"dependencies": {},
"peerDependencies": {}
}
15 changes: 15 additions & 0 deletions @empirica-mocks/core/react-mocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export function useGlobal() {
// This is a mock function that returns a mock global object
const global = {
isMock: true,
recruitingBatchConfig: undefined, //TODO
get: function (varName) {return this[varName]}

};

return global;
}

export function Loading() {
return "Loading...";
}
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,9 @@ Check out our [Next.js deployment documentation](https://nextjs.org/docs/deploym

Search docs:
https://docs.github.com/en/rest/search/search?apiVersion=2022-11-28#search-repositories

# to get the submodule if it doesn't automatically clone with the parent:

in the local clone of the repo
`git submodule init`
`git submodule update`
Loading

0 comments on commit 15bfa5e

Please sign in to comment.