@commandkit/tasks 0.0.0-dev.20250726103524 → 0.0.0-dev.20250726104429
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/README.md +5 -6
- package/dist/context.d.ts +2 -2
- package/dist/context.js +2 -2
- package/dist/task.d.ts +2 -2
- package/dist/task.js +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -21,13 +21,12 @@ npm install @commandkit/tasks
|
|
|
21
21
|
### 1. Add the plugin to your CommandKit configuration
|
|
22
22
|
|
|
23
23
|
```ts
|
|
24
|
+
import { defineConfig } from 'commandkit/config';
|
|
24
25
|
import { tasks } from '@commandkit/tasks';
|
|
25
26
|
|
|
26
|
-
export default {
|
|
27
|
-
plugins: [
|
|
28
|
-
|
|
29
|
-
],
|
|
30
|
-
};
|
|
27
|
+
export default defineConfig({
|
|
28
|
+
plugins: [tasks()],
|
|
29
|
+
});
|
|
31
30
|
```
|
|
32
31
|
|
|
33
32
|
### 2. Set up a driver
|
|
@@ -46,7 +45,7 @@ Create a file in `src/app/tasks/`:
|
|
|
46
45
|
```ts
|
|
47
46
|
import { task } from '@commandkit/tasks';
|
|
48
47
|
|
|
49
|
-
export
|
|
48
|
+
export default task({
|
|
50
49
|
name: 'refresh-exchange-rate',
|
|
51
50
|
schedule: { type: 'cron', value: '0 0 * * *' }, // daily at midnight
|
|
52
51
|
async execute(ctx) {
|
package/dist/context.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export interface TaskContextData<T extends Record<string, any> = Record<string,
|
|
|
24
24
|
* ```ts
|
|
25
25
|
* import { task } from '@commandkit/tasks';
|
|
26
26
|
*
|
|
27
|
-
* export
|
|
27
|
+
* export default task({
|
|
28
28
|
* name: 'reminder',
|
|
29
29
|
* async execute(ctx) {
|
|
30
30
|
* // Access custom data passed to the task
|
|
@@ -51,7 +51,7 @@ export declare class TaskContext<T extends Record<string, any> = Record<string,
|
|
|
51
51
|
*
|
|
52
52
|
* @example
|
|
53
53
|
* ```ts
|
|
54
|
-
* export
|
|
54
|
+
* export default task({
|
|
55
55
|
* name: 'conditional-task',
|
|
56
56
|
* async prepare(ctx) {
|
|
57
57
|
* const shouldRun = await checkConditions();
|
package/dist/context.js
CHANGED
|
@@ -11,7 +11,7 @@ exports.TaskContext = void 0;
|
|
|
11
11
|
* ```ts
|
|
12
12
|
* import { task } from '@commandkit/tasks';
|
|
13
13
|
*
|
|
14
|
-
* export
|
|
14
|
+
* export default task({
|
|
15
15
|
* name: 'reminder',
|
|
16
16
|
* async execute(ctx) {
|
|
17
17
|
* // Access custom data passed to the task
|
|
@@ -44,7 +44,7 @@ class TaskContext {
|
|
|
44
44
|
*
|
|
45
45
|
* @example
|
|
46
46
|
* ```ts
|
|
47
|
-
* export
|
|
47
|
+
* export default task({
|
|
48
48
|
* name: 'conditional-task',
|
|
49
49
|
* async prepare(ctx) {
|
|
50
50
|
* const shouldRun = await checkConditions();
|
package/dist/task.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { TaskDefinition, TaskSchedule } from './types';
|
|
|
11
11
|
* ```ts
|
|
12
12
|
* import { task } from '@commandkit/tasks';
|
|
13
13
|
*
|
|
14
|
-
* export
|
|
14
|
+
* export default task({
|
|
15
15
|
* name: 'cleanup-old-data',
|
|
16
16
|
* schedule: { type: 'cron', value: '0 2 * * *' }, // Daily at 2 AM
|
|
17
17
|
* async prepare(ctx) {
|
|
@@ -98,7 +98,7 @@ export declare class Task<T extends Record<string, any> = Record<string, any>> {
|
|
|
98
98
|
* import { task } from '@commandkit/tasks';
|
|
99
99
|
*
|
|
100
100
|
* // Simple scheduled task
|
|
101
|
-
* export
|
|
101
|
+
* export default task({
|
|
102
102
|
* name: 'daily-backup',
|
|
103
103
|
* schedule: { type: 'cron', value: '0 0 * * *' },
|
|
104
104
|
* async execute(ctx) {
|
package/dist/task.js
CHANGED
|
@@ -13,7 +13,7 @@ exports.task = task;
|
|
|
13
13
|
* ```ts
|
|
14
14
|
* import { task } from '@commandkit/tasks';
|
|
15
15
|
*
|
|
16
|
-
* export
|
|
16
|
+
* export default task({
|
|
17
17
|
* name: 'cleanup-old-data',
|
|
18
18
|
* schedule: { type: 'cron', value: '0 2 * * *' }, // Daily at 2 AM
|
|
19
19
|
* async prepare(ctx) {
|
|
@@ -120,7 +120,7 @@ exports.Task = Task;
|
|
|
120
120
|
* import { task } from '@commandkit/tasks';
|
|
121
121
|
*
|
|
122
122
|
* // Simple scheduled task
|
|
123
|
-
* export
|
|
123
|
+
* export default task({
|
|
124
124
|
* name: 'daily-backup',
|
|
125
125
|
* schedule: { type: 'cron', value: '0 0 * * *' },
|
|
126
126
|
* async execute(ctx) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commandkit/tasks",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.20250726104429",
|
|
4
4
|
"description": "Task management plugin for CommandKit",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"bullmq": "^5.56.5",
|
|
47
47
|
"typescript": "^5.8.3",
|
|
48
|
-
"
|
|
49
|
-
"
|
|
48
|
+
"commandkit": "1.0.0-dev.20250726104429",
|
|
49
|
+
"tsconfig": "0.0.0-dev.20250726104429"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"cron-parser": "^4.9.0"
|