feat(cli-hooks): add default app and manifest watch config#2480
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2480 +/- ##
==========================================
+ Coverage 93.10% 93.11% +0.01%
==========================================
Files 40 40
Lines 11250 11269 +19
Branches 713 713
==========================================
+ Hits 10474 10493 +19
Misses 764 764
Partials 12 12
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
packages/cli-hooks/src/get-hooks.js
Outdated
| paths: ['.'], | ||
| app: { | ||
| paths: ['.'], | ||
| 'filter-regex': '.js$', |
There was a problem hiding this comment.
suggestion: I think we should also support .ts for TypeScript developers using Bolt JS?
There was a problem hiding this comment.
@mwbrooks We might use the built changes from tsc for now, though these changes might be good to document as well!
A note on this is mentioned now in the CHANGELOG and also updates to the sample app:
🦋 Changeset detectedLatest commit: 7c7927d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
🏷️ Follows: slackapi/slack-cli#310 |
srtaalej
left a comment
There was a problem hiding this comment.
LGTM and its working for me! ⭐ ⭐ ⭐
|
|
||
| ### Custom Configurations | ||
|
|
||
| You can override these defaults in your `.slack/hooks.json` file to reduce the paths searched or change the file patterns. Read [Watch Configurations](https://docs.slack.dev/tools/slack-cli/reference/hooks/#watch-configurations) for more options. |
| it('should return watch config for app files', async () => { | ||
| const { config } = getHooks(); | ||
| assert(config.watch); | ||
| assert(config.watch.app); | ||
| assert.equal(config.watch.app['filter-regex'], '\\.js$'); | ||
| assert.deepEqual(config.watch.app.paths, ['.']); | ||
| }); | ||
|
|
||
| it('should return watch config for manifest files', async () => { | ||
| const { config } = getHooks(); | ||
| assert(config.watch); | ||
| assert(config.watch.manifest); | ||
| assert.deepEqual(config.watch.manifest.paths, ['manifest.json']); |
mwbrooks
left a comment
There was a problem hiding this comment.
✅ Love this improvement @zimeg! It's so exciting to see this land!
🧪 Local testing works great on my end! 👾
🛠️ I left a few minor, non-blocking suggestions.
✏️ Love the very detailed changeset! This is what I'd like to see in more of our PRs for developers!
| 'filter-regex': '^manifest\\.json$', | ||
| paths: ['.'], | ||
| app: { | ||
| 'filter-regex': '\\.js$', |
There was a problem hiding this comment.
nit: Non-blocker. Not sure if we want to include, this but we could ignore node_modules to avoid restarting the server when the developer runs npm install.
There was a problem hiding this comment.
@mwbrooks Our current CLI implementations don't support "not" paths AFAICT. We might want to follow up with this, since changes to the test directories might also be odd to cause restarts! 🤖
Co-authored-by: Michael Brooks <mbrooks@slack-corp.com>
Co-authored-by: Michael Brooks <mbrooks@slack-corp.com>
| 'filter-regex': '^manifest\\.json$', | ||
| paths: ['.'], | ||
| app: { | ||
| 'filter-regex': '\\.js$', |
There was a problem hiding this comment.
@mwbrooks Our current CLI implementations don't support "not" paths AFAICT. We might want to follow up with this, since changes to the test directories might also be odd to cause restarts! 🤖
Summary
This PR adds a default
appandmanifestoption to file watching for server restarts and app reinstalls.Requirements