@hackwaly/task 0.3.0 → 0.3.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hackwaly/task",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": "github:hackwaly/task",
package/src/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function cliMain(): Promise<void>;
@@ -0,0 +1,21 @@
1
+ import type { TaskDef, TaskRunContext } from "./types.js";
2
+ export interface TaskConfig {
3
+ name: string;
4
+ description?: string;
5
+ run?: (ctx: TaskRunContext) => Promise<void>;
6
+ command?: string | string[] | {
7
+ program: string;
8
+ args?: string[];
9
+ };
10
+ env?: Record<string, string>;
11
+ cwd?: string;
12
+ inputs?: string[];
13
+ outputs?: string[];
14
+ persistent?: boolean;
15
+ interruptible?: boolean;
16
+ dependsOn?: [TaskDef];
17
+ }
18
+ export interface ConfigAPI {
19
+ defineTask(config: TaskConfig): TaskDef;
20
+ }
21
+ export declare function configInit(importMeta: ImportMeta): ConfigAPI;
@@ -0,0 +1,3 @@
1
+ export declare class InvariantViolation extends Error {
2
+ get name(): string;
3
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { cliMain } from "./cli.js";
2
+ export { configInit } from "./config.js";
package/src/run.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import type { Command, TaskMeta, TaskRunContext } from "./types.js";
2
+ export declare function runCommand(command: Command, meta: TaskMeta, ctx: TaskRunContext): Promise<void>;
@@ -0,0 +1,5 @@
1
+ import type { TaskDef } from "./types.js";
2
+ import { type Observable } from "rxjs";
3
+ export declare function start(taskChan: Observable<Set<TaskDef>>, options: {
4
+ abort: AbortSignal;
5
+ }): Promise<void>;
package/src/types.d.ts ADDED
@@ -0,0 +1,23 @@
1
+ export interface Command {
2
+ program: string;
3
+ args: string[];
4
+ }
5
+ export interface TaskRunContext {
6
+ abort: AbortSignal;
7
+ }
8
+ export interface TaskMeta {
9
+ name: string;
10
+ description: string | undefined;
11
+ cwd: string;
12
+ env: Record<string, string>;
13
+ inputs: string[];
14
+ outputs: string[];
15
+ persistent: boolean;
16
+ interruptible: boolean;
17
+ }
18
+ export interface TaskDef {
19
+ run: (ctx: TaskRunContext) => Promise<void>;
20
+ meta: TaskMeta;
21
+ deps: Set<TaskDef>;
22
+ invDeps: Set<TaskDef>;
23
+ }