windmill-cli 1.460.0 → 1.461.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/esm/dev.js +45 -18
- package/esm/gen/core/OpenAPI.js +1 -1
- package/esm/main.js +1 -1
- package/package.json +1 -1
- package/types/dev.d.ts.map +1 -1
- package/types/main.d.ts +1 -1
package/esm/dev.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import * as dntShim from "./_dnt.shims.js";
|
|
2
|
-
import { Command, SEP, WebSocketServer, express, getPort, http, log, open, } from "./deps.js";
|
|
2
|
+
import { Command, SEP, WebSocketServer, express, getPort, http, log, open, yamlParseFile, } from "./deps.js";
|
|
3
|
+
import { getTypeStrFromPath } from "./types.js";
|
|
3
4
|
import { ignoreF } from "./sync.js";
|
|
4
5
|
import { requireLogin, resolveWorkspace } from "./context.js";
|
|
5
6
|
import { mergeConfigWithConfigFile, readConfigFile, } from "./conf.js";
|
|
6
7
|
import { exts } from "./script.js";
|
|
7
8
|
import { inferContentTypeFromFilePath } from "./script_common.js";
|
|
9
|
+
import { replaceInlineScripts } from "./flow.js";
|
|
8
10
|
const PORT = 3001;
|
|
9
11
|
async function dev(opts) {
|
|
10
12
|
const workspace = await resolveWorkspace(opts);
|
|
@@ -16,32 +18,57 @@ async function dev(opts) {
|
|
|
16
18
|
const base = await dntShim.Deno.realPath(".");
|
|
17
19
|
opts = await mergeConfigWithConfigFile(opts);
|
|
18
20
|
const ignore = await ignoreF(opts);
|
|
21
|
+
const changesTimeouts = {};
|
|
19
22
|
async function watchChanges() {
|
|
20
23
|
for await (const event of watcher) {
|
|
21
|
-
log
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
// console.log(">>>> event", event);
|
|
25
|
+
const key = event.paths.join(",");
|
|
26
|
+
if (changesTimeouts[key]) {
|
|
27
|
+
clearTimeout(changesTimeouts[key]);
|
|
28
|
+
}
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
changesTimeouts[key] = setTimeout(async () => {
|
|
31
|
+
delete changesTimeouts[key];
|
|
32
|
+
await loadPaths(event.paths);
|
|
33
|
+
}, 100);
|
|
24
34
|
}
|
|
25
35
|
}
|
|
36
|
+
const DOT_FLOW_SEP = ".flow" + SEP;
|
|
26
37
|
async function loadPaths(pathsToLoad) {
|
|
27
|
-
const paths = pathsToLoad.filter((path) => exts.some((ext) => path.endsWith(ext)));
|
|
38
|
+
const paths = pathsToLoad.filter((path) => exts.some((ext) => path.endsWith(ext)) || path.includes(DOT_FLOW_SEP));
|
|
28
39
|
if (paths.length == 0) {
|
|
29
40
|
return;
|
|
30
41
|
}
|
|
31
42
|
const cpath = (await dntShim.Deno.realPath(paths[0])).replace(base + SEP, "");
|
|
32
|
-
console.log("Detected change in " + cpath);
|
|
33
43
|
if (!ignore(cpath, false)) {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
const typ = getTypeStrFromPath(cpath);
|
|
45
|
+
log.info("Detected change in " + cpath + " (" + typ + ")");
|
|
46
|
+
if (typ == "flow") {
|
|
47
|
+
const localPath = cpath.split(DOT_FLOW_SEP)[0] + DOT_FLOW_SEP;
|
|
48
|
+
const localFlow = (await yamlParseFile(localPath + "flow.yaml"));
|
|
49
|
+
replaceInlineScripts(localFlow.value.modules, localPath, undefined);
|
|
50
|
+
currentLastEdit = {
|
|
51
|
+
type: "flow",
|
|
52
|
+
flow: localFlow,
|
|
53
|
+
uriPath: localPath,
|
|
54
|
+
};
|
|
55
|
+
log.info("Updated " + localPath);
|
|
56
|
+
broadcastChanges(currentLastEdit);
|
|
57
|
+
}
|
|
58
|
+
else if (typ == "script") {
|
|
59
|
+
const content = await dntShim.Deno.readTextFile(cpath);
|
|
60
|
+
const splitted = cpath.split(".");
|
|
61
|
+
const wmPath = splitted[0];
|
|
62
|
+
const lang = inferContentTypeFromFilePath(cpath, conf.defaultTs);
|
|
63
|
+
currentLastEdit = {
|
|
64
|
+
type: "script",
|
|
65
|
+
content,
|
|
66
|
+
path: wmPath,
|
|
67
|
+
language: lang,
|
|
68
|
+
};
|
|
69
|
+
log.info("Updated " + wmPath);
|
|
70
|
+
broadcastChanges(currentLastEdit);
|
|
71
|
+
}
|
|
45
72
|
}
|
|
46
73
|
}
|
|
47
74
|
const connectedClients = new Set();
|
|
@@ -84,7 +111,7 @@ async function dev(opts) {
|
|
|
84
111
|
});
|
|
85
112
|
// Start the server
|
|
86
113
|
const port = await getPort.default({ port: 3001 });
|
|
87
|
-
const url = `${workspace.remote}
|
|
114
|
+
const url = `${workspace.remote}dev?workspace=${workspace.workspaceId}&local=true&wm_token=${workspace.token}` +
|
|
88
115
|
(port === PORT ? "" : `&port=${port}`);
|
|
89
116
|
console.log(`Go to ${url}`);
|
|
90
117
|
try {
|
package/esm/gen/core/OpenAPI.js
CHANGED
package/esm/main.js
CHANGED
|
@@ -34,7 +34,7 @@ export { flow, app, script, workspace, resource, user, variable, hub, folder, sc
|
|
|
34
34
|
// console.error(JSON.stringify(event.error, null, 4));
|
|
35
35
|
// }
|
|
36
36
|
// });
|
|
37
|
-
export const VERSION = "1.
|
|
37
|
+
export const VERSION = "1.461.1";
|
|
38
38
|
const command = new Command()
|
|
39
39
|
.name("wmill")
|
|
40
40
|
.action(() => log.info(`Welcome to Windmill CLI ${VERSION}. Use -h for help.`))
|
package/package.json
CHANGED
package/types/dev.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../src/dev.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../src/dev.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EAUR,MAAM,WAAW,CAAC;AAiLnB,QAAA,MAAM,OAAO;;;;;;;;mBAOQ,CAAC;AAEtB,eAAe,OAAO,CAAC"}
|
package/types/main.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ import { pull as hubPull } from "./hub.js";
|
|
|
20
20
|
import { pull, push } from "./sync.js";
|
|
21
21
|
import { add as workspaceAdd } from "./workspace.js";
|
|
22
22
|
export { flow, app, script, workspace, resource, user, variable, hub, folder, schedule, trigger, sync, instance, dev, hubPull, pull, push, workspaceAdd, };
|
|
23
|
-
export declare const VERSION = "1.
|
|
23
|
+
export declare const VERSION = "1.461.1";
|
|
24
24
|
declare const command: Command<{
|
|
25
25
|
workspace?: (import("./deps/jsr.io/@windmill-labs/cliffy-command/1.0.0-rc.5/mod.js").StringType & string) | undefined;
|
|
26
26
|
} & {
|