Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix failing license

Mikayla Maki6a2a1303c41f
diff --git a/styles/src/buildLicenses.ts b/styles/src/buildLicenses.ts
index b1e130e8003..793a14a3b21 100644
--- a/styles/src/buildLicenses.ts
+++ b/styles/src/buildLicenses.ts
@@ -1,7 +1,7 @@
import * as fs from "fs"
import toml from "toml"
import { schemeMeta } from "./colorSchemes"
-import { Meta } from "./themes/common/colorScheme"
+import { Meta, Verification } from "./themes/common/colorScheme"
import https from "https"
import crypto from "crypto"
@@ -36,40 +36,45 @@ function getLicenseText(
callback: (meta: Meta, license_text: string) => void
) {
for (let meta of schemeMeta) {
- // The following copied from the example code on nodejs.org:
- // https://nodejs.org/api/http.html#httpgetoptions-callback
- https
- .get(meta.license.https_url, (res) => {
- const { statusCode } = res
+ if (typeof meta.license.license_text == "string") {
+ callback(meta, meta.license.license_text)
+ } else {
+ let license_text_obj: Verification = meta.license.license_text;
+ // The following copied from the example code on nodejs.org:
+ // https://nodejs.org/api/http.html#httpgetoptions-callback
+ https
+ .get(license_text_obj.https_url, (res) => {
+ const { statusCode } = res
- if (statusCode < 200 || statusCode >= 300) {
- throw new Error(
- `Failed to fetch license for: ${meta.name}, Status Code: ${statusCode}`
- )
- }
-
- res.setEncoding("utf8")
- let rawData = ""
- res.on("data", (chunk) => {
- rawData += chunk
- })
- res.on("end", () => {
- const hash = crypto
- .createHash("sha256")
- .update(rawData)
- .digest("hex")
- if (meta.license.license_checksum == hash) {
- callback(meta, rawData)
- } else {
- throw Error(
- `Checksum for ${meta.name} did not match file downloaded from ${meta.license.https_url}`
+ if (statusCode < 200 || statusCode >= 300) {
+ throw new Error(
+ `Failed to fetch license for: ${meta.name}, Status Code: ${statusCode}`
)
}
+
+ res.setEncoding("utf8")
+ let rawData = ""
+ res.on("data", (chunk) => {
+ rawData += chunk
+ })
+ res.on("end", () => {
+ const hash = crypto
+ .createHash("sha256")
+ .update(rawData)
+ .digest("hex")
+ if (license_text_obj.license_checksum == hash) {
+ callback(meta, rawData)
+ } else {
+ throw Error(
+ `Checksum for ${meta.name} did not match file downloaded from ${license_text_obj.https_url}`
+ )
+ }
+ })
})
- })
- .on("error", (e) => {
- throw e
- })
+ .on("error", (e) => {
+ throw e
+ })
+ }
}
}
diff --git a/styles/src/themes/andromeda.ts b/styles/src/themes/andromeda.ts
index 37a4d3c345d..369f1d7f2b6 100644
--- a/styles/src/themes/andromeda.ts
+++ b/styles/src/themes/andromeda.ts
@@ -34,10 +34,12 @@ export const meta: Meta = {
author: "EliverLara",
license: {
SPDX: "MIT",
- https_url:
- "https://raw.githubusercontent.com/EliverLara/Andromeda/master/LICENSE.md",
- license_checksum:
- "2f7886f1a05cefc2c26f5e49de1a39fa4466413c1ccb06fc80960e73f5ed4b89",
+ license_text: {
+ https_url:
+ "https://raw.githubusercontent.com/EliverLara/Andromeda/master/LICENSE.md",
+ license_checksum:
+ "2f7886f1a05cefc2c26f5e49de1a39fa4466413c1ccb06fc80960e73f5ed4b89",
+ }
},
url: "https://github.com/EliverLara/Andromeda",
}
diff --git a/styles/src/themes/atelier-cave.ts b/styles/src/themes/atelier-cave.ts
index 7a85db97e9f..21b846d708c 100644
--- a/styles/src/themes/atelier-cave.ts
+++ b/styles/src/themes/atelier-cave.ts
@@ -55,9 +55,11 @@ export const meta: Meta = {
author: "atelierbram",
license: {
SPDX: "MIT",
- https_url: "https://atelierbram.mit-license.org/license.txt",
- license_checksum:
- "f95ce526ef4e7eecf7a832bba0e3451cc1000f9ce63eb01ed6f64f8109f5d0a5",
+ license_text: {
+ https_url: "https://atelierbram.mit-license.org/license.txt",
+ license_checksum:
+ "f95ce526ef4e7eecf7a832bba0e3451cc1000f9ce63eb01ed6f64f8109f5d0a5",
+ }
},
url: "https://atelierbram.github.io/syntax-highlighting/atelier-schemes/cave/",
}
diff --git a/styles/src/themes/atelier-sulphurpool.ts b/styles/src/themes/atelier-sulphurpool.ts
index bfd105172a0..e34bc802389 100644
--- a/styles/src/themes/atelier-sulphurpool.ts
+++ b/styles/src/themes/atelier-sulphurpool.ts
@@ -35,9 +35,11 @@ export const meta: Meta = {
author: "atelierbram",
license: {
SPDX: "MIT",
- https_url: "https://atelierbram.mit-license.org/license.txt",
- license_checksum:
- "f95ce526ef4e7eecf7a832bba0e3451cc1000f9ce63eb01ed6f64f8109f5d0a5",
+ license_text: {
+ https_url: "https://atelierbram.mit-license.org/license.txt",
+ license_checksum:
+ "f95ce526ef4e7eecf7a832bba0e3451cc1000f9ce63eb01ed6f64f8109f5d0a5",
+ }
},
url: "https://atelierbram.github.io/syntax-highlighting/atelier-schemes/sulphurpool/",
}
diff --git a/styles/src/themes/common/colorScheme.ts b/styles/src/themes/common/colorScheme.ts
index d2f0d17201c..3b5b8f69329 100644
--- a/styles/src/themes/common/colorScheme.ts
+++ b/styles/src/themes/common/colorScheme.ts
@@ -29,6 +29,10 @@ export interface Meta {
export interface License {
SPDX: SPDXExpression
/// A url where we can download the license's text
+ license_text: Verification | string
+}
+
+export interface Verification {
https_url: string
license_checksum: string
}
diff --git a/styles/src/themes/gruvbox-common.ts b/styles/src/themes/gruvbox-common.ts
index 4c270d6f846..c3e63a31cf1 100644
--- a/styles/src/themes/gruvbox-common.ts
+++ b/styles/src/themes/gruvbox-common.ts
@@ -248,8 +248,7 @@ export const meta: Meta = {
name,
license: {
SPDX: "MIT", // "MIT/X11"
- https_url: "",
- license_checksum: "",
+ license_text: "Copyright <YEAR> <COPYRIGHT HOLDER>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/ or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
},
author: "morhetz <[email protected]>",
url: "https://github.com/morhetz/gruvbox",
diff --git a/styles/src/themes/gruvbox-dark-hard.ts b/styles/src/themes/gruvbox-dark-hard.ts
index c7345552509..a6e20e10209 100644
--- a/styles/src/themes/gruvbox-dark-hard.ts
+++ b/styles/src/themes/gruvbox-dark-hard.ts
@@ -1,3 +1,6 @@
-import { darkHard as dark, meta } from "./gruvbox-common";
+import { darkHard as dark, meta as commonMeta } from "./gruvbox-common";
+
+let meta = { ...commonMeta };
+meta.name = `${commonMeta.name} Dark Hard`
export { dark, meta }
\ No newline at end of file
diff --git a/styles/src/themes/gruvbox-dark-soft.ts b/styles/src/themes/gruvbox-dark-soft.ts
index 6f43c3d69f6..7eaefaa99ac 100644
--- a/styles/src/themes/gruvbox-dark-soft.ts
+++ b/styles/src/themes/gruvbox-dark-soft.ts
@@ -1,3 +1,7 @@
-import { darkSoft as dark, meta } from "./gruvbox-common";
+import { darkSoft as dark, meta as commonMeta } from "./gruvbox-common";
+
+
+let meta = { ...commonMeta };
+meta.name = `${commonMeta.name} Dark Soft`
export { dark, meta }
\ No newline at end of file
diff --git a/styles/src/themes/gruvbox-dark.ts b/styles/src/themes/gruvbox-dark.ts
index ded33815174..ea21933714e 100644
--- a/styles/src/themes/gruvbox-dark.ts
+++ b/styles/src/themes/gruvbox-dark.ts
@@ -1,3 +1,7 @@
-import { darkDefault as dark, meta } from "./gruvbox-common";
+import { darkDefault as dark, meta as commonMeta } from "./gruvbox-common";
+
+
+let meta = { ...commonMeta };
+meta.name = `${commonMeta.name} Dark`
export { dark, meta }
\ No newline at end of file
diff --git a/styles/src/themes/gruvbox-light-hard copy.ts b/styles/src/themes/gruvbox-light-hard copy.ts
deleted file mode 100644
index 4925eb74eea..00000000000
--- a/styles/src/themes/gruvbox-light-hard copy.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import { lightHard as light, meta } from "./gruvbox-common";
-
-export { light, meta }
\ No newline at end of file
diff --git a/styles/src/themes/gruvbox-light-hard.ts b/styles/src/themes/gruvbox-light-hard.ts
new file mode 100644
index 00000000000..b0f42ca4b7a
--- /dev/null
+++ b/styles/src/themes/gruvbox-light-hard.ts
@@ -0,0 +1,6 @@
+import { lightHard as light, meta as commonMeta } from "./gruvbox-common";
+
+let meta = { ...commonMeta };
+meta.name = `${commonMeta.name} Dark Soft`
+
+export { light, meta }
\ No newline at end of file
diff --git a/styles/src/themes/gruvbox-light-soft.ts b/styles/src/themes/gruvbox-light-soft.ts
index 1a38bb78f10..6743d292329 100644
--- a/styles/src/themes/gruvbox-light-soft.ts
+++ b/styles/src/themes/gruvbox-light-soft.ts
@@ -1,3 +1,6 @@
-import { lightSoft as light, meta } from "./gruvbox-common";
+import { lightSoft as light, meta as commonMeta } from "./gruvbox-common";
+
+let meta = { ...commonMeta };
+meta.name = `${commonMeta.name} Light Soft`
export { light, meta }
\ No newline at end of file
diff --git a/styles/src/themes/gruvbox-light.ts b/styles/src/themes/gruvbox-light.ts
index acb50a8d314..f64778d8564 100644
--- a/styles/src/themes/gruvbox-light.ts
+++ b/styles/src/themes/gruvbox-light.ts
@@ -1,3 +1,6 @@
-import { lightDefault as light, meta } from "./gruvbox-common";
+import { lightDefault as light, meta as commonMeta } from "./gruvbox-common";
+
+let meta = { ...commonMeta };
+meta.name = `${commonMeta.name} Light`
export { light, meta }
\ No newline at end of file
diff --git a/styles/src/themes/one-dark.ts b/styles/src/themes/one-dark.ts
index 48305e5bd92..e8e4089d4c2 100644
--- a/styles/src/themes/one-dark.ts
+++ b/styles/src/themes/one-dark.ts
@@ -72,10 +72,12 @@ export const meta: Meta = {
author: "simurai",
license: {
SPDX: "MIT",
- https_url:
- "https://raw.githubusercontent.com/atom/atom/master/packages/one-light-ui/LICENSE.md",
- license_checksum:
- "d5af8fc171f6f600c0ab4e7597dca398dda80dbe6821ce01cef78e859e7a00f8",
+ license_text: {
+ https_url:
+ "https://raw.githubusercontent.com/atom/atom/master/packages/one-light-ui/LICENSE.md",
+ license_checksum:
+ "d5af8fc171f6f600c0ab4e7597dca398dda80dbe6821ce01cef78e859e7a00f8",
+ }
},
url: "https://github.com/atom/atom/tree/master/packages/one-dark-ui",
}
diff --git a/styles/src/themes/one-light.ts b/styles/src/themes/one-light.ts
index 267345ed4ec..534e4c16481 100644
--- a/styles/src/themes/one-light.ts
+++ b/styles/src/themes/one-light.ts
@@ -73,10 +73,12 @@ export const meta: Meta = {
author: "simurai",
license: {
SPDX: "MIT",
- https_url:
- "https://raw.githubusercontent.com/atom/atom/master/packages/one-light-ui/LICENSE.md",
- license_checksum:
- "d5af8fc171f6f600c0ab4e7597dca398dda80dbe6821ce01cef78e859e7a00f8",
+ license_text: {
+ https_url:
+ "https://raw.githubusercontent.com/atom/atom/master/packages/one-light-ui/LICENSE.md",
+ license_checksum:
+ "d5af8fc171f6f600c0ab4e7597dca398dda80dbe6821ce01cef78e859e7a00f8",
+ }
},
url: "https://github.com/atom/atom/tree/master/packages/one-light-ui",
}
diff --git a/styles/src/themes/rose-pine-dawn.ts b/styles/src/themes/rose-pine-dawn.ts
index bcd4e268bd5..7f7d52079d4 100644
--- a/styles/src/themes/rose-pine-dawn.ts
+++ b/styles/src/themes/rose-pine-dawn.ts
@@ -34,10 +34,12 @@ export const meta: Meta = {
author: "edunfelt",
license: {
SPDX: "MIT",
- https_url:
- "https://raw.githubusercontent.com/edunfelt/base16-rose-pine-scheme/main/LICENSE",
- license_checksum:
- "6ca1b9da8c78c8441c5aa43d024a4e4a7bf59d1ecca1480196e94fda0f91ee4a",
+ license_text: {
+ https_url:
+ "https://raw.githubusercontent.com/edunfelt/base16-rose-pine-scheme/main/LICENSE",
+ license_checksum:
+ "6ca1b9da8c78c8441c5aa43d024a4e4a7bf59d1ecca1480196e94fda0f91ee4a",
+ }
},
url: "https://github.com/edunfelt/base16-rose-pine-scheme",
}
diff --git a/styles/src/themes/rose-pine-moon.ts b/styles/src/themes/rose-pine-moon.ts
index d40ea390ac8..a89d44487e0 100644
--- a/styles/src/themes/rose-pine-moon.ts
+++ b/styles/src/themes/rose-pine-moon.ts
@@ -34,10 +34,12 @@ export const meta: Meta = {
author: "edunfelt",
license: {
SPDX: "MIT",
- https_url:
- "https://raw.githubusercontent.com/edunfelt/base16-rose-pine-scheme/main/LICENSE",
- license_checksum:
- "6ca1b9da8c78c8441c5aa43d024a4e4a7bf59d1ecca1480196e94fda0f91ee4a",
+ license_text: {
+ https_url:
+ "https://raw.githubusercontent.com/edunfelt/base16-rose-pine-scheme/main/LICENSE",
+ license_checksum:
+ "6ca1b9da8c78c8441c5aa43d024a4e4a7bf59d1ecca1480196e94fda0f91ee4a",
+ }
},
url: "https://github.com/edunfelt/base16-rose-pine-scheme",
}
diff --git a/styles/src/themes/rose-pine.ts b/styles/src/themes/rose-pine.ts
index 7b61ab56e70..87c9d34ffef 100644
--- a/styles/src/themes/rose-pine.ts
+++ b/styles/src/themes/rose-pine.ts
@@ -32,10 +32,12 @@ export const meta: Meta = {
author: "edunfelt",
license: {
SPDX: "MIT",
- https_url:
- "https://raw.githubusercontent.com/edunfelt/base16-rose-pine-scheme/main/LICENSE",
- license_checksum:
- "6ca1b9da8c78c8441c5aa43d024a4e4a7bf59d1ecca1480196e94fda0f91ee4a",
+ license_text: {
+ https_url:
+ "https://raw.githubusercontent.com/edunfelt/base16-rose-pine-scheme/main/LICENSE",
+ license_checksum:
+ "6ca1b9da8c78c8441c5aa43d024a4e4a7bf59d1ecca1480196e94fda0f91ee4a",
+ }
},
url: "https://github.com/edunfelt/base16-rose-pine-scheme",
}
diff --git a/styles/src/themes/sandcastle.ts b/styles/src/themes/sandcastle.ts
index b38416a966d..86179db3dba 100644
--- a/styles/src/themes/sandcastle.ts
+++ b/styles/src/themes/sandcastle.ts
@@ -32,10 +32,12 @@ export const meta: Meta = {
author: "gessig",
license: {
SPDX: "MIT",
- https_url:
- "https://raw.githubusercontent.com/gessig/base16-sandcastle-scheme/master/LICENSE",
- license_checksum:
- "8399d44b4d935b60be9fee0a76d7cc9a817b4f3f11574c9d6d1e8fd57e72ffdc",
+ license_text: {
+ https_url:
+ "https://raw.githubusercontent.com/gessig/base16-sandcastle-scheme/master/LICENSE",
+ license_checksum:
+ "8399d44b4d935b60be9fee0a76d7cc9a817b4f3f11574c9d6d1e8fd57e72ffdc",
+ }
},
url: "https://github.com/gessig/base16-sandcastle-scheme",
}
diff --git a/styles/src/themes/solarized.ts b/styles/src/themes/solarized.ts
index 51baeed5640..42306f68c3a 100644
--- a/styles/src/themes/solarized.ts
+++ b/styles/src/themes/solarized.ts
@@ -35,10 +35,12 @@ export const meta: Metadata = {
author: "Ethan Schoonover",
license: {
SPDX: "MIT",
- https_url:
- "https://raw.githubusercontent.com/altercation/solarized/master/LICENSE",
- license_checksum:
- "494aefdabf86acce06bd63001ad8aedad4ee38da23509d3f917d95aa3368b9a6",
+ license_text: {
+ https_url:
+ "https://raw.githubusercontent.com/altercation/solarized/master/LICENSE",
+ license_checksum:
+ "494aefdabf86acce06bd63001ad8aedad4ee38da23509d3f917d95aa3368b9a6",
+ }
},
url: "https://github.com/altercation/solarized",
}
diff --git a/styles/src/themes/summercamp.ts b/styles/src/themes/summercamp.ts
index 1114f496c2e..e8d1bd40b25 100644
--- a/styles/src/themes/summercamp.ts
+++ b/styles/src/themes/summercamp.ts
@@ -34,9 +34,11 @@ export const meta: Meta = {
url: "https://github.com/zoefiri/base16-sc",
license: {
SPDX: "MIT",
- https_url:
- "https://raw.githubusercontent.com/zoefiri/base16-sc/master/LICENSE",
- license_checksum:
- "fadcc834b7eaf2943800956600e8aeea4b495ecf6490f4c4b6c91556a90accaf",
+ license_text: {
+ https_url:
+ "https://raw.githubusercontent.com/zoefiri/base16-sc/master/LICENSE",
+ license_checksum:
+ "fadcc834b7eaf2943800956600e8aeea4b495ecf6490f4c4b6c91556a90accaf",
+ }
},
}