You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e620ca9
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: apps/docs/content/docs/jsrepo-config.mdx
+53Lines changed: 53 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -239,3 +239,56 @@ Available warning types:
239
239
-`UnresolvableDynamicImportWarning`: Triggered when a dynamic import cannot be resolved due to unresolvable syntax
240
240
241
241
All warnings extend the base `Warning` class which has a `message` property. Each specific warning type includes additional properties relevant to that warning type.
242
+
243
+
### hooks
244
+
245
+
Hooks allow you to run custom logic before and after CLI commands.
246
+
247
+
-`before` hooks run before the command executes.
248
+
-`after` hooks run after the command completes.
249
+
250
+
Hooks can be a function, a shell command string, or an array of either.
251
+
252
+
```ts title="jsrepo.config.ts"
253
+
import { defineConfig } from"jsrepo";
254
+
255
+
exportdefaultdefineConfig({
256
+
hooks: {
257
+
before: ({ command }) => {
258
+
console.log(`Running ${command}...`);
259
+
},
260
+
after: "echo done",
261
+
},
262
+
});
263
+
```
264
+
265
+
Function hooks receive typed arguments with a `command` discriminant. Use it to narrow and access command-specific data:
0 commit comments