tasktui 1.0.1 → 1.0.3
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/dist/cli.js +0 -0
- package/package.json +4 -4
- package/dist/components/SubprocessOutput.d.ts +0 -6
- package/dist/components/SubprocessOutput.js +0 -21
- package/dist/lib/constants.d.ts +0 -2
- package/dist/lib/constants.js +0 -2
- package/dist/lib/types.d.ts +0 -15
- package/dist/lib/types.js +0 -9
- package/dist/lib/utils.d.ts +0 -5
- package/dist/lib/utils.js +0 -44
package/dist/cli.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tasktui",
|
|
3
3
|
"description": "Run tasks in a multiplexed terminal with dependency management.",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": "dist/cli.js",
|
|
7
7
|
"type": "module",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"blessed": "^0.1.81",
|
|
20
|
-
"meow": "^11.0.0"
|
|
20
|
+
"meow": "^11.0.0",
|
|
21
|
+
"zod": "^4.1.12"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"@sindresorhus/tsconfig": "^3.0.1",
|
|
@@ -25,7 +26,6 @@
|
|
|
25
26
|
"@vdemedes/prettier-config": "^2.0.1",
|
|
26
27
|
"prettier": "^2.8.7",
|
|
27
28
|
"ts-node": "^10.9.1",
|
|
28
|
-
"typescript": "^5.0.3"
|
|
29
|
-
"zod": "^4.1.12"
|
|
29
|
+
"typescript": "^5.0.3"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Box, Text } from 'ink';
|
|
2
|
-
import childProcess from 'node:child_process';
|
|
3
|
-
import React, { useEffect, useState } from 'react';
|
|
4
|
-
import stripAnsi from 'strip-ansi';
|
|
5
|
-
export default function TaskWindow({ tasks, selected, }) {
|
|
6
|
-
const [buffers, setBuffers] = useState({});
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
for (const [name, task] of Object.entries(tasks)) {
|
|
9
|
-
const subProcess = childProcess.spawn('sh', ['-c', task.command]);
|
|
10
|
-
subProcess.stdout.on('data', (newOutput) => {
|
|
11
|
-
const text = stripAnsi(newOutput.toString('utf8')).trim();
|
|
12
|
-
setBuffers(prev => {
|
|
13
|
-
return { ...prev, [name]: text };
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
}, [tasks]);
|
|
18
|
-
return (React.createElement(Box, { flexDirection: "column" },
|
|
19
|
-
React.createElement(Text, { dimColor: true }, selected),
|
|
20
|
-
React.createElement(Text, null, buffers[selected] ?? '')));
|
|
21
|
-
}
|
package/dist/lib/constants.d.ts
DELETED
package/dist/lib/constants.js
DELETED
package/dist/lib/types.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import z from 'zod';
|
|
2
|
-
export declare const TaskSchema: z.ZodObject<{
|
|
3
|
-
command: z.ZodString;
|
|
4
|
-
dependsOn: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
5
|
-
cwd: z.ZodDefault<z.ZodString>;
|
|
6
|
-
}, z.z.core.$strip>;
|
|
7
|
-
export type Task = z.infer<typeof TaskSchema>;
|
|
8
|
-
export declare const TasksConfigSchema: z.ZodObject<{
|
|
9
|
-
tasks: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
10
|
-
command: z.ZodString;
|
|
11
|
-
dependsOn: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
12
|
-
cwd: z.ZodDefault<z.ZodString>;
|
|
13
|
-
}, z.z.core.$strip>>;
|
|
14
|
-
}, z.z.core.$strip>;
|
|
15
|
-
export type TasksConfig = z.infer<typeof TasksConfigSchema>;
|
package/dist/lib/types.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import z from 'zod';
|
|
2
|
-
export const TaskSchema = z.object({
|
|
3
|
-
command: z.string(),
|
|
4
|
-
dependsOn: z.string().array().default([]),
|
|
5
|
-
cwd: z.string().default(process.cwd()),
|
|
6
|
-
});
|
|
7
|
-
export const TasksConfigSchema = z.object({
|
|
8
|
-
tasks: z.record(z.string(), TaskSchema),
|
|
9
|
-
});
|
package/dist/lib/utils.d.ts
DELETED
package/dist/lib/utils.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import z from 'zod';
|
|
4
|
-
import { CONFIG_PATH } from './constants.js';
|
|
5
|
-
import { TasksConfigSchema } from './types.js';
|
|
6
|
-
function getConfigPath(cliOption) {
|
|
7
|
-
if (cliOption)
|
|
8
|
-
return cliOption;
|
|
9
|
-
return CONFIG_PATH;
|
|
10
|
-
}
|
|
11
|
-
export default function formatZodError(error) {
|
|
12
|
-
if (error.issues.length === 0) {
|
|
13
|
-
return 'Unknown Zod error';
|
|
14
|
-
}
|
|
15
|
-
const issue = error.issues[0];
|
|
16
|
-
if (!issue)
|
|
17
|
-
return error.message;
|
|
18
|
-
const path = issue.path.join('.');
|
|
19
|
-
return `${issue.message} at '${path}' [code: ${issue.code}]`;
|
|
20
|
-
}
|
|
21
|
-
export function loadConfig(configPath) {
|
|
22
|
-
try {
|
|
23
|
-
const relativePath = path.join(process.cwd(), getConfigPath(configPath));
|
|
24
|
-
const raw = fs.readFileSync(relativePath, 'utf-8');
|
|
25
|
-
const parsed = JSON.parse(raw);
|
|
26
|
-
return z.parse(TasksConfigSchema, parsed);
|
|
27
|
-
}
|
|
28
|
-
catch (e) {
|
|
29
|
-
const error = ensureError(e);
|
|
30
|
-
throw error;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export function ensureError(error) {
|
|
34
|
-
if (error instanceof z.ZodError)
|
|
35
|
-
return new Error(formatZodError(error));
|
|
36
|
-
if (error instanceof Error)
|
|
37
|
-
return error;
|
|
38
|
-
let stringified = '[Unable to stringify the thrown value]';
|
|
39
|
-
try {
|
|
40
|
-
stringified = JSON.stringify(error);
|
|
41
|
-
}
|
|
42
|
-
catch { }
|
|
43
|
-
return new Error(stringified);
|
|
44
|
-
}
|