1
0
Fork 0
mirror of https://github.com/classchartsapi/classcharts-api-js.git synced 2026-05-14 19:59:37 +00:00

fix: use jsr imports

This commit is contained in:
James Cook 2024-05-28 14:32:57 +01:00
parent d357afffb6
commit e3924f0322
8 changed files with 235 additions and 29 deletions

View file

@ -4,5 +4,9 @@
"format": "deno run -A npm:@biomejs/biome format . --write",
"lint": "deno run -A npm:@biomejs/biome lint ."
},
"exclude": ["npm"]
"exclude": ["npm"],
"imports": {
"@deno/dnt": "jsr:@deno/dnt@^0.41.1",
"@std/assert": "jsr:@std/assert@^0.225.3"
}
}

226
deno.lock generated
View file

@ -2,7 +2,81 @@
"version": "3",
"packages": {
"specifiers": {
"npm:@biomejs/biome": "npm:@biomejs/biome@1.4.0"
"jsr:@deno/cache-dir@^0.8.0": "jsr:@deno/cache-dir@0.8.0",
"jsr:@deno/dnt@^0.41.1": "jsr:@deno/dnt@0.41.1",
"jsr:@deno/graph@^0.69.7": "jsr:@deno/graph@0.69.10",
"jsr:@std/assert@^0.218.2": "jsr:@std/assert@0.218.2",
"jsr:@std/assert@^0.225.3": "jsr:@std/assert@0.225.3",
"jsr:@std/bytes@^0.218.2": "jsr:@std/bytes@0.218.2",
"jsr:@std/fmt@^0.218.2": "jsr:@std/fmt@0.218.2",
"jsr:@std/fs@^0.218.2": "jsr:@std/fs@0.218.2",
"jsr:@std/internal@^1.0.0": "jsr:@std/internal@1.0.0",
"jsr:@std/io@^0.218.2": "jsr:@std/io@0.218.2",
"jsr:@std/path@^0.218.2": "jsr:@std/path@0.218.2",
"npm:@biomejs/biome": "npm:@biomejs/biome@1.4.0",
"npm:@ts-morph/bootstrap@0.22": "npm:@ts-morph/bootstrap@0.22.0",
"npm:code-block-writer@^13.0.1": "npm:code-block-writer@13.0.1"
},
"jsr": {
"@deno/cache-dir@0.8.0": {
"integrity": "e87e80a404958f6350d903e6238b72afb92468378b0b32111f7a1e4916ac7fe7",
"dependencies": [
"jsr:@deno/graph@^0.69.7",
"jsr:@std/fs@^0.218.2",
"jsr:@std/io@^0.218.2"
]
},
"@deno/dnt@0.41.1": {
"integrity": "8746a773e031ae19ef43d0eece850217b76cf1d0118fdd8e059652d7023d4aff",
"dependencies": [
"jsr:@deno/cache-dir@^0.8.0",
"jsr:@std/fmt@^0.218.2",
"jsr:@std/fs@^0.218.2",
"jsr:@std/path@^0.218.2",
"npm:@ts-morph/bootstrap@0.22",
"npm:code-block-writer@^13.0.1"
]
},
"@deno/graph@0.69.10": {
"integrity": "38fe22ac5686f6ece5daeec5a4df65c6314d7d32adcc33f77917a13cfaffa26f"
},
"@std/assert@0.218.2": {
"integrity": "7f0a5a1a8cf86607cd6c2c030584096e1ffad27fc9271429a8cb48cfbdee5eaf"
},
"@std/assert@0.225.3": {
"integrity": "b3c2847aecf6955b50644cdb9cf072004ea3d1998dd7579fc0acb99dbb23bd4f",
"dependencies": [
"jsr:@std/internal@^1.0.0"
]
},
"@std/bytes@0.218.2": {
"integrity": "91fe54b232dcca73856b79a817247f4a651dbb60d51baafafb6408c137241670"
},
"@std/fmt@0.218.2": {
"integrity": "99526449d2505aa758b6cbef81e7dd471d8b28ec0dcb1491d122b284c548788a"
},
"@std/fs@0.218.2": {
"integrity": "dd9431453f7282e8c577cc22c9e6d036055a9a980b5549f887d6012969fabcca",
"dependencies": [
"jsr:@std/assert@^0.218.2",
"jsr:@std/path@^0.218.2"
]
},
"@std/internal@1.0.0": {
"integrity": "ac6a6dfebf838582c4b4f61a6907374e27e05bedb6ce276e0f1608fe84e7cd9a"
},
"@std/io@0.218.2": {
"integrity": "c64fbfa087b7c9d4d386c5672f291f607d88cb7d44fc299c20c713e345f2785f",
"dependencies": [
"jsr:@std/bytes@^0.218.2"
]
},
"@std/path@0.218.2": {
"integrity": "b568fd923d9e53ad76d17c513e7310bda8e755a3e825e6289a0ce536404e2662",
"dependencies": [
"jsr:@std/assert@^0.218.2"
]
}
},
"npm": {
"@biomejs/biome@1.4.0": {
@ -39,6 +113,150 @@
"@biomejs/cli-win32-x64@1.4.0": {
"integrity": "sha512-gN6DgyyBxIwoCovAUFJHFWVallb0cLosayDRtNyxU3MDv/atZxSXOWQezfVKBIbgmFPxYWJObd+awvbPYXwwww==",
"dependencies": {}
},
"@nodelib/fs.scandir@2.1.5": {
"integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",
"dependencies": {
"@nodelib/fs.stat": "@nodelib/fs.stat@2.0.5",
"run-parallel": "run-parallel@1.2.0"
}
},
"@nodelib/fs.stat@2.0.5": {
"integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",
"dependencies": {}
},
"@nodelib/fs.walk@1.2.8": {
"integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",
"dependencies": {
"@nodelib/fs.scandir": "@nodelib/fs.scandir@2.1.5",
"fastq": "fastq@1.17.1"
}
},
"@ts-morph/bootstrap@0.22.0": {
"integrity": "sha512-MI5q7pid4swAlE2lcHwHRa6rcjoIMyT6fy8uuZm8BGg7DHGi/H5bQ0GMZzbk3N0r/LfStMdOYPkl+3IwvfIQ2g==",
"dependencies": {
"@ts-morph/common": "@ts-morph/common@0.22.0"
}
},
"@ts-morph/common@0.22.0": {
"integrity": "sha512-HqNBuV/oIlMKdkLshXd1zKBqNQCsuPEsgQOkfFQ/eUKjRlwndXW1AjN9LVkBEIukm00gGXSRmfkl0Wv5VXLnlw==",
"dependencies": {
"fast-glob": "fast-glob@3.3.2",
"minimatch": "minimatch@9.0.4",
"mkdirp": "mkdirp@3.0.1",
"path-browserify": "path-browserify@1.0.1"
}
},
"balanced-match@1.0.2": {
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"dependencies": {}
},
"brace-expansion@2.0.1": {
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dependencies": {
"balanced-match": "balanced-match@1.0.2"
}
},
"braces@3.0.3": {
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"dependencies": {
"fill-range": "fill-range@7.1.1"
}
},
"code-block-writer@13.0.1": {
"integrity": "sha512-c5or4P6erEA69TxaxTNcHUNcIn+oyxSRTOWV+pSYF+z4epXqNvwvJ70XPGjPNgue83oAFAPBRQYwpAJ/Hpe/Sg==",
"dependencies": {}
},
"fast-glob@3.3.2": {
"integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==",
"dependencies": {
"@nodelib/fs.stat": "@nodelib/fs.stat@2.0.5",
"@nodelib/fs.walk": "@nodelib/fs.walk@1.2.8",
"glob-parent": "glob-parent@5.1.2",
"merge2": "merge2@1.4.1",
"micromatch": "micromatch@4.0.7"
}
},
"fastq@1.17.1": {
"integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==",
"dependencies": {
"reusify": "reusify@1.0.4"
}
},
"fill-range@7.1.1": {
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"dependencies": {
"to-regex-range": "to-regex-range@5.0.1"
}
},
"glob-parent@5.1.2": {
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
"dependencies": {
"is-glob": "is-glob@4.0.3"
}
},
"is-extglob@2.1.1": {
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
"dependencies": {}
},
"is-glob@4.0.3": {
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
"dependencies": {
"is-extglob": "is-extglob@2.1.1"
}
},
"is-number@7.0.0": {
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dependencies": {}
},
"merge2@1.4.1": {
"integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
"dependencies": {}
},
"micromatch@4.0.7": {
"integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==",
"dependencies": {
"braces": "braces@3.0.3",
"picomatch": "picomatch@2.3.1"
}
},
"minimatch@9.0.4": {
"integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==",
"dependencies": {
"brace-expansion": "brace-expansion@2.0.1"
}
},
"mkdirp@3.0.1": {
"integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==",
"dependencies": {}
},
"path-browserify@1.0.1": {
"integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==",
"dependencies": {}
},
"picomatch@2.3.1": {
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dependencies": {}
},
"queue-microtask@1.2.3": {
"integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",
"dependencies": {}
},
"reusify@1.0.4": {
"integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==",
"dependencies": {}
},
"run-parallel@1.2.0": {
"integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==",
"dependencies": {
"queue-microtask": "queue-microtask@1.2.3"
}
},
"to-regex-range@5.0.1": {
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dependencies": {
"is-number": "is-number@7.0.0"
}
}
}
},
@ -260,5 +478,11 @@
"https://deno.land/x/wasmbuild@0.15.0/loader.ts": "d98d195a715f823151cbc8baa3f32127337628379a02d9eb2a3c5902dbccfc02",
"https://deno.land/x/wasmbuild@0.15.1/cache.ts": "9d01b5cb24e7f2a942bbd8d14b093751fa690a6cde8e21709ddc97667e6669ed",
"https://deno.land/x/wasmbuild@0.15.1/loader.ts": "8c2fc10e21678e42f84c5135d8ab6ab7dc92424c3f05d2354896a29ccfd02a63"
},
"workspace": {
"dependencies": [
"jsr:@deno/dnt@^0.41.1",
"jsr:@std/assert@^0.225.3"
]
}
}

