From 8a5c5ff6efc9e4b2f53b348863dff6d5a2dac95e Mon Sep 17 00:00:00 2001 From: Yu-huan Kuo Date: Sun, 3 Mar 2024 12:51:26 +0800 Subject: [PATCH] fix: use `quote.txt` instead of `dist/quote.txt` to avoid errors --- dist/index.js | 8 ++++---- src/index.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/index.js b/dist/index.js index db39328..30299e5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,7 +1,7 @@ -var c=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var p=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of l(e))!h.call(t,n)&&n!==o&&c(t,n,{get:()=>e[n],enumerable:!(r=a(e,n))||r.enumerable});return t};var g=t=>p(c({},"__esModule",{value:!0}),t);var u={};module.exports=g(u);var i=require("path"),s=require("fs/promises");(async()=>{let t=await fetch("https://v0.elegant.tw/all").then(o=>o.json()),e=`${t.sentence} - \u2014\u2014${t.author!==null?t.author:t.cite} +var c=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var p=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of l(t))!h.call(e,n)&&n!==o&&c(e,n,{get:()=>t[n],enumerable:!(r=a(t,n))||r.enumerable});return e};var g=e=>p(c({},"__esModule",{value:!0}),e);var u={};module.exports=g(u);var i=require("path"),s=require("fs/promises");(async()=>{let e=await fetch("https://v0.elegant.tw/all").then(o=>o.json()),t=`${e.sentence} + \u2014\u2014${e.author!==null?e.author:e.cite} \u65BC ${new Date().toLocaleString("zh-TW",{timeZone:"Asia/Taipei",hourCycle:"h23"})} \u66F4\u65B0`;console.log(` -${e} -`);try{await(0,s.writeFile)((0,i.join)(process.cwd(),"dist/quote.txt"),e)}catch(o){console.error(`FATAL: ${o}`),process.exit(1)}console.log(`INFO: \u6210\u529F\u5132\u5B58\u3002 +${t} +`);try{await(0,s.writeFile)((0,i.join)(process.cwd(),"quote.txt"),t)}catch(o){console.error(`FATAL: ${o}`),process.exit(1)}console.log(`INFO: \u6210\u529F\u5132\u5B58\u3002 `)})(); diff --git a/src/index.ts b/src/index.ts index dbab750..a2f0a01 100644 --- a/src/index.ts +++ b/src/index.ts @@ -25,7 +25,7 @@ export interface Resp { console.log(`\n${content}\n`) try { - await writeFile(join(process.cwd(), 'dist/quote.txt'), content) + await writeFile(join(process.cwd(), 'quote.txt'), content) } catch (err) { console.error(`FATAL: ${err}`) process.exit(1)