@openfn/cli 0.0.27 → 0.0.28
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/README.md +13 -1
- package/dist/index.js +9 -2
- package/dist/process/runner.js +148 -62
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -50,7 +50,9 @@ If output.json and state.json are not passed, the CLI will look for them next to
|
|
|
50
50
|
|
|
51
51
|
The CLI can auto-install language adaptors to its own privately maintained repo. Run `openfn repo list` to see where the repo is, and what's in it. Set the `OPENFN_REPO_DIR` env var to specify the repo folder. When autoinstalling, the CLI will check to see if a matching version is found in the repo.
|
|
52
52
|
|
|
53
|
-
You can specify adaptors with a shorthand (`http`) or use the full package name (`@openfn/language-http`). You can add a specific version like `http@2.0.0`. You can pass a path to a locally installed adaptor like `http=/repo/openfn/adaptors/my-http-build`.
|
|
53
|
+
You can specify adaptors with a shorthand (`http`) or use the full package name (`@openfn/language-http`). You can add a specific version like `http@2.0.0`. You can pass a path to a locally installed adaptor like `http=/repo/openfn/adaptors/my-http-build`.
|
|
54
|
+
|
|
55
|
+
If you have the adaptors monorepo set up on your machine, you can also run from that. Pass the `-m` flag to load from the monorepo. Set the monorepo location by setting the OPENFN_ADAPTORS_REPO env var to a valid path. This runs from the built package, so remember to build an adaptor before running!
|
|
54
56
|
|
|
55
57
|
You can pass `--log info` to get more feedback about what's happening, or `--log debug` for more details than you could ever use.
|
|
56
58
|
|
|
@@ -91,6 +93,16 @@ If something unexpected happens during a command, your first step should be to r
|
|
|
91
93
|
|
|
92
94
|
`debug` level logging is highly verbose and aims to tell you everything that's going on under-the hood. This is aimed mostly at CLI/runtime developers and can be very useful for debugging problems.
|
|
93
95
|
|
|
96
|
+
## Structred/JSON logging
|
|
97
|
+
|
|
98
|
+
By default all logs will be printed as human-readable strings.
|
|
99
|
+
|
|
100
|
+
For a more structured output, you can emit logs as JSON objects with `level`, `name` and `message` properties:
|
|
101
|
+
```
|
|
102
|
+
{ level: 'info', name: 'CLI', message: ['Loaded adaptor'] }
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Pass `--log-json` to the CLI to do this. You can also set the OPENFN_LOG_JSON env var (and use `--no-log-json` to disable).
|
|
94
106
|
|
|
95
107
|
## Compilation
|
|
96
108
|
|
package/dist/index.js
CHANGED
|
@@ -95,6 +95,10 @@ var executeCommand = {
|
|
|
95
95
|
return applyExecuteOptions(yargs2).option("immutable", {
|
|
96
96
|
boolean: true,
|
|
97
97
|
description: "Treat state as immutable"
|
|
98
|
+
}).option("use-adaptors-monorepo", {
|
|
99
|
+
alias: "m",
|
|
100
|
+
boolean: true,
|
|
101
|
+
description: "Load adaptors from the monorepo. The OPENFN_ADAPTORS_REPO env var must be set to a valid path"
|
|
98
102
|
}).option("autoinstall", {
|
|
99
103
|
alias: "i",
|
|
100
104
|
boolean: true,
|
|
@@ -116,7 +120,7 @@ var executeCommand = {
|
|
|
116
120
|
description: "Skip compilation"
|
|
117
121
|
}).option("no-strict-output", {
|
|
118
122
|
boolean: true,
|
|
119
|
-
description: "Allow properties other than data to be returned in the output
|
|
123
|
+
description: "Allow properties other than data to be returned in the output"
|
|
120
124
|
}).example(
|
|
121
125
|
"openfn foo/job.js",
|
|
122
126
|
"Reads foo/job.js, looks for state and output in foo"
|
|
@@ -141,7 +145,7 @@ var applyExecuteOptions = (yargs2) => yargs2.positional("path", {
|
|
|
141
145
|
description: "Print output to stdout (instead of a file)"
|
|
142
146
|
}).option("adaptors", {
|
|
143
147
|
alias: ["a", "adaptor"],
|
|
144
|
-
description: "A language adaptor to use for the job. Short-form names are allowed. Can include an explicit path to a local adaptor build
|
|
148
|
+
description: "A language adaptor to use for the job. Short-form names are allowed. Can include an explicit path to a local adaptor build",
|
|
145
149
|
array: true
|
|
146
150
|
}).option("no-expand", {
|
|
147
151
|
description: "Don attempt to auto-expand adaptor shorthand names",
|
|
@@ -209,6 +213,9 @@ var cmd = yargs(hideBin(process.argv)).command(command_default).command(command_
|
|
|
209
213
|
alias: ["l"],
|
|
210
214
|
description: "Set the default log level to none, default, info or debug",
|
|
211
215
|
array: true
|
|
216
|
+
}).option("log-json", {
|
|
217
|
+
description: "Output all logs as JSON objects",
|
|
218
|
+
boolean: true
|
|
212
219
|
}).example("openfn execute help", "Show documentation for the execute command").example(
|
|
213
220
|
"openfn docs @openfn/language-common each",
|
|
214
221
|
"Get more help on the common.each command"
|
package/dist/process/runner.js
CHANGED
|
@@ -12,8 +12,11 @@ var namespaces = {
|
|
|
12
12
|
[JOB]: "JOB"
|
|
13
13
|
};
|
|
14
14
|
var createLogger = (name = "", options) => {
|
|
15
|
-
const logOptions = options.log || {};
|
|
15
|
+
const logOptions = options.log || { json: true };
|
|
16
16
|
let level = logOptions[name] || logOptions.default || "default";
|
|
17
|
+
if (options.logJson) {
|
|
18
|
+
logOptions.json = true;
|
|
19
|
+
}
|
|
17
20
|
return actualCreateLogger(namespaces[name] || name, {
|
|
18
21
|
level,
|
|
19
22
|
...logOptions
|
|
@@ -78,23 +81,27 @@ function ensureOpts(basePath = ".", opts) {
|
|
|
78
81
|
adaptors: opts.adaptors || [],
|
|
79
82
|
autoinstall: opts.autoinstall,
|
|
80
83
|
command: opts.command,
|
|
84
|
+
expand: opts.expand !== false,
|
|
81
85
|
force: opts.force || false,
|
|
82
|
-
|
|
86
|
+
immutable: opts.immutable || false,
|
|
87
|
+
logJson: typeof opts.logJson == "boolean" ? opts.logJson : Boolean(process.env.OPENFN_LOG_JSON),
|
|
83
88
|
noCompile: Boolean(opts.noCompile),
|
|
84
|
-
expand: opts.expand !== false,
|
|
85
|
-
outputStdout: Boolean(opts.outputStdout),
|
|
86
89
|
operation: opts.operation,
|
|
90
|
+
outputStdout: Boolean(opts.outputStdout),
|
|
87
91
|
packages: opts.packages,
|
|
88
|
-
|
|
89
|
-
|
|
92
|
+
repoDir: opts.repoDir || process.env.OPENFN_REPO_DIR || DEFAULT_REPO_DIR,
|
|
93
|
+
skipAdaptorValidation: opts.skipAdaptorValidation ?? false,
|
|
90
94
|
specifier: opts.specifier,
|
|
95
|
+
stateStdin: opts.stateStdin,
|
|
91
96
|
strictOutput: opts.strictOutput ?? true,
|
|
92
|
-
|
|
93
|
-
immutable: opts.immutable || false
|
|
97
|
+
timeout: opts.timeout
|
|
94
98
|
};
|
|
95
99
|
const set = (key, value) => {
|
|
96
100
|
newOpts[key] = opts.hasOwnProperty(key) ? opts[key] : value;
|
|
97
101
|
};
|
|
102
|
+
if (opts.useAdaptorsMonorepo) {
|
|
103
|
+
newOpts.monorepoPath = process.env.OPENFN_ADAPTORS_REPO || "ERR";
|
|
104
|
+
}
|
|
98
105
|
let baseDir = basePath;
|
|
99
106
|
if (basePath.endsWith(".js")) {
|
|
100
107
|
baseDir = path.dirname(basePath);
|
|
@@ -164,11 +171,11 @@ var execute_default = (code, state, opts) => {
|
|
|
164
171
|
function parseAdaptors(opts) {
|
|
165
172
|
const adaptors = {};
|
|
166
173
|
opts.adaptors.reduce((obj, exp) => {
|
|
167
|
-
const [module,
|
|
174
|
+
const [module, path4] = exp.split("=");
|
|
168
175
|
const { name, version } = getNameAndVersion(module);
|
|
169
176
|
const info = {};
|
|
170
|
-
if (
|
|
171
|
-
info.path =
|
|
177
|
+
if (path4) {
|
|
178
|
+
info.path = path4;
|
|
172
179
|
}
|
|
173
180
|
if (version) {
|
|
174
181
|
info.version = version;
|
|
@@ -210,10 +217,10 @@ var stripVersionSpecifier = (specifier) => {
|
|
|
210
217
|
return specifier;
|
|
211
218
|
};
|
|
212
219
|
var resolveSpecifierPath = async (pattern, repoDir, log) => {
|
|
213
|
-
const [specifier,
|
|
214
|
-
if (
|
|
215
|
-
log.debug(`Resolved ${specifier} to path: ${
|
|
216
|
-
return
|
|
220
|
+
const [specifier, path4] = pattern.split("=");
|
|
221
|
+
if (path4) {
|
|
222
|
+
log.debug(`Resolved ${specifier} to path: ${path4}`);
|
|
223
|
+
return path4;
|
|
217
224
|
}
|
|
218
225
|
const repoPath = await getModulePath(specifier, repoDir, log);
|
|
219
226
|
if (repoPath) {
|
|
@@ -230,15 +237,15 @@ var loadTransformOptions = async (opts, log) => {
|
|
|
230
237
|
const [pattern] = opts.adaptors;
|
|
231
238
|
const [specifier] = pattern.split("=");
|
|
232
239
|
log.debug(`Attempting to preload typedefs for ${specifier}`);
|
|
233
|
-
const
|
|
234
|
-
if (
|
|
240
|
+
const path4 = await resolveSpecifierPath(pattern, opts.repoDir, log);
|
|
241
|
+
if (path4) {
|
|
235
242
|
try {
|
|
236
|
-
exports = await preloadAdaptorExports(
|
|
243
|
+
exports = await preloadAdaptorExports(path4);
|
|
237
244
|
if (exports) {
|
|
238
245
|
log.info(`Loaded typedefs for ${specifier}`);
|
|
239
246
|
}
|
|
240
247
|
} catch (e) {
|
|
241
|
-
log.error(`Failed to load adaptor typedefs from path ${
|
|
248
|
+
log.error(`Failed to load adaptor typedefs from path ${path4}`);
|
|
242
249
|
log.error(e);
|
|
243
250
|
}
|
|
244
251
|
}
|
|
@@ -390,7 +397,7 @@ var validate_adaptors_default = validateAdaptors;
|
|
|
390
397
|
|
|
391
398
|
// src/execute/handler.ts
|
|
392
399
|
var getAutoinstallTargets = (options) => {
|
|
393
|
-
if (options.
|
|
400
|
+
if (options.adaptors) {
|
|
394
401
|
return options.adaptors?.filter((a) => !/=/.test(a));
|
|
395
402
|
}
|
|
396
403
|
return [];
|
|
@@ -398,11 +405,17 @@ var getAutoinstallTargets = (options) => {
|
|
|
398
405
|
var executeHandler = async (options, logger) => {
|
|
399
406
|
const start = new Date().getTime();
|
|
400
407
|
await validate_adaptors_default(options, logger);
|
|
401
|
-
const
|
|
402
|
-
if (
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
408
|
+
const { repoDir, monorepoPath, autoinstall } = options;
|
|
409
|
+
if (autoinstall) {
|
|
410
|
+
if (monorepoPath) {
|
|
411
|
+
logger.warn("Skipping auto-install as monorepo is being used");
|
|
412
|
+
} else {
|
|
413
|
+
const autoInstallTargets = getAutoinstallTargets(options);
|
|
414
|
+
if (autoInstallTargets.length) {
|
|
415
|
+
logger.info("Auto-installing language adaptors");
|
|
416
|
+
await install({ packages: autoInstallTargets, repoDir }, logger);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
406
419
|
}
|
|
407
420
|
const state = await load_state_default(options, logger);
|
|
408
421
|
const code = await compile_default(options, logger);
|
|
@@ -466,20 +479,20 @@ var RETRY_COUNT = 20;
|
|
|
466
479
|
var TIMEOUT_MS = 1e3 * 60;
|
|
467
480
|
var actualDocGen = (specifier) => describePackage(specifier, {});
|
|
468
481
|
var ensurePath = (filePath) => mkdirSync(path2.dirname(filePath), { recursive: true });
|
|
469
|
-
var generatePlaceholder = (
|
|
470
|
-
writeFileSync(
|
|
482
|
+
var generatePlaceholder = (path4) => {
|
|
483
|
+
writeFileSync(path4, `{ "loading": true, "timestamp": ${Date.now()}}`);
|
|
471
484
|
};
|
|
472
485
|
var finish = (logger, resultPath) => {
|
|
473
486
|
logger.success("Done! Docs can be found at:\n");
|
|
474
487
|
logger.print(` ${path2.resolve(resultPath)}`);
|
|
475
488
|
};
|
|
476
|
-
var generateDocs = async (specifier,
|
|
489
|
+
var generateDocs = async (specifier, path4, docgen, logger) => {
|
|
477
490
|
const result = await docgen(specifier);
|
|
478
|
-
await writeFile3(
|
|
479
|
-
finish(logger,
|
|
480
|
-
return
|
|
491
|
+
await writeFile3(path4, JSON.stringify(result, null, 2));
|
|
492
|
+
finish(logger, path4);
|
|
493
|
+
return path4;
|
|
481
494
|
};
|
|
482
|
-
var waitForDocs = async (docs,
|
|
495
|
+
var waitForDocs = async (docs, path4, logger, retryDuration = RETRY_DURATION) => {
|
|
483
496
|
try {
|
|
484
497
|
if (docs.hasOwnProperty("loading")) {
|
|
485
498
|
logger.info("Docs are being loaded by another process. Waiting.");
|
|
@@ -491,19 +504,19 @@ var waitForDocs = async (docs, path3, logger, retryDuration = RETRY_DURATION) =>
|
|
|
491
504
|
clearInterval(i);
|
|
492
505
|
reject(new Error("Timed out waiting for docs to load"));
|
|
493
506
|
}
|
|
494
|
-
const updated = JSON.parse(readFileSync(
|
|
507
|
+
const updated = JSON.parse(readFileSync(path4, "utf8"));
|
|
495
508
|
if (!updated.hasOwnProperty("loading")) {
|
|
496
509
|
logger.info("Docs found!");
|
|
497
510
|
clearInterval(i);
|
|
498
|
-
resolve(
|
|
511
|
+
resolve(path4);
|
|
499
512
|
}
|
|
500
513
|
count++;
|
|
501
514
|
}, retryDuration);
|
|
502
515
|
});
|
|
503
516
|
} else {
|
|
504
|
-
logger.info(`Docs already written to cache at ${
|
|
505
|
-
finish(logger,
|
|
506
|
-
return
|
|
517
|
+
logger.info(`Docs already written to cache at ${path4}`);
|
|
518
|
+
finish(logger, path4);
|
|
519
|
+
return path4;
|
|
507
520
|
}
|
|
508
521
|
} catch (e) {
|
|
509
522
|
logger.error("Existing doc JSON corrupt. Aborting");
|
|
@@ -520,28 +533,28 @@ var docgenHandler = (options, logger, docgen = actualDocGen, retryDuration = RET
|
|
|
520
533
|
process.exit(9);
|
|
521
534
|
}
|
|
522
535
|
logger.success(`Generating docs for ${specifier}`);
|
|
523
|
-
const
|
|
524
|
-
ensurePath(
|
|
536
|
+
const path4 = `${repoDir}/docs/${specifier}.json`;
|
|
537
|
+
ensurePath(path4);
|
|
525
538
|
const handleError = () => {
|
|
526
539
|
logger.info("Removing placeholder");
|
|
527
|
-
rmSync(
|
|
540
|
+
rmSync(path4);
|
|
528
541
|
};
|
|
529
542
|
try {
|
|
530
|
-
const existing = readFileSync(
|
|
543
|
+
const existing = readFileSync(path4, "utf8");
|
|
531
544
|
const json = JSON.parse(existing);
|
|
532
545
|
if (json && json.timeout && Date.now() - json.timeout >= TIMEOUT_MS) {
|
|
533
546
|
logger.info(`Expired placeholder found. Removing.`);
|
|
534
|
-
rmSync(
|
|
547
|
+
rmSync(path4);
|
|
535
548
|
throw new Error("TIMEOUT");
|
|
536
549
|
}
|
|
537
|
-
return waitForDocs(json,
|
|
550
|
+
return waitForDocs(json, path4, logger, retryDuration);
|
|
538
551
|
} catch (e) {
|
|
539
552
|
if (e.message !== "TIMEOUT") {
|
|
540
|
-
logger.info(`Docs JSON not found at ${
|
|
553
|
+
logger.info(`Docs JSON not found at ${path4}`);
|
|
541
554
|
}
|
|
542
555
|
logger.debug("Generating placeholder");
|
|
543
|
-
generatePlaceholder(
|
|
544
|
-
return generateDocs(specifier,
|
|
556
|
+
generatePlaceholder(path4);
|
|
557
|
+
return generateDocs(specifier, path4, docgen, logger).catch((e2) => {
|
|
545
558
|
logger.error("Error generating documentation");
|
|
546
559
|
logger.error(e2);
|
|
547
560
|
handleError();
|
|
@@ -589,15 +602,15 @@ var docsHandler = async (options, logger) => {
|
|
|
589
602
|
logger.success(`Showing docs for ${adaptorName} v${version}`);
|
|
590
603
|
}
|
|
591
604
|
logger.info("Generating/loading documentation...");
|
|
592
|
-
const
|
|
605
|
+
const path4 = await handler_default4(
|
|
593
606
|
{
|
|
594
607
|
specifier: `${name}@${version}`,
|
|
595
608
|
repoDir
|
|
596
609
|
},
|
|
597
610
|
createNullLogger()
|
|
598
611
|
);
|
|
599
|
-
if (
|
|
600
|
-
const source = await readFile(
|
|
612
|
+
if (path4) {
|
|
613
|
+
const source = await readFile(path4, "utf8");
|
|
601
614
|
const data = JSON.parse(source);
|
|
602
615
|
let desc;
|
|
603
616
|
if (operation) {
|
|
@@ -618,9 +631,50 @@ var docsHandler = async (options, logger) => {
|
|
|
618
631
|
};
|
|
619
632
|
var handler_default5 = docsHandler;
|
|
620
633
|
|
|
634
|
+
// src/util/use-adaptors-repo.ts
|
|
635
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
636
|
+
import path3 from "node:path";
|
|
637
|
+
import assert from "node:assert";
|
|
638
|
+
import { getNameAndVersion as getNameAndVersion4 } from "@openfn/runtime";
|
|
639
|
+
var validateMonoRepo = async (repoPath, log) => {
|
|
640
|
+
try {
|
|
641
|
+
const raw = await readFile2(`${repoPath}/package.json`, "utf8");
|
|
642
|
+
const pkg = JSON.parse(raw);
|
|
643
|
+
assert(pkg.name === "adaptors");
|
|
644
|
+
} catch (e) {
|
|
645
|
+
log.error(`ERROR: Adaptors Monorepo not found at ${repoPath}`);
|
|
646
|
+
process.exit(9);
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
var updatePath = (adaptor, repoPath, log) => {
|
|
650
|
+
if (adaptor.match("=")) {
|
|
651
|
+
return adaptor;
|
|
652
|
+
}
|
|
653
|
+
const { name, version } = getNameAndVersion4(adaptor);
|
|
654
|
+
if (version) {
|
|
655
|
+
log.warn(
|
|
656
|
+
`Warning: Ignoring version specifier on ${adaptor} as loading from the adaptors monorepo`
|
|
657
|
+
);
|
|
658
|
+
}
|
|
659
|
+
const shortName = name.replace("@openfn/language-", "");
|
|
660
|
+
const abspath = path3.resolve(repoPath, "packages", shortName);
|
|
661
|
+
return `${name}=${abspath}`;
|
|
662
|
+
};
|
|
663
|
+
var useAdaptorsRepo = async (adaptors, repoPath, log) => {
|
|
664
|
+
await validateMonoRepo(repoPath, log);
|
|
665
|
+
log.success(`Loading adaptors from monorepo at ${repoPath}`);
|
|
666
|
+
const updatedAdaptors = adaptors.map((a) => {
|
|
667
|
+
const p = updatePath(a, repoPath, log);
|
|
668
|
+
log.info(`Mapped adaptor ${a} to monorepo: ${p.split("=")[1]}`);
|
|
669
|
+
return p;
|
|
670
|
+
});
|
|
671
|
+
return updatedAdaptors;
|
|
672
|
+
};
|
|
673
|
+
var use_adaptors_repo_default = useAdaptorsRepo;
|
|
674
|
+
|
|
621
675
|
// src/util/print-versions.ts
|
|
622
676
|
import { mainSymbols } from "figures";
|
|
623
|
-
import { getNameAndVersion as
|
|
677
|
+
import { getNameAndVersion as getNameAndVersion5 } from "@openfn/runtime";
|
|
624
678
|
var { triangleRightSmall: t } = mainSymbols;
|
|
625
679
|
var printVersions = async (logger, options = {}) => {
|
|
626
680
|
const prefix = (str) => ` ${t} ${str.padEnd(options.adaptors ? 16 : 8, " ")}`;
|
|
@@ -629,20 +683,39 @@ var printVersions = async (logger, options = {}) => {
|
|
|
629
683
|
const compilerVersion = dependencies["@openfn/compiler"];
|
|
630
684
|
const runtimeVersion = dependencies["@openfn/runtime"];
|
|
631
685
|
const { adaptors } = options;
|
|
632
|
-
let
|
|
686
|
+
let adaptorName, adaptorVersion;
|
|
633
687
|
if (adaptors && adaptors.length === 1) {
|
|
634
688
|
const [a] = adaptors;
|
|
635
|
-
const { name, version: version2 } =
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
689
|
+
const { name, version: version2 } = getNameAndVersion5(a);
|
|
690
|
+
adaptorName = name.replace(/^@openfn\/language-/, "");
|
|
691
|
+
adaptorVersion = version2 || "latest";
|
|
692
|
+
}
|
|
693
|
+
let output;
|
|
694
|
+
if (options.logJson) {
|
|
695
|
+
output = {
|
|
696
|
+
versions: {
|
|
697
|
+
"node.js": process.version.substring(1),
|
|
698
|
+
cli: version,
|
|
699
|
+
runtime: runtimeVersion,
|
|
700
|
+
compiler: compilerVersion
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
if (adaptorName) {
|
|
704
|
+
output.versions.adaptor = {
|
|
705
|
+
name: adaptorName,
|
|
706
|
+
version: adaptorVersion
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
} else {
|
|
710
|
+
const adaptorVersionString = adaptorName ? `
|
|
711
|
+
${prefix("adaptor " + adaptorName)}${adaptorVersion}` : "";
|
|
712
|
+
output = `Versions:
|
|
642
713
|
${prefix("node.js")}${process.version.substring(1)}
|
|
643
714
|
${prefix("cli")}${version}
|
|
644
715
|
${prefix("runtime")}${runtimeVersion}
|
|
645
|
-
${prefix("compiler")}${compilerVersion}${adaptorVersionString}
|
|
716
|
+
${prefix("compiler")}${compilerVersion}${adaptorVersionString}`;
|
|
717
|
+
}
|
|
718
|
+
logger.info(output);
|
|
646
719
|
};
|
|
647
720
|
var print_versions_default = printVersions;
|
|
648
721
|
|
|
@@ -657,7 +730,7 @@ var handlers = {
|
|
|
657
730
|
["repo-install"]: install,
|
|
658
731
|
["repo-pwd"]: pwd,
|
|
659
732
|
["repo-list"]: list,
|
|
660
|
-
version: async (
|
|
733
|
+
version: async (opts, logger) => print_versions_default(logger, opts)
|
|
661
734
|
};
|
|
662
735
|
var parse = async (basePath, options, log) => {
|
|
663
736
|
const opts = ensureOpts(basePath, options);
|
|
@@ -665,7 +738,20 @@ var parse = async (basePath, options, log) => {
|
|
|
665
738
|
if (opts.command === "execute" || opts.command === "test") {
|
|
666
739
|
await print_versions_default(logger, opts);
|
|
667
740
|
}
|
|
668
|
-
if (opts.
|
|
741
|
+
if (opts.monorepoPath) {
|
|
742
|
+
if (opts.monorepoPath === "ERR") {
|
|
743
|
+
logger.error(
|
|
744
|
+
"ERROR: --use-adaptors-monorepo was passed, but OPENFN_ADAPTORS_REPO env var is undefined"
|
|
745
|
+
);
|
|
746
|
+
logger.error("Set OPENFN_ADAPTORS_REPO to a path pointing to the repo");
|
|
747
|
+
process.exit(9);
|
|
748
|
+
}
|
|
749
|
+
opts.adaptors = await use_adaptors_repo_default(
|
|
750
|
+
opts.adaptors,
|
|
751
|
+
opts.monorepoPath,
|
|
752
|
+
logger
|
|
753
|
+
);
|
|
754
|
+
} else if (opts.adaptors && opts.expand) {
|
|
669
755
|
opts.adaptors = expand_adaptors_default(opts.adaptors, logger);
|
|
670
756
|
}
|
|
671
757
|
if (/^(test|version)$/.test(opts.command) && !opts.repoDir) {
|
|
@@ -681,7 +767,7 @@ var parse = async (basePath, options, log) => {
|
|
|
681
767
|
assertPath(basePath);
|
|
682
768
|
}
|
|
683
769
|
if (!handler) {
|
|
684
|
-
logger.error(`
|
|
770
|
+
logger.error(`Unrecognised command: ${options.command}`);
|
|
685
771
|
process.exit(1);
|
|
686
772
|
}
|
|
687
773
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"description": "CLI devtools for the openfn toolchain.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18",
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
"typescript": "^4.7.4"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
+
"@openfn/compiler": "0.0.24",
|
|
40
|
+
"@openfn/describe-package": "0.0.14",
|
|
41
|
+
"@openfn/logger": "0.0.9",
|
|
42
|
+
"@openfn/runtime": "0.0.18",
|
|
39
43
|
"fast-safe-stringify": "^2.1.1",
|
|
40
44
|
"figures": "^5.0.0",
|
|
41
45
|
"rimraf": "^3.0.2",
|
|
42
46
|
"treeify": "^1.1.0",
|
|
43
|
-
"yargs": "^17.5.1"
|
|
44
|
-
"@openfn/compiler": "0.0.23",
|
|
45
|
-
"@openfn/describe-package": "0.0.14",
|
|
46
|
-
"@openfn/logger": "0.0.8",
|
|
47
|
-
"@openfn/runtime": "0.0.17"
|
|
47
|
+
"yargs": "^17.5.1"
|
|
48
48
|
},
|
|
49
49
|
"files": [
|
|
50
50
|
"dist",
|