Skip to content

Commit c490af5

Browse files
authored
feat: Merge pull request #82 from Liooo/pass-watchman-glob-exp
2 parents 3243a43 + c3b6171 commit c490af5

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,18 @@ Changes to `*.yml` files are not supported (yet? - this is a Serverless Framewor
8787

8888
Hot-reloading relies on [watchman](https://facebook.github.io/watchman). Make sure it is [installed](https://facebook.github.io/watchman/docs/install.html) on your system.
8989

90-
You can change the files being watched with the `watch` option.
91-
Or you can opt-out by leaving an emptry array or set the option to `false`.
90+
You can change the files being watched with the `watch` option, which is then passed to watchman as [the match expression](https://facebook.github.io/watchman/docs/expr/match.html).
91+
92+
e.g.
93+
```
94+
custom:
95+
appsync-simulator:
96+
watch:
97+
- ["match", "handlers/**/*.vtl", "wholename"] # => array is interpreted as the literal match expression
98+
- "*.graphql" # => string like this is equivalent to `["match", "*.graphql"]`
99+
```
100+
101+
Or you can opt-out by leaving an empty array or set the option to `false`
92102
93103
Note: Functions should not require hot-reloading, unless you are using a transpiler or a bundler (such as webpack, babel or typescript), un which case you should delegate hot-reloading to that instead.
94104

src/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,12 @@ class ServerlessAppSyncSimulator {
120120
const sub = {
121121
expression: [
122122
'anyof',
123-
...this.options.watch.map((glob) => ['match', glob]),
123+
...this.options.watch.map((glob) => {
124+
if (Array.isArray(glob)) {
125+
return glob;
126+
}
127+
return ['match', glob];
128+
}),
124129
],
125130
fields: ['name'],
126131
since: resp.clock,

0 commit comments

Comments
 (0)