@telorun/cli 0.74.0 → 0.75.0
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/bundle/manifest-text.d.ts +28 -0
- package/dist/bundle/manifest-text.d.ts.map +1 -0
- package/dist/bundle/manifest-text.js +92 -0
- package/dist/bundle/manifest-text.js.map +1 -0
- package/dist/bundle/module-payload.d.ts +157 -0
- package/dist/bundle/module-payload.d.ts.map +1 -0
- package/dist/bundle/module-payload.js +273 -0
- package/dist/bundle/module-payload.js.map +1 -0
- package/dist/bundle/payload-drift.d.ts +14 -8
- package/dist/bundle/payload-drift.d.ts.map +1 -1
- package/dist/bundle/payload-drift.js +23 -3
- package/dist/bundle/payload-drift.js.map +1 -1
- package/dist/bundle/select-files.d.ts +16 -4
- package/dist/bundle/select-files.d.ts.map +1 -1
- package/dist/bundle/select-files.js +25 -7
- package/dist/bundle/select-files.js.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/publish.d.ts +7 -18
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +60 -250
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/release.d.ts +16 -0
- package/dist/commands/release.d.ts.map +1 -0
- package/dist/commands/release.js +376 -0
- package/dist/commands/release.js.map +1 -0
- package/dist/output.d.ts +40 -0
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +86 -2
- package/dist/output.js.map +1 -1
- package/dist/release/apply-plan.d.ts +38 -0
- package/dist/release/apply-plan.d.ts.map +1 -0
- package/dist/release/apply-plan.js +103 -0
- package/dist/release/apply-plan.js.map +1 -0
- package/dist/release/evidence.d.ts +56 -0
- package/dist/release/evidence.d.ts.map +1 -0
- package/dist/release/evidence.js +245 -0
- package/dist/release/evidence.js.map +1 -0
- package/dist/release/ledger-store.d.ts +27 -0
- package/dist/release/ledger-store.d.ts.map +1 -0
- package/dist/release/ledger-store.js +62 -0
- package/dist/release/ledger-store.js.map +1 -0
- package/dist/release/render.d.ts +17 -0
- package/dist/release/render.d.ts.map +1 -0
- package/dist/release/render.js +71 -0
- package/dist/release/render.js.map +1 -0
- package/dist/release/workspace.d.ts +58 -0
- package/dist/release/workspace.d.ts.map +1 -0
- package/dist/release/workspace.js +138 -0
- package/dist/release/workspace.js.map +1 -0
- package/package.json +6 -6
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rendering a release plan for a person.
|
|
3
|
+
*
|
|
4
|
+
* The output's job is to answer "why is this module in the list", because that
|
|
5
|
+
* is the question every previous version of this system could not answer. A
|
|
6
|
+
* payload that moved through an inlined sibling, through an import whose version
|
|
7
|
+
* is about to change, or through nothing anyone can name are three different
|
|
8
|
+
* situations, and only the last one is a judgement call the reader has to make.
|
|
9
|
+
*/
|
|
10
|
+
/** How many inlined files to name before summarizing. One is the common case
|
|
11
|
+
* and reads well; twenty would bury the module list. */
|
|
12
|
+
const MAX_NAMED_FILES = 2;
|
|
13
|
+
export function describeReason(reason) {
|
|
14
|
+
switch (reason.kind) {
|
|
15
|
+
case "declared":
|
|
16
|
+
return "declared";
|
|
17
|
+
case "imports":
|
|
18
|
+
return `imports ${reason.module}`;
|
|
19
|
+
case "inlines": {
|
|
20
|
+
const shown = reason.files.slice(0, MAX_NAMED_FILES).join(", ");
|
|
21
|
+
const rest = reason.files.length - MAX_NAMED_FILES;
|
|
22
|
+
return `inlines ${shown}${rest > 0 ? ` and ${rest} more` : ""}`;
|
|
23
|
+
}
|
|
24
|
+
case "unattributed":
|
|
25
|
+
return "payload changed, unattributed";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The reason column: kinds in a fixed order so two runs read the same, a
|
|
30
|
+
* declared fragment first because it is the one a human wrote, and repeats
|
|
31
|
+
* collapsed — two fragments for one module are two changelog lines but one
|
|
32
|
+
* reason, and printing `declared; declared` says nothing the count does not.
|
|
33
|
+
*/
|
|
34
|
+
function describeReasons(module) {
|
|
35
|
+
const order = ["declared", "inlines", "imports", "unattributed"];
|
|
36
|
+
const sorted = [...module.reasons].sort((a, b) => order.indexOf(a.kind) - order.indexOf(b.kind));
|
|
37
|
+
return [...new Set(sorted.map(describeReason))].join("; ");
|
|
38
|
+
}
|
|
39
|
+
export function renderPlan(plan, log) {
|
|
40
|
+
if (plan.modules.length === 0)
|
|
41
|
+
return ["Nothing to release — every module matches the ledger."];
|
|
42
|
+
const keyWidth = Math.max(...plan.modules.map((module) => module.key.length));
|
|
43
|
+
const moveWidth = Math.max(...plan.modules.map((module) => `${module.from} → ${module.to}`.length));
|
|
44
|
+
return plan.modules.map((module) => {
|
|
45
|
+
const move = `${module.from} → ${module.to}`;
|
|
46
|
+
return (`${module.key.padEnd(keyWidth)} ${move.padEnd(moveWidth)} ` +
|
|
47
|
+
`${log.dim(`${module.level} — ${describeReasons(module)}`)}`);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export function renderDiagnostics(plan, log) {
|
|
51
|
+
return plan.diagnostics.map((diagnostic) => `${diagnostic.severity === "error" ? log.err.error("error") : log.err.warn("warning")} ` +
|
|
52
|
+
`${diagnostic.message}`);
|
|
53
|
+
}
|
|
54
|
+
/** The machine surface: the same plan, without the column alignment. */
|
|
55
|
+
export function planPayload(plan) {
|
|
56
|
+
return {
|
|
57
|
+
modules: plan.modules.map((module) => ({
|
|
58
|
+
key: module.key,
|
|
59
|
+
name: module.name,
|
|
60
|
+
from: module.from,
|
|
61
|
+
to: module.to,
|
|
62
|
+
level: module.level,
|
|
63
|
+
reasons: module.reasons.map(describeReason),
|
|
64
|
+
changedLayers: module.changed.map((change) => change.layer),
|
|
65
|
+
entries: module.entries.map((entry) => ({ kind: entry.kind, body: entry.body })),
|
|
66
|
+
})),
|
|
67
|
+
fragments: plan.fragments,
|
|
68
|
+
diagnostics: plan.diagnostics,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 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AAC,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI;QACzF,GAAG,UAAU,CAAC,OAAO,EAAE,CAC1B,CAAC;AACJ,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,WAAW,CAAC,IAAiB;IAC3C,OAAO;QACL,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACrC,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,EAAE,EAAE,MAAM,CAAC,EAAE;YACb,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;YAC3C,aAAa,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC;YAC3D,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;SACjF,CAAC,CAAC;QACH,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,WAAW,EAAE,IAAI,CAAC,WAAW;KAC9B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finding the workspace, and the modules inside it.
|
|
3
|
+
*
|
|
4
|
+
* The Node half of `telo-workspace.yaml`: walking up from the cwd to find the
|
|
5
|
+
* marker, and filtering its named subtrees down to actual modules. Parsing the
|
|
6
|
+
* marker is the analyzer's (`release/workspace-config.ts`), so the editor reads
|
|
7
|
+
* the same file the same way.
|
|
8
|
+
*
|
|
9
|
+
* **Discovery, not registration.** Nothing lists the modules: `modules/sql` is a
|
|
10
|
+
* module because `modules/sql/telo.yaml` carries a `metadata.version`, and that
|
|
11
|
+
* one field is both the declaration and the current value. Changie's generated
|
|
12
|
+
* `projects:` list was the alternative, and it needed a CI check to catch itself
|
|
13
|
+
* drifting.
|
|
14
|
+
*
|
|
15
|
+
* The rule is deliberately the module DOC's version rather than any manifest in
|
|
16
|
+
* the directory — the looser reading admits `apps/hub/test-suite-e2e.yaml`'s
|
|
17
|
+
* `version: 1.0.0` as a second module — and a listed directory holding no
|
|
18
|
+
* manifest simply is not one, which is how `apps/hub-web` and `apps/telo-editor`
|
|
19
|
+
* fall out.
|
|
20
|
+
*/
|
|
21
|
+
import { type ArtifactKind, type ModuleKey, type WorkspaceConfig } from "@telorun/analyzer";
|
|
22
|
+
export interface DiscoveredModule {
|
|
23
|
+
readonly key: ModuleKey;
|
|
24
|
+
/** Absolute path of the module's directory. */
|
|
25
|
+
readonly dir: string;
|
|
26
|
+
/** Absolute path of its `telo.yaml`. */
|
|
27
|
+
readonly manifestPath: string;
|
|
28
|
+
/** `metadata.name`, for display. */
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly version: string;
|
|
31
|
+
readonly artifactKind: ArtifactKind;
|
|
32
|
+
}
|
|
33
|
+
export interface Workspace {
|
|
34
|
+
/** Absolute path of the directory holding `telo-workspace.yaml` — the anchor
|
|
35
|
+
* every key, ledger entry and fragment path is relative to. */
|
|
36
|
+
readonly root: string;
|
|
37
|
+
readonly config: WorkspaceConfig;
|
|
38
|
+
readonly modules: readonly DiscoveredModule[];
|
|
39
|
+
}
|
|
40
|
+
export declare class WorkspaceNotFoundError extends Error {
|
|
41
|
+
}
|
|
42
|
+
/** Walk up from `from` looking for the marker. Returns the directory holding
|
|
43
|
+
* it, or `undefined` — the file is optional, and only `telo release` requires
|
|
44
|
+
* one. */
|
|
45
|
+
export declare function findWorkspaceRoot(from: string): string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Load the workspace rooted at or above `from`.
|
|
48
|
+
*
|
|
49
|
+
* Absence is an actionable error naming the file to create, never a guess at the
|
|
50
|
+
* layout: guessing is what the retired scripts did by hardcoding this repo's
|
|
51
|
+
* `modules/*` and `apps/*` globs into a feature meant to serve any module repo.
|
|
52
|
+
*/
|
|
53
|
+
export declare function loadWorkspace(from?: string): Workspace;
|
|
54
|
+
/** Look a module up by key, with a message that lists what does exist — the
|
|
55
|
+
* common mistake is a bare name (`sql`) where a path (`modules/sql`) is
|
|
56
|
+
* wanted. */
|
|
57
|
+
export declare function requireModule(workspace: Workspace, key: string): DiscoveredModule;
|
|
58
|
+
//# sourceMappingURL=workspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/release/workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAML,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;AAM3B,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,+CAA+C;IAC/C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,oCAAoC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;CACrC;AAED,MAAM,WAAW,SAAS;IACxB;oEACgE;IAChE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;CAC/C;AAED,qBAAa,sBAAuB,SAAQ,KAAK;CAAG;AAEpD;;WAEW;AACX,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQlE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,GAAE,MAAsB,GAAG,SAAS,CAYrE;AAoED;;cAEc;AACd,wBAAgB,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAejF"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finding the workspace, and the modules inside it.
|
|
3
|
+
*
|
|
4
|
+
* The Node half of `telo-workspace.yaml`: walking up from the cwd to find the
|
|
5
|
+
* marker, and filtering its named subtrees down to actual modules. Parsing the
|
|
6
|
+
* marker is the analyzer's (`release/workspace-config.ts`), so the editor reads
|
|
7
|
+
* the same file the same way.
|
|
8
|
+
*
|
|
9
|
+
* **Discovery, not registration.** Nothing lists the modules: `modules/sql` is a
|
|
10
|
+
* module because `modules/sql/telo.yaml` carries a `metadata.version`, and that
|
|
11
|
+
* one field is both the declaration and the current value. Changie's generated
|
|
12
|
+
* `projects:` list was the alternative, and it needed a CI check to catch itself
|
|
13
|
+
* drifting.
|
|
14
|
+
*
|
|
15
|
+
* The rule is deliberately the module DOC's version rather than any manifest in
|
|
16
|
+
* the directory — the looser reading admits `apps/hub/test-suite-e2e.yaml`'s
|
|
17
|
+
* `version: 1.0.0` as a second module — and a listed directory holding no
|
|
18
|
+
* manifest simply is not one, which is how `apps/hub-web` and `apps/telo-editor`
|
|
19
|
+
* fall out.
|
|
20
|
+
*/
|
|
21
|
+
import { DEFAULT_MANIFEST_FILENAME, WORKSPACE_FILENAME, normalizeModuleKey, parseWorkspaceConfig, readManifestVersion, } from "@telorun/analyzer";
|
|
22
|
+
import { GLOB_PRUNE_DIRS, selectByPatterns } from "@telorun/glob";
|
|
23
|
+
import * as fs from "node:fs";
|
|
24
|
+
import * as path from "node:path";
|
|
25
|
+
import { parseAllDocuments } from "yaml";
|
|
26
|
+
export class WorkspaceNotFoundError extends Error {
|
|
27
|
+
}
|
|
28
|
+
/** Walk up from `from` looking for the marker. Returns the directory holding
|
|
29
|
+
* it, or `undefined` — the file is optional, and only `telo release` requires
|
|
30
|
+
* one. */
|
|
31
|
+
export function findWorkspaceRoot(from) {
|
|
32
|
+
let dir = path.resolve(from);
|
|
33
|
+
for (;;) {
|
|
34
|
+
if (fs.existsSync(path.join(dir, WORKSPACE_FILENAME)))
|
|
35
|
+
return dir;
|
|
36
|
+
const parent = path.dirname(dir);
|
|
37
|
+
if (parent === dir)
|
|
38
|
+
return undefined;
|
|
39
|
+
dir = parent;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Load the workspace rooted at or above `from`.
|
|
44
|
+
*
|
|
45
|
+
* Absence is an actionable error naming the file to create, never a guess at the
|
|
46
|
+
* layout: guessing is what the retired scripts did by hardcoding this repo's
|
|
47
|
+
* `modules/*` and `apps/*` globs into a feature meant to serve any module repo.
|
|
48
|
+
*/
|
|
49
|
+
export function loadWorkspace(from = process.cwd()) {
|
|
50
|
+
const root = findWorkspaceRoot(from);
|
|
51
|
+
if (!root) {
|
|
52
|
+
throw new WorkspaceNotFoundError(`No ${WORKSPACE_FILENAME} found in '${path.resolve(from)}' or any parent directory. ` +
|
|
53
|
+
`\`telo release\` works over a declared workspace — create one at the repo root naming ` +
|
|
54
|
+
`the subtrees that hold modules:\n\n modules:\n - modules/*\n - apps/*\n`);
|
|
55
|
+
}
|
|
56
|
+
const file = path.join(root, WORKSPACE_FILENAME);
|
|
57
|
+
const config = parseWorkspaceConfig(fs.readFileSync(file, "utf8"), WORKSPACE_FILENAME);
|
|
58
|
+
return { root, config, modules: discoverModules(root, config) };
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Every directory under a named subtree that holds a versioned module manifest.
|
|
62
|
+
*
|
|
63
|
+
* Candidates come from a pruned walk for `telo.yaml` rather than from expanding
|
|
64
|
+
* the patterns against the filesystem, because the patterns are gitignore-style
|
|
65
|
+
* and a prefix is not always derivable from one. The prune set is the shared one
|
|
66
|
+
* (`node_modules`, `.git`, `.telo`), which is what keeps the hundreds of cached
|
|
67
|
+
* manifests under `**\/.telo/manifests/` out — each of those is a published
|
|
68
|
+
* module's `telo.yaml` and would otherwise read as a module of this workspace.
|
|
69
|
+
*/
|
|
70
|
+
function discoverModules(root, config) {
|
|
71
|
+
const candidates = findManifestDirs(root);
|
|
72
|
+
const matched = new Set(selectByPatterns(candidates, [...config.modules], { applyDefaultIgnore: false }));
|
|
73
|
+
const modules = [];
|
|
74
|
+
for (const key of [...matched].sort()) {
|
|
75
|
+
const dir = path.join(root, key);
|
|
76
|
+
const manifestPath = path.join(dir, DEFAULT_MANIFEST_FILENAME);
|
|
77
|
+
const text = fs.readFileSync(manifestPath, "utf8");
|
|
78
|
+
const version = readManifestVersion(text);
|
|
79
|
+
if (!version)
|
|
80
|
+
continue;
|
|
81
|
+
modules.push({
|
|
82
|
+
key: normalizeModuleKey(key),
|
|
83
|
+
dir,
|
|
84
|
+
manifestPath,
|
|
85
|
+
name: readModuleName(text) ?? path.basename(dir),
|
|
86
|
+
version,
|
|
87
|
+
artifactKind: fs.existsSync(path.join(dir, "Dockerfile")) ? "image" : "registry",
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return modules;
|
|
91
|
+
}
|
|
92
|
+
/** Workspace-relative directories holding a `telo.yaml`, pruned. */
|
|
93
|
+
function findManifestDirs(root) {
|
|
94
|
+
const found = [];
|
|
95
|
+
const walk = (dir) => {
|
|
96
|
+
let entries;
|
|
97
|
+
try {
|
|
98
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (entries.some((entry) => entry.isFile() && entry.name === DEFAULT_MANIFEST_FILENAME)) {
|
|
104
|
+
const rel = path.relative(root, dir).split(path.sep).join("/");
|
|
105
|
+
if (rel !== "")
|
|
106
|
+
found.push(rel);
|
|
107
|
+
}
|
|
108
|
+
for (const entry of entries) {
|
|
109
|
+
if (!entry.isDirectory() || GLOB_PRUNE_DIRS.has(entry.name))
|
|
110
|
+
continue;
|
|
111
|
+
walk(path.join(dir, entry.name));
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
walk(root);
|
|
115
|
+
return found;
|
|
116
|
+
}
|
|
117
|
+
function readModuleName(text) {
|
|
118
|
+
const first = parseAllDocuments(text)[0]?.toJSON();
|
|
119
|
+
const name = first?.metadata?.name;
|
|
120
|
+
return typeof name === "string" ? name : undefined;
|
|
121
|
+
}
|
|
122
|
+
/** Look a module up by key, with a message that lists what does exist — the
|
|
123
|
+
* common mistake is a bare name (`sql`) where a path (`modules/sql`) is
|
|
124
|
+
* wanted. */
|
|
125
|
+
export function requireModule(workspace, key) {
|
|
126
|
+
const normalized = normalizeModuleKey(key);
|
|
127
|
+
const found = workspace.modules.find((module) => module.key === normalized);
|
|
128
|
+
if (found)
|
|
129
|
+
return found;
|
|
130
|
+
const suffixMatches = workspace.modules.filter((module) => module.key.endsWith(`/${normalized}`));
|
|
131
|
+
throw new Error(`'${key}' is not a module in this workspace.` +
|
|
132
|
+
(suffixMatches.length > 0
|
|
133
|
+
? ` A module is named by its workspace-relative path — did you mean ${suffixMatches
|
|
134
|
+
.map((module) => `'${module.key}'`)
|
|
135
|
+
.join(" or ")}?`
|
|
136
|
+
: ` Modules are discovered under ${workspace.config.modules.join(", ")}.`));
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/release/workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EACL,yBAAyB,EACzB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,GAIpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAA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,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AACrD,CAAC;AAED;;cAEc;AACd,MAAM,UAAU,aAAa,CAAC,SAAoB,EAAE,GAAW;IAC7D,MAAM,UAAU,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAC3C,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,KAAK,UAAU,CAAC,CAAC;IAC5E,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC;IACxB,MAAM,aAAa,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,CAC5C,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,UAAU,EAAE,CAAC,CAClD,CAAC;IACF,MAAM,IAAI,KAAK,CACb,IAAI,GAAG,sCAAsC;QAC3C,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC;YACvB,CAAC,CAAC,oEAAoE,aAAa;iBAC9E,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,GAAG,CAAC;iBAClC,IAAI,CAAC,MAAM,CAAC,GAAG;YACpB,CAAC,CAAC,iCAAiC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAC/E,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telorun/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.75.0",
|
|
4
4
|
"description": "Telo CLI - Command-line interface for the Telo runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"telo",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"dist"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@telorun/analyzer": "0.
|
|
37
|
+
"@telorun/analyzer": "0.60.0",
|
|
38
38
|
"@telorun/glob": "0.2.0",
|
|
39
|
-
"@telorun/ide-support": "0.13.
|
|
40
|
-
"@telorun/kernel": "0.
|
|
41
|
-
"@telorun/sdk": "0.
|
|
42
|
-
"@telorun/templating": "0.
|
|
39
|
+
"@telorun/ide-support": "0.13.2",
|
|
40
|
+
"@telorun/kernel": "0.75.0",
|
|
41
|
+
"@telorun/sdk": "0.75.0",
|
|
42
|
+
"@telorun/templating": "0.16.0",
|
|
43
43
|
"dotenv": "^17.4.0",
|
|
44
44
|
"packageurl-js": "^2.0.1",
|
|
45
45
|
"semver": "^7.7.3",
|