cofacts / rumors-api

GraphQL API server for clients like rumors-site and rumors-line-bot
https://api.cofacts.tw
MIT License
113 stars 27 forks source link

fix(scripts): fix top-level await issue #351

Closed MrOrz closed 2 weeks ago

MrOrz commented 2 weeks ago

In previous PR #338 we added await to yargs in blockUser script. This is causing the following error when script is being executed:

nodejs SyntaxError: await is only valid in async functions and the top level bodies of modules

The type of yargs is somehow Sth | Promise<Sth> hence the await. We try to use Promise.resolve().then() to tackle this.

coveralls commented 2 weeks ago

Coverage Status

coverage: 83.371%. remained the same when pulling 8d9cd48a9ff16d76689245c29361db2eec4da132 on fix-blockuser-script into 25f2df4284a8149ba98dd122f8b02d1741bdaae7 on master.