windmill-cli 1.573.5 → 1.574.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.
@@ -32,7 +32,7 @@ export const OpenAPI = {
32
32
  PASSWORD: undefined,
33
33
  TOKEN: getEnv("WM_TOKEN"),
34
34
  USERNAME: undefined,
35
- VERSION: '1.573.5',
35
+ VERSION: '1.574.0',
36
36
  WITH_CREDENTIALS: true,
37
37
  interceptors: {
38
38
  request: new Interceptors(),
@@ -93,7 +93,9 @@ export async function handleFile(path, workspace, alreadySynced, message, opts,
93
93
  const language = inferContentTypeFromFilePath(path, opts?.defaultTs);
94
94
  const codebase = language == "bun" ? findCodebase(path, codebases) : undefined;
95
95
  let bundleContent = undefined;
96
+ let forceTar = false;
96
97
  if (codebase) {
98
+ let outputFiles = [];
97
99
  if (codebase.customBundler) {
98
100
  log.info(`Using custom bundler ${codebase.customBundler} for ${path}`);
99
101
  bundleContent = execSync(codebase.customBundler + " " + path, { maxBuffer: 1024 * 1024 * 50 }).toString();
@@ -112,30 +114,57 @@ export async function handleFile(path, workspace, alreadySynced, message, opts,
112
114
  external: codebase.external,
113
115
  inject: codebase.inject,
114
116
  define: codebase.define,
117
+ loader: codebase.loader ?? { ".node": "file" },
118
+ outdir: '/',
115
119
  platform: "node",
116
120
  packages: "bundle",
117
121
  target: format == "cjs" ? "node20.15.1" : "esnext",
118
122
  });
119
123
  const endTime = performance.now();
120
124
  bundleContent = out.outputFiles[0].text;
125
+ outputFiles = out.outputFiles;
121
126
  log.info(`Finished bundling ${path}: ${(bundleContent.length / 1024).toFixed(0)}kB (${(endTime - startTime).toFixed(0)}ms)`);
122
127
  }
123
- if (Array.isArray(codebase.assets) && codebase.assets.length > 0) {
128
+ if (outputFiles.length > 1) {
124
129
  const archiveNpm = await import("@ayonli/jsext/archive");
125
- log.info(`Using the following asset configuration for ${path}: ${JSON.stringify(codebase.assets)}`);
130
+ log.info(`Found multiple output files for ${path}, creating a tarball... ${outputFiles.map((file) => file.path).join(", ")}`);
131
+ forceTar = true;
126
132
  const startTime = performance.now();
127
133
  const tarball = new archiveNpm.Tarball();
128
- tarball.append(new File([bundleContent], "main.js", { type: "text/plain" }));
129
- for (const asset of codebase.assets) {
130
- const data = fs.readFileSync(asset.from);
131
- const blob = new Blob([data], { type: "text/plain" });
132
- const file = new File([blob], asset.to);
133
- tarball.append(file);
134
+ const mainPath = path.split(SEP).pop()?.split(".")[0] + ".js";
135
+ const content = outputFiles.find((file) => file.path == "/" + mainPath)?.text ?? '';
136
+ log.info(`Main content: ${content.length}chars`);
137
+ tarball.append(new File([content], "main.js", { type: "text/plain" }));
138
+ for (const file of outputFiles) {
139
+ if (file.path == "/" + mainPath) {
140
+ continue;
141
+ }
142
+ log.info(`Adding file: ${file.path.substring(1)}`);
143
+ const fil = new File([file.contents], file.path.substring(1));
144
+ tarball.append(fil);
134
145
  }
135
146
  const endTime = performance.now();
136
147
  log.info(`Finished creating tarball for ${path}: ${(tarball.size / 1024).toFixed(0)}kB (${(endTime - startTime).toFixed(0)}ms)`);
137
148
  bundleContent = tarball;
138
149
  }
150
+ else {
151
+ if (Array.isArray(codebase.assets) && codebase.assets.length > 0) {
152
+ const archiveNpm = await import("@ayonli/jsext/archive");
153
+ log.info(`Using the following asset configuration for ${path}: ${JSON.stringify(codebase.assets)}`);
154
+ const startTime = performance.now();
155
+ const tarball = new archiveNpm.Tarball();
156
+ tarball.append(new File([bundleContent], "main.js", { type: "text/plain" }));
157
+ for (const asset of codebase.assets) {
158
+ const data = fs.readFileSync(asset.from);
159
+ const blob = new Blob([data], { type: "text/plain" });
160
+ const file = new File([blob], asset.to);
161
+ tarball.append(file);
162
+ }
163
+ const endTime = performance.now();
164
+ log.info(`Finished creating tarball for ${path}: ${(tarball.size / 1024).toFixed(0)}kB (${(endTime - startTime).toFixed(0)}ms)`);
165
+ bundleContent = tarball;
166
+ }
167
+ }
139
168
  }
140
169
  let typed = opts?.skipScriptsMetadata
141
170
  ? undefined
@@ -183,7 +212,7 @@ export async function handleFile(path, workspace, alreadySynced, message, opts,
183
212
  // }
184
213
  }
185
214
  if (typed && codebase) {
186
- typed.codebase = await codebase.getDigest();
215
+ typed.codebase = await codebase.getDigest(forceTar);
187
216
  }
188
217
  const requestBodyCommon = {
189
218
  content,
@@ -209,7 +238,7 @@ export async function handleFile(path, workspace, alreadySynced, message, opts,
209
238
  concurrency_key: typed?.concurrency_key,
210
239
  debounce_key: typed?.debounce_key,
211
240
  debounce_delay_s: typed?.debounce_delay_s,
212
- codebase: await codebase?.getDigest(),
241
+ codebase: await codebase?.getDigest(forceTar),
213
242
  timeout: typed?.timeout,
214
243
  on_behalf_of_email: typed?.on_behalf_of_email,
215
244
  };
package/esm/src/main.js CHANGED
@@ -38,7 +38,7 @@ export { flow, app, script, workspace, resource, resourceType, user, variable, h
38
38
  // console.error(JSON.stringify(event.error, null, 4));
39
39
  // }
40
40
  // });
41
- export const VERSION = "1.573.5";
41
+ export const VERSION = "1.574.0";
42
42
  export const WM_FORK_PREFIX = "wm-fork";
43
43
  const command = new Command()
44
44
  .name("wmill")
@@ -8,13 +8,18 @@ export function listSyncCodebases(options) {
8
8
  }
9
9
  for (const codebase of options?.codebases ?? []) {
10
10
  let _digest = undefined;
11
- const getDigest = async () => {
12
- if (_digest == undefined) {
11
+ let alreadyPrinted = false;
12
+ const getDigest = async (forceTar) => {
13
+ if (_digest == undefined || forceTar) {
13
14
  _digest = await digestDir(codebase.relative_path, JSON.stringify(codebase));
14
- if (Array.isArray(codebase.assets) && codebase.assets.length > 0) {
15
+ if (forceTar || (Array.isArray(codebase.assets) && codebase.assets.length > 0)) {
15
16
  _digest += ".tar";
16
17
  }
17
- log.info(`Codebase ${codebase.relative_path}, digest: ${_digest}`);
18
+ if (!alreadyPrinted) {
19
+ alreadyPrinted = true;
20
+ log.info(`Codebase ${codebase.relative_path}, digest: ${_digest}`);
21
+ }
22
+ return _digest;
18
23
  }
19
24
  return _digest;
20
25
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-cli",
3
- "version": "1.573.5",
3
+ "version": "1.574.0",
4
4
  "description": "CLI for Windmill",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,6 +18,9 @@ export type FlowValue = {
18
18
  debounce_key?: string;
19
19
  skip_expr?: string;
20
20
  cache_ttl?: number;
21
+ flow_env?: {
22
+ [key: string]: (string);
23
+ };
21
24
  priority?: number;
22
25
  early_return?: string;
23
26
  /**