create-psytask 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.js +1 -0
- package/package.json +23 -0
- package/template/bun-js/index.html +11 -0
- package/template/bun-js/package.json +13 -0
- package/template/bun-ts/index.html +11 -0
- package/template/bun-ts/index.ts +17 -0
- package/template/bun-ts/package.json +16 -0
- package/template/bun-ts/tsconfig.json +25 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Create a new [psytask](https://github.com/bluebones-team/psytask) project.
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{confirm as c,isCancel as p,outro as l,text as u}from"@clack/prompts";import e from"node:fs/promises";import a from"node:path";const m=a.join(import.meta.dirname,"../template"),o=async(t)=>{const s=await t;if(p(s))process.exit(0);return s};(async()=>{if(process.argv0!=="bun")console.warn("We only provide templates for bun temporarily, please change package.json scripts yourself.");const t=(await o(u({message:"Project name:",placeholder:"psytask-project",defaultValue:"psytask-project"}))).trim(),s=await o(c({message:"Use TypeScript?",initialValue:!1})),r=a.join(process.cwd(),t);await e.access(r,e.constants.W_OK).then(async()=>{if(!await o(c({message:"Directory already exists. Do you want to overwrite it?",initialValue:!1})))return;await e.rm(r,{recursive:!0,force:!0})},()=>e.mkdir(r,{recursive:!0}));await e.cp(a.join(m,s?"bun-ts":"bun-js"),r,{recursive:!0});const i=a.join(r,"package.json"),n=Object.assign(JSON.parse(await e.readFile(i,"utf-8")),{name:t});await e.writeFile(i,JSON.stringify(n,null,2));l(`Project created successfully: ${r}`)})().catch((t)=>{console.error(t);process.exit(1)});
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-psytask",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "CLI tool to create a new psytask project",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=22"
|
|
8
|
+
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"create-psytask": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"template"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"dev": "bun run build --watch",
|
|
18
|
+
"build": "bun build index.ts --outfile=dist/index.js --target=node --no-bundle --production"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@clack/prompts": "^0.11.0"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Welcome to Psytask</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<script type="module" src="./index.js"></script>
|
|
10
|
+
</body>
|
|
11
|
+
</html>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Welcome to Psytask</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<script type="module" src="./index.ts"></script>
|
|
10
|
+
</body>
|
|
11
|
+
</html>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createApp } from 'psytask';
|
|
2
|
+
|
|
3
|
+
using app = await createApp();
|
|
4
|
+
using dc = app.collector('demo.csv');
|
|
5
|
+
|
|
6
|
+
using text = app.text('', { close_on: 'pointerup' });
|
|
7
|
+
|
|
8
|
+
await text.show({
|
|
9
|
+
children: 'Welcome to the experiment! Click to continue.',
|
|
10
|
+
});
|
|
11
|
+
for (let i = 0; i < 3; i++) {
|
|
12
|
+
const { start_time } = await text.show({
|
|
13
|
+
children: `This is trial ${i + 1}. Click to continue.`,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
dc.add({ index: i + 1, start_time });
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bun-ts",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "bun index.html",
|
|
8
|
+
"build": "bun build index.html --outdir=dist --production"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"psytask": "^1"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"typescript": "^5"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// environment
|
|
4
|
+
"lib": ["DOM", "ES2022"],
|
|
5
|
+
"target": "es2022",
|
|
6
|
+
"module": "esnext",
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"jsx": "preserve",
|
|
9
|
+
|
|
10
|
+
// module
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"esModuleInterop": true,
|
|
13
|
+
"forceConsistentCasingInFileNames": true,
|
|
14
|
+
"verbatimModuleSyntax": true,
|
|
15
|
+
"composite": true,
|
|
16
|
+
|
|
17
|
+
// best practices
|
|
18
|
+
"strict": true,
|
|
19
|
+
"skipLibCheck": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"noUncheckedIndexedAccess": true,
|
|
22
|
+
"noImplicitOverride": true,
|
|
23
|
+
"checkJs": true
|
|
24
|
+
}
|
|
25
|
+
}
|