quote0 0.0.0 → 1.0.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/package.json +9 -10
- package/dist/index.mjs +0 -2
package/package.json
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quote0",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Access your Quote/0 from the command line.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "tsc --noEmit && tsdown",
|
|
9
|
-
"dev": "tsx src/index.tsx",
|
|
10
|
-
"start": "node dist/index.mjs",
|
|
11
|
-
"format": "prettier . --write",
|
|
12
|
-
"changeset": "changeset"
|
|
13
|
-
},
|
|
14
7
|
"files": [
|
|
15
8
|
"dist"
|
|
16
9
|
],
|
|
@@ -25,7 +18,6 @@
|
|
|
25
18
|
"bugs": {
|
|
26
19
|
"url": "https://github.com/MrWillCom/quote0/issues"
|
|
27
20
|
},
|
|
28
|
-
"packageManager": "pnpm@10.30.1+sha512.3590e550d5384caa39bd5c7c739f72270234b2f6059e13018f975c313b1eb9fefcc09714048765d4d9efe961382c312e624572c0420762bdc5d5940cdf9be73a",
|
|
29
21
|
"devDependencies": {
|
|
30
22
|
"@changesets/cli": "^2.29.8",
|
|
31
23
|
"@types/node": "^25.3.0",
|
|
@@ -45,5 +37,12 @@
|
|
|
45
37
|
"satori": "^0.19.2",
|
|
46
38
|
"sharp": "^0.34.5",
|
|
47
39
|
"yargs": "^18.0.0"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsc --noEmit && tsdown",
|
|
43
|
+
"dev": "tsx src/index.tsx",
|
|
44
|
+
"start": "node dist/index.mjs",
|
|
45
|
+
"format": "prettier . --write",
|
|
46
|
+
"changeset": "changeset"
|
|
48
47
|
}
|
|
49
|
-
}
|
|
48
|
+
}
|
package/dist/index.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import"dotenv/config";import e from"yargs";import{hideBin as t}from"yargs/helpers";import{Box as n,Text as r,render as i}from"ink";import a from"node:fs/promises";import o from"ky";import s from"node:path";import c from"react";import l from"ink-spinner";import u from"satori";import d from"sharp";import{jsx as f,jsxs as p}from"react/jsx-runtime";const m={quote0ApiKey:process.env.QUOTE0_API_KEY,quote0DeviceId:process.env.QUOTE0_DEVICEID,dotApiEndpoint:`https://dot.mindreset.tech/api`,quote0Width:296,quote0Height:152,composeApiUrl:e=>e.startsWith(`/`)?m.dotApiEndpoint+e:m.dotApiEndpoint+`/`+e,fetchApi:async(e,t)=>{let n=m.composeApiUrl(e),r=Object.assign({method:`GET`,headers:{"Content-Type":`application/json`,Authorization:`Bearer `+m.quote0ApiKey}},t??{});try{let e=await fetch(n,r);if(e.ok)return await e.json();throw Error(`API request failed with status ${e.status}: ${e.statusText}`)}catch(e){throw e}}};async function h(){return await m.fetchApi(`/authV2/open/device/${m.quote0DeviceId}/status`)}async function g(e){return await m.fetchApi(`/authV2/open/device/${m.quote0DeviceId}/image`,{method:`POST`,body:JSON.stringify(e)})}const _={border:(...e)=>({borderTop:e.includes(`top`),borderRight:e.includes(`right`),borderBottom:e.includes(`bottom`),borderLeft:e.includes(`left`)})};e(t(process.argv)).command(`status`,`Check device status`,e=>e,async e=>{try{let e=await h();i(p(n,{borderStyle:`round`,flexDirection:`column`,children:[p(n,{justifyContent:`space-between`,width:`100%`,borderStyle:`single`,..._.border(`bottom`),borderDimColor:!0,paddingX:1,children:[p(n,{gap:1,children:[f(r,{children:e.alias}),f(r,{dimColor:!0,children:e.location}),f(r,{dimColor:!0,children:e.status.battery})]}),p(r,{children:[f(r,{dimColor:!0,children:`Device ID: `}),e.deviceId]})]}),p(n,{flexDirection:`column`,paddingX:1,children:[p(n,{justifyContent:`space-between`,width:`100%`,children:[f(r,{dimColor:!0,children:`Status`}),f(r,{children:e.status.current})]}),p(n,{justifyContent:`space-between`,width:`100%`,children:[f(r,{dimColor:!0,children:`Last Render`}),f(r,{children:e.renderInfo.last})]}),p(n,{justifyContent:`space-between`,width:`100%`,children:[f(r,{dimColor:!0,children:`Next Render (Battery)`}),f(r,{children:e.renderInfo.next.battery})]}),p(n,{justifyContent:`space-between`,width:`100%`,children:[f(r,{dimColor:!0,children:`Next Render (Power)`}),f(r,{children:e.renderInfo.next.power})]}),p(n,{justifyContent:`space-between`,width:`100%`,children:[f(r,{dimColor:!0,children:`Current Images`}),f(r,{children:e.renderInfo.current.image.length})]}),p(n,{justifyContent:`space-between`,width:`100%`,children:[f(r,{dimColor:!0,children:`Version`}),p(r,{children:[f(r,{dimColor:!0,children:`v`}),e.status.version]})]})]})]}))}catch(e){console.error(e)}}).command(`prepare`,`Download necessary resources`,e=>e,async e=>{let t=[{filename:`DepartureMono-Regular.otf`,url:`https://departuremono.com/assets/DepartureMono-Regular.otf`}];await a.mkdir(`cache/resources`,{recursive:!0}),i(f(()=>{let[e,i]=c.useState(t.map(()=>({percent:0,done:!1})));return c.useEffect(()=>{(async()=>{await Promise.all(t.map(async({filename:e,url:t},n)=>{let r=await o.get(t,{onDownloadProgress:e=>{i(t=>{let r=[...t];return r[n].percent=e.percent,r})}}).bytes();await a.writeFile(s.join(`cache/resources`,e),r),i(e=>{let t=[...e];return t[n].done=!0,t})}))})()},[]),p(n,{flexDirection:`column`,borderStyle:`round`,children:[p(n,{justifyContent:`space-between`,borderStyle:`single`,..._.border(`bottom`),borderDimColor:!0,paddingX:1,children:[f(r,{children:`Downloading…`}),p(r,{dimColor:!0,children:[e.filter(e=>e.done).length,`/`,t.length]})]}),f(n,{flexDirection:`column`,paddingX:1,children:t.map(({filename:t},i)=>p(n,{justifyContent:`space-between`,children:[p(r,{children:[e[i].done?f(r,{dimColor:!0,children:`✓`}):f(l,{}),` `,t]}),p(r,{children:[Math.round(e[i].percent*100),`%`]})]},i))})]})},{}))}).command(`serve`,`Start periodically rendering and pushing images`,e=>e,async e=>{let t=[`SVG Rendering`,`SVG Saving`,`PNG Conversion`,`PNG Saving`,`Base64 Encoding`,`Pushing to Device`];i(f(()=>{let[e,i]=c.useState(-1),o=()=>{i(e=>e+1)};return c.useEffect(()=>{(async()=>{o();let e=await u(f(`div`,{style:{width:m.quote0Width,height:m.quote0Height,color:`black`,backgroundColor:`white`,fontFamily:`Departure Mono`,fontSize:`11px`,lineHeight:`12px`},children:`hello, world`}),{width:m.quote0Width,height:m.quote0Height,fonts:[{name:`Departure Mono`,data:await a.readFile(s.join(`cache/resources`,`DepartureMono-Regular.otf`)),weight:400,style:`normal`}]});o(),await a.writeFile(`cache/out.svg`,e),o();let t=await d(Buffer.from(e)).png().toBuffer();o(),await a.writeFile(`cache/out.png`,t),o();let n=t.toString(`base64`);o(),await g({image:n,ditherType:`NONE`}),o()})()},[]),p(n,{flexDirection:`column`,borderStyle:`round`,children:[f(n,{borderStyle:`single`,..._.border(`bottom`),borderDimColor:!0,paddingX:1,children:f(r,{children:`Progress`})}),f(n,{flexDirection:`column`,paddingX:1,children:t.map((t,i)=>f(n,{justifyContent:`space-between`,children:p(r,{children:[e===i?f(l,{}):f(r,{dimColor:!0,children:e>i?`✓`:` `}),` `,t]})},i))})]})},{}))}).demandCommand(1,`Please specify a command`).parse();export{};
|