create-psytask 1.1.0 → 1.1.2

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 CHANGED
@@ -1 +1,7 @@
1
+ # create-psytask
2
+
3
+ ![NPM Version](https://img.shields.io/npm/v/create-psytask)
4
+ ![NPM Downloads](https://img.shields.io/npm/dm/create-psytask)
5
+ ![jsDelivr hits (npm)](https://img.shields.io/jsdelivr/npm/hm/create-psytask)
6
+
1
7
  Create a new [psytask](https://github.com/bluebones-team/psytask) project.
package/dist/index.js CHANGED
@@ -1 +1,2 @@
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)});
1
+ #!/usr/bin/env node
2
+ import{confirm as p,isCancel as m,outro as d,select as v,text as f}from"@clack/prompts";import i from"node:fs/promises";import c from"node:path";var y=c.join(import.meta.dirname,"../template"),o=async(e)=>{let t=await e;if(m(t))process.exit(0);return t},u=async(e,t)=>{let a=await i.readFile(e,"utf-8"),s=t(a);await i.writeFile(e,s)};(async()=>{if(process.argv0!=="bun")console.warn("We only provide templates for bun temporarily, please change package.json scripts yourself.");let e=(await o(f({message:"Project name:",placeholder:"psytask-project",defaultValue:"psytask-project"}))).trim(),t=await o(p({message:"Use TypeScript?",initialValue:!1})),a=await o(v({message:"Select a bundler:",options:[{value:"vite"},{value:"bun"}],initialValue:"vite"})),s=c.join(process.cwd(),e);await i.access(s,i.constants.W_OK).then(async()=>{if(!await o(p({message:"Directory already exists. Do you want to overwrite it?",initialValue:!1})))return;await i.rm(s,{recursive:!0,force:!0})},()=>i.mkdir(s,{recursive:!0})),await i.cp(y,s,{recursive:!0});let r=c.join.bind(null,s),l=[u(r("package.json"),(n)=>JSON.stringify(Object.assign(JSON.parse(n),{name:e,scripts:a==="bun"?{dev:"bun index.html",build:"bun build index.html --outdir=dist --production","type-check":t?"tsc --noEmit":void 0}:{dev:"vite",build:"vite build",preview:"vite preview","type-check":t?"tsc --noEmit":void 0},devDependencies:{typescript:t?"^5":void 0,vite:a==="vite"?"^7":void 0}}),null,2))];if(!t)l.push(u(r("index.html"),(n)=>n.replace("main.ts","main.js")),i.rename(r("main.ts"),r("main.js")),i.rename(r("tsconfig.json"),r("jsconfig.json")));await Promise.all(l),d(`Project created successfully: ${s}`)})().catch((e)=>{console.error(e),process.exit(1)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-psytask",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "CLI tool to create a new psytask project",
5
5
  "type": "module",
6
6
  "engines": {
@@ -15,7 +15,7 @@
15
15
  ],
16
16
  "scripts": {
17
17
  "dev": "bun run build --watch",
18
- "build": "bun build index.ts --outfile=dist/index.js --target=node --no-bundle --production"
18
+ "build": "bun build index.ts --outfile=dist/index.js --target=node --external=@clack/prompts --banner='#!/usr/bin/env node' --production"
19
19
  },
20
20
  "dependencies": {
21
21
  "@clack/prompts": "^0.11.0"
@@ -6,6 +6,6 @@
6
6
  <title>Welcome to Psytask</title>
7
7
  </head>
8
8
  <body>
9
- <script type="module" src="./index.js"></script>
9
+ <script type="module" src="./main.ts"></script>
10
10
  </body>
11
11
  </html>
@@ -1,4 +1,5 @@
1
1
  import { createApp } from 'psytask';
2
+ import 'psytask/main.css';
2
3
 
3
4
  using app = await createApp();
4
5
  using dc = app.collector('demo.csv');
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "base",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "dependencies": {
7
+ "psytask": "^1"
8
+ }
9
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  // environment
4
- "lib": ["DOM", "ES2022"],
4
+ "lib": ["DOM", "ES2022", "ESNext.Disposable"],
5
5
  "target": "es2022",
6
6
  "module": "esnext",
7
7
  "moduleDetection": "force",
@@ -1,13 +0,0 @@
1
- {
2
- "name": "bun-js",
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
- }
@@ -1,11 +0,0 @@
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>
@@ -1,16 +0,0 @@
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
- }