alfy 2.0.0 → 2.1.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/index.d.ts +4 -0
- package/index.js +0 -5
- package/lib/update-notification.js +2 -2
- package/package.json +11 -9
- package/readme.md +24 -1
package/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export type OutputOptions = {
|
|
|
22
22
|
readonly rerunInterval?: number;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
// eslint-disable-next-line unicorn/prevent-abbreviations
|
|
25
26
|
export type CacheConfGetOptions = {
|
|
26
27
|
/**
|
|
27
28
|
Get the item for the key provided without taking the `maxAge` of the item into account.
|
|
@@ -29,6 +30,7 @@ export type CacheConfGetOptions = {
|
|
|
29
30
|
readonly ignoreMaxAge?: boolean;
|
|
30
31
|
};
|
|
31
32
|
|
|
33
|
+
// eslint-disable-next-line unicorn/prevent-abbreviations
|
|
32
34
|
export type CacheConfSetOptions = {
|
|
33
35
|
/**
|
|
34
36
|
Number of milliseconds the cached value is valid.
|
|
@@ -36,6 +38,8 @@ export type CacheConfSetOptions = {
|
|
|
36
38
|
readonly maxAge?: number;
|
|
37
39
|
};
|
|
38
40
|
|
|
41
|
+
// TODO: Rename this in the next major version.
|
|
42
|
+
// eslint-disable-next-line unicorn/prevent-abbreviations
|
|
39
43
|
export type CacheConf<T extends Record<string, any> = Record<string, unknown>> = {
|
|
40
44
|
isExpired: (key: keyof T) => boolean;
|
|
41
45
|
|
package/index.js
CHANGED
|
@@ -118,11 +118,6 @@ alfy.fetch = async (url, options) => {
|
|
|
118
118
|
...options,
|
|
119
119
|
};
|
|
120
120
|
|
|
121
|
-
// TODO: Remove this in 2024.
|
|
122
|
-
if (options.query) {
|
|
123
|
-
throw new Error('The `query` option was renamed to `searchParams`.');
|
|
124
|
-
}
|
|
125
|
-
|
|
126
121
|
if (typeof url !== 'string') {
|
|
127
122
|
throw new TypeError(`Expected \`url\` to be a \`string\`, got \`${typeof url}\``);
|
|
128
123
|
}
|
|
@@ -2,8 +2,8 @@ import {readPackageUp} from 'read-package-up';
|
|
|
2
2
|
import alfredNotifier from 'alfred-notifier';
|
|
3
3
|
|
|
4
4
|
export default async function updateNotification() {
|
|
5
|
-
const {package:
|
|
6
|
-
const alfy =
|
|
5
|
+
const {package: package_} = await readPackageUp();
|
|
6
|
+
const alfy = package_?.alfy ?? {};
|
|
7
7
|
|
|
8
8
|
if (alfy.updateNotification !== false) {
|
|
9
9
|
alfredNotifier();
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alfy",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Create Alfred workflows with ease",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "sindresorhus/alfy",
|
|
7
|
+
"funding": "https://github.com/sponsors/sindresorhus",
|
|
7
8
|
"type": "module",
|
|
8
9
|
"bin": {
|
|
9
10
|
"run-node": "./run-node.sh",
|
|
@@ -14,6 +15,7 @@
|
|
|
14
15
|
"types": "./index.d.ts",
|
|
15
16
|
"default": "./index.js"
|
|
16
17
|
},
|
|
18
|
+
"sideEffects": false,
|
|
17
19
|
"engines": {
|
|
18
20
|
"node": ">=18"
|
|
19
21
|
},
|
|
@@ -45,21 +47,21 @@
|
|
|
45
47
|
"alfred-notifier": "^0.2.3",
|
|
46
48
|
"cache-conf": "^0.6.0",
|
|
47
49
|
"clean-stack": "^5.2.0",
|
|
48
|
-
"conf": "^
|
|
49
|
-
"dot-prop": "^
|
|
50
|
-
"execa": "^
|
|
51
|
-
"got": "^
|
|
50
|
+
"conf": "^13.0.1",
|
|
51
|
+
"dot-prop": "^9.0.0",
|
|
52
|
+
"execa": "^9.3.0",
|
|
53
|
+
"got": "^14.4.2",
|
|
52
54
|
"hook-std": "^3.0.0",
|
|
53
55
|
"loud-rejection": "^2.2.0",
|
|
54
56
|
"read-package-up": "^11.0.0"
|
|
55
57
|
},
|
|
56
58
|
"devDependencies": {
|
|
57
|
-
"ava": "^
|
|
59
|
+
"ava": "^6.1.3",
|
|
58
60
|
"delay": "^6.0.0",
|
|
59
|
-
"nock": "^13.
|
|
61
|
+
"nock": "^13.5.4",
|
|
60
62
|
"tempfile": "^5.0.0",
|
|
61
|
-
"tsd": "^0.
|
|
62
|
-
"xo": "^0.
|
|
63
|
+
"tsd": "^0.31.1",
|
|
64
|
+
"xo": "^0.59.2"
|
|
63
65
|
},
|
|
64
66
|
"tsd": {
|
|
65
67
|
"compilerOptions": {
|
package/readme.md
CHANGED
|
@@ -103,7 +103,7 @@ By adding `alfy-init` as `postinstall` and `alfy-cleanup` as `preuninstall` scri
|
|
|
103
103
|
"author": {
|
|
104
104
|
"name": "Sindre Sorhus",
|
|
105
105
|
"email": "sindresorhus@gmail.com",
|
|
106
|
-
"url": "sindresorhus.com"
|
|
106
|
+
"url": "https://sindresorhus.com"
|
|
107
107
|
},
|
|
108
108
|
"scripts": {
|
|
109
109
|
"postinstall": "alfy-init",
|
|
@@ -323,6 +323,29 @@ alfy.matches('Foo', list, (item, input) => item === input);
|
|
|
323
323
|
|
|
324
324
|
Same as `matches()`, but with `alfy.input` as `input`.
|
|
325
325
|
|
|
326
|
+
If you want to match against multiple items, you must define your own matching function ([as shown here](#item)). Let’s extend the [example from the beginning](#example) to search for a keyword that appears either within the `title` or `body` property or both.
|
|
327
|
+
|
|
328
|
+
```js
|
|
329
|
+
import alfy from 'alfy';
|
|
330
|
+
|
|
331
|
+
const data = await alfy.fetch('https://jsonplaceholder.typicode.com/posts');
|
|
332
|
+
|
|
333
|
+
const items = alfy
|
|
334
|
+
.inputMatches(
|
|
335
|
+
data,
|
|
336
|
+
(item, input) =>
|
|
337
|
+
item.title?.toLowerCase().includes(input) ||
|
|
338
|
+
item.body?.toLowerCase().includes(input)
|
|
339
|
+
)
|
|
340
|
+
.map((element) => ({
|
|
341
|
+
title: element.title,
|
|
342
|
+
subtitle: element.body,
|
|
343
|
+
arg: element.id,
|
|
344
|
+
}));
|
|
345
|
+
|
|
346
|
+
alfy.output(items);
|
|
347
|
+
```
|
|
348
|
+
|
|
326
349
|
#### error(error)
|
|
327
350
|
|
|
328
351
|
Display an error or error message in Alfred.
|