@openfn/cli 1.17.1 → 1.18.1
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/index.js +4 -1
- package/dist/process/runner.js +25 -20
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1135,7 +1135,10 @@ var options11 = [
|
|
|
1135
1135
|
projectPath,
|
|
1136
1136
|
removeUnmapped,
|
|
1137
1137
|
workflowMappings,
|
|
1138
|
-
log
|
|
1138
|
+
log,
|
|
1139
|
+
override(force, {
|
|
1140
|
+
description: "Force a merge even when workflows are incompatible"
|
|
1141
|
+
})
|
|
1139
1142
|
];
|
|
1140
1143
|
var mergeCommand = {
|
|
1141
1144
|
command: "merge [project-name]",
|
package/dist/process/runner.js
CHANGED
|
@@ -2106,36 +2106,39 @@ import { confirm } from "@inquirer/prompts";
|
|
|
2106
2106
|
import path9 from "path";
|
|
2107
2107
|
import fs4 from "node:fs/promises";
|
|
2108
2108
|
import { getProject } from "@openfn/deploy";
|
|
2109
|
-
import Project3 from "@openfn/project";
|
|
2109
|
+
import Project3, { Workspace } from "@openfn/project";
|
|
2110
2110
|
import { rimraf } from "rimraf";
|
|
2111
2111
|
async function handler2(options, logger) {
|
|
2112
2112
|
const { OPENFN_API_KEY, OPENFN_ENDPOINT } = process.env;
|
|
2113
|
-
const
|
|
2113
|
+
const cfg = {
|
|
2114
2114
|
apiKey: options.apiKey,
|
|
2115
2115
|
endpoint: options.endpoint
|
|
2116
2116
|
};
|
|
2117
2117
|
if (!options.apiKey && OPENFN_API_KEY) {
|
|
2118
2118
|
logger.info("Using OPENFN_API_KEY environment variable");
|
|
2119
|
-
|
|
2119
|
+
cfg.apiKey = OPENFN_API_KEY;
|
|
2120
2120
|
}
|
|
2121
2121
|
if (!options.endpoint && OPENFN_ENDPOINT) {
|
|
2122
2122
|
logger.info("Using OPENFN_ENDPOINT environment variable");
|
|
2123
|
-
|
|
2123
|
+
cfg.endpoint = OPENFN_ENDPOINT;
|
|
2124
2124
|
}
|
|
2125
|
-
const
|
|
2125
|
+
const outputRoot = path9.resolve(options.path || ".");
|
|
2126
|
+
const workspace = new Workspace(outputRoot);
|
|
2127
|
+
const config = workspace.getConfig();
|
|
2128
|
+
const { data } = await getProject(cfg, options.projectId);
|
|
2126
2129
|
const name = options.env || "project";
|
|
2127
2130
|
const project = Project3.from("state", data, {
|
|
2128
|
-
|
|
2131
|
+
config,
|
|
2132
|
+
endpoint: cfg.endpoint,
|
|
2129
2133
|
env: name,
|
|
2130
2134
|
fetched_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2131
2135
|
});
|
|
2132
|
-
const outputRoot = path9.resolve(options.path || ".");
|
|
2133
2136
|
const projectFileName = project.getIdentifier();
|
|
2134
2137
|
await fs4.mkdir(`${outputRoot}/.projects`, { recursive: true });
|
|
2135
2138
|
let stateOutputPath = `${outputRoot}/.projects/${projectFileName}`;
|
|
2136
2139
|
const workflowsRoot = path9.resolve(
|
|
2137
2140
|
outputRoot,
|
|
2138
|
-
project.
|
|
2141
|
+
project.config.dirs.workflows ?? "workflows"
|
|
2139
2142
|
);
|
|
2140
2143
|
if (!await confirm({
|
|
2141
2144
|
message: `This will remove all files in ${path9.resolve(
|
|
@@ -2149,7 +2152,7 @@ async function handler2(options, logger) {
|
|
|
2149
2152
|
}
|
|
2150
2153
|
await rimraf(workflowsRoot);
|
|
2151
2154
|
const state = project?.serialize("state");
|
|
2152
|
-
if (project.
|
|
2155
|
+
if (project.config.formats.project === "yaml") {
|
|
2153
2156
|
await fs4.writeFile(`${stateOutputPath}.yaml`, state);
|
|
2154
2157
|
} else {
|
|
2155
2158
|
await fs4.writeFile(
|
|
@@ -2271,11 +2274,11 @@ function pickFirst2(...args) {
|
|
|
2271
2274
|
var handler_default10 = pullHandler;
|
|
2272
2275
|
|
|
2273
2276
|
// src/projects/handler.ts
|
|
2274
|
-
import { Workspace } from "@openfn/project";
|
|
2277
|
+
import { Workspace as Workspace2 } from "@openfn/project";
|
|
2275
2278
|
import path11 from "path";
|
|
2276
2279
|
var projectsHandler = async (options, logger) => {
|
|
2277
2280
|
const commandPath = path11.resolve(options.projectPath ?? ".");
|
|
2278
|
-
const workspace = new
|
|
2281
|
+
const workspace = new Workspace2(commandPath);
|
|
2279
2282
|
if (!workspace.valid) {
|
|
2280
2283
|
logger.error("Command was run in an invalid openfn workspace");
|
|
2281
2284
|
return;
|
|
@@ -2295,11 +2298,11 @@ ${project.workflows.map((w) => " - " + w.name).join("\n")}`;
|
|
|
2295
2298
|
var handler_default11 = projectsHandler;
|
|
2296
2299
|
|
|
2297
2300
|
// src/version/handler.ts
|
|
2298
|
-
import { Workspace as
|
|
2301
|
+
import { Workspace as Workspace3 } from "@openfn/project";
|
|
2299
2302
|
import path12 from "path";
|
|
2300
2303
|
var workflowVersionHandler = async (options, logger) => {
|
|
2301
2304
|
const commandPath = path12.resolve(options.projectPath ?? ".");
|
|
2302
|
-
const workspace = new
|
|
2305
|
+
const workspace = new Workspace3(commandPath);
|
|
2303
2306
|
if (!workspace.valid) {
|
|
2304
2307
|
logger.error("Command was run in an invalid openfn workspace");
|
|
2305
2308
|
return;
|
|
@@ -2335,18 +2338,18 @@ ${final}`);
|
|
|
2335
2338
|
var handler_default12 = workflowVersionHandler;
|
|
2336
2339
|
|
|
2337
2340
|
// src/checkout/handler.ts
|
|
2338
|
-
import Project5, { Workspace as
|
|
2341
|
+
import Project5, { Workspace as Workspace4 } from "@openfn/project";
|
|
2339
2342
|
import path13 from "path";
|
|
2340
2343
|
import fs6 from "fs";
|
|
2341
2344
|
import { rimraf as rimraf2 } from "rimraf";
|
|
2342
2345
|
var checkoutHandler = async (options, logger) => {
|
|
2343
2346
|
const commandPath = path13.resolve(options.projectPath ?? ".");
|
|
2344
|
-
const workspace = new
|
|
2347
|
+
const workspace = new Workspace4(commandPath);
|
|
2345
2348
|
if (!workspace.valid) {
|
|
2346
2349
|
logger.error("Command was run in an invalid openfn workspace");
|
|
2347
2350
|
return;
|
|
2348
2351
|
}
|
|
2349
|
-
const { project: _, ...config } = workspace.getConfig()
|
|
2352
|
+
const { project: _, ...config } = workspace.getConfig();
|
|
2350
2353
|
let switchProject;
|
|
2351
2354
|
if (/\.(yaml|json)$/.test(options.projectName)) {
|
|
2352
2355
|
const filePath = path13.join(commandPath, options.projectName);
|
|
@@ -2380,12 +2383,12 @@ var checkoutHandler = async (options, logger) => {
|
|
|
2380
2383
|
var handler_default13 = checkoutHandler;
|
|
2381
2384
|
|
|
2382
2385
|
// src/merge/handler.ts
|
|
2383
|
-
import Project6, { Workspace as
|
|
2386
|
+
import Project6, { Workspace as Workspace5 } from "@openfn/project";
|
|
2384
2387
|
import path14 from "path";
|
|
2385
2388
|
import { promises as fs7 } from "fs";
|
|
2386
2389
|
var mergeHandler = async (options, logger) => {
|
|
2387
2390
|
const commandPath = path14.resolve(options.projectPath ?? ".");
|
|
2388
|
-
const workspace = new
|
|
2391
|
+
const workspace = new Workspace5(commandPath);
|
|
2389
2392
|
if (!workspace.valid) {
|
|
2390
2393
|
logger.error("Command was run in an invalid openfn workspace");
|
|
2391
2394
|
return;
|
|
@@ -2422,7 +2425,8 @@ var mergeHandler = async (options, logger) => {
|
|
|
2422
2425
|
}
|
|
2423
2426
|
const final = Project6.merge(sourceProject, targetProject, {
|
|
2424
2427
|
removeUnmapped: options.removeUnmapped,
|
|
2425
|
-
workflowMappings: options.workflowMappings
|
|
2428
|
+
workflowMappings: options.workflowMappings,
|
|
2429
|
+
force: options.force
|
|
2426
2430
|
});
|
|
2427
2431
|
const yaml = final.serialize("state", { format: "yaml" });
|
|
2428
2432
|
await fs7.writeFile(finalPath, yaml);
|
|
@@ -2430,7 +2434,8 @@ var mergeHandler = async (options, logger) => {
|
|
|
2430
2434
|
{
|
|
2431
2435
|
command: "checkout",
|
|
2432
2436
|
projectPath: commandPath,
|
|
2433
|
-
projectName: final.name || ""
|
|
2437
|
+
projectName: final.name || "",
|
|
2438
|
+
log: options.log
|
|
2434
2439
|
},
|
|
2435
2440
|
logger
|
|
2436
2441
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.1",
|
|
4
4
|
"description": "CLI devtools for the OpenFn toolchain",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"@openfn/compiler": "1.1.5",
|
|
51
51
|
"@openfn/deploy": "0.11.3",
|
|
52
52
|
"@openfn/describe-package": "0.1.5",
|
|
53
|
-
"@openfn/
|
|
54
|
-
"@openfn/
|
|
55
|
-
"@openfn/
|
|
56
|
-
"@openfn/
|
|
53
|
+
"@openfn/logger": "1.0.6",
|
|
54
|
+
"@openfn/project": "^0.7.0",
|
|
55
|
+
"@openfn/lexicon": "^1.2.5",
|
|
56
|
+
"@openfn/runtime": "1.7.4"
|
|
57
57
|
},
|
|
58
58
|
"files": [
|
|
59
59
|
"dist",
|