View file

@ -1,5 +0,0 @@
export {
assertEquals,
assertExists,
assertRejects,
} from "https://deno.land/std@0.208.0/assert/mod.ts";

View file

@ -1,5 +1,4 @@
// This dependancy cannot be moved to dev_deps.ts since dnt complains about a top-level await
import { build, emptyDir } from "https://deno.land/x/dnt@0.39.0/mod.ts";
import { build, emptyDir } from "@deno/dnt";
if (!Deno.args[0]) {
throw new Error("No version specified");

View file

@ -1,4 +1,4 @@
import { assertRejects } from "../../deps_dev.ts";
import { assertRejects } from "@std/assert";
import { ParentClient } from "../core/parentClient.ts";
Deno.test("Throws when no email is provided", async () => {

View file

@ -1,4 +1,4 @@
import { assertRejects } from "../../deps_dev.ts";
import { assertRejects } from "@std/assert";
import { StudentClient } from "../core/studentClient.ts";
Deno.test("Throws when no student code is provided", async () => {

View file

@ -8,12 +8,9 @@ export function parseCookies(input: string) {
const cookies = input.split(",");
for (const cookie of cookies) {
const cookieSplit = cookie.split(";")[0].split("=");
output[leftTrim(decodeURIComponent(cookieSplit[0]))] = decodeURIComponent(
output[decodeURIComponent(cookieSplit[0]).trimStart()] = decodeURIComponent(
cookieSplit[1],
);
}
return output;
}
export function leftTrim(str: string) {
return str.replace(/^\s+/g, "");
}

View file

@ -1,4 +1,4 @@
import { assertEquals, assertExists } from "../../deps_dev.ts";
import { assertEquals, assertExists } from "@std/assert";
import { parseCookies } from "./utils.ts";
Deno.test("Parses simple cookie", () => {
const cookie =
@ -22,16 +22,3 @@ Deno.test("Parses cookie with no value", () => {
assertExists(parsed.cookieWithNoValue);
assertEquals(parsed.cookieWithNoValue, "");
});
import { leftTrim } from "./utils.ts";
Deno.test("Trims left with spaces", () => {
const input = " Hello world!";
const output = leftTrim(input);
assertEquals(output, "Hello world!");
});
Deno.test("Trims left with no spaces", () => {
const input = "Hello world!";
const output = leftTrim(input);
assertEquals(output, "Hello world!");
});