| 96 | ); |
| 97 | |
| 98 | const lsRemote = (pattern?: string) => { |
| 99 | // note that no errors are catched by this function |
| 100 | const URL = `https://api.npms.io/v2/search?q=${ |
| 101 | (pattern && `${pattern}+`) || '' |
| 102 | }keywords:hyper-plugin,hyper-theme&size=250`; |
| 103 | type npmResult = {package: {name: string; description: string}}; |
| 104 | return got(URL) |
| 105 | .then((response) => JSON.parse(response.body).results as npmResult[]) |
| 106 | .then((entries) => entries.map((entry) => entry.package)) |
| 107 | .then((entries) => |
| 108 | entries.map(({name, description}) => { |
| 109 | return {name, description}; |
| 110 | }) |
| 111 | ); |
| 112 | }; |
| 113 | |
| 114 | args.command( |
| 115 | 'search', |