diff --git a/.prettierignore b/.prettierignore
index 520bef1f..8d70f4b2 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -34,4 +34,4 @@ yarn-error.log*
next-env.d.ts
#sql
-/supabase
+/supabase
\ No newline at end of file
diff --git a/.vercelignore b/.vercelignore
index ffed2669..5a0da42e 100644
--- a/.vercelignore
+++ b/.vercelignore
@@ -1,2 +1,2 @@
supabase
-rls
+scripts
\ No newline at end of file
diff --git a/middleware.ts b/middleware.ts
index fa901acc..3f4baf84 100644
--- a/middleware.ts
+++ b/middleware.ts
@@ -127,7 +127,7 @@ export async function middleware(req: NextRequest) {
export const config = {
matcher:
- "/((?!api|_next/static|favicon.ico|login|demo|txt|svg|privacypolicy.txt|termsandconditions.txt|brand-logos).*)",
+ "/((?!api|_next/static|favicon.ico|login|demo|txt|svg|privacypolicy.txt|termsandconditions.txt|brand-logos|acknowledgements).*)",
};
export enum OnboardingState {
diff --git a/package.json b/package.json
index 52505db1..36059531 100644
--- a/package.json
+++ b/package.json
@@ -18,7 +18,9 @@
"slink": "supabase link --project-ref hhrehffmdrcjqowwvgqg",
"static": "next export",
"ionic:build": "yarn build && yarn static",
- "ionic:serve": "npm run start"
+ "ionic:serve": "npm run start",
+ "license": "echo \"Updating licenses\" && cd ./scripts/ && deno task export-licenses && npm run fmt",
+ "postinstall": "echo \"Make sure to run `yarn run license` to update licenses on install/uninstall!\""
},
"dependencies": {
"@aws-sdk/client-ses": "^3.409.0",
diff --git a/pages/acknowledgements.tsx b/pages/acknowledgements.tsx
new file mode 100644
index 00000000..efb668f9
--- /dev/null
+++ b/pages/acknowledgements.tsx
@@ -0,0 +1,32 @@
+import { NextPageWithLayout } from "./_app";
+import Layout from "@/components/layout/layout";
+import { ReactElement, Fragment } from "react";
+import licenses from "../public/licenses.json";
+
+const Acknowledgements: NextPageWithLayout = () => {
+ return (
+ <>
+
Acknowledgements
+ We use the following packages under these licenses:
+
+ {Object.entries(licenses).map(([license, packages]) => (
+
+
{license}
+
+ {packages.map((pkg) => (
+
+ {pkg}
+
+ ))}
+
+ ))}
+
+ >
+ );
+};
+
+export default Acknowledgements;
+
+Acknowledgements.getLayout = function getLayout(page: ReactElement) {
+ return {page};
+};
diff --git a/pages/login.tsx b/pages/login.tsx
index acc670c2..9902b0fc 100644
--- a/pages/login.tsx
+++ b/pages/login.tsx
@@ -77,22 +77,3 @@ Login.getLayout = function getLayout(page: ReactElement) {
);
};
-
-/**/
diff --git a/public/licenses.json b/public/licenses.json
new file mode 100644
index 00000000..da3b0b02
--- /dev/null
+++ b/public/licenses.json
@@ -0,0 +1,733 @@
+{
+ "Apache-2.0": [
+ "@aws-sdk/util-endpoints",
+ "@aws-sdk/credential-provider-env",
+ "@aws-sdk/util-utf8-browser",
+ "@aws-sdk/middleware-host-header",
+ "@aws-sdk/middleware-logger",
+ "@aws-sdk/credential-provider-node",
+ "@aws-sdk/util-user-agent-node",
+ "@aws-sdk/credential-provider-process",
+ "@aws-sdk/token-providers",
+ "@aws-sdk/util-locate-window",
+ "@aws-sdk/middleware-sdk-sts",
+ "@aws-sdk/middleware-user-agent",
+ "@aws-sdk/types",
+ "@aws-sdk/util-user-agent-browser",
+ "@aws-sdk/client-sts",
+ "@aws-sdk/credential-provider-ini",
+ "@aws-sdk/middleware-signing",
+ "@aws-sdk/middleware-recursion-detection",
+ "@aws-sdk/client-ses",
+ "@aws-sdk/credential-provider-web-identity",
+ "@aws-sdk/client-sso",
+ "@aws-sdk/credential-provider-sso",
+ "@smithy/util-retry",
+ "@smithy/querystring-parser",
+ "@smithy/util-defaults-mode-browser",
+ "@smithy/middleware-serde",
+ "@smithy/util-stream",
+ "@smithy/util-defaults-mode-node",
+ "@smithy/url-parser",
+ "@smithy/querystring-builder",
+ "@smithy/credential-provider-imds",
+ "@smithy/middleware-endpoint",
+ "@smithy/util-middleware",
+ "@smithy/util-config-provider",
+ "@smithy/protocol-http",
+ "@smithy/node-config-provider",
+ "@smithy/eventstream-codec",
+ "@smithy/property-provider",
+ "@smithy/types",
+ "@smithy/util-hex-encoding",
+ "@smithy/config-resolver",
+ "@smithy/util-base64",
+ "@smithy/util-buffer-from",
+ "@smithy/hash-node",
+ "@smithy/fetch-http-handler",
+ "@smithy/util-body-length-node",
+ "@smithy/middleware-content-length",
+ "@smithy/service-error-classification",
+ "@smithy/util-uri-escape",
+ "@smithy/middleware-stack",
+ "@smithy/util-waiter",
+ "@smithy/util-utf8",
+ "@smithy/shared-ini-file-loader",
+ "@smithy/smithy-client",
+ "@smithy/node-http-handler",
+ "@smithy/middleware-retry",
+ "@smithy/is-array-buffer",
+ "@smithy/util-body-length-browser",
+ "@smithy/invalid-dependency",
+ "@smithy/signature-v4",
+ "@smithy/abort-controller",
+ "acorn-node",
+ "before-after-hook",
+ "eslint-visitor-keys",
+ "aria-query",
+ "formik",
+ "detect-libc",
+ "validate-npm-package-license",
+ "human-signals",
+ "doctrine",
+ "@swc/helpers",
+ "rxjs",
+ "typescript",
+ "@aws-crypto/sha256-browser",
+ "@aws-crypto/ie11-detection",
+ "@aws-crypto/sha256-js",
+ "@aws-crypto/util",
+ "@aws-crypto/crc32",
+ "@aws-crypto/supports-web-crypto",
+ "tunnel-agent",
+ "ts-interface-checker",
+ "sharp",
+ "didyoumean",
+ "elementtree",
+ "axobject-query",
+ "@humanwhocodes/config-array",
+ "@humanwhocodes/module-importer",
+ "websocket",
+ "spdx-correct"
+ ],
+ "MIT": [
+ "normalize-path",
+ "autoprefixer",
+ "resolve-pkg-maps",
+ "styled-jsx",
+ "tailwindcss-theme-swapper",
+ "ansi-styles",
+ "html-to-text",
+ "esbuild",
+ "queue-microtask",
+ "supports-preserve-symlinks-flag",
+ "prebuild-install",
+ "parent-module",
+ "imurmurhash",
+ "p-limit",
+ "function.prototype.name",
+ "is-number-object",
+ "node-fetch",
+ "parse-json",
+ "lines-and-columns",
+ "cssesc",
+ "config-chain",
+ "ansi-escapes",
+ "extend",
+ "prismjs",
+ "is-extglob",
+ "typed-array-byte-offset",
+ "style-to-object",
+ "@eslint/js",
+ "@eslint/eslintrc",
+ "@manypkg/find-root",
+ "@manypkg/tools",
+ "is-callable",
+ "rechoir",
+ "@esbuild/linux-x64",
+ "pify",
+ "which-typed-array",
+ "fs-constants",
+ "pretty-bytes",
+ "colorette",
+ "sucrase",
+ "json-parse-even-better-errors",
+ "array-union",
+ "is-regex",
+ "xml2js",
+ "yauzl",
+ "eslint-plugin-react",
+ "tw-to-css",
+ "json5",
+ "read-pkg",
+ "run-parallel",
+ "@one-ini/wasm",
+ "resolve-from",
+ "selderee",
+ "escape-string-regexp",
+ "@types/json5",
+ "@types/cookie",
+ "@types/react-dom",
+ "@types/fs-extra",
+ "@types/prop-types",
+ "@types/canvas-confetti",
+ "@types/phoenix",
+ "@types/hoist-non-react-statics",
+ "@types/normalize-package-data",
+ "@types/react-tagsinput",
+ "@types/node",
+ "@types/scheduler",
+ "@types/slice-ansi",
+ "@types/websocket",
+ "@types/react",
+ "end-of-stream",
+ "@tailwindcss/container-queries",
+ "@tailwindcss/typography",
+ "@tailwindcss/forms",
+ "string-argv",
+ "array.prototype.tosorted",
+ "clean-stack",
+ "merge2",
+ "is-path-inside",
+ "braces",
+ "inline-style-parser",
+ "is-symbol",
+ "arraybuffer.prototype.slice",
+ "wrap-ansi",
+ "regexp.prototype.flags",
+ "balanced-match",
+ "pirates",
+ "tiny-warning",
+ "yocto-queue",
+ "strip-bom",
+ "type-check",
+ "htmlparser2",
+ "object-keys",
+ "xtend",
+ "cookie",
+ "is-date-object",
+ "pretty",
+ "error-ex",
+ "busboy",
+ "path-key",
+ "for-each",
+ "safe-regex-test",
+ "enhanced-resolve",
+ "acorn-jsx",
+ "tar-stream",
+ "string.prototype.trimend",
+ "nanoid",
+ "array.prototype.flat",
+ "react-property",
+ "html-react-parser",
+ "restore-cursor",
+ "lexical",
+ "internal-slot",
+ "object-hash",
+ "typed-array-buffer",
+ "xmlbuilder",
+ "jju",
+ "eslint-plugin-jsx-a11y",
+ "process-nextick-args",
+ "eslint-module-utils",
+ "eslint-plugin-import",
+ "postcss-value-parser",
+ "color-name",
+ "aggregate-error",
+ "@jridgewell/gen-mapping",
+ "@jridgewell/set-array",
+ "@jridgewell/sourcemap-codec",
+ "@jridgewell/resolve-uri",
+ "@jridgewell/trace-mapping",
+ "text-table",
+ "regenerator-runtime",
+ "core-util-is",
+ "binary-extensions",
+ "tree-kill",
+ "concat-map",
+ "prettier-plugin-tailwindcss",
+ "define-properties",
+ "has",
+ "node-abi",
+ "simple-concat",
+ "utf-8-validate",
+ "es-shim-unscopables",
+ "fast-json-stable-stringify",
+ "react-dom",
+ "pidtree",
+ "dir-glob",
+ "bowser",
+ "slash",
+ "jsx-ast-utils",
+ "tree-node-cli",
+ "streamx",
+ "color-convert",
+ "is-string",
+ "deep-extend",
+ "watchpack",
+ "json-schema-traverse",
+ "mkdirp-classic",
+ "supports-color",
+ "es-abstract",
+ "env-paths",
+ "resolve",
+ "minimist",
+ "fs-extra",
+ "optionator",
+ "gopd",
+ "array-buffer-byte-length",
+ "simple-swizzle",
+ "tsconfig-paths",
+ "through2",
+ "is-buffer",
+ "micromatch",
+ "bplist-parser",
+ "is-whitespace",
+ "strip-json-comments",
+ "html-dom-parser",
+ "clone",
+ "reusify",
+ "use-sync-external-store",
+ "is-interactive",
+ "is-boolean-object",
+ "prop-types",
+ "buffer-indexof-polyfill",
+ "kleur",
+ "rfdc",
+ "toposort",
+ "@supabase/auth-helpers-shared",
+ "@supabase/supabase-js",
+ "@supabase/gotrue-js",
+ "@supabase/functions-js",
+ "@supabase/auth-helpers-nextjs",
+ "@supabase/storage-js",
+ "@supabase/auth-helpers-react",
+ "@supabase/postgrest-js",
+ "@supabase/realtime-js",
+ "fast-glob",
+ "@babel/highlight",
+ "@babel/runtime",
+ "@babel/code-frame",
+ "@babel/helper-validator-identifier",
+ "napi-build-utils",
+ "graphemer",
+ "readable-stream",
+ "file-entry-cache",
+ "quick-lru",
+ "typedarray-to-buffer",
+ "js-beautify",
+ "string-width",
+ "sisteransi",
+ "zod",
+ "path-parse",
+ "is-docker",
+ "tiny-case",
+ "object.fromentries",
+ "mz",
+ "use-child",
+ "plist",
+ "universal-cookie",
+ "color-string",
+ "get-intrinsic",
+ "escalade",
+ "kind-of",
+ "object.hasown",
+ "@headlessui/react",
+ "is-binary-path",
+ "has-symbols",
+ "eslint-config-next",
+ "object.entries",
+ "cli-cursor",
+ "eslint",
+ "@ionic/utils-terminal",
+ "@ionic/utils-array",
+ "@ionic/cli-framework-output",
+ "@ionic/utils-fs",
+ "@ionic/utils-object",
+ "@ionic/utils-process",
+ "@ionic/utils-stream",
+ "@ionic/utils-subprocess",
+ "native-run",
+ "import-fresh",
+ "cross-fetch",
+ "immutable",
+ "cli-truncate",
+ "emoji-regex",
+ "is-arrayish",
+ "object.values",
+ "deep-is",
+ "prelude-ls",
+ "bufferutil",
+ "style-to-js",
+ "es-to-primitive",
+ "ansi-regex",
+ "has-bigints",
+ "find-up",
+ "define-lazy-prop",
+ "safe-array-concat",
+ "path-is-absolute",
+ "property-expr",
+ "husky",
+ "minizlib",
+ "readdirp",
+ "is-stream",
+ "get-symbol-description",
+ "lilconfig",
+ "globby",
+ "acorn-walk",
+ "natural-compare",
+ "pump",
+ "has-property-descriptors",
+ "array.prototype.flatmap",
+ "lodash",
+ "@typescript-eslint/types",
+ "@typescript-eslint/visitor-keys",
+ "@typescript-eslint/scope-manager",
+ "next-themes",
+ "deepmerge",
+ "through",
+ "prettier-plugin-organize-imports",
+ "editorconfig",
+ "astral-regex",
+ "react-fast-compare",
+ "js-yaml",
+ "thenify-all",
+ "open",
+ "dequal",
+ "yup",
+ "universalify",
+ "ts-api-utils",
+ "pend",
+ "arg",
+ "lodash.merge",
+ "get-tsconfig",
+ "@next/swc-linux-x64-musl",
+ "@next/env",
+ "@next/eslint-plugin-next",
+ "@next/swc-linux-x64-gnu",
+ "zustand",
+ "es-set-tostringtag",
+ "dlv",
+ "@alloc/quick-lru",
+ "postcss-load-config",
+ "normalize-range",
+ "p-try",
+ "callsites",
+ "mini-svg-data-uri",
+ "interpret",
+ "eslint-import-resolver-node",
+ "string_decoder",
+ "@heroicons/react",
+ "log-update",
+ "is-fullwidth-code-point",
+ "functions-have-names",
+ "eastasianwidth",
+ "@eslint-community/regexpp",
+ "@eslint-community/eslint-utils",
+ "cli-spinners",
+ "locate-path",
+ "whatwg-url",
+ "node-releases",
+ "string.prototype.trimstart",
+ "globals",
+ "defined",
+ "is-shared-array-buffer",
+ "react-tagsinput",
+ "react-is",
+ "queue-tick",
+ "fraction.js",
+ "base64-js",
+ "fill-range",
+ "is-glob",
+ "sass",
+ "@xmldom/xmldom",
+ "node-addon-api",
+ "is-typed-array",
+ "lint-staged",
+ "which-boxed-primitive",
+ "chalk",
+ "react-error-boundary",
+ "language-tags",
+ "is-extendable",
+ "decompress-response",
+ "path-exists",
+ "uuid",
+ "fast-xml-parser",
+ "is-typedarray",
+ "leac",
+ "unbox-primitive",
+ "eslint-config-prettier",
+ "postcss",
+ "json-stable-stringify-without-jsonify",
+ "fast-fifo",
+ "levn",
+ "condense-newlines",
+ "is-plain-object",
+ "@capacitor/haptics",
+ "@capacitor/core",
+ "@capacitor/status-bar",
+ "@capacitor/app",
+ "@capacitor/android",
+ "@capacitor/ios",
+ "@capacitor/cli",
+ "@capacitor/keyboard",
+ "onetime",
+ "peberminta",
+ "has-proto",
+ "safe-buffer",
+ "camelcase-css",
+ "csstype",
+ "postcss-selector-parser",
+ "array.prototype.findlastindex",
+ "@octokit/endpoint",
+ "@octokit/request-error",
+ "@octokit/auth-token",
+ "@octokit/tsconfig",
+ "@octokit/core",
+ "@octokit/plugin-rest-endpoint-methods",
+ "@octokit/plugin-paginate-rest",
+ "@octokit/graphql",
+ "@octokit/types",
+ "@octokit/openapi-types",
+ "@octokit/request",
+ "@octokit/rest",
+ "@octokit/plugin-request-log",
+ "object-inspect",
+ "debug",
+ "streamsearch",
+ "to-regex-range",
+ "eslint-plugin-react-hooks",
+ "object.groupby",
+ "is-weakref",
+ "call-bind",
+ "lodash-es",
+ "bl",
+ "punycode",
+ "ajv",
+ "execa",
+ "detect-package-manager",
+ "is-number",
+ "@react-email/components",
+ "@react-email/tailwind",
+ "@react-email/heading",
+ "@react-email/head",
+ "@react-email/body",
+ "@react-email/html",
+ "@react-email/column",
+ "@react-email/text",
+ "@react-email/hr",
+ "@react-email/render",
+ "@react-email/font",
+ "@react-email/button",
+ "@react-email/row",
+ "@react-email/preview",
+ "@react-email/container",
+ "@react-email/section",
+ "@react-email/link",
+ "@react-email/img",
+ "ora",
+ "@selderee/plugin-htmlparser2",
+ "detective",
+ "strip-final-newline",
+ "@aashutoshrathi/word-wrap",
+ "ms",
+ "globalthis",
+ "is-negative-zero",
+ "setimmediate",
+ "js-tokens",
+ "any-promise",
+ "react-email",
+ "typed-array-byte-length",
+ "is-core-module",
+ "string.prototype.trim",
+ "yaeti",
+ "path-type",
+ "read-cache",
+ "brace-expansion",
+ "fast-deep-equal",
+ "chokidar",
+ "fd-slicer",
+ "util-deprecate",
+ "next",
+ "bluebird",
+ "@lexical/clipboard",
+ "@lexical/dragon",
+ "@lexical/rich-text",
+ "@lexical/selection",
+ "@lexical/html",
+ "@lexical/offset",
+ "@lexical/code",
+ "@lexical/utils",
+ "@lexical/hashtag",
+ "@lexical/text",
+ "@lexical/history",
+ "@lexical/mark",
+ "@lexical/yjs",
+ "@lexical/list",
+ "@lexical/overflow",
+ "@lexical/table",
+ "@lexical/markdown",
+ "@lexical/link",
+ "@lexical/react",
+ "@lexical/plain-text",
+ "merge-stream",
+ "node-gyp-build",
+ "object-assign",
+ "listr2",
+ "has-tostringtag",
+ "tailwindcss",
+ "npm-run-path",
+ "spdx-expression-parse",
+ "p-map",
+ "react-cookie",
+ "object.assign",
+ "commander",
+ "es6-iterator",
+ "fast-levenshtein",
+ "wcwidth",
+ "lodash.castarray",
+ "thenify",
+ "is-wsl",
+ "strip-ansi",
+ "is-unicode-supported",
+ "simple-get",
+ "indent-string",
+ "has-flag",
+ "buffer",
+ "client-only",
+ "p-locate",
+ "scheduler",
+ "lodash.isplainobject",
+ "prettier",
+ "mimic-fn",
+ "defaults",
+ "@uiball/loaders",
+ "jose",
+ "read-yaml-file",
+ "function-bind",
+ "string.prototype.matchall",
+ "buffer-crc32",
+ "flat-cache",
+ "available-typed-arrays",
+ "tr46",
+ "@nodelib/fs.stat",
+ "@nodelib/fs.scandir",
+ "@nodelib/fs.walk",
+ "is-bigint",
+ "get-stream",
+ "is-array-buffer",
+ "slice-ansi",
+ "shebang-regex",
+ "browserslist",
+ "export-to-csv",
+ "color",
+ "array-includes",
+ "set-cookie-parser",
+ "side-channel",
+ "update-browserslist-db",
+ "jiti",
+ "binary",
+ "loose-envify",
+ "strnum",
+ "tar-fs",
+ "@rushstack/eslint-patch",
+ "postcss-import",
+ "cross-spawn",
+ "shebang-command",
+ "jsonfile",
+ "@radix-ui/react-slot",
+ "@radix-ui/react-compose-refs",
+ "dom-serializer",
+ "tapable",
+ "postcss-nested",
+ "untildify",
+ "mimic-response",
+ "typed-array-length",
+ "react",
+ "picomatch",
+ "parseley",
+ "prompts",
+ "ignore",
+ "postcss-js",
+ "extend-shallow",
+ "unzipper",
+ "acorn",
+ "log-symbols",
+ "mkdirp",
+ "isarray",
+ "github-from-package"
+ ],
+ "BSD-3-Clause": [
+ "esquery",
+ "duplexer2",
+ "source-map-js",
+ "hoist-non-react-statics",
+ "shelljs",
+ "ieee754",
+ "sprintf-js",
+ "@humanwhocodes/object-schema"
+ ],
+ "ISC": [
+ "semver",
+ "inflight",
+ "fs.realpath",
+ "eslint-import-resolver-typescript",
+ "ast-types-flow",
+ "at-least-node",
+ "fastq",
+ "isexe",
+ "tar",
+ "type",
+ "next-tick",
+ "b4a",
+ "chownr",
+ "fs-minipass",
+ "rimraf",
+ "canvas-confetti",
+ "flatted",
+ "graceful-fs",
+ "universal-user-agent",
+ "es6-symbol",
+ "fast-folder-size",
+ "signal-exit",
+ "electron-to-chromium",
+ "es5-ext",
+ "glob",
+ "lru-cache",
+ "ini",
+ "abbrev",
+ "nopt",
+ "yaml",
+ "deprecation",
+ "minipass",
+ "glob-parent",
+ "listenercount",
+ "proto-list",
+ "which",
+ "wrappy",
+ "ext",
+ "split2",
+ "hosted-git-info",
+ "yallist",
+ "anymatch",
+ "inherits",
+ "d",
+ "sax",
+ "once",
+ "fstream",
+ "minimatch",
+ "picocolors"
+ ],
+ "BSD-2-Clause": [
+ "domhandler",
+ "glob-to-regexp",
+ "entities",
+ "estraverse",
+ "espree",
+ "webidl-conversions",
+ "damerau-levenshtein",
+ "esutils",
+ "normalize-package-data",
+ "@typescript-eslint/parser",
+ "@typescript-eslint/typescript-estree",
+ "esrecurse",
+ "domutils",
+ "esprima",
+ "uri-js",
+ "domelementtype",
+ "eslint-scope"
+ ],
+ "CC0-1.0": ["spdx-license-ids", "language-subtag-registry"],
+ "Unlicense": ["big-integer"],
+ "(MIT OR WTFPL)": ["expand-template"],
+ "MPL-2.0": ["axe-core", "@vercel/analytics"],
+ "MIT/X11": ["traverse", "chainsaw"],
+ "Python-2.0": ["argparse"],
+ "(MIT OR CC0-1.0)": ["type-fest"],
+ "0BSD": ["tslib"],
+ "CC-BY-4.0": ["caniuse-lite"],
+ "BlueOak-1.0.0": ["path-scurry"],
+ "CC-BY-3.0": ["spdx-exceptions"],
+ "(BSD-2-Clause OR MIT OR Apache-2.0)": ["rc"],
+ "Unknown": ["buffers"]
+}
diff --git a/rls/deno.jsonc b/rls/deno.jsonc
deleted file mode 100644
index a0eda5d4..00000000
--- a/rls/deno.jsonc
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "tasks": {
- "export": "deno run --allow-write ./index.ts"
- }
-}
diff --git a/scripts/.vscode/settings.json b/scripts/.vscode/settings.json
new file mode 100644
index 00000000..e600b0d6
--- /dev/null
+++ b/scripts/.vscode/settings.json
@@ -0,0 +1,5 @@
+{
+ "deno.enable": true,
+ "deno.lint": true,
+ "deno.unstable": true
+}
diff --git a/scripts/deno.jsonc b/scripts/deno.jsonc
new file mode 100644
index 00000000..094a6904
--- /dev/null
+++ b/scripts/deno.jsonc
@@ -0,0 +1,6 @@
+{
+ "tasks": {
+ "export-rls": "deno run --allow-write ./rls/index.ts",
+ "export-licenses": "deno run --allow-read --allow-write ./licenses/index.ts"
+ }
+}
diff --git a/scripts/licenses/index.ts b/scripts/licenses/index.ts
new file mode 100644
index 00000000..6302634c
--- /dev/null
+++ b/scripts/licenses/index.ts
@@ -0,0 +1,127 @@
+const licenses: Record = {};
+
+// NodeJS polyfill
+const deno = ((globalThis as { [key: string]: unknown }).Deno as {
+ writeTextFile: (file: string, content: string) => Promise;
+ readTextFile: (file: string) => Promise;
+ readDir: (folder: string) => AsyncIterableIterator<{
+ name: string;
+ isFile: boolean;
+ isDirectory: boolean;
+ isSymlink: boolean;
+ }>;
+}) ?? {
+ // deno-lint-ignore require-await
+ writeTextFile: async (_file: string, _content: string) => {
+ // eslint-disable-next-line no-console
+ console.log("Why are you running this in node?");
+ throw new Error("Run this script in deno (deno task)");
+ },
+ // deno-lint-ignore require-await
+ readTextFile: async (_file: string) => {
+ // eslint-disable-next-line no-console
+ console.log("Why are you running this in node?");
+ throw new Error("Run this script in deno (deno task)");
+ },
+ // deno-lint-ignore require-await
+ readDir: async (_folder: string) => {
+ // eslint-disable-next-line no-console
+ console.log("Why are you running this in node?");
+ throw new Error("Run this script in deno (deno task)");
+ },
+};
+
+const isFile = async (path: string) => {
+ try {
+ const info = await deno.readTextFile(path);
+ return info;
+ } catch {
+ return undefined;
+ }
+};
+
+const fetchLicense = (
+ licenseField:
+ | string
+ | Record
+ | string[]
+ | Record[]
+): string | string[] => {
+ if (typeof licenseField == "string") {
+ return licenseField;
+ }
+ if (Array.isArray(licenseField)) {
+ return licenseField.map((license) => fetchLicense(license) as string);
+ }
+ if (typeof licenseField == "object") {
+ // types my beloved
+ const licenseFieldObject = licenseField as Record;
+ if (licenseFieldObject.type != undefined) {
+ return licenseFieldObject.type;
+ }
+ if (licenseFieldObject.name != undefined) {
+ return licenseFieldObject.name;
+ }
+ }
+ return "unknown";
+};
+
+const walkFolder = async (folder: string, packageRoot?: string) => {
+ for await (const directory of deno.readDir(folder)) {
+ if (!directory.isDirectory) continue;
+ if ([".bin", ".cache"].includes(directory.name)) continue;
+ const packageJson = await isFile(
+ `${folder}/${directory.name}/package.json`
+ );
+ if (packageJson != undefined) {
+ const packageInfo = JSON.parse(packageJson);
+ if (
+ packageInfo.license != undefined ||
+ packageInfo.licenses != undefined
+ ) {
+ const licenseData = fetchLicense(
+ packageInfo.license ?? packageInfo.licenses
+ );
+ const licenseList = Array.isArray(licenseData)
+ ? licenseData
+ : [licenseData];
+ for (const license of licenseList) {
+ licenses[license] ??= [];
+ licenses[license].push(
+ `${packageRoot != undefined ? `${packageRoot}/` : ""}${
+ directory.name
+ }`
+ );
+ }
+ continue;
+ } else {
+ // eslint-disable-next-line no-console
+ console.log(
+ `${packageRoot != undefined ? `${packageRoot}/` : ""}${
+ directory.name
+ } has no license`
+ );
+ licenses["Unknown"] ??= [];
+ licenses["Unknown"].push(
+ `${packageRoot != undefined ? `${packageRoot}/` : ""}${
+ directory.name
+ }`
+ );
+ }
+ } else {
+ if (packageRoot == undefined) {
+ await walkFolder(`${folder}/${directory.name}`, directory.name);
+ }
+ }
+ }
+};
+
+await walkFolder("../node_modules");
+
+await deno.writeTextFile(
+ "../public/licenses.json",
+ JSON.stringify(licenses, null, 4)
+);
+
+// Made node happy or whatever
+export {};
diff --git a/rls/.gitignore b/scripts/rls/.gitignore
similarity index 100%
rename from rls/.gitignore
rename to scripts/rls/.gitignore
diff --git a/rls/.vscode/settings.json b/scripts/rls/.vscode/settings.json
similarity index 100%
rename from rls/.vscode/settings.json
rename to scripts/rls/.vscode/settings.json
diff --git a/rls/ScriptQL.ts b/scripts/rls/ScriptQL.ts
similarity index 96%
rename from rls/ScriptQL.ts
rename to scripts/rls/ScriptQL.ts
index 940dcc98..6821c007 100644
--- a/rls/ScriptQL.ts
+++ b/scripts/rls/ScriptQL.ts
@@ -141,10 +141,11 @@ export const savePolicies = async (file: string, ...policies: Policy[]) => {
const deno = ((globalThis as { [key: string]: unknown }).Deno as {
writeTextFile: (file: string, content: string) => Promise;
}) ?? {
- writeTextFile: async (file: string, content: string) => {
+ // deno-lint-ignore require-await
+ writeTextFile: async (_file: string, _content: string) => {
// eslint-disable-next-line no-console
console.log("Why are you running this in node?");
- throw new Error("Run this with `Deno task export`");
+ throw new Error("Run this script in deno (deno task)");
},
};
diff --git a/rls/index.ts b/scripts/rls/index.ts
similarity index 97%
rename from rls/index.ts
rename to scripts/rls/index.ts
index 23a6a1eb..0e119e47 100644
--- a/rls/index.ts
+++ b/scripts/rls/index.ts
@@ -22,7 +22,7 @@ import {
import { adminModifyClassUsers } from "./tables/classUsers.ts";
savePolicies(
- "./policies.sql",
+ "./rls/policies.sql",
assignmentViewing,
assignmentManagement,
assignmentSubmissionView,
diff --git a/rls/tables/agendas.ts b/scripts/rls/tables/agendas.ts
similarity index 100%
rename from rls/tables/agendas.ts
rename to scripts/rls/tables/agendas.ts
diff --git a/rls/tables/assignments.ts b/scripts/rls/tables/assignments.ts
similarity index 100%
rename from rls/tables/assignments.ts
rename to scripts/rls/tables/assignments.ts
diff --git a/rls/tables/classUsers.ts b/scripts/rls/tables/classUsers.ts
similarity index 100%
rename from rls/tables/classUsers.ts
rename to scripts/rls/tables/classUsers.ts
diff --git a/rls/tables/classes.ts b/scripts/rls/tables/classes.ts
similarity index 100%
rename from rls/tables/classes.ts
rename to scripts/rls/tables/classes.ts
diff --git a/rls/tables/enrolled.ts b/scripts/rls/tables/enrolled.ts
similarity index 100%
rename from rls/tables/enrolled.ts
rename to scripts/rls/tables/enrolled.ts
diff --git a/rls/tables/submissions.ts b/scripts/rls/tables/submissions.ts
similarity index 100%
rename from rls/tables/submissions.ts
rename to scripts/rls/tables/submissions.ts
diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json
new file mode 100644
index 00000000..683701aa
--- /dev/null
+++ b/scripts/tsconfig.json
@@ -0,0 +1,7 @@
+{
+ "compilerOptions": {
+ "allowImportingTsExtensions": true,
+ "target": "ESNext",
+ "module": "ESNext"
+ }
+}
diff --git a/tsconfig.json b/tsconfig.json
index 451dc27b..913e7716 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -33,5 +33,5 @@
"emails/index.tsx",
"emails/onboardingStudent.tsx"
],
- "exclude": ["node_modules", "supabase"]
+ "exclude": ["node_modules", "supabase", "scripts"]
}