@omni-oss/create-jobs 0.1.5 → 0.1.7
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/CHANGELOG.md +12 -0
- package/dist/create-jobs.cjs +1 -1
- package/dist/create-jobs.d.ts +2 -1
- package/dist/create-jobs.d.ts.map +1 -1
- package/dist/create-jobs.mjs +12 -12
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/schemas-BnpD42eF.js +1 -0
- package/dist/{schemas-BNiWDmJf.mjs → schemas-CySsa0xy.mjs} +54 -46
- package/dist/schemas.d.ts +27 -0
- package/dist/schemas.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/cli/index.ts +2 -1
- package/src/create-jobs.spec.ts +162 -10
- package/src/create-jobs.ts +29 -18
- package/src/schemas.ts +12 -0
- package/vite.config.ts +6 -1
- package/dist/schemas-BCY99Jil.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.
|
|
3
3
|
|
|
4
4
|
- - -
|
|
5
|
+
## @omni-oss/create-jobs-v0.1.7 - 2026-02-10
|
|
6
|
+
#### Bug Fixes
|
|
7
|
+
- generic publish task - (f5d56c4) - Clarence Manuel
|
|
8
|
+
|
|
9
|
+
- - -
|
|
10
|
+
|
|
11
|
+
## @omni-oss/create-jobs-v0.1.6 - 2026-02-09
|
|
12
|
+
#### Bug Fixes
|
|
13
|
+
- (**@omni-oss/create-jobs**) support create jobs via is_*_task meta data - (d95dbca) - Clarence Manuel
|
|
14
|
+
|
|
15
|
+
- - -
|
|
16
|
+
|
|
5
17
|
## @omni-oss/create-jobs-v0.1.5 - 2026-02-09
|
|
6
18
|
#### Bug Fixes
|
|
7
19
|
- (**@omni-oss/create-jobs**) support sanitizing artifact names - (1ed9932) - Clarence Manuel
|
package/dist/create-jobs.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
"use strict";const
|
|
2
|
+
"use strict";const r=require("node:fs/promises"),i=require("@commander-js/extra-typings"),s=require("./schemas-BnpD42eF.js"),l=new i.Command;l.argument("<input>","The input file to read from.").option("-o, --output <output>","The output file to write to.").option("-r, --root <root>","Override the workspace root.").action(async(n,e)=>{const a=await r.readFile(n,"utf-8"),u=JSON.parse(a),t=s.TaskResultArraySchema.safeParse(u);if(t.success){const c=t.data,o=s.createJobs(c,e.root);e.output?await r.writeFile(e.output,JSON.stringify(o,null,2)):console.log(o)}else console.error(t.error),process.exit(1)}).parseAsync();
|
package/dist/create-jobs.d.ts
CHANGED
|
@@ -29,7 +29,8 @@ export type BuildJobs = {
|
|
|
29
29
|
};
|
|
30
30
|
export type PublishJobs = {
|
|
31
31
|
npm: Job[];
|
|
32
|
+
generic: Job[];
|
|
32
33
|
rust_github: Job[];
|
|
33
34
|
};
|
|
34
|
-
export declare function createJobs(results: TaskResultArray): Jobs;
|
|
35
|
+
export declare function createJobs(results: TaskResultArray, rootDir?: string): Jobs;
|
|
35
36
|
//# sourceMappingURL=create-jobs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-jobs.d.ts","sourceRoot":"","sources":["../src/create-jobs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-jobs.d.ts","sourceRoot":"","sources":["../src/create-jobs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAc,eAAe,EAAE,MAAM,WAAW,CAAC;AAEnE,MAAM,MAAM,QAAQ,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,GAAG,GAAG;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE;QACP,SAAS,EAAE,QAAQ,CAAC;QACpB,OAAO,EAAE,QAAQ,CAAC;KACrB,CAAC;IACF,IAAI,EAAE,IAAI,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACf,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,WAAW,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACnB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,GAAG,EAAE,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACpB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,GAAG,EAAE,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACtB,GAAG,EAAE,GAAG,EAAE,CAAC;IACX,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,WAAW,EAAE,GAAG,EAAE,CAAC;CACtB,CAAC;AAEF,wBAAgB,UAAU,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CA8D3E"}
|
package/dist/create-jobs.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import
|
|
2
|
+
import r from "node:fs/promises";
|
|
3
3
|
import { Command as u } from "@commander-js/extra-typings";
|
|
4
|
-
import { T as c, c as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const a = await
|
|
8
|
-
if (
|
|
9
|
-
const i =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
JSON.stringify(
|
|
13
|
-
) : console.log(
|
|
4
|
+
import { T as c, c as p } from "./schemas-CySsa0xy.mjs";
|
|
5
|
+
const l = new u();
|
|
6
|
+
l.argument("<input>", "The input file to read from.").option("-o, --output <output>", "The output file to write to.").option("-r, --root <root>", "Override the workspace root.").action(async (s, t) => {
|
|
7
|
+
const a = await r.readFile(s, "utf-8"), n = JSON.parse(a), o = c.safeParse(n);
|
|
8
|
+
if (o.success) {
|
|
9
|
+
const i = o.data, e = p(i, t.root);
|
|
10
|
+
t.output ? await r.writeFile(
|
|
11
|
+
t.output,
|
|
12
|
+
JSON.stringify(e, null, 2)
|
|
13
|
+
) : console.log(e);
|
|
14
14
|
} else
|
|
15
|
-
console.error(
|
|
15
|
+
console.error(o.error), process.exit(1);
|
|
16
16
|
}).parseAsync();
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./schemas-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./schemas-BnpD42eF.js");exports.TaskResultArraySchema=e.TaskResultArraySchema;exports.TaskResultSchema=e.TaskResultSchema;exports.createJobs=e.createJobs;
|
package/dist/index.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("node:path"),u=require("node:process"),e=require("zod");function b(s,a){a||(a=u.cwd());const i={test:{rust:[],typescript:[]},build:{rust:[],typescript:[]},publish:{generic:[],npm:[],rust_github:[]}};for(const t of s){if(t.status==="skipped")continue;const o=t.task;(o.task_name==="test"||t.details.meta?.is_test_task)&&(t.details.meta?.language==="rust"&&i.test.rust.push(r(t,a)),t.details.meta?.language==="typescript"&&i.test.typescript.push(r(t,a))),(o.task_name==="build"||t.details.meta?.is_build_task)&&(t.details.meta?.language==="rust"&&i.build.rust.push(r(t,a)),t.details.meta?.language==="typescript"&&i.build.typescript.push(r(t,a))),(o.task_name==="publish"||t.details.meta?.is_publish_task)&&(t.details.meta?.language==="typescript"?i.publish.npm.push(r(t,a)):t.details.meta?.language==="rust"?i.publish.rust_github.push(r(t,a)):i.publish.generic.push(r(t,a)))}return i}function r(s,a){const i=[],t=[];if(s.details.output_files&&s.details.output_files.length>0)for(const o of s.details.output_files){const l=n.resolve(s.task.project_dir,o);m(s.task.project_dir,l)?t.push(n.relative(s.task.project_dir,l)):i.push(n.relative(a,l))}return{task_name:s.task.task_name,project_name:s.task.project_name,artifacts:{project:{name:`project-${c(s.task.project_name)}__${c(s.task.task_name)}`,files:t,files_count:t.length},workspace:{name:`workspace-${c(s.task.project_name)}__${c(s.task.task_name)}`,files:i,files_count:i.length}},project_dir:n.relative(a,s.task.project_dir),meta:s.details.meta??{}}}function m(s,a){const i=n.relative(s,a);return i&&!i.startsWith("..")&&!n.isAbsolute(i)}function c(s){let a=s.replace(/[/\\?%*:|"<> \x00-\x1f]/g,"_");return a=a.replace(/[.\s]+$/,""),/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i.test(a)&&(a+="_"),a||"unsaved_file"}const f=e.z.object({secs:e.z.number().int().nonnegative().describe("The number of whole seconds elapsed."),nanos:e.z.number().int().nonnegative().describe("The number of nanoseconds elapsed.")}),k=e.z.object({runner:e.z.string().describe("The runner to use for the target.")}),g=e.z.object({npm:e.z.boolean().optional().describe("Whether to publish to npm."),github:e.z.boolean().optional().describe("Whether to publish to github.")}),_=e.z.object({type:e.z.string().optional().describe("The type of project (e.g., library, service, application)."),language:e.z.string().optional().describe("The primary language of the project."),targets:e.z.record(e.z.string(),k).optional().describe("The targets to build."),release:g.optional(),is_publish_task:e.z.boolean().optional().describe("Whether this is a publish job."),is_build_task:e.z.boolean().optional().describe("Whether this is a build job."),is_test_task:e.z.boolean().optional().describe("Whether this is a test job.")}),p=e.z.object({meta:_.optional(),output_files:e.z.array(e.z.string()).optional().describe("The output files generated.")}),d=e.z.object({task_name:e.z.string().describe("The short name of the task (e.g., 'test', 'build')."),task_command:e.z.string().describe("The command executed for the task."),project_name:e.z.string().describe("The name of the project."),project_dir:e.z.string().describe("The absolute directory path of the project."),full_task_name:e.z.string().describe("The fully qualified task name (e.g., 'omni_utils#test')."),dependencies:e.z.array(e.z.string()).describe("A list of dependent task names."),enabled:e.z.boolean().or(e.z.string()).optional().describe("Whether the task is enabled by configuration. Either a boolean or a tera template string that evaluates to a boolean."),interactive:e.z.boolean().describe("Whether the task is interactive."),persistent:e.z.boolean().describe("Whether the task is persistent.")}),z=e.z.object({status:e.z.literal("completed"),hash:e.z.string().describe("The task's content hash (Base64 encoded string). Used for caching."),task:d,exit_code:e.z.number().int().describe("The exit code of the executed command (typically 0 for success)."),elapsed:f.describe("The duration the task took to execute."),cache_hit:e.z.boolean().describe("Indicates if the result was pulled from cache."),details:p}),j=e.z.object({status:e.z.literal("errored"),task:d,error:e.z.string().describe("The error message."),details:p}),T=e.z.object({status:e.z.literal("skipped"),task:d,skip_reason:e.z.string().describe("The reason the task was skipped (e.g., 'disabled')."),details:p}),h=e.z.discriminatedUnion("status",[z,T,j]).describe("Schema for a single task execution result (completed or skipped)."),y=e.z.array(h).describe("An array of task execution results.");exports.TaskResultArraySchema=y;exports.TaskResultSchema=h;exports.createJobs=b;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from "node:path";
|
|
2
|
+
import h from "node:process";
|
|
2
3
|
import { z as e } from "zod";
|
|
3
|
-
function
|
|
4
|
-
|
|
4
|
+
function x(s, a) {
|
|
5
|
+
a || (a = h.cwd());
|
|
6
|
+
const i = {
|
|
5
7
|
test: {
|
|
6
8
|
rust: [],
|
|
7
9
|
typescript: []
|
|
@@ -11,6 +13,7 @@ function y(s) {
|
|
|
11
13
|
typescript: []
|
|
12
14
|
},
|
|
13
15
|
publish: {
|
|
16
|
+
generic: [],
|
|
14
17
|
npm: [],
|
|
15
18
|
rust_github: []
|
|
16
19
|
}
|
|
@@ -18,62 +21,67 @@ function y(s) {
|
|
|
18
21
|
for (const t of s) {
|
|
19
22
|
if (t.status === "skipped")
|
|
20
23
|
continue;
|
|
21
|
-
const
|
|
22
|
-
|
|
24
|
+
const n = t.task;
|
|
25
|
+
(n.task_name === "test" || t.details.meta?.is_test_task) && (t.details.meta?.language === "rust" && i.test.rust.push(r(t, a)), t.details.meta?.language === "typescript" && i.test.typescript.push(r(t, a))), (n.task_name === "build" || t.details.meta?.is_build_task) && (t.details.meta?.language === "rust" && i.build.rust.push(r(t, a)), t.details.meta?.language === "typescript" && i.build.typescript.push(r(t, a))), (n.task_name === "publish" || t.details.meta?.is_publish_task) && (t.details.meta?.language === "typescript" ? i.publish.npm.push(r(t, a)) : t.details.meta?.language === "rust" ? i.publish.rust_github.push(r(t, a)) : i.publish.generic.push(r(t, a)));
|
|
23
26
|
}
|
|
24
|
-
return
|
|
27
|
+
return i;
|
|
25
28
|
}
|
|
26
|
-
function
|
|
27
|
-
const
|
|
29
|
+
function r(s, a) {
|
|
30
|
+
const i = [], t = [];
|
|
28
31
|
if (s.details.output_files && s.details.output_files.length > 0)
|
|
29
|
-
for (const
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
+
for (const n of s.details.output_files) {
|
|
33
|
+
const l = o.resolve(s.task.project_dir, n);
|
|
34
|
+
u(s.task.project_dir, l) ? t.push(
|
|
35
|
+
o.relative(s.task.project_dir, l)
|
|
36
|
+
) : i.push(o.relative(a, l));
|
|
32
37
|
}
|
|
33
38
|
return {
|
|
34
39
|
task_name: s.task.task_name,
|
|
35
40
|
project_name: s.task.project_name,
|
|
36
41
|
artifacts: {
|
|
37
42
|
project: {
|
|
38
|
-
name: `project-${
|
|
43
|
+
name: `project-${c(s.task.project_name)}__${c(s.task.task_name)}`,
|
|
39
44
|
files: t,
|
|
40
45
|
files_count: t.length
|
|
41
46
|
},
|
|
42
47
|
workspace: {
|
|
43
|
-
name: `workspace-${
|
|
44
|
-
files:
|
|
45
|
-
files_count:
|
|
48
|
+
name: `workspace-${c(s.task.project_name)}__${c(s.task.task_name)}`,
|
|
49
|
+
files: i,
|
|
50
|
+
files_count: i.length
|
|
46
51
|
}
|
|
47
52
|
},
|
|
48
|
-
project_dir: s.task.project_dir,
|
|
53
|
+
project_dir: o.relative(a, s.task.project_dir),
|
|
49
54
|
meta: s.details.meta ?? {}
|
|
50
55
|
};
|
|
51
56
|
}
|
|
52
|
-
function
|
|
53
|
-
const
|
|
54
|
-
return
|
|
57
|
+
function u(s, a) {
|
|
58
|
+
const i = o.relative(s, a);
|
|
59
|
+
return i && !i.startsWith("..") && !o.isAbsolute(i);
|
|
55
60
|
}
|
|
56
|
-
function
|
|
61
|
+
function c(s) {
|
|
57
62
|
let a = s.replace(/[/\\?%*:|"<> \x00-\x1f]/g, "_");
|
|
58
63
|
return a = a.replace(/[.\s]+$/, ""), /^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i.test(a) && (a += "_"), a || "unsaved_file";
|
|
59
64
|
}
|
|
60
|
-
const
|
|
65
|
+
const b = e.object({
|
|
61
66
|
secs: e.number().int().nonnegative().describe("The number of whole seconds elapsed."),
|
|
62
67
|
nanos: e.number().int().nonnegative().describe("The number of nanoseconds elapsed.")
|
|
63
|
-
}),
|
|
68
|
+
}), m = e.object({
|
|
64
69
|
runner: e.string().describe("The runner to use for the target.")
|
|
65
|
-
}),
|
|
70
|
+
}), f = e.object({
|
|
66
71
|
npm: e.boolean().optional().describe("Whether to publish to npm."),
|
|
67
72
|
github: e.boolean().optional().describe("Whether to publish to github.")
|
|
68
|
-
}),
|
|
73
|
+
}), g = e.object({
|
|
69
74
|
type: e.string().optional().describe("The type of project (e.g., library, service, application)."),
|
|
70
75
|
language: e.string().optional().describe("The primary language of the project."),
|
|
71
|
-
targets: e.record(e.string(),
|
|
72
|
-
release:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
targets: e.record(e.string(), m).optional().describe("The targets to build."),
|
|
77
|
+
release: f.optional(),
|
|
78
|
+
is_publish_task: e.boolean().optional().describe("Whether this is a publish job."),
|
|
79
|
+
is_build_task: e.boolean().optional().describe("Whether this is a build job."),
|
|
80
|
+
is_test_task: e.boolean().optional().describe("Whether this is a test job.")
|
|
76
81
|
}), p = e.object({
|
|
82
|
+
meta: g.optional(),
|
|
83
|
+
output_files: e.array(e.string()).optional().describe("The output files generated.")
|
|
84
|
+
}), d = e.object({
|
|
77
85
|
task_name: e.string().describe("The short name of the task (e.g., 'test', 'build')."),
|
|
78
86
|
task_command: e.string().describe("The command executed for the task."),
|
|
79
87
|
project_name: e.string().describe("The name of the project."),
|
|
@@ -85,37 +93,37 @@ const h = e.object({
|
|
|
85
93
|
),
|
|
86
94
|
interactive: e.boolean().describe("Whether the task is interactive."),
|
|
87
95
|
persistent: e.boolean().describe("Whether the task is persistent.")
|
|
88
|
-
}),
|
|
96
|
+
}), k = e.object({
|
|
89
97
|
status: e.literal("completed"),
|
|
90
98
|
hash: e.string().describe(
|
|
91
99
|
"The task's content hash (Base64 encoded string). Used for caching."
|
|
92
100
|
),
|
|
93
|
-
task:
|
|
101
|
+
task: d,
|
|
94
102
|
exit_code: e.number().int().describe(
|
|
95
103
|
"The exit code of the executed command (typically 0 for success)."
|
|
96
104
|
),
|
|
97
|
-
elapsed:
|
|
105
|
+
elapsed: b.describe("The duration the task took to execute."),
|
|
98
106
|
cache_hit: e.boolean().describe("Indicates if the result was pulled from cache."),
|
|
99
|
-
details:
|
|
100
|
-
}),
|
|
107
|
+
details: p
|
|
108
|
+
}), _ = e.object({
|
|
101
109
|
status: e.literal("errored"),
|
|
102
|
-
task:
|
|
110
|
+
task: d,
|
|
103
111
|
error: e.string().describe("The error message."),
|
|
104
|
-
details:
|
|
105
|
-
}),
|
|
112
|
+
details: p
|
|
113
|
+
}), j = e.object({
|
|
106
114
|
status: e.literal("skipped"),
|
|
107
|
-
task:
|
|
115
|
+
task: d,
|
|
108
116
|
skip_reason: e.string().describe("The reason the task was skipped (e.g., 'disabled')."),
|
|
109
|
-
details:
|
|
110
|
-
}),
|
|
111
|
-
f,
|
|
117
|
+
details: p
|
|
118
|
+
}), T = e.discriminatedUnion("status", [
|
|
112
119
|
k,
|
|
113
|
-
|
|
120
|
+
j,
|
|
121
|
+
_
|
|
114
122
|
]).describe(
|
|
115
123
|
"Schema for a single task execution result (completed or skipped)."
|
|
116
|
-
),
|
|
124
|
+
), W = e.array(T).describe("An array of task execution results.");
|
|
117
125
|
export {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
126
|
+
W as T,
|
|
127
|
+
T as a,
|
|
128
|
+
x as c
|
|
121
129
|
};
|
package/dist/schemas.d.ts
CHANGED
|
@@ -19,6 +19,9 @@ declare const MetaSchema: z.ZodObject<{
|
|
|
19
19
|
npm: z.ZodOptional<z.ZodBoolean>;
|
|
20
20
|
github: z.ZodOptional<z.ZodBoolean>;
|
|
21
21
|
}, z.core.$strip>>;
|
|
22
|
+
is_publish_task: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
is_build_task: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
+
is_test_task: z.ZodOptional<z.ZodBoolean>;
|
|
22
25
|
}, z.core.$strip>;
|
|
23
26
|
/**
|
|
24
27
|
* Defines the details of the task that was run or skipped.
|
|
@@ -69,6 +72,9 @@ declare const CompletedTaskSchema: z.ZodObject<{
|
|
|
69
72
|
npm: z.ZodOptional<z.ZodBoolean>;
|
|
70
73
|
github: z.ZodOptional<z.ZodBoolean>;
|
|
71
74
|
}, z.core.$strip>>;
|
|
75
|
+
is_publish_task: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
is_build_task: z.ZodOptional<z.ZodBoolean>;
|
|
77
|
+
is_test_task: z.ZodOptional<z.ZodBoolean>;
|
|
72
78
|
}, z.core.$strip>>;
|
|
73
79
|
output_files: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
74
80
|
}, z.core.$strip>;
|
|
@@ -102,6 +108,9 @@ declare const SkippedTaskSchema: z.ZodObject<{
|
|
|
102
108
|
npm: z.ZodOptional<z.ZodBoolean>;
|
|
103
109
|
github: z.ZodOptional<z.ZodBoolean>;
|
|
104
110
|
}, z.core.$strip>>;
|
|
111
|
+
is_publish_task: z.ZodOptional<z.ZodBoolean>;
|
|
112
|
+
is_build_task: z.ZodOptional<z.ZodBoolean>;
|
|
113
|
+
is_test_task: z.ZodOptional<z.ZodBoolean>;
|
|
105
114
|
}, z.core.$strip>>;
|
|
106
115
|
output_files: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
107
116
|
}, z.core.$strip>;
|
|
@@ -141,6 +150,9 @@ export declare const TaskResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
141
150
|
npm: z.ZodOptional<z.ZodBoolean>;
|
|
142
151
|
github: z.ZodOptional<z.ZodBoolean>;
|
|
143
152
|
}, z.core.$strip>>;
|
|
153
|
+
is_publish_task: z.ZodOptional<z.ZodBoolean>;
|
|
154
|
+
is_build_task: z.ZodOptional<z.ZodBoolean>;
|
|
155
|
+
is_test_task: z.ZodOptional<z.ZodBoolean>;
|
|
144
156
|
}, z.core.$strip>>;
|
|
145
157
|
output_files: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
146
158
|
}, z.core.$strip>;
|
|
@@ -169,6 +181,9 @@ export declare const TaskResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
169
181
|
npm: z.ZodOptional<z.ZodBoolean>;
|
|
170
182
|
github: z.ZodOptional<z.ZodBoolean>;
|
|
171
183
|
}, z.core.$strip>>;
|
|
184
|
+
is_publish_task: z.ZodOptional<z.ZodBoolean>;
|
|
185
|
+
is_build_task: z.ZodOptional<z.ZodBoolean>;
|
|
186
|
+
is_test_task: z.ZodOptional<z.ZodBoolean>;
|
|
172
187
|
}, z.core.$strip>>;
|
|
173
188
|
output_files: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
174
189
|
}, z.core.$strip>;
|
|
@@ -197,6 +212,9 @@ export declare const TaskResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
197
212
|
npm: z.ZodOptional<z.ZodBoolean>;
|
|
198
213
|
github: z.ZodOptional<z.ZodBoolean>;
|
|
199
214
|
}, z.core.$strip>>;
|
|
215
|
+
is_publish_task: z.ZodOptional<z.ZodBoolean>;
|
|
216
|
+
is_build_task: z.ZodOptional<z.ZodBoolean>;
|
|
217
|
+
is_test_task: z.ZodOptional<z.ZodBoolean>;
|
|
200
218
|
}, z.core.$strip>>;
|
|
201
219
|
output_files: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
202
220
|
}, z.core.$strip>;
|
|
@@ -235,6 +253,9 @@ export declare const TaskResultArraySchema: z.ZodArray<z.ZodDiscriminatedUnion<[
|
|
|
235
253
|
npm: z.ZodOptional<z.ZodBoolean>;
|
|
236
254
|
github: z.ZodOptional<z.ZodBoolean>;
|
|
237
255
|
}, z.core.$strip>>;
|
|
256
|
+
is_publish_task: z.ZodOptional<z.ZodBoolean>;
|
|
257
|
+
is_build_task: z.ZodOptional<z.ZodBoolean>;
|
|
258
|
+
is_test_task: z.ZodOptional<z.ZodBoolean>;
|
|
238
259
|
}, z.core.$strip>>;
|
|
239
260
|
output_files: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
240
261
|
}, z.core.$strip>;
|
|
@@ -263,6 +284,9 @@ export declare const TaskResultArraySchema: z.ZodArray<z.ZodDiscriminatedUnion<[
|
|
|
263
284
|
npm: z.ZodOptional<z.ZodBoolean>;
|
|
264
285
|
github: z.ZodOptional<z.ZodBoolean>;
|
|
265
286
|
}, z.core.$strip>>;
|
|
287
|
+
is_publish_task: z.ZodOptional<z.ZodBoolean>;
|
|
288
|
+
is_build_task: z.ZodOptional<z.ZodBoolean>;
|
|
289
|
+
is_test_task: z.ZodOptional<z.ZodBoolean>;
|
|
266
290
|
}, z.core.$strip>>;
|
|
267
291
|
output_files: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
268
292
|
}, z.core.$strip>;
|
|
@@ -291,6 +315,9 @@ export declare const TaskResultArraySchema: z.ZodArray<z.ZodDiscriminatedUnion<[
|
|
|
291
315
|
npm: z.ZodOptional<z.ZodBoolean>;
|
|
292
316
|
github: z.ZodOptional<z.ZodBoolean>;
|
|
293
317
|
}, z.core.$strip>>;
|
|
318
|
+
is_publish_task: z.ZodOptional<z.ZodBoolean>;
|
|
319
|
+
is_build_task: z.ZodOptional<z.ZodBoolean>;
|
|
320
|
+
is_test_task: z.ZodOptional<z.ZodBoolean>;
|
|
294
321
|
}, z.core.$strip>>;
|
|
295
322
|
output_files: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
296
323
|
}, z.core.$strip>;
|
package/dist/schemas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;GAEG;AACH,QAAA,MAAM,aAAa;;;iBAWjB,CAAC;AAWH;;GAEG;AACH,QAAA,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;GAEG;AACH,QAAA,MAAM,aAAa;;;iBAWjB,CAAC;AAWH;;GAEG;AACH,QAAA,MAAM,UAAU;;;;;;;;;;;;;iBA0Bd,CAAC;AAUH;;GAEG;AACH,QAAA,MAAM,UAAU;;;;;;;;;;iBAwBd,CAAC;AAIH;;;GAGG;AACH,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmBvB,CAAC;AASH;;;GAGG;AACH,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAOrB,CAAC;AAIH;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAQxB,CAAC;AAEN;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAEkB,CAAC;AAIrD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAC9C,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAC9C,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACtE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
package/package.json
CHANGED
package/src/cli/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ const command = new Command();
|
|
|
8
8
|
command
|
|
9
9
|
.argument("<input>", "The input file to read from.")
|
|
10
10
|
.option("-o, --output <output>", "The output file to write to.")
|
|
11
|
+
.option("-r, --root <root>", "Override the workspace root.")
|
|
11
12
|
.action(async (input, options) => {
|
|
12
13
|
const inputFile = await fsAsync.readFile(input, "utf-8");
|
|
13
14
|
const results = JSON.parse(inputFile);
|
|
@@ -15,7 +16,7 @@ command
|
|
|
15
16
|
|
|
16
17
|
if (result.success) {
|
|
17
18
|
const data = result.data;
|
|
18
|
-
const processed = createJobs(data);
|
|
19
|
+
const processed = createJobs(data, options.root);
|
|
19
20
|
if (options.output) {
|
|
20
21
|
await fsAsync.writeFile(
|
|
21
22
|
options.output,
|
package/src/create-jobs.spec.ts
CHANGED
|
@@ -53,14 +53,14 @@ describe("createJobs", () => {
|
|
|
53
53
|
},
|
|
54
54
|
];
|
|
55
55
|
|
|
56
|
-
const jobs = createJobs(results);
|
|
56
|
+
const jobs = createJobs(results, "/mnt/c/Users/user");
|
|
57
57
|
|
|
58
58
|
expect(jobs.test.rust[0]).toMatchObject({
|
|
59
59
|
project_name: "rust-app",
|
|
60
60
|
task_name: "test",
|
|
61
61
|
artifacts: {
|
|
62
62
|
project: {
|
|
63
|
-
files: ["
|
|
63
|
+
files: ["binary"],
|
|
64
64
|
},
|
|
65
65
|
},
|
|
66
66
|
});
|
|
@@ -77,12 +77,17 @@ describe("createJobs", () => {
|
|
|
77
77
|
project_name: "js-pkg",
|
|
78
78
|
project_dir: "/mnt/c/Users/user/project",
|
|
79
79
|
},
|
|
80
|
-
details: {
|
|
80
|
+
details: {
|
|
81
|
+
meta: {
|
|
82
|
+
language: "typescript",
|
|
83
|
+
release: { npm: true },
|
|
84
|
+
},
|
|
85
|
+
},
|
|
81
86
|
},
|
|
82
87
|
{
|
|
83
88
|
status: "success",
|
|
84
89
|
task: {
|
|
85
|
-
task_name: "
|
|
90
|
+
task_name: "publish",
|
|
86
91
|
project_name: "rust-pkg",
|
|
87
92
|
project_dir: "/mnt/c/Users/user/project",
|
|
88
93
|
},
|
|
@@ -101,8 +106,7 @@ describe("createJobs", () => {
|
|
|
101
106
|
expect(jobs.publish.npm).toHaveLength(1);
|
|
102
107
|
expect(jobs.publish.npm[0]?.project_name).toBe("js-pkg");
|
|
103
108
|
|
|
104
|
-
// Checks GitHub logic: meta.release.github must be true AND language must be "rust"
|
|
105
|
-
// Note: your code doesn't strictly check if task_name === "publish" for rust_github!
|
|
109
|
+
// Checks GitHub logic: meta.release.github must be true AND language must be "rust" AND task_name must be "publish"
|
|
106
110
|
expect(jobs.publish.rust_github).toHaveLength(1);
|
|
107
111
|
expect(jobs.publish.rust_github[0]?.project_name).toBe("rust-pkg");
|
|
108
112
|
});
|
|
@@ -141,14 +145,14 @@ describe("createJobs", () => {
|
|
|
141
145
|
},
|
|
142
146
|
];
|
|
143
147
|
|
|
144
|
-
const jobs = createJobs(results);
|
|
148
|
+
const jobs = createJobs(results, "/mnt/c/Users/usert");
|
|
145
149
|
|
|
146
150
|
expect(jobs.test.rust[0]).toMatchObject({
|
|
147
151
|
project_name: "minimal",
|
|
148
152
|
task_name: "test",
|
|
149
153
|
artifacts: {
|
|
150
154
|
project: {
|
|
151
|
-
files: ["
|
|
155
|
+
files: ["target/debug/minimal"],
|
|
152
156
|
},
|
|
153
157
|
},
|
|
154
158
|
});
|
|
@@ -170,14 +174,14 @@ describe("createJobs", () => {
|
|
|
170
174
|
},
|
|
171
175
|
];
|
|
172
176
|
|
|
173
|
-
const jobs = createJobs(results);
|
|
177
|
+
const jobs = createJobs(results, "/mnt/c/Users/user");
|
|
174
178
|
|
|
175
179
|
expect(jobs.test.rust[0]).toMatchObject({
|
|
176
180
|
project_name: "minimal",
|
|
177
181
|
task_name: "test",
|
|
178
182
|
artifacts: {
|
|
179
183
|
workspace: {
|
|
180
|
-
files: ["
|
|
184
|
+
files: ["target/debug/minimal"],
|
|
181
185
|
},
|
|
182
186
|
},
|
|
183
187
|
});
|
|
@@ -216,4 +220,152 @@ describe("createJobs", () => {
|
|
|
216
220
|
},
|
|
217
221
|
});
|
|
218
222
|
});
|
|
223
|
+
|
|
224
|
+
it("should handle is_publish_task correctly", () => {
|
|
225
|
+
const results: any[] = [
|
|
226
|
+
{
|
|
227
|
+
status: "success",
|
|
228
|
+
task: {
|
|
229
|
+
task_name: "publish",
|
|
230
|
+
project_name: "js-pkg",
|
|
231
|
+
project_dir: "/mnt/c/Users/user/project",
|
|
232
|
+
},
|
|
233
|
+
details: {
|
|
234
|
+
meta: {
|
|
235
|
+
language: "typescript",
|
|
236
|
+
release: { npm: true },
|
|
237
|
+
is_publish_task: true,
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
status: "success",
|
|
243
|
+
task: {
|
|
244
|
+
task_name: "any-task",
|
|
245
|
+
project_name: "rust-pkg",
|
|
246
|
+
project_dir: "/mnt/c/Users/user/project",
|
|
247
|
+
},
|
|
248
|
+
details: {
|
|
249
|
+
meta: {
|
|
250
|
+
language: "rust",
|
|
251
|
+
release: { github: true },
|
|
252
|
+
is_publish_task: true,
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
];
|
|
257
|
+
|
|
258
|
+
const jobs = createJobs(results);
|
|
259
|
+
|
|
260
|
+
// Checks NPM logic: task_name must be "publish" AND meta.release.npm must be true
|
|
261
|
+
expect(jobs.publish.npm).toHaveLength(1);
|
|
262
|
+
expect(jobs.publish.npm[0]?.project_name).toBe("js-pkg");
|
|
263
|
+
|
|
264
|
+
// Checks GitHub logic: meta.release.github must be true AND language must be "rust"
|
|
265
|
+
// Note that your code doesn't strictly check if task_name === "publish" for rust_github!
|
|
266
|
+
expect(jobs.publish.rust_github).toHaveLength(1);
|
|
267
|
+
expect(jobs.publish.rust_github[0]?.project_name).toBe("rust-pkg");
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
it("should handle is_build_task correctly", () => {
|
|
271
|
+
const results: any[] = [
|
|
272
|
+
{
|
|
273
|
+
status: "success",
|
|
274
|
+
task: {
|
|
275
|
+
task_name: "build",
|
|
276
|
+
project_name: "ts-lib",
|
|
277
|
+
project_dir: "/mnt/c/Users/user/project",
|
|
278
|
+
},
|
|
279
|
+
details: {
|
|
280
|
+
meta: { language: "typescript", is_build_task: true },
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
status: "success",
|
|
285
|
+
task: {
|
|
286
|
+
task_name: "any-task",
|
|
287
|
+
project_name: "rust-pkg",
|
|
288
|
+
project_dir: "/mnt/c/Users/user/project",
|
|
289
|
+
},
|
|
290
|
+
details: {
|
|
291
|
+
meta: {
|
|
292
|
+
language: "rust",
|
|
293
|
+
is_build_task: true,
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
];
|
|
298
|
+
|
|
299
|
+
const jobs = createJobs(results);
|
|
300
|
+
|
|
301
|
+
// Checks build logic: task_name must be "build" AND meta.language must be "typescript"
|
|
302
|
+
expect(jobs.build.typescript).toHaveLength(1);
|
|
303
|
+
expect(jobs.build.typescript[0]?.project_name).toBe("ts-lib");
|
|
304
|
+
|
|
305
|
+
// Checks build logic: task_name must be "any-task" AND meta.language must be "rust"
|
|
306
|
+
expect(jobs.build.rust).toHaveLength(1);
|
|
307
|
+
expect(jobs.build.rust[0]?.project_name).toBe("rust-pkg");
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
it("should handle is_test_task correctly", () => {
|
|
311
|
+
const results: any[] = [
|
|
312
|
+
{
|
|
313
|
+
status: "success",
|
|
314
|
+
task: {
|
|
315
|
+
task_name: "test",
|
|
316
|
+
project_name: "rust-app",
|
|
317
|
+
project_dir: "/mnt/c/Users/user/project",
|
|
318
|
+
},
|
|
319
|
+
details: {
|
|
320
|
+
meta: { language: "rust", is_test_task: true },
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
status: "success",
|
|
325
|
+
task: {
|
|
326
|
+
task_name: "test",
|
|
327
|
+
project_name: "rust-pkg",
|
|
328
|
+
project_dir: "/mnt/c/Users/user/project",
|
|
329
|
+
},
|
|
330
|
+
details: {
|
|
331
|
+
meta: {
|
|
332
|
+
language: "rust",
|
|
333
|
+
is_test_task: true,
|
|
334
|
+
},
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
];
|
|
338
|
+
|
|
339
|
+
const jobs = createJobs(results);
|
|
340
|
+
|
|
341
|
+
// Checks test logic: task_name must be "test" AND meta.language must be "rust"
|
|
342
|
+
expect(jobs.test.rust).toHaveLength(2);
|
|
343
|
+
expect(jobs.test.rust[0]?.project_name).toBe("rust-app");
|
|
344
|
+
expect(jobs.test.rust[1]?.project_name).toBe("rust-pkg");
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
it("should handle generic publish tasks correctly", () => {
|
|
348
|
+
const results: any[] = [
|
|
349
|
+
{
|
|
350
|
+
status: "success",
|
|
351
|
+
task: {
|
|
352
|
+
task_name: "publish",
|
|
353
|
+
project_name: "rust-pkg",
|
|
354
|
+
project_dir: "/mnt/c/Users/user/project",
|
|
355
|
+
},
|
|
356
|
+
details: {
|
|
357
|
+
meta: {
|
|
358
|
+
release: { github: true },
|
|
359
|
+
is_publish_task: true,
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
},
|
|
363
|
+
];
|
|
364
|
+
|
|
365
|
+
const jobs = createJobs(results);
|
|
366
|
+
|
|
367
|
+
// Checks generic logic: task_name must be "publish" AND meta.release.github must be true
|
|
368
|
+
expect(jobs.publish.generic).toHaveLength(1);
|
|
369
|
+
expect(jobs.publish.generic[0]?.project_name).toBe("rust-pkg");
|
|
370
|
+
});
|
|
219
371
|
});
|
package/src/create-jobs.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import process from "node:process";
|
|
2
3
|
import type { Meta, TaskResult, TaskResultArray } from "./schemas";
|
|
3
4
|
|
|
4
5
|
export type Artifact = {
|
|
@@ -36,10 +37,15 @@ export type BuildJobs = {
|
|
|
36
37
|
|
|
37
38
|
export type PublishJobs = {
|
|
38
39
|
npm: Job[];
|
|
40
|
+
generic: Job[];
|
|
39
41
|
rust_github: Job[];
|
|
40
42
|
};
|
|
41
43
|
|
|
42
|
-
export function createJobs(results: TaskResultArray): Jobs {
|
|
44
|
+
export function createJobs(results: TaskResultArray, rootDir?: string): Jobs {
|
|
45
|
+
if (!rootDir) {
|
|
46
|
+
rootDir = process.cwd();
|
|
47
|
+
}
|
|
48
|
+
|
|
43
49
|
const jobs: Jobs = {
|
|
44
50
|
test: {
|
|
45
51
|
rust: [],
|
|
@@ -50,6 +56,7 @@ export function createJobs(results: TaskResultArray): Jobs {
|
|
|
50
56
|
typescript: [],
|
|
51
57
|
},
|
|
52
58
|
publish: {
|
|
59
|
+
generic: [],
|
|
53
60
|
npm: [],
|
|
54
61
|
rust_github: [],
|
|
55
62
|
},
|
|
@@ -61,42 +68,44 @@ export function createJobs(results: TaskResultArray): Jobs {
|
|
|
61
68
|
}
|
|
62
69
|
|
|
63
70
|
const task = result.task;
|
|
64
|
-
if (task.task_name === "test") {
|
|
71
|
+
if (task.task_name === "test" || result.details.meta?.is_test_task) {
|
|
65
72
|
if (result.details.meta?.language === "rust") {
|
|
66
|
-
jobs.test.rust.push(jobFromResult(result));
|
|
73
|
+
jobs.test.rust.push(jobFromResult(result, rootDir));
|
|
67
74
|
}
|
|
68
75
|
|
|
69
76
|
if (result.details.meta?.language === "typescript") {
|
|
70
|
-
jobs.test.typescript.push(jobFromResult(result));
|
|
77
|
+
jobs.test.typescript.push(jobFromResult(result, rootDir));
|
|
71
78
|
}
|
|
72
79
|
}
|
|
73
80
|
|
|
74
|
-
if (task.task_name === "build") {
|
|
81
|
+
if (task.task_name === "build" || result.details.meta?.is_build_task) {
|
|
75
82
|
if (result.details.meta?.language === "rust") {
|
|
76
|
-
jobs.build.rust.push(jobFromResult(result));
|
|
83
|
+
jobs.build.rust.push(jobFromResult(result, rootDir));
|
|
77
84
|
}
|
|
78
85
|
|
|
79
86
|
if (result.details.meta?.language === "typescript") {
|
|
80
|
-
jobs.build.typescript.push(jobFromResult(result));
|
|
87
|
+
jobs.build.typescript.push(jobFromResult(result, rootDir));
|
|
81
88
|
}
|
|
82
89
|
}
|
|
83
90
|
|
|
84
|
-
if (task.task_name === "publish" && result.details.meta?.release?.npm) {
|
|
85
|
-
jobs.publish.npm.push(jobFromResult(result));
|
|
86
|
-
}
|
|
87
|
-
|
|
88
91
|
if (
|
|
89
|
-
|
|
90
|
-
result.details.meta?.
|
|
92
|
+
task.task_name === "publish" ||
|
|
93
|
+
result.details.meta?.is_publish_task
|
|
91
94
|
) {
|
|
92
|
-
|
|
95
|
+
if (result.details.meta?.language === "typescript") {
|
|
96
|
+
jobs.publish.npm.push(jobFromResult(result, rootDir));
|
|
97
|
+
} else if (result.details.meta?.language === "rust") {
|
|
98
|
+
jobs.publish.rust_github.push(jobFromResult(result, rootDir));
|
|
99
|
+
} else {
|
|
100
|
+
jobs.publish.generic.push(jobFromResult(result, rootDir));
|
|
101
|
+
}
|
|
93
102
|
}
|
|
94
103
|
}
|
|
95
104
|
|
|
96
105
|
return jobs;
|
|
97
106
|
}
|
|
98
107
|
|
|
99
|
-
function jobFromResult(result: TaskResult): Job {
|
|
108
|
+
function jobFromResult(result: TaskResult, rootDir: string): Job {
|
|
100
109
|
const workspaceArtifacts = [] as string[];
|
|
101
110
|
const projectArtifacts = [] as string[];
|
|
102
111
|
|
|
@@ -105,9 +114,11 @@ function jobFromResult(result: TaskResult): Job {
|
|
|
105
114
|
const fullPath = path.resolve(result.task.project_dir, file);
|
|
106
115
|
|
|
107
116
|
if (isPathInside(result.task.project_dir, fullPath)) {
|
|
108
|
-
projectArtifacts.push(
|
|
117
|
+
projectArtifacts.push(
|
|
118
|
+
path.relative(result.task.project_dir, fullPath),
|
|
119
|
+
);
|
|
109
120
|
} else {
|
|
110
|
-
workspaceArtifacts.push(fullPath);
|
|
121
|
+
workspaceArtifacts.push(path.relative(rootDir, fullPath));
|
|
111
122
|
}
|
|
112
123
|
}
|
|
113
124
|
}
|
|
@@ -127,7 +138,7 @@ function jobFromResult(result: TaskResult): Job {
|
|
|
127
138
|
files_count: workspaceArtifacts.length,
|
|
128
139
|
},
|
|
129
140
|
},
|
|
130
|
-
project_dir: result.task.project_dir,
|
|
141
|
+
project_dir: path.relative(rootDir, result.task.project_dir),
|
|
131
142
|
meta: result.details.meta ?? {},
|
|
132
143
|
};
|
|
133
144
|
}
|
package/src/schemas.ts
CHANGED
|
@@ -44,6 +44,18 @@ const MetaSchema = z.object({
|
|
|
44
44
|
.optional()
|
|
45
45
|
.describe("The targets to build."),
|
|
46
46
|
release: ReleaseSchema.optional(),
|
|
47
|
+
is_publish_task: z
|
|
48
|
+
.boolean()
|
|
49
|
+
.optional()
|
|
50
|
+
.describe("Whether this is a publish job."),
|
|
51
|
+
is_build_task: z
|
|
52
|
+
.boolean()
|
|
53
|
+
.optional()
|
|
54
|
+
.describe("Whether this is a build job."),
|
|
55
|
+
is_test_task: z
|
|
56
|
+
.boolean()
|
|
57
|
+
.optional()
|
|
58
|
+
.describe("Whether this is a test job."),
|
|
47
59
|
});
|
|
48
60
|
|
|
49
61
|
const DetailsSchema = z.object({
|
package/vite.config.ts
CHANGED
|
@@ -6,7 +6,12 @@ const baseConfig = createBaseConfig({
|
|
|
6
6
|
generateTypes: true,
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
-
const externalNodeDeps = [
|
|
9
|
+
const externalNodeDeps = [
|
|
10
|
+
"node:path",
|
|
11
|
+
"node:fs",
|
|
12
|
+
"node:fs/promises",
|
|
13
|
+
"node:process",
|
|
14
|
+
];
|
|
10
15
|
|
|
11
16
|
export default mergeConfig(baseConfig, {
|
|
12
17
|
build: {
|
package/dist/schemas-BCY99Jil.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const c=require("node:path"),e=require("zod");function h(s){const a={test:{rust:[],typescript:[]},build:{rust:[],typescript:[]},publish:{npm:[],rust_github:[]}};for(const t of s){if(t.status==="skipped")continue;const r=t.task;r.task_name==="test"&&(t.details.meta?.language==="rust"&&a.test.rust.push(i(t)),t.details.meta?.language==="typescript"&&a.test.typescript.push(i(t))),r.task_name==="build"&&(t.details.meta?.language==="rust"&&a.build.rust.push(i(t)),t.details.meta?.language==="typescript"&&a.build.typescript.push(i(t))),r.task_name==="publish"&&t.details.meta?.release?.npm&&a.publish.npm.push(i(t)),t.details.meta?.release?.github&&t.details.meta?.language==="rust"&&a.publish.rust_github.push(i(t))}return a}function i(s){const a=[],t=[];if(s.details.output_files&&s.details.output_files.length>0)for(const r of s.details.output_files){const n=c.resolve(s.task.project_dir,r);u(s.task.project_dir,n)?t.push(n):a.push(n)}return{task_name:s.task.task_name,project_name:s.task.project_name,artifacts:{project:{name:`project-${o(s.task.project_name)}__${o(s.task.task_name)}`,files:t,files_count:t.length},workspace:{name:`workspace-${o(s.task.project_name)}__${o(s.task.task_name)}`,files:a,files_count:a.length}},project_dir:s.task.project_dir,meta:s.details.meta??{}}}function u(s,a){const t=c.relative(s,a);return t&&!t.startsWith("..")&&!c.isAbsolute(t)}function o(s){let a=s.replace(/[/\\?%*:|"<> \x00-\x1f]/g,"_");return a=a.replace(/[.\s]+$/,""),/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i.test(a)&&(a+="_"),a||"unsaved_file"}const b=e.z.object({secs:e.z.number().int().nonnegative().describe("The number of whole seconds elapsed."),nanos:e.z.number().int().nonnegative().describe("The number of nanoseconds elapsed.")}),m=e.z.object({runner:e.z.string().describe("The runner to use for the target.")}),f=e.z.object({npm:e.z.boolean().optional().describe("Whether to publish to npm."),github:e.z.boolean().optional().describe("Whether to publish to github.")}),g=e.z.object({type:e.z.string().optional().describe("The type of project (e.g., library, service, application)."),language:e.z.string().optional().describe("The primary language of the project."),targets:e.z.record(e.z.string(),m).optional().describe("The targets to build."),release:f.optional()}),l=e.z.object({meta:g.optional(),output_files:e.z.array(e.z.string()).optional().describe("The output files generated.")}),d=e.z.object({task_name:e.z.string().describe("The short name of the task (e.g., 'test', 'build')."),task_command:e.z.string().describe("The command executed for the task."),project_name:e.z.string().describe("The name of the project."),project_dir:e.z.string().describe("The absolute directory path of the project."),full_task_name:e.z.string().describe("The fully qualified task name (e.g., 'omni_utils#test')."),dependencies:e.z.array(e.z.string()).describe("A list of dependent task names."),enabled:e.z.boolean().or(e.z.string()).optional().describe("Whether the task is enabled by configuration. Either a boolean or a tera template string that evaluates to a boolean."),interactive:e.z.boolean().describe("Whether the task is interactive."),persistent:e.z.boolean().describe("Whether the task is persistent.")}),k=e.z.object({status:e.z.literal("completed"),hash:e.z.string().describe("The task's content hash (Base64 encoded string). Used for caching."),task:d,exit_code:e.z.number().int().describe("The exit code of the executed command (typically 0 for success)."),elapsed:b.describe("The duration the task took to execute."),cache_hit:e.z.boolean().describe("Indicates if the result was pulled from cache."),details:l}),z=e.z.object({status:e.z.literal("errored"),task:d,error:e.z.string().describe("The error message."),details:l}),_=e.z.object({status:e.z.literal("skipped"),task:d,skip_reason:e.z.string().describe("The reason the task was skipped (e.g., 'disabled')."),details:l}),p=e.z.discriminatedUnion("status",[k,_,z]).describe("Schema for a single task execution result (completed or skipped)."),j=e.z.array(p).describe("An array of task execution results.");exports.TaskResultArraySchema=j;exports.TaskResultSchema=p;exports.createJobs=h;
|