forked from windmill-labs/windmill
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli): do not rely on x.nest.land
- Loading branch information
1 parent
48aae74
commit ad66bfa
Showing
8 changed files
with
95 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ export { | |
} from "https://deno.land/[email protected]/streams/mod.ts"; | ||
export { DelimiterStream } from "https://deno.land/[email protected]/streams/mod.ts"; | ||
export { iterateReader } from "https://deno.land/[email protected]/streams/iterate_reader.ts"; | ||
export { writeAllSync } from "https://deno.land/[email protected]/streams/mod.ts"; | ||
|
||
// other | ||
export { getAvailablePort } from "https://deno.land/x/[email protected]/mod.ts"; | ||
|
@@ -38,3 +39,8 @@ export { default as objectHash } from "https://deno.land/x/[email protected]/m | |
export { default as gitignore_parser } from "npm:gitignore-parser"; | ||
export { default as JSZip } from "npm:[email protected]"; | ||
export * as log from "https://deno.land/[email protected]/log/mod.ts"; | ||
export { | ||
stringify as yamlStringify, | ||
parse as yamlParse, | ||
} from "https://deno.land/[email protected]/yaml/mod.ts"; | ||
export { open } from "https://deno.land/x/[email protected]/index.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
// deno-lint-ignore-file no-explicit-any | ||
import { GlobalOptions, isSuperset } from "./types.ts"; | ||
import { parse as yamlParse } from "https://deno.land/[email protected]/yaml/mod.ts"; | ||
|
||
import { | ||
colors, | ||
|
@@ -10,6 +9,7 @@ import { | |
FlowService, | ||
JobService, | ||
Table, | ||
yamlParse, | ||
} from "./deps.ts"; | ||
import { requireLogin, resolveWorkspace, validatePath } from "./context.ts"; | ||
import { resolve, track_job } from "./script.ts"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ import { | |
CompletionsCommand, | ||
DenoLandProvider, | ||
UpgradeCommand, | ||
log, | ||
} from "./deps.ts"; | ||
import flow from "./flow.ts"; | ||
import app from "./apps.ts"; | ||
|
@@ -18,7 +19,6 @@ import folder from "./folder.ts"; | |
import sync from "./sync.ts"; | ||
import { tryResolveVersion } from "./context.ts"; | ||
import { GlobalOptions } from "./types.ts"; | ||
import * as log from "https://deno.land/[email protected]/log/mod.ts"; | ||
|
||
addEventListener("error", (event) => { | ||
if (event.error) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,9 @@ import { | |
Script, | ||
ScriptService, | ||
Table, | ||
writeAllSync, | ||
yamlParse, | ||
} from "./deps.ts"; | ||
import { writeAllSync } from "https://deno.land/[email protected]/streams/mod.ts"; | ||
import { parse as yamlParse } from "https://deno.land/[email protected]/yaml/mod.ts"; | ||
|
||
export interface ScriptFile { | ||
parent_hash?: string; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,8 @@ import { | |
FlowModule, | ||
RawScript, | ||
log, | ||
yamlStringify, | ||
yamlParse, | ||
} from "./deps.ts"; | ||
import { | ||
getTypeStrFromPath, | ||
|
@@ -31,11 +33,7 @@ import { downloadZip } from "./pull.ts"; | |
import { handleScriptMetadata } from "./script.ts"; | ||
|
||
import { handleFile } from "./script.ts"; | ||
import { equal } from "https://deno.land/x/[email protected]/mod.ts"; | ||
import { | ||
stringify as yamlStringify, | ||
parse as yamlParse, | ||
} from "https://deno.land/[email protected]/yaml/mod.ts"; | ||
import { deepEqual } from "./utils.ts"; | ||
|
||
type DynFSElement = { | ||
isDirectory: boolean; | ||
|
@@ -325,8 +323,8 @@ async function compareDynFSElement( | |
changes.push({ name: "added", path: k, content: v }); | ||
} else if ( | ||
m2[k] != v && | ||
(!k.endsWith(".json") || !equal(JSON.parse(v), JSON.parse(m2[k]))) && | ||
(!k.endsWith(".yaml") || !equal(yamlParse(v), yamlParse(m2[k]))) | ||
(!k.endsWith(".json") || !deepEqual(JSON.parse(v), JSON.parse(m2[k]))) && | ||
(!k.endsWith(".yaml") || !deepEqual(yamlParse(v), yamlParse(m2[k]))) | ||
) { | ||
changes.push({ name: "edited", path: k, after: v, before: m2[k] }); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
// deno-lint-ignore-file no-explicit-any | ||
|
||
import { colors, log, path } from "./deps.ts"; | ||
import { colors, log, path, yamlParse, yamlStringify } from "./deps.ts"; | ||
import { pushApp } from "./apps.ts"; | ||
import { | ||
parse as yamlParse, | ||
stringify as yamlStringify, | ||
} from "https://deno.land/[email protected]/yaml/mod.ts"; | ||
import { equal } from "https://deno.land/x/[email protected]/equal.ts"; | ||
import { pushFolder } from "./folder.ts"; | ||
import { pushFlow } from "./flow.ts"; | ||
import { pushResource } from "./resource.ts"; | ||
|
@@ -15,6 +10,7 @@ import { pushVariable } from "./variable.ts"; | |
import * as Diff from "npm:diff"; | ||
import { yamlOptions } from "./sync.ts"; | ||
import { showDiffs } from "./main.ts"; | ||
import { deepEqual } from "./utils.ts"; | ||
|
||
export interface DifferenceCreate { | ||
type: "CREATE"; | ||
|
@@ -47,7 +43,7 @@ export function isSuperset( | |
superset: Record<string, any> | ||
): boolean { | ||
return Object.keys(subset).every((key) => { | ||
const eq = equal(subset[key], superset[key]); | ||
const eq = deepEqual(subset[key], superset[key]); | ||
if (!eq && showDiffs) { | ||
const sub = subset[key]; | ||
const supers = superset[key]; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// Modified from: https://raw.githubusercontent.com/epoberezkin/fast-deep-equal/master/src/index.jst | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-nocheck This file is copied from a JS project, so it's not type-safe. | ||
export function deepEqual<T>(a: T, b: T): boolean { | ||
if (a === b) return true; | ||
|
||
if (a && b && typeof a === "object" && typeof b === "object") { | ||
if (a.constructor !== b.constructor) return false; | ||
|
||
let length, i; | ||
if (Array.isArray(a)) { | ||
length = a.length; | ||
if (length != b.length) return false; | ||
for (i = length; i-- !== 0; ) { | ||
if (!deepEqual(a[i], b[i])) return false; | ||
} | ||
return true; | ||
} | ||
|
||
if (a instanceof Map && b instanceof Map) { | ||
if (a.size !== b.size) return false; | ||
for (i of a.entries()) { | ||
if (!b.has(i[0])) return false; | ||
} | ||
for (i of a.entries()) { | ||
if (!deepEqual(i[1], b.get(i[0]))) return false; | ||
} | ||
return true; | ||
} | ||
|
||
if (a instanceof Set && b instanceof Set) { | ||
if (a.size !== b.size) return false; | ||
for (i of a.entries()) { | ||
if (!b.has(i[0])) return false; | ||
} | ||
return true; | ||
} | ||
|
||
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { | ||
length = a.length; | ||
if (length != b.length) return false; | ||
for (i = length; i-- !== 0; ) { | ||
if (a[i] !== b[i]) return false; | ||
} | ||
return true; | ||
} | ||
|
||
if (a.constructor === RegExp) { | ||
return a.source === b.source && a.flags === b.flags; | ||
} | ||
if (a.valueOf !== Object.prototype.valueOf) { | ||
return a.valueOf() === b.valueOf(); | ||
} | ||
if (a.toString !== Object.prototype.toString) { | ||
return a.toString() === b.toString(); | ||
} | ||
|
||
const keys = Object.keys(a); | ||
length = keys.length; | ||
if (length !== Object.keys(b).length) return false; | ||
|
||
for (i = length; i-- !== 0; ) { | ||
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; | ||
} | ||
|
||
for (i = length; i-- !== 0; ) { | ||
const key = keys[i]; | ||
if (!deepEqual(a[key], b[key])) return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
// true if both NaN, false otherwise | ||
return a !== a && b !== b; | ||
} |