drone-path 0.9.0 → 0.11.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/CHANGELOG.md +64 -0
- package/README.md +16 -14
- package/THIRD-PARTY-NOTICES.md +7 -7
- package/app/ipc.d.mts +43 -0
- package/app/ipc.mjs +216 -0
- package/app/main.mjs +10 -204
- package/dist/appsession.js +34 -75
- package/dist/appstate.js +24 -21
- package/dist/buildinfo.js +9 -16
- package/dist/cammeta-decode.js +237 -0
- package/dist/cammeta.js +8 -247
- package/dist/cli.js +40 -32
- package/dist/config.js +333 -173
- package/dist/configfile.js +20 -7
- package/dist/errors.js +30 -0
- package/dist/exec-tool.js +13 -0
- package/dist/exportjob.js +7 -7
- package/dist/{fftools.js → ffmpeg-tools.js} +5 -4
- package/dist/{ff.js → ffmpeg.js} +14 -29
- package/dist/frametime.js +32 -0
- package/dist/geo.js +1 -1
- package/dist/manual/build.js +5 -10
- package/dist/manual/cliref.js +4 -1
- package/dist/manual/reference.js +6 -11
- package/dist/{run.js → pipeline.js} +100 -143
- package/dist/png.js +1 -18
- package/dist/{proto.js → protobuf-wire.js} +5 -5
- package/dist/range.js +3 -3
- package/dist/{page.js → render-page.js} +2 -2
- package/dist/render.js +25 -115
- package/dist/renderer/boot.js +2 -2
- package/dist/renderer/dom.js +32 -10
- package/dist/renderer/scene.js +14 -6
- package/dist/restyle.js +1 -1
- package/dist/serve.js +1 -31
- package/dist/srt.js +2 -2
- package/dist/telemetry-json-schema.js +6 -11
- package/dist/telemetry-json.js +46 -27
- package/dist/telemetry-math.js +3 -2
- package/dist/{summary.js → telemetry-summary.js} +4 -4
- package/dist/telemetry.js +32 -18
- package/dist/tiles.js +30 -86
- package/dist/track-format.js +13 -0
- package/dist/track-geojson.js +44 -0
- package/dist/track-gpx.js +34 -0
- package/dist/track-kml.js +47 -0
- package/dist/track-kmz.js +68 -0
- package/dist/track-write.js +41 -0
- package/dist/track.js +79 -0
- package/package.json +13 -14
- package/dist/tracing.js +0 -184
- /package/dist/{renderer/leaflet.js → logging.js} +0 -0
- /package/dist/{inputs.js → recordings.js} +0 -0
package/dist/configfile.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { userDataDir } from './apppaths.js';
|
|
4
|
-
import { CONFIG_FILE_NAME, DEFAULT_CONFIG, normalizeDimensions, normalizeOverrides, validateRenderConfig, } from './config.js';
|
|
4
|
+
import { CONFIG_FILE_NAME, DEFAULT_CONFIG, assertOneTrackOutSpelling, normalizeDimensions, normalizeOverrides, trackOutSpellingOf, validateRenderConfig, } from './config.js';
|
|
5
|
+
import { errorMessage } from './errors.js';
|
|
5
6
|
export function defaultTileCache() {
|
|
6
7
|
const override = process.env['DRONEPATH_TILE_CACHE'];
|
|
7
8
|
if (override)
|
|
@@ -20,13 +21,13 @@ export function discoverConfigFile(startDir) {
|
|
|
20
21
|
dir = parent;
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
|
-
export function loadConfigFile(file) {
|
|
24
|
+
export function loadConfigFile(file, onDeprecated) {
|
|
24
25
|
let text;
|
|
25
26
|
try {
|
|
26
27
|
text = fs.readFileSync(file, 'utf8');
|
|
27
28
|
}
|
|
28
29
|
catch (e) {
|
|
29
|
-
throw new Error(`cannot read config file ${file}: ${e
|
|
30
|
+
throw new Error(`cannot read config file ${file}: ${errorMessage(e)}`, {
|
|
30
31
|
cause: e,
|
|
31
32
|
});
|
|
32
33
|
}
|
|
@@ -35,12 +36,16 @@ export function loadConfigFile(file) {
|
|
|
35
36
|
raw = JSON.parse(text);
|
|
36
37
|
}
|
|
37
38
|
catch (e) {
|
|
38
|
-
throw new Error(`config file is not valid JSON: ${file}: ${e
|
|
39
|
+
throw new Error(`config file is not valid JSON: ${file}: ${errorMessage(e)}`, { cause: e });
|
|
39
40
|
}
|
|
40
41
|
if (raw === null || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
41
42
|
throw new Error(`config file must contain a JSON object: ${file}`);
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
+
const input = raw;
|
|
45
|
+
return {
|
|
46
|
+
overrides: normalizeOverrides(input, file, onDeprecated),
|
|
47
|
+
trackOutSpelling: trackOutSpellingOf(input, file),
|
|
48
|
+
};
|
|
44
49
|
}
|
|
45
50
|
function mergeConfigLayers(fileCfg, cli) {
|
|
46
51
|
return {
|
|
@@ -62,8 +67,16 @@ export function resolveConfig(opts) {
|
|
|
62
67
|
const configPath = opts.configPath !== undefined && opts.configPath !== null
|
|
63
68
|
? path.resolve(cwd, opts.configPath)
|
|
64
69
|
: discoverConfigFile(cwd);
|
|
65
|
-
const
|
|
66
|
-
|
|
70
|
+
const fileLayer = configPath
|
|
71
|
+
? loadConfigFile(configPath, opts.onDeprecated)
|
|
72
|
+
: { overrides: {}, trackOutSpelling: null };
|
|
73
|
+
// The merged effective config may use only one spelling of the trackOut
|
|
74
|
+
// key - across origins, not just within one of them.
|
|
75
|
+
assertOneTrackOutSpelling([
|
|
76
|
+
{ origin: 'the config file', spelling: fileLayer.trackOutSpelling },
|
|
77
|
+
{ origin: 'the command line', spelling: opts.cliTrackOutSpelling ?? null },
|
|
78
|
+
]);
|
|
79
|
+
const merged = mergeConfigLayers(fileLayer.overrides, opts.cli ?? {});
|
|
67
80
|
validateRenderConfig(merged);
|
|
68
81
|
const normalized = {
|
|
69
82
|
...merged,
|
package/dist/errors.js
CHANGED
|
@@ -2,3 +2,33 @@ export const ERROR_PREFIX = '[drone-path] ERROR: ';
|
|
|
2
2
|
export function errorMessage(error) {
|
|
3
3
|
return error instanceof Error ? error.message : String(error);
|
|
4
4
|
}
|
|
5
|
+
// The backend-to-UI error protocol: ui/lib/errortext.ts builds its sentence
|
|
6
|
+
// patterns from these exact strings, so every producer spells its message
|
|
7
|
+
// through here — rewording one is greppable and cannot silently downgrade
|
|
8
|
+
// its UI sentence.
|
|
9
|
+
export const ERR_NO_RECORDING = 'no recording loaded';
|
|
10
|
+
export const ERR_EXPORT_ALREADY_RUNNING = 'an export is already running';
|
|
11
|
+
export const ERR_EXPORT_COULD_NOT_START = 'export could not start';
|
|
12
|
+
export const ERR_EXPORT_COULD_NOT_BE_CANCELED = 'export could not be canceled';
|
|
13
|
+
export const ERR_OUTPUT_OVERWRITES_SOURCE = 'the output must not overwrite the source recording';
|
|
14
|
+
export const ERR_OUTPUT_PATH_ABSOLUTE = 'output path must be absolute: ';
|
|
15
|
+
export const ERR_APP_BRIDGE_UNAVAILABLE = 'app bridge unavailable';
|
|
16
|
+
export const ERR_RENDER_CANCELED = 'render canceled';
|
|
17
|
+
export const ERR_NOT_READABLE_MP4 = 'not a readable .mp4 file: ';
|
|
18
|
+
export const ERR_NO_TELEMETRY = 'no telemetry found: ';
|
|
19
|
+
export const ERR_OUTPUT_VERIFICATION = 'output verification failed: ';
|
|
20
|
+
export const ERR_COULD_NOT_REPLACE = 'could not replace ';
|
|
21
|
+
export const ERR_RENDER_KEPT_AT = 'the finished render is at ';
|
|
22
|
+
export const ERR_NO_FRAME_RATE = 'could not determine the frame rate of the video';
|
|
23
|
+
export const ERR_UNKNOWN = 'unknown error';
|
|
24
|
+
// The mandated failure shell for generated-art tool entries (AGENTS.md): one
|
|
25
|
+
// ERROR line on stderr and process.exitCode = 1, never a mid-flow exit.
|
|
26
|
+
export async function runToolMain(fn) {
|
|
27
|
+
try {
|
|
28
|
+
await fn();
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
process.stderr.write(`${ERROR_PREFIX}${errorMessage(e)}\n`);
|
|
32
|
+
process.exitCode = 1;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { promisify } from 'node:util';
|
|
3
|
+
const execFileAsync = promisify(execFile);
|
|
4
|
+
// One child-process seam for src/: command, argv and buffer budget pass
|
|
5
|
+
// through untouched, and the spawned error propagates unwrapped so each
|
|
6
|
+
// caller keeps its own { cause } wording. Tool output is text (utf8).
|
|
7
|
+
export async function runTool(command, args, opts) {
|
|
8
|
+
const result = await execFileAsync(command, args, opts);
|
|
9
|
+
return {
|
|
10
|
+
stdout: String(result?.stdout ?? ''),
|
|
11
|
+
stderr: String(result?.stderr ?? ''),
|
|
12
|
+
};
|
|
13
|
+
}
|
package/dist/exportjob.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { errorMessage } from './errors.js';
|
|
3
|
+
import { ERR_COULD_NOT_REPLACE, ERR_EXPORT_ALREADY_RUNNING, ERR_OUTPUT_OVERWRITES_SOURCE, ERR_OUTPUT_PATH_ABSOLUTE, ERR_RENDER_KEPT_AT, errorMessage, } from './errors.js';
|
|
4
4
|
import { samePath, uniquePath } from './paths.js';
|
|
5
|
-
import { processRecording } from './
|
|
5
|
+
import { processRecording } from './pipeline.js';
|
|
6
6
|
const runViaPipeline = (deps) => (videoPath, request, log, workingPath, signal, onCapture) => processRecording(videoPath, request.config, log, workingPath, {
|
|
7
7
|
range: request.range ?? undefined,
|
|
8
8
|
signal,
|
|
@@ -28,8 +28,8 @@ function swapIntoPlace(working, outPath) {
|
|
|
28
28
|
fs.renameSync(working, outPath);
|
|
29
29
|
}
|
|
30
30
|
catch (e) {
|
|
31
|
-
throw new Error(
|
|
32
|
-
`(
|
|
31
|
+
throw new Error(`${ERR_COULD_NOT_REPLACE}${outPath}: ${errorMessage(e)} ` +
|
|
32
|
+
`(${ERR_RENDER_KEPT_AT}${working})`, { cause: e });
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
export function createExportRunner(options) {
|
|
@@ -59,12 +59,12 @@ export function createExportRunner(options) {
|
|
|
59
59
|
return {
|
|
60
60
|
start(videoPath, request) {
|
|
61
61
|
if (job)
|
|
62
|
-
throw new Error(
|
|
62
|
+
throw new Error(ERR_EXPORT_ALREADY_RUNNING);
|
|
63
63
|
if (!path.isAbsolute(request.outPath)) {
|
|
64
|
-
throw new Error(
|
|
64
|
+
throw new Error(`${ERR_OUTPUT_PATH_ABSOLUTE}${request.outPath}`);
|
|
65
65
|
}
|
|
66
66
|
if (samePath(request.outPath, videoPath)) {
|
|
67
|
-
throw new Error(
|
|
67
|
+
throw new Error(ERR_OUTPUT_OVERWRITES_SOURCE);
|
|
68
68
|
}
|
|
69
69
|
const controller = new AbortController();
|
|
70
70
|
job = { abort: () => controller.abort() };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
+
export const FFMPEG_TOOL_NAMES = ['ffmpeg', 'ffprobe'];
|
|
4
5
|
function isPathLike(value) {
|
|
5
6
|
return value.includes('/') || value.includes('\\') || path.isAbsolute(value);
|
|
6
7
|
}
|
|
7
|
-
export function
|
|
8
|
+
export function pickFfmpegTool(tool, override, candidates, exists) {
|
|
8
9
|
if (override) {
|
|
9
10
|
if (isPathLike(override) && !exists(override)) {
|
|
10
11
|
throw new Error(`invalid ${tool} override (CLI --${tool} or config key \`${tool}\`): no such file: ${override}`);
|
|
@@ -47,9 +48,9 @@ function realEnv() {
|
|
|
47
48
|
candidates: (tool) => [packagedCandidate(tool), devCandidate(tool)],
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
|
-
export function
|
|
51
|
+
export function resolveFfmpegTools(overrides, env = realEnv()) {
|
|
51
52
|
return {
|
|
52
|
-
ffmpeg:
|
|
53
|
-
ffprobe:
|
|
53
|
+
ffmpeg: pickFfmpegTool('ffmpeg', overrides.ffmpeg, env.candidates('ffmpeg'), env.exists),
|
|
54
|
+
ffprobe: pickFfmpegTool('ffprobe', overrides.ffprobe, env.candidates('ffprobe'), env.exists),
|
|
54
55
|
};
|
|
55
56
|
}
|
package/dist/{ff.js → ffmpeg.js}
RENAMED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { ERR_NO_FRAME_RATE } from './errors.js';
|
|
2
|
+
import { runTool } from './exec-tool.js';
|
|
3
|
+
import { framesForSeconds, parseFpsRate, parseRate } from './frametime.js';
|
|
4
|
+
import { FFMPEG_TOOL_NAMES } from './ffmpeg-tools.js';
|
|
4
5
|
const INSTALL_HINT = 'point --ffmpeg/--ffprobe at your executables, or install ffmpeg (includes ' +
|
|
5
6
|
'ffprobe) and make sure both are on PATH, e.g. "winget install Gyan.FFmpeg" ' +
|
|
6
7
|
'(Windows), "brew install ffmpeg" (macOS) or "apt install ffmpeg" (Linux)';
|
|
7
8
|
const FFPROBE_MAX_BUFFER = 64 * 1024 * 1024;
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
const TOOL_VERSION_MAX_BUFFER = 1 << 20;
|
|
10
|
+
const RATE_PROBE_MAX_BUFFER = 1 << 20;
|
|
11
|
+
export async function requireFfmpegTools(tools) {
|
|
12
|
+
for (const tool of FFMPEG_TOOL_NAMES) {
|
|
10
13
|
const command = tools[tool];
|
|
11
14
|
try {
|
|
12
|
-
await
|
|
15
|
+
await runTool(command, ['-version'], { maxBuffer: TOOL_VERSION_MAX_BUFFER });
|
|
13
16
|
}
|
|
14
17
|
catch (e) {
|
|
15
18
|
throw new Error(`${tool} is required but could not be run (${command}) - ${INSTALL_HINT}`, { cause: e });
|
|
@@ -17,27 +20,9 @@ export async function requireTools(tools) {
|
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
export async function ffprobeJson(tools, videoPath, args) {
|
|
20
|
-
const { stdout } = await
|
|
23
|
+
const { stdout } = await runTool(tools.ffprobe, ['-v', 'error', ...args, videoPath], { maxBuffer: FFPROBE_MAX_BUFFER });
|
|
21
24
|
return JSON.parse(stdout || '{}');
|
|
22
25
|
}
|
|
23
|
-
function parseRate(str) {
|
|
24
|
-
const [num, den] = str.split('/').map(Number);
|
|
25
|
-
return Number.isFinite(num) ? { num, den } : null;
|
|
26
|
-
}
|
|
27
|
-
function parseFpsRate(str) {
|
|
28
|
-
const rate = str ? parseRate(str) : null;
|
|
29
|
-
if (!rate || !Number.isFinite(rate.den) || rate.den === 0 || rate.num === 0) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
const { num } = rate;
|
|
33
|
-
const den = rate.den;
|
|
34
|
-
return {
|
|
35
|
-
num,
|
|
36
|
-
den,
|
|
37
|
-
value: num / den,
|
|
38
|
-
str: den === 1 ? String(num) : `${num}/${den}`,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
26
|
function parseCount(text) {
|
|
42
27
|
return Number.parseInt(text ?? '', 10);
|
|
43
28
|
}
|
|
@@ -56,11 +41,11 @@ export async function probeVideo(tools, videoPath, log = () => { }) {
|
|
|
56
41
|
const fps = parseFpsRate(stream.r_frame_rate) ??
|
|
57
42
|
parseFpsRate(stream.avg_frame_rate);
|
|
58
43
|
if (!fps)
|
|
59
|
-
throw new Error(
|
|
44
|
+
throw new Error(ERR_NO_FRAME_RATE);
|
|
60
45
|
const durationSec = Number.parseFloat(format.duration ?? '');
|
|
61
46
|
let frames = parseCount(stream.nb_frames);
|
|
62
47
|
if (!Number.isFinite(frames) || frames <= 0) {
|
|
63
|
-
frames =
|
|
48
|
+
frames = framesForSeconds(fps.value, durationSec);
|
|
64
49
|
log('warning: nb_frames missing, using duration x fps');
|
|
65
50
|
}
|
|
66
51
|
if (!Number.isFinite(frames) || frames <= 0) {
|
|
@@ -94,11 +79,11 @@ export async function verifyOutput(tools, outPath, frames, fpsValue) {
|
|
|
94
79
|
};
|
|
95
80
|
}
|
|
96
81
|
async function probeRateFrames(ffprobe, file) {
|
|
97
|
-
const { stdout } = await
|
|
82
|
+
const { stdout } = await runTool(ffprobe, [
|
|
98
83
|
'-v', 'error', '-select_streams', 'v:0',
|
|
99
84
|
'-show_entries', 'stream=avg_frame_rate,nb_frames',
|
|
100
85
|
'-of', 'csv=p=0', '--', file,
|
|
101
|
-
], { maxBuffer:
|
|
86
|
+
], { maxBuffer: RATE_PROBE_MAX_BUFFER });
|
|
102
87
|
return stdout.trim();
|
|
103
88
|
}
|
|
104
89
|
export async function outputMatchesSource(tools, src, out) {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export function parseRate(str) {
|
|
2
|
+
const [num, den] = str.split('/').map(Number);
|
|
3
|
+
return Number.isFinite(num) ? { num, den } : null;
|
|
4
|
+
}
|
|
5
|
+
export function parseFpsRate(str) {
|
|
6
|
+
const rate = str ? parseRate(str) : null;
|
|
7
|
+
if (!rate || !Number.isFinite(rate.den) || rate.den === 0 || rate.num === 0) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
const { num } = rate;
|
|
11
|
+
const den = rate.den;
|
|
12
|
+
return {
|
|
13
|
+
num,
|
|
14
|
+
den,
|
|
15
|
+
value: num / den,
|
|
16
|
+
str: den === 1 ? String(num) : `${num}/${den}`,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function formatFps(rate) {
|
|
20
|
+
const ratio = /^(\d+)\/(\d+)$/.exec(rate);
|
|
21
|
+
const num = ratio ? Number(ratio[1]) : Number(rate);
|
|
22
|
+
const den = ratio ? Number(ratio[2]) : 1;
|
|
23
|
+
if (!(num > 0) || !(den > 0))
|
|
24
|
+
return rate;
|
|
25
|
+
return `${Math.round((num / den) * 100) / 100} fps`;
|
|
26
|
+
}
|
|
27
|
+
export function timeAt(frame, fps) {
|
|
28
|
+
return fps > 0 ? frame / fps : 0;
|
|
29
|
+
}
|
|
30
|
+
export function framesForSeconds(fps, seconds) {
|
|
31
|
+
return Math.round(fps * seconds);
|
|
32
|
+
}
|
package/dist/geo.js
CHANGED
|
@@ -11,7 +11,7 @@ export function isGpsFix(lat, lon) {
|
|
|
11
11
|
lon < 180 &&
|
|
12
12
|
!(lat === 0 && lon === 0));
|
|
13
13
|
}
|
|
14
|
-
export function
|
|
14
|
+
export function gpsFixOrNull(lat, lon) {
|
|
15
15
|
return lat !== null && lon !== null && isGpsFix(lat, lon) ? { lat, lon } : null;
|
|
16
16
|
}
|
|
17
17
|
export function haversineM(a, b) {
|
package/dist/manual/build.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { runToolMain } from '../errors.js';
|
|
4
5
|
import { compileMarkdown } from './markdown.js';
|
|
5
6
|
import { bundleModuleSource } from './module.js';
|
|
6
7
|
import { navFromIndex } from './nav.js';
|
|
@@ -57,16 +58,10 @@ export function buildManual(paths) {
|
|
|
57
58
|
return { pages: compiled.length, images: referenced };
|
|
58
59
|
}
|
|
59
60
|
function main() {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
process.stderr.write(`[drone-path] manual: ${result.pages} page(s), ${result.images.length} image(s)\n`);
|
|
64
|
-
}
|
|
65
|
-
catch (e) {
|
|
66
|
-
process.stderr.write(`[drone-path] ERROR: ${e.message}\n`);
|
|
67
|
-
process.exitCode = 1;
|
|
68
|
-
}
|
|
61
|
+
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
|
|
62
|
+
const result = buildManual(defaultManualPaths(root));
|
|
63
|
+
process.stderr.write(`[drone-path] manual: ${result.pages} page(s), ${result.images.length} image(s)\n`);
|
|
69
64
|
}
|
|
70
65
|
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
71
|
-
main
|
|
66
|
+
void runToolMain(main);
|
|
72
67
|
}
|
package/dist/manual/cliref.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CONFIG_FILE_OPTION, CONFIG_OPTIONS, cliDefaultOf } from '../config.js';
|
|
1
|
+
import { CONFIG_FILE_OPTION, CONFIG_OPTIONS, TELEMETRY_JSON_ALIAS, cliDefaultOf, } from '../config.js';
|
|
2
2
|
function defaultCell(key) {
|
|
3
3
|
const value = cliDefaultOf(key);
|
|
4
4
|
if (typeof value === 'boolean')
|
|
@@ -12,6 +12,9 @@ function describe(row) {
|
|
|
12
12
|
export function generateCliReference() {
|
|
13
13
|
const rows = CONFIG_OPTIONS.map((row) => `| \`${row.key}\` | \`${row.cli.flags}\` | ${defaultCell(row.key)} | ${describe(row)} |`);
|
|
14
14
|
rows.push(`| — | \`${CONFIG_FILE_OPTION.flags}\` | — | ${CONFIG_FILE_OPTION.help} |`);
|
|
15
|
+
rows.push(`| \`${TELEMETRY_JSON_ALIAS.inputKey}\` | \`${TELEMETRY_JSON_ALIAS.flags}\` | — | ` +
|
|
16
|
+
`deprecated alias of --track-out <file>.json: same output, warns on use, ` +
|
|
17
|
+
`removed in a future version |`);
|
|
15
18
|
return [
|
|
16
19
|
'<!-- Generated from the option vocabulary in src/config.ts by "npm run docs:reference". Do not edit by hand. -->',
|
|
17
20
|
'',
|
package/dist/manual/reference.js
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { runToolMain } from '../errors.js';
|
|
4
5
|
import { generateCliReference } from './cliref.js';
|
|
5
6
|
function writeReference(file) {
|
|
6
7
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
7
8
|
fs.writeFileSync(file, generateCliReference());
|
|
8
9
|
}
|
|
9
10
|
function main() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
process.stderr.write(`[drone-path] manual: wrote ${path.relative(root, file)}\n`);
|
|
15
|
-
}
|
|
16
|
-
catch (e) {
|
|
17
|
-
process.stderr.write(`[drone-path] ERROR: ${e.message}\n`);
|
|
18
|
-
process.exitCode = 1;
|
|
19
|
-
}
|
|
11
|
+
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
|
|
12
|
+
const file = path.join(root, 'docs', 'user', 'cli-reference.md');
|
|
13
|
+
writeReference(file);
|
|
14
|
+
process.stderr.write(`[drone-path] manual: wrote ${path.relative(root, file)}\n`);
|
|
20
15
|
}
|
|
21
16
|
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
22
|
-
main
|
|
17
|
+
void runToolMain(main);
|
|
23
18
|
}
|