From 7b973967e8fa626a860fc3955e98682a90ba4123 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Tue, 30 Aug 2022 00:06:28 -0400 Subject: [PATCH 01/42] chore: wip --- .gitignore | 2 + bin/sync_plugins_sanity.ts | 91 +++ bin/tsconfig.json | 101 +++ package-lock.json | 1446 ++++++++++++++++++++++++++++++++++++ package.json | 3 + 5 files changed, 1643 insertions(+) create mode 100644 bin/sync_plugins_sanity.ts create mode 100644 bin/tsconfig.json diff --git a/.gitignore b/.gitignore index 43ffa20e4..ecc9b628c 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ node_modules /build .vscode .DS_Store + +.env \ No newline at end of file diff --git a/bin/sync_plugins_sanity.ts b/bin/sync_plugins_sanity.ts new file mode 100644 index 000000000..c872fe32c --- /dev/null +++ b/bin/sync_plugins_sanity.ts @@ -0,0 +1,91 @@ +// eslint-env node +import type { SanityClient } from '@sanity/client' +import sanityClient from '@sanity/client' +import dotenv from 'dotenv' + +// Using dotenv for local development. When its running in a GitHub action it will use the GitHub action's environment variables +dotenv.config() + +const sanityFieldNameToPluginKeyLookup = { + title: 'name', + description: 'description', + // In sanity, the field is an array of authors, in plugins.json. it's one author + authors: 'author', + packageName: 'package', + repoUrl: 'repo', + version: 'version', + // an object that can be null + compatibility: 'compatibility', +} as const + +type SanityFieldNameToPluginKeyLookup = typeof sanityFieldNameToPluginKeyLookup + +interface SanityBuildPluginEntity { + authors: [ + { + _key: string + _ref: string + _type: 'reference' + }, + ] + compatibility: null + description: string + packageName: string + repoUrl: string + title: string + version: string +} + +type SanityPluginLookup = Record + +// eslint-disable-next-line n/prefer-global/process +const { SANITY_API_TOKEN, SANITY_PROJECT_ID, SANITY_DATASET } = process.env +const [apiVersion] = new Date().toISOString().split('T') + +/** + * Retrieves a list of all the plugins stored in Sanity + * + * @param client Sanity client + * @param query Query to execute + * @returns A list of all the plugins stored in Sanity + */ +const getSanityPluginLookup = async (client: SanityClient, query: string) => { + const plugins = await client.fetch(query, {}) + const pluginLookup = plugins.reduce((sanitytPluginLookup: SanityPluginLookup, plugin: SanityBuildPluginEntity) => { + // eslint-disable-next-line no-param-reassign + sanitytPluginLookup[plugin.packageName] = plugin + + return sanitytPluginLookup + }, {}) + + return pluginLookup +} + +// TODO: projectId and dataset should be read from GH action secrets? +const config = { + projectId: SANITY_PROJECT_ID, + dataset: SANITY_DATASET, + apiVersion, + token: SANITY_API_TOKEN, + // make sure we have the freshest data when doing the diff with plugins.json + useCdn: false, +} + +/** + * @type: SanityClient + */ +const client = sanityClient(config) + +const query = `*[_type == "buildPlugin"] { title, description, authors, packageName, repoUrl, version, compatibility }` + +// TODO: Add a retry mechanism to handle network errors +;(async () => { + try { + const sanityPluginLookup = await getSanityPluginLookup(client, query) + + console.log(JSON.stringify(sanityPluginLookup, null, 2)) + } catch (error) { + console.error(error) + throw new Error('Unable to retrieve plugins from CMS') + } +})() diff --git a/bin/tsconfig.json b/bin/tsconfig.json new file mode 100644 index 000000000..28482da8c --- /dev/null +++ b/bin/tsconfig.json @@ -0,0 +1,101 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + // "incremental": true, /* Enable incremental compilation */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "ES2020" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */ + // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + + /* Modules */ + "module": "commonjs" /* Specify what module code is generated. */, + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "resolveJsonModule": true, /* Enable importing .json files */ + // "noResolve": true, /* Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ + // "outDir": "./", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */, + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, + + /* Type Checking */ + "strict": true /* Enable all strict type-checking options. */, + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */ + // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */ + // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} diff --git a/package-lock.json b/package-lock.json index 668fdc287..986b53b59 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,9 +10,11 @@ "license": "MIT", "devDependencies": { "@netlify/eslint-config-node": "^6.0.0", + "@sanity/client": "^3.3.6", "ava": "^4.3.3", "c8": "^7.11.0", "diff": "^5.0.0", + "dotenv": "^16.0.1", "got": "^11.8.0", "husky": "^7.0.4", "is-plain-obj": "^4.0.0", @@ -20,6 +22,7 @@ "normalize-node-version": "^11.0.0", "pacote": "^13.0.0", "semver": "^7.0.0", + "tsx": "^3.9.0", "upper-case-first": "^2.0.2" }, "engines": { @@ -784,6 +787,52 @@ "node": ">=12" } }, + "node_modules/@esbuild-kit/cjs-loader": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/@esbuild-kit/cjs-loader/-/cjs-loader-2.3.3.tgz", + "integrity": "sha512-Rt4O1mXlPEDVxvjsHLgbtHVdUXYK9C1/6ThpQnt7FaXIjUOsI6qhHYMgALhNnlIMZffag44lXd6Dqgx3xALbpQ==", + "dev": true, + "dependencies": { + "@esbuild-kit/core-utils": "^2.1.0", + "get-tsconfig": "^4.1.0" + } + }, + "node_modules/@esbuild-kit/core-utils": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@esbuild-kit/core-utils/-/core-utils-2.3.0.tgz", + "integrity": "sha512-JL73zt/LN/qqziHuod4/bM2xBNNofDZu1cbwT6KIn6B11lA4cgDXkoSHOfNCbZMZOnh0Aqf0vW/gNQC+Z18hKQ==", + "dev": true, + "dependencies": { + "esbuild": "~0.15.4", + "source-map-support": "^0.5.21" + } + }, + "node_modules/@esbuild-kit/esm-loader": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/@esbuild-kit/esm-loader/-/esm-loader-2.4.2.tgz", + "integrity": "sha512-N9dPKAj8WOx6djVnStgILWXip4fjDcBk9L7azO0/uQDpu8Ee0eaL78mkN4Acid9BzvNAKWwdYXFJZnsVahNEew==", + "dev": true, + "dependencies": { + "@esbuild-kit/core-utils": "^2.1.0", + "get-tsconfig": "^4.1.0" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.6.tgz", + "integrity": "sha512-hqmVU2mUjH6J2ZivHphJ/Pdse2ZD+uGCHK0uvsiLDk/JnSedEVj77CiVUnbMKuU4tih1TZZL8tG9DExQg/GZsw==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@eslint/eslintrc": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz", @@ -1276,6 +1325,41 @@ "node": "^12.13.0 || ^14.15.0 || >=16" } }, + "node_modules/@sanity/client": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/@sanity/client/-/client-3.3.6.tgz", + "integrity": "sha512-UgCHWnpb0N0q1K8NYqAZ4iWpja0ts9LEnuUXcYYbx2xmA57LgA6myCxIVXsF/XH1ArbCQNth0r7zcVpxYH++bQ==", + "dev": true, + "dependencies": { + "@sanity/eventsource": "^4.0.0", + "get-it": "^6.1.1", + "make-error": "^1.3.0", + "object-assign": "^4.1.1", + "rxjs": "^6.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@sanity/eventsource": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@sanity/eventsource/-/eventsource-4.0.0.tgz", + "integrity": "sha512-W0AD141JILOySJ177j2+HTr5k4tWNyXjGsr0dDXJzpqlwZ09J/uPHI73hMe5XtoFumPa9Bj6jy8uu2qdZX84NQ==", + "dev": true, + "dependencies": { + "event-source-polyfill": "1.0.25", + "eventsource": "^2.0.2" + } + }, + "node_modules/@sanity/timed-out": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@sanity/timed-out/-/timed-out-4.0.2.tgz", + "integrity": "sha512-NBDKGj14g9Z+bopIvZcQKWCzJq5JSrdmzRR1CS+iyA3Gm8SnIWBfZa7I3mTg2X6Nu8LQXG0EPKXdOGozLS4i3w==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/@sindresorhus/is": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.2.1.tgz", @@ -2254,6 +2338,12 @@ "url": "https://opencollective.com/browserslist" } }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, "node_modules/builtin-modules": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.2.0.tgz", @@ -2463,6 +2553,15 @@ "url": "https://opencollective.com/browserslist" } }, + "node_modules/capture-stack-trace": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.1.tgz", + "integrity": "sha512-mYQLZnx5Qt1JgB1WEiMCf2647plpGeQ2NMR/5L0HNZzGQo4fuSPnK+wjfPnKZV0aiJDgzmWqqkV/g7JD+DW0qw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/cbor": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/cbor/-/cbor-8.1.0.tgz", @@ -2946,6 +3045,12 @@ "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true + }, "node_modules/cosmiconfig": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz", @@ -2981,6 +3086,18 @@ "typescript": ">=3" } }, + "node_modules/create-error-class": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz", + "integrity": "sha512-gYTKKexFO3kh200H1Nit76sRwRtOY32vQd3jpAQKpLtZqyNsSQNfI4N7o3eP2wUjV35pTWKRYqFUDBvUha/Pkw==", + "dev": true, + "dependencies": { + "capture-stack-trace": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/create-eslint-index": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/create-eslint-index/-/create-eslint-index-1.0.0.tgz", @@ -3327,6 +3444,15 @@ "node": ">=8" } }, + "node_modules/dotenv": { + "version": "16.0.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.1.tgz", + "integrity": "sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ==", + "dev": true, + "engines": { + "node": ">=12" + } + }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -3475,6 +3601,362 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/esbuild": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.6.tgz", + "integrity": "sha512-sgLOv3l4xklvXzzczhRwKRotyrfyZ2i1fCS6PTOLPd9wevDPArGU8HFtHrHCOcsMwTjLjzGm15gvC8uxVzQf+w==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/linux-loong64": "0.15.6", + "esbuild-android-64": "0.15.6", + "esbuild-android-arm64": "0.15.6", + "esbuild-darwin-64": "0.15.6", + "esbuild-darwin-arm64": "0.15.6", + "esbuild-freebsd-64": "0.15.6", + "esbuild-freebsd-arm64": "0.15.6", + "esbuild-linux-32": "0.15.6", + "esbuild-linux-64": "0.15.6", + "esbuild-linux-arm": "0.15.6", + "esbuild-linux-arm64": "0.15.6", + "esbuild-linux-mips64le": "0.15.6", + "esbuild-linux-ppc64le": "0.15.6", + "esbuild-linux-riscv64": "0.15.6", + "esbuild-linux-s390x": "0.15.6", + "esbuild-netbsd-64": "0.15.6", + "esbuild-openbsd-64": "0.15.6", + "esbuild-sunos-64": "0.15.6", + "esbuild-windows-32": "0.15.6", + "esbuild-windows-64": "0.15.6", + "esbuild-windows-arm64": "0.15.6" + } + }, + "node_modules/esbuild-android-64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.6.tgz", + "integrity": "sha512-Z1CHSgB1crVQi2LKSBwSkpaGtaloVz0ZIYcRMsvHc3uSXcR/x5/bv9wcZspvH/25lIGTaViosciS/NS09ERmVA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-android-arm64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.6.tgz", + "integrity": "sha512-mvM+gqNxqKm2pCa3dnjdRzl7gIowuc4ga7P7c3yHzs58Im8v/Lfk1ixSgQ2USgIywT48QWaACRa3F4MG7djpSw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.6.tgz", + "integrity": "sha512-BsfVt3usScAfGlXJiGtGamwVEOTM8AiYiw1zqDWhGv6BncLXCnTg1As+90mxWewdTZKq3iIy8s9g8CKkrrAXVw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-arm64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.6.tgz", + "integrity": "sha512-CnrAeJaEpPakUobhqO4wVSA4Zm6TPaI5UY4EsI62j9mTrjIyQPXA1n4Ju6Iu5TVZRnEqV6q8blodgYJ6CJuwCA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.6.tgz", + "integrity": "sha512-+qFdmqi+jkAsxsNJkaWVrnxEUUI50nu6c3MBVarv3RCDCbz7ZS1a4ZrdkwEYFnKcVWu6UUE0Kkb1SQ1yGEG6sg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-arm64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.6.tgz", + "integrity": "sha512-KtQkQOhnNciXm2yrTYZMD3MOm2zBiiwFSU+dkwNbcfDumzzUprr1x70ClTdGuZwieBS1BM/k0KajRQX7r504Xw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-32": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.6.tgz", + "integrity": "sha512-IAkDNz3TpxwISTGVdQijwyHBZrbFgLlRi5YXcvaEHtgbmayLSDcJmH5nV1MFgo/x2QdKcHBkOYHdjhKxUAcPwg==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.6.tgz", + "integrity": "sha512-gQPksyrEYfA4LJwyfTQWAZaVZCx4wpaLrSzo2+Xc9QLC+i/sMWmX31jBjrn4nLJCd79KvwCinto36QC7BEIU/A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.6.tgz", + "integrity": "sha512-xZ0Bq2aivsthDjA/ytQZzxrxIZbG0ATJYMJxNeOIBc1zUjpbVpzBKgllOZMsTSXMHFHGrow6TnCcgwqY0+oEoQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.6.tgz", + "integrity": "sha512-aovDkclFa6C9EdZVBuOXxqZx83fuoq8097xZKhEPSygwuy4Lxs8J4anHG7kojAsR+31lfUuxzOo2tHxv7EiNHA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-mips64le": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.6.tgz", + "integrity": "sha512-wVpW8wkWOGizsCqCwOR/G3SHwhaecpGy3fic9BF1r7vq4djLjUcA8KunDaBCjJ6TgLQFhJ98RjDuyEf8AGjAvw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-ppc64le": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.6.tgz", + "integrity": "sha512-z6w6gsPH/Y77uchocluDC8tkCg9rfkcPTePzZKNr879bF4tu7j9t255wuNOCE396IYEGxY7y8u2HJ9i7kjCLVw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-riscv64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.6.tgz", + "integrity": "sha512-pfK/3MJcmbfU399TnXW5RTPS1S+ID6ra+CVj9TFZ2s0q9Ja1F5A1VirUUvViPkjiw+Kq3zveyn6U09Wg1zJXrw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-s390x": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.6.tgz", + "integrity": "sha512-OZeeDu32liefcwAE63FhVqM4heWTC8E3MglOC7SK0KYocDdY/6jyApw0UDkDHlcEK9mW6alX/SH9r3PDjcCo/Q==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-netbsd-64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.6.tgz", + "integrity": "sha512-kaxw61wcHMyiEsSsi5ut1YYs/hvTC2QkxJwyRvC2Cnsz3lfMLEu8zAjpBKWh9aU/N0O/gsRap4wTur5GRuSvBA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-openbsd-64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.6.tgz", + "integrity": "sha512-CuoY60alzYfIZapUHqFXqXbj88bbRJu8Fp9okCSHRX2zWIcGz4BXAHXiG7dlCye5nFVrY72psesLuWdusyf2qw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-sunos-64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.6.tgz", + "integrity": "sha512-1ceefLdPWcd1nW/ZLruPEYxeUEAVX0YHbG7w+BB4aYgfknaLGotI/ZvPWUZpzhC8l1EybrVlz++lm3E6ODIJOg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-32": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.6.tgz", + "integrity": "sha512-pBqdOsKqCD5LRYiwF29PJRDJZi7/Wgkz46u3d17MRFmrLFcAZDke3nbdDa1c8YgY78RiemudfCeAemN8EBlIpA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.6.tgz", + "integrity": "sha512-KpPOh4aTOo//g9Pk2oVAzXMpc9Sz9n5A9sZTmWqDSXCiiachfFhbuFlsKBGATYCVitXfmBIJ4nNYYWSOdz4hQg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-arm64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.6.tgz", + "integrity": "sha512-DB3G2x9OvFEa00jV+OkDBYpufq5x/K7a6VW6E2iM896DG4ZnAvJKQksOsCPiM1DUaa+DrijXAQ/ZOcKAqf/3Hg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -4433,6 +4915,21 @@ "node": ">=0.10.0" } }, + "node_modules/event-source-polyfill": { + "version": "1.0.25", + "resolved": "https://registry.npmjs.org/event-source-polyfill/-/event-source-polyfill-1.0.25.tgz", + "integrity": "sha512-hQxu6sN1Eq4JjoI7ITdQeGGUN193A2ra83qC0Ltm9I2UJVAten3OFVN6k5RX4YWeCS0BoC8xg/5czOCIHVosQg==", + "dev": true + }, + "node_modules/eventsource": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", + "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==", + "dev": true, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", @@ -4628,6 +5125,26 @@ "integrity": "sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw==", "dev": true }, + "node_modules/follow-redirects": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", + "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/foreground-child": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", @@ -4641,6 +5158,12 @@ "node": ">=8.0.0" } }, + "node_modules/form-urlencoded": { + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/form-urlencoded/-/form-urlencoded-2.0.9.tgz", + "integrity": "sha512-fWUzNiOnYa126vFAT6TFXd1mhJrvD8IqmQ9ilZPjkLYQfaRreBr5fIUoOpPlWtqaAG64nzoE7u5zSetifab9IA==", + "dev": true + }, "node_modules/formdata-polyfill": { "version": "4.0.10", "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", @@ -4653,6 +5176,40 @@ "node": ">=12.20.0" } }, + "node_modules/from2": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", + "integrity": "sha512-OMcX/4IC/uqEPVgGeyfN22LJk6AZrMkRZHxcHBMBvHScDGgwTm2GT2Wkgtocyd3JfZffjj2kYUDXXII0Fk9W0g==", + "dev": true, + "dependencies": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.0" + } + }, + "node_modules/from2/node_modules/readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/from2/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, "node_modules/fs-extra": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", @@ -4763,6 +5320,71 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-it": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/get-it/-/get-it-6.1.1.tgz", + "integrity": "sha512-2835L9lb4NAgjAbFOMMOm2XDSgj+lWmmCQv40A5rE7zZoIdM2+yk7Ie+sBD3T5lHW/Dw5IFFHyx16oQGpAo4hQ==", + "dev": true, + "dependencies": { + "@sanity/timed-out": "^4.0.2", + "create-error-class": "^3.0.2", + "debug": "^2.6.8", + "decompress-response": "^6.0.0", + "follow-redirects": "^1.2.4", + "form-urlencoded": "^2.0.7", + "into-stream": "^3.1.0", + "is-plain-object": "^2.0.4", + "is-retry-allowed": "^1.1.0", + "is-stream": "^1.1.0", + "nano-pubsub": "^1.0.2", + "object-assign": "^4.1.1", + "parse-headers": "^2.0.4", + "progress-stream": "^2.0.0", + "same-origin": "^0.1.1", + "simple-concat": "^1.0.1", + "tunnel-agent": "^0.6.0", + "url-parse": "^1.1.9" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/get-it/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/get-it/node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/get-it/node_modules/is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/get-it/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true + }, "node_modules/get-stream": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", @@ -4791,6 +5413,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-tsconfig": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.2.0.tgz", + "integrity": "sha512-X8u8fREiYOE6S8hLbq99PeykTDoLVnxvF4DjWKJmz9xy2nNRdUcV8ZN9tniJFeKyTU3qnC9lL8n4Chd6LmVKHg==", + "dev": true, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, "node_modules/git-raw-commits": { "version": "2.0.11", "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-2.0.11.tgz", @@ -5261,6 +5892,19 @@ "node": ">= 0.4" } }, + "node_modules/into-stream": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-3.1.0.tgz", + "integrity": "sha512-TcdjPibTksa1NQximqep2r17ISRiNE9fwlfbg3F8ANdvP5/yrFTew86VcO//jk4QTaMlbjypPBq76HN2zaKfZQ==", + "dev": true, + "dependencies": { + "from2": "^2.1.1", + "p-is-promise": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/ip": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", @@ -5577,6 +6221,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-retry-allowed": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz", + "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-shared-array-buffer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", @@ -5670,12 +6323,27 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/istanbul-lib-coverage": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", @@ -6543,6 +7211,12 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, + "node_modules/nano-pubsub": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/nano-pubsub/-/nano-pubsub-1.0.2.tgz", + "integrity": "sha512-HtPs1RbULM/z8wt3BbeeZlxVNiJbl+zQAwwrbc0KAq5NHaCG3MmffOVCpRhNTs+TK67MdN6aZ+5wzPtRZvME+w==", + "dev": true + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -7273,6 +7947,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/p-is-promise": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", + "integrity": "sha512-zL7VE4JVS2IFSkR2GQKDSPEVxkoH43/p7oEnwpdCndKYJO0HVeRB7fA8TJwuLOTBREtK0ea8eHaxdwcpob5dmg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -7404,6 +8087,12 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/parse-headers": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz", + "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==", + "dev": true + }, "node_modules/parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", @@ -7696,6 +8385,56 @@ "node": "^12.13.0 || ^14.15.0 || >=16" } }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, + "node_modules/progress-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/progress-stream/-/progress-stream-2.0.0.tgz", + "integrity": "sha512-xJwOWR46jcXUq6EH9yYyqp+I52skPySOeHfkxOZ2IY1AiBi/sFJhbhAKHoV3OTw/omQ45KTio9215dRJ2Yxd3Q==", + "dev": true, + "dependencies": { + "speedometer": "~1.0.0", + "through2": "~2.0.3" + } + }, + "node_modules/progress-stream/node_modules/readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/progress-stream/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/progress-stream/node_modules/through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "dev": true, + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, "node_modules/promise-inflight": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", @@ -7761,6 +8500,12 @@ "teleport": ">=0.2.0" } }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", + "dev": true + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -8059,6 +8804,12 @@ "node": ">=0.10.0" } }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "dev": true + }, "node_modules/resolve": { "version": "1.22.1", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", @@ -8181,6 +8932,18 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "dev": true, + "dependencies": { + "tslib": "^1.9.0" + }, + "engines": { + "npm": ">=2.0.0" + } + }, "node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -8203,6 +8966,12 @@ "dev": true, "optional": true }, + "node_modules/same-origin": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/same-origin/-/same-origin-0.1.1.tgz", + "integrity": "sha512-effkSW9cap879l6CVNdwL5iubVz8tkspqgfiqwgBgFQspV7152WHaLzr5590yR8oFgt7E1d4lO09uUhtAgUPoA==", + "dev": true + }, "node_modules/semver": { "version": "7.3.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", @@ -8298,6 +9067,26 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -8394,6 +9183,25 @@ "node": ">=0.10.0" } }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/source-map-support/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/spdx-correct": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", @@ -8426,6 +9234,12 @@ "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==", "dev": true }, + "node_modules/speedometer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/speedometer/-/speedometer-1.0.0.tgz", + "integrity": "sha512-lgxErLl/7A5+vgIIXsh9MbeukOaCb2axgQ+bKCdIE+ibNT4XNYGNCR1qFEGq6F+YDASXK3Fh/c5FgtZchFolxw==", + "dev": true + }, "node_modules/split2": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", @@ -8924,6 +9738,35 @@ "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" } }, + "node_modules/tsx": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-3.9.0.tgz", + "integrity": "sha512-ofxsE+qjqCYYq4UBt5khglvb+ESgxef1YpuNcdQI92kvcAT2tZVrnSK3g4bRXTUhLmKHcC5q8vIZA47os/stng==", + "dev": true, + "dependencies": { + "@esbuild-kit/cjs-loader": "^2.3.3", + "@esbuild-kit/core-utils": "^2.1.0", + "@esbuild-kit/esm-loader": "^2.4.2" + }, + "bin": { + "tsx": "dist/cli.js" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -9049,6 +9892,16 @@ "punycode": "^2.1.0" } }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dev": true, + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -9220,6 +10073,15 @@ "typedarray-to-buffer": "^3.1.5" } }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true, + "engines": { + "node": ">=0.4" + } + }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", @@ -9870,6 +10732,43 @@ "@cspotcode/source-map-consumer": "0.8.0" } }, + "@esbuild-kit/cjs-loader": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/@esbuild-kit/cjs-loader/-/cjs-loader-2.3.3.tgz", + "integrity": "sha512-Rt4O1mXlPEDVxvjsHLgbtHVdUXYK9C1/6ThpQnt7FaXIjUOsI6qhHYMgALhNnlIMZffag44lXd6Dqgx3xALbpQ==", + "dev": true, + "requires": { + "@esbuild-kit/core-utils": "^2.1.0", + "get-tsconfig": "^4.1.0" + } + }, + "@esbuild-kit/core-utils": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@esbuild-kit/core-utils/-/core-utils-2.3.0.tgz", + "integrity": "sha512-JL73zt/LN/qqziHuod4/bM2xBNNofDZu1cbwT6KIn6B11lA4cgDXkoSHOfNCbZMZOnh0Aqf0vW/gNQC+Z18hKQ==", + "dev": true, + "requires": { + "esbuild": "~0.15.4", + "source-map-support": "^0.5.21" + } + }, + "@esbuild-kit/esm-loader": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/@esbuild-kit/esm-loader/-/esm-loader-2.4.2.tgz", + "integrity": "sha512-N9dPKAj8WOx6djVnStgILWXip4fjDcBk9L7azO0/uQDpu8Ee0eaL78mkN4Acid9BzvNAKWwdYXFJZnsVahNEew==", + "dev": true, + "requires": { + "@esbuild-kit/core-utils": "^2.1.0", + "get-tsconfig": "^4.1.0" + } + }, + "@esbuild/linux-loong64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.6.tgz", + "integrity": "sha512-hqmVU2mUjH6J2ZivHphJ/Pdse2ZD+uGCHK0uvsiLDk/JnSedEVj77CiVUnbMKuU4tih1TZZL8tG9DExQg/GZsw==", + "dev": true, + "optional": true + }, "@eslint/eslintrc": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz", @@ -10232,6 +11131,35 @@ "read-package-json-fast": "^2.0.3" } }, + "@sanity/client": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/@sanity/client/-/client-3.3.6.tgz", + "integrity": "sha512-UgCHWnpb0N0q1K8NYqAZ4iWpja0ts9LEnuUXcYYbx2xmA57LgA6myCxIVXsF/XH1ArbCQNth0r7zcVpxYH++bQ==", + "dev": true, + "requires": { + "@sanity/eventsource": "^4.0.0", + "get-it": "^6.1.1", + "make-error": "^1.3.0", + "object-assign": "^4.1.1", + "rxjs": "^6.0.0" + } + }, + "@sanity/eventsource": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@sanity/eventsource/-/eventsource-4.0.0.tgz", + "integrity": "sha512-W0AD141JILOySJ177j2+HTr5k4tWNyXjGsr0dDXJzpqlwZ09J/uPHI73hMe5XtoFumPa9Bj6jy8uu2qdZX84NQ==", + "dev": true, + "requires": { + "event-source-polyfill": "1.0.25", + "eventsource": "^2.0.2" + } + }, + "@sanity/timed-out": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@sanity/timed-out/-/timed-out-4.0.2.tgz", + "integrity": "sha512-NBDKGj14g9Z+bopIvZcQKWCzJq5JSrdmzRR1CS+iyA3Gm8SnIWBfZa7I3mTg2X6Nu8LQXG0EPKXdOGozLS4i3w==", + "dev": true + }, "@sindresorhus/is": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.2.1.tgz", @@ -10926,6 +11854,12 @@ "picocolors": "^1.0.0" } }, + "buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, "builtin-modules": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.2.0.tgz", @@ -11086,6 +12020,12 @@ "integrity": "sha512-AcKqikjMLlvghZL/vfTHorlQsLDhGRalYf1+GmWCf5SCMziSGjRYQW/JEksj14NaYHIR6KIhrFAy0HV5C25UzQ==", "dev": true }, + "capture-stack-trace": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.1.tgz", + "integrity": "sha512-mYQLZnx5Qt1JgB1WEiMCf2647plpGeQ2NMR/5L0HNZzGQo4fuSPnK+wjfPnKZV0aiJDgzmWqqkV/g7JD+DW0qw==", + "dev": true + }, "cbor": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/cbor/-/cbor-8.1.0.tgz", @@ -11456,6 +12396,12 @@ "integrity": "sha512-rcQ1bsQO9799wq24uE5AM2tAILy4gXGIK/njFWcVQkGNZ96edlpY+A7bjwvzjYvLDyzmG1MmMLZhpcsb+klNMQ==", "dev": true }, + "core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true + }, "cosmiconfig": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz", @@ -11479,6 +12425,15 @@ "ts-node": "^10.4.0" } }, + "create-error-class": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz", + "integrity": "sha512-gYTKKexFO3kh200H1Nit76sRwRtOY32vQd3jpAQKpLtZqyNsSQNfI4N7o3eP2wUjV35pTWKRYqFUDBvUha/Pkw==", + "dev": true, + "requires": { + "capture-stack-trace": "^1.0.0" + } + }, "create-eslint-index": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/create-eslint-index/-/create-eslint-index-1.0.0.tgz", @@ -11729,6 +12684,12 @@ "is-obj": "^2.0.0" } }, + "dotenv": { + "version": "16.0.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.1.tgz", + "integrity": "sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ==", + "dev": true + }, "eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -11847,6 +12808,175 @@ "is-symbol": "^1.0.2" } }, + "esbuild": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.6.tgz", + "integrity": "sha512-sgLOv3l4xklvXzzczhRwKRotyrfyZ2i1fCS6PTOLPd9wevDPArGU8HFtHrHCOcsMwTjLjzGm15gvC8uxVzQf+w==", + "dev": true, + "requires": { + "@esbuild/linux-loong64": "0.15.6", + "esbuild-android-64": "0.15.6", + "esbuild-android-arm64": "0.15.6", + "esbuild-darwin-64": "0.15.6", + "esbuild-darwin-arm64": "0.15.6", + "esbuild-freebsd-64": "0.15.6", + "esbuild-freebsd-arm64": "0.15.6", + "esbuild-linux-32": "0.15.6", + "esbuild-linux-64": "0.15.6", + "esbuild-linux-arm": "0.15.6", + "esbuild-linux-arm64": "0.15.6", + "esbuild-linux-mips64le": "0.15.6", + "esbuild-linux-ppc64le": "0.15.6", + "esbuild-linux-riscv64": "0.15.6", + "esbuild-linux-s390x": "0.15.6", + "esbuild-netbsd-64": "0.15.6", + "esbuild-openbsd-64": "0.15.6", + "esbuild-sunos-64": "0.15.6", + "esbuild-windows-32": "0.15.6", + "esbuild-windows-64": "0.15.6", + "esbuild-windows-arm64": "0.15.6" + } + }, + "esbuild-android-64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.6.tgz", + "integrity": "sha512-Z1CHSgB1crVQi2LKSBwSkpaGtaloVz0ZIYcRMsvHc3uSXcR/x5/bv9wcZspvH/25lIGTaViosciS/NS09ERmVA==", + "dev": true, + "optional": true + }, + "esbuild-android-arm64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.6.tgz", + "integrity": "sha512-mvM+gqNxqKm2pCa3dnjdRzl7gIowuc4ga7P7c3yHzs58Im8v/Lfk1ixSgQ2USgIywT48QWaACRa3F4MG7djpSw==", + "dev": true, + "optional": true + }, + "esbuild-darwin-64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.6.tgz", + "integrity": "sha512-BsfVt3usScAfGlXJiGtGamwVEOTM8AiYiw1zqDWhGv6BncLXCnTg1As+90mxWewdTZKq3iIy8s9g8CKkrrAXVw==", + "dev": true, + "optional": true + }, + "esbuild-darwin-arm64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.6.tgz", + "integrity": "sha512-CnrAeJaEpPakUobhqO4wVSA4Zm6TPaI5UY4EsI62j9mTrjIyQPXA1n4Ju6Iu5TVZRnEqV6q8blodgYJ6CJuwCA==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.6.tgz", + "integrity": "sha512-+qFdmqi+jkAsxsNJkaWVrnxEUUI50nu6c3MBVarv3RCDCbz7ZS1a4ZrdkwEYFnKcVWu6UUE0Kkb1SQ1yGEG6sg==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-arm64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.6.tgz", + "integrity": "sha512-KtQkQOhnNciXm2yrTYZMD3MOm2zBiiwFSU+dkwNbcfDumzzUprr1x70ClTdGuZwieBS1BM/k0KajRQX7r504Xw==", + "dev": true, + "optional": true + }, + "esbuild-linux-32": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.6.tgz", + "integrity": "sha512-IAkDNz3TpxwISTGVdQijwyHBZrbFgLlRi5YXcvaEHtgbmayLSDcJmH5nV1MFgo/x2QdKcHBkOYHdjhKxUAcPwg==", + "dev": true, + "optional": true + }, + "esbuild-linux-64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.6.tgz", + "integrity": "sha512-gQPksyrEYfA4LJwyfTQWAZaVZCx4wpaLrSzo2+Xc9QLC+i/sMWmX31jBjrn4nLJCd79KvwCinto36QC7BEIU/A==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.6.tgz", + "integrity": "sha512-xZ0Bq2aivsthDjA/ytQZzxrxIZbG0ATJYMJxNeOIBc1zUjpbVpzBKgllOZMsTSXMHFHGrow6TnCcgwqY0+oEoQ==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.6.tgz", + "integrity": "sha512-aovDkclFa6C9EdZVBuOXxqZx83fuoq8097xZKhEPSygwuy4Lxs8J4anHG7kojAsR+31lfUuxzOo2tHxv7EiNHA==", + "dev": true, + "optional": true + }, + "esbuild-linux-mips64le": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.6.tgz", + "integrity": "sha512-wVpW8wkWOGizsCqCwOR/G3SHwhaecpGy3fic9BF1r7vq4djLjUcA8KunDaBCjJ6TgLQFhJ98RjDuyEf8AGjAvw==", + "dev": true, + "optional": true + }, + "esbuild-linux-ppc64le": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.6.tgz", + "integrity": "sha512-z6w6gsPH/Y77uchocluDC8tkCg9rfkcPTePzZKNr879bF4tu7j9t255wuNOCE396IYEGxY7y8u2HJ9i7kjCLVw==", + "dev": true, + "optional": true + }, + "esbuild-linux-riscv64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.6.tgz", + "integrity": "sha512-pfK/3MJcmbfU399TnXW5RTPS1S+ID6ra+CVj9TFZ2s0q9Ja1F5A1VirUUvViPkjiw+Kq3zveyn6U09Wg1zJXrw==", + "dev": true, + "optional": true + }, + "esbuild-linux-s390x": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.6.tgz", + "integrity": "sha512-OZeeDu32liefcwAE63FhVqM4heWTC8E3MglOC7SK0KYocDdY/6jyApw0UDkDHlcEK9mW6alX/SH9r3PDjcCo/Q==", + "dev": true, + "optional": true + }, + "esbuild-netbsd-64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.6.tgz", + "integrity": "sha512-kaxw61wcHMyiEsSsi5ut1YYs/hvTC2QkxJwyRvC2Cnsz3lfMLEu8zAjpBKWh9aU/N0O/gsRap4wTur5GRuSvBA==", + "dev": true, + "optional": true + }, + "esbuild-openbsd-64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.6.tgz", + "integrity": "sha512-CuoY60alzYfIZapUHqFXqXbj88bbRJu8Fp9okCSHRX2zWIcGz4BXAHXiG7dlCye5nFVrY72psesLuWdusyf2qw==", + "dev": true, + "optional": true + }, + "esbuild-sunos-64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.6.tgz", + "integrity": "sha512-1ceefLdPWcd1nW/ZLruPEYxeUEAVX0YHbG7w+BB4aYgfknaLGotI/ZvPWUZpzhC8l1EybrVlz++lm3E6ODIJOg==", + "dev": true, + "optional": true + }, + "esbuild-windows-32": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.6.tgz", + "integrity": "sha512-pBqdOsKqCD5LRYiwF29PJRDJZi7/Wgkz46u3d17MRFmrLFcAZDke3nbdDa1c8YgY78RiemudfCeAemN8EBlIpA==", + "dev": true, + "optional": true + }, + "esbuild-windows-64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.6.tgz", + "integrity": "sha512-KpPOh4aTOo//g9Pk2oVAzXMpc9Sz9n5A9sZTmWqDSXCiiachfFhbuFlsKBGATYCVitXfmBIJ4nNYYWSOdz4hQg==", + "dev": true, + "optional": true + }, + "esbuild-windows-arm64": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.6.tgz", + "integrity": "sha512-DB3G2x9OvFEa00jV+OkDBYpufq5x/K7a6VW6E2iM896DG4ZnAvJKQksOsCPiM1DUaa+DrijXAQ/ZOcKAqf/3Hg==", + "dev": true, + "optional": true + }, "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -12539,6 +13669,18 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, + "event-source-polyfill": { + "version": "1.0.25", + "resolved": "https://registry.npmjs.org/event-source-polyfill/-/event-source-polyfill-1.0.25.tgz", + "integrity": "sha512-hQxu6sN1Eq4JjoI7ITdQeGGUN193A2ra83qC0Ltm9I2UJVAten3OFVN6k5RX4YWeCS0BoC8xg/5czOCIHVosQg==", + "dev": true + }, + "eventsource": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", + "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==", + "dev": true + }, "execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", @@ -12685,6 +13827,12 @@ "integrity": "sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw==", "dev": true }, + "follow-redirects": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", + "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==", + "dev": true + }, "foreground-child": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", @@ -12695,6 +13843,12 @@ "signal-exit": "^3.0.2" } }, + "form-urlencoded": { + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/form-urlencoded/-/form-urlencoded-2.0.9.tgz", + "integrity": "sha512-fWUzNiOnYa126vFAT6TFXd1mhJrvD8IqmQ9ilZPjkLYQfaRreBr5fIUoOpPlWtqaAG64nzoE7u5zSetifab9IA==", + "dev": true + }, "formdata-polyfill": { "version": "4.0.10", "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", @@ -12704,6 +13858,42 @@ "fetch-blob": "^3.1.2" } }, + "from2": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", + "integrity": "sha512-OMcX/4IC/uqEPVgGeyfN22LJk6AZrMkRZHxcHBMBvHScDGgwTm2GT2Wkgtocyd3JfZffjj2kYUDXXII0Fk9W0g==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.0" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, "fs-extra": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", @@ -12789,6 +13979,64 @@ "has-symbols": "^1.0.1" } }, + "get-it": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/get-it/-/get-it-6.1.1.tgz", + "integrity": "sha512-2835L9lb4NAgjAbFOMMOm2XDSgj+lWmmCQv40A5rE7zZoIdM2+yk7Ie+sBD3T5lHW/Dw5IFFHyx16oQGpAo4hQ==", + "dev": true, + "requires": { + "@sanity/timed-out": "^4.0.2", + "create-error-class": "^3.0.2", + "debug": "^2.6.8", + "decompress-response": "^6.0.0", + "follow-redirects": "^1.2.4", + "form-urlencoded": "^2.0.7", + "into-stream": "^3.1.0", + "is-plain-object": "^2.0.4", + "is-retry-allowed": "^1.1.0", + "is-stream": "^1.1.0", + "nano-pubsub": "^1.0.2", + "object-assign": "^4.1.1", + "parse-headers": "^2.0.4", + "progress-stream": "^2.0.0", + "same-origin": "^0.1.1", + "simple-concat": "^1.0.1", + "tunnel-agent": "^0.6.0", + "url-parse": "^1.1.9" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", + "dev": true + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true + } + } + }, "get-stream": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", @@ -12805,6 +14053,12 @@ "get-intrinsic": "^1.1.1" } }, + "get-tsconfig": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.2.0.tgz", + "integrity": "sha512-X8u8fREiYOE6S8hLbq99PeykTDoLVnxvF4DjWKJmz9xy2nNRdUcV8ZN9tniJFeKyTU3qnC9lL8n4Chd6LmVKHg==", + "dev": true + }, "git-raw-commits": { "version": "2.0.11", "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-2.0.11.tgz", @@ -13150,6 +14404,16 @@ "side-channel": "^1.0.4" } }, + "into-stream": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-3.1.0.tgz", + "integrity": "sha512-TcdjPibTksa1NQximqep2r17ISRiNE9fwlfbg3F8ANdvP5/yrFTew86VcO//jk4QTaMlbjypPBq76HN2zaKfZQ==", + "dev": true, + "requires": { + "from2": "^2.1.1", + "p-is-promise": "^1.1.0" + } + }, "ip": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", @@ -13366,6 +14630,12 @@ "has-tostringtag": "^1.0.0" } }, + "is-retry-allowed": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz", + "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==", + "dev": true + }, "is-shared-array-buffer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", @@ -13426,12 +14696,24 @@ "call-bind": "^1.0.2" } }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true + }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "dev": true + }, "istanbul-lib-coverage": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", @@ -14074,6 +15356,12 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, + "nano-pubsub": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/nano-pubsub/-/nano-pubsub-1.0.2.tgz", + "integrity": "sha512-HtPs1RbULM/z8wt3BbeeZlxVNiJbl+zQAwwrbc0KAq5NHaCG3MmffOVCpRhNTs+TK67MdN6aZ+5wzPtRZvME+w==", + "dev": true + }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -14620,6 +15908,12 @@ "p-timeout": "^5.0.2" } }, + "p-is-promise": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", + "integrity": "sha512-zL7VE4JVS2IFSkR2GQKDSPEVxkoH43/p7oEnwpdCndKYJO0HVeRB7fA8TJwuLOTBREtK0ea8eHaxdwcpob5dmg==", + "dev": true + }, "p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -14711,6 +16005,12 @@ "is-hexadecimal": "^1.0.0" } }, + "parse-headers": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz", + "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==", + "dev": true + }, "parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", @@ -14900,6 +16200,58 @@ "integrity": "sha512-I/35MfCX2H8jBUhKN8JB8nmqvQo/nKdrBodBY7L3RhDSPPyvOHwLYNmPuhwuJq7a7C3vgFKWGQM+ecPStcvOHA==", "dev": true }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, + "progress-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/progress-stream/-/progress-stream-2.0.0.tgz", + "integrity": "sha512-xJwOWR46jcXUq6EH9yYyqp+I52skPySOeHfkxOZ2IY1AiBi/sFJhbhAKHoV3OTw/omQ45KTio9215dRJ2Yxd3Q==", + "dev": true, + "requires": { + "speedometer": "~1.0.0", + "through2": "~2.0.3" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "dev": true, + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } + } + }, "promise-inflight": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", @@ -14957,6 +16309,12 @@ "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=", "dev": true }, + "querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", + "dev": true + }, "queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -15167,6 +16525,12 @@ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "dev": true + }, "resolve": { "version": "1.22.1", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", @@ -15247,6 +16611,15 @@ "queue-microtask": "^1.2.2" } }, + "rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -15269,6 +16642,12 @@ "dev": true, "optional": true }, + "same-origin": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/same-origin/-/same-origin-0.1.1.tgz", + "integrity": "sha512-effkSW9cap879l6CVNdwL5iubVz8tkspqgfiqwgBgFQspV7152WHaLzr5590yR8oFgt7E1d4lO09uUhtAgUPoA==", + "dev": true + }, "semver": { "version": "7.3.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", @@ -15339,6 +16718,12 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, + "simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "dev": true + }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -15402,6 +16787,24 @@ "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", "dev": true }, + "source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, "spdx-correct": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", @@ -15434,6 +16837,12 @@ "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==", "dev": true }, + "speedometer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/speedometer/-/speedometer-1.0.0.tgz", + "integrity": "sha512-lgxErLl/7A5+vgIIXsh9MbeukOaCb2axgQ+bKCdIE+ibNT4XNYGNCR1qFEGq6F+YDASXK3Fh/c5FgtZchFolxw==", + "dev": true + }, "split2": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", @@ -15793,6 +17202,27 @@ "tslib": "^1.8.1" } }, + "tsx": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-3.9.0.tgz", + "integrity": "sha512-ofxsE+qjqCYYq4UBt5khglvb+ESgxef1YpuNcdQI92kvcAT2tZVrnSK3g4bRXTUhLmKHcC5q8vIZA47os/stng==", + "dev": true, + "requires": { + "@esbuild-kit/cjs-loader": "^2.3.3", + "@esbuild-kit/core-utils": "^2.1.0", + "@esbuild-kit/esm-loader": "^2.4.2", + "fsevents": "~2.3.2" + } + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, "type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -15894,6 +17324,16 @@ "punycode": "^2.1.0" } }, + "url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dev": true, + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -16033,6 +17473,12 @@ "typedarray-to-buffer": "^3.1.5" } }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true + }, "y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", diff --git a/package.json b/package.json index a7625d526..260065158 100644 --- a/package.json +++ b/package.json @@ -36,9 +36,11 @@ "license": "MIT", "devDependencies": { "@netlify/eslint-config-node": "^6.0.0", + "@sanity/client": "^3.3.6", "ava": "^4.3.3", "c8": "^7.11.0", "diff": "^5.0.0", + "dotenv": "^16.0.1", "got": "^11.8.0", "husky": "^7.0.4", "is-plain-obj": "^4.0.0", @@ -46,6 +48,7 @@ "normalize-node-version": "^11.0.0", "pacote": "^13.0.0", "semver": "^7.0.0", + "tsx": "^3.9.0", "upper-case-first": "^2.0.2" }, "engines": { From 19fa8e626c3d8401506016064d05d4911a6b1c8b Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Tue, 30 Aug 2022 00:23:25 -0400 Subject: [PATCH 02/42] chore: switched to ES2022 for TS --- bin/sync_plugins_sanity.ts | 16 +++++++--------- bin/tsconfig.json | 6 +++--- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/bin/sync_plugins_sanity.ts b/bin/sync_plugins_sanity.ts index c872fe32c..d03ebeb34 100644 --- a/bin/sync_plugins_sanity.ts +++ b/bin/sync_plugins_sanity.ts @@ -79,13 +79,11 @@ const client = sanityClient(config) const query = `*[_type == "buildPlugin"] { title, description, authors, packageName, repoUrl, version, compatibility }` // TODO: Add a retry mechanism to handle network errors -;(async () => { - try { - const sanityPluginLookup = await getSanityPluginLookup(client, query) +try { + const sanityPluginLookup = await getSanityPluginLookup(client, query) - console.log(JSON.stringify(sanityPluginLookup, null, 2)) - } catch (error) { - console.error(error) - throw new Error('Unable to retrieve plugins from CMS') - } -})() + console.log(JSON.stringify(sanityPluginLookup, null, 2)) +} catch (error) { + console.error(error) + throw new Error('Unable to retrieve plugins from CMS') +} diff --git a/bin/tsconfig.json b/bin/tsconfig.json index 28482da8c..2f6f0b2b4 100644 --- a/bin/tsconfig.json +++ b/bin/tsconfig.json @@ -11,7 +11,7 @@ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ - "target": "ES2020" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, + "target": "ES2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ @@ -24,9 +24,9 @@ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ /* Modules */ - "module": "commonjs" /* Specify what module code is generated. */, + "module": "ES2022" /* Specify what module code is generated. */, // "rootDir": "./", /* Specify the root folder within your source files. */ - // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + "moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */, // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ From edcb194527f642f8fd0de8484a08dcba315510e8 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Tue, 30 Aug 2022 09:49:25 -0400 Subject: [PATCH 03/42] chore: got query returning actual authors instead of refs --- bin/sync_plugins_sanity.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/bin/sync_plugins_sanity.ts b/bin/sync_plugins_sanity.ts index d03ebeb34..028cc5304 100644 --- a/bin/sync_plugins_sanity.ts +++ b/bin/sync_plugins_sanity.ts @@ -23,9 +23,8 @@ type SanityFieldNameToPluginKeyLookup = typeof sanityFieldNameToPluginKeyLookup interface SanityBuildPluginEntity { authors: [ { - _key: string - _ref: string - _type: 'reference' + _id: string + name: string | null }, ] compatibility: null @@ -76,7 +75,16 @@ const config = { */ const client = sanityClient(config) -const query = `*[_type == "buildPlugin"] { title, description, authors, packageName, repoUrl, version, compatibility }` +const query = `*[_type == "buildPlugin"] { + title, + description, + authors, + authors[]->{_id, name}, + packageName, + repoUrl, + version, + compatibility +}` // TODO: Add a retry mechanism to handle network errors try { @@ -87,3 +95,4 @@ try { console.error(error) throw new Error('Unable to retrieve plugins from CMS') } +// })() From 7bb494302db25eb3d28599d9b0b05b57f48f019b Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Tue, 30 Aug 2022 13:10:33 -0400 Subject: [PATCH 04/42] chore: moved back to TypeScript because existing tests aren't currently set up for TypeScript --- bin/sync_plugins_sanity.js | 49 +++++++++++++++++++ bin/sync_plugins_sanity.ts | 98 -------------------------------------- bin/utils.js | 50 +++++++++++++++++++ 3 files changed, 99 insertions(+), 98 deletions(-) create mode 100644 bin/sync_plugins_sanity.js delete mode 100644 bin/sync_plugins_sanity.ts create mode 100644 bin/utils.js diff --git a/bin/sync_plugins_sanity.js b/bin/sync_plugins_sanity.js new file mode 100644 index 000000000..983474cf0 --- /dev/null +++ b/bin/sync_plugins_sanity.js @@ -0,0 +1,49 @@ +// eslint-env node +import sanityClient from '@sanity/client' +import dotenv from 'dotenv' + +import { getSanityPluginLookup } from './utils.js' + +// Using dotenv for local development. When its running in a GitHub action it will use the GitHub action's environment variables +dotenv.config() + +// eslint-disable-next-line n/prefer-global/process +const { SANITY_API_TOKEN, SANITY_PROJECT_ID, SANITY_DATASET } = process.env +const [apiVersion] = new Date().toISOString().split('T') + +// TODO: projectId and dataset should be read from GH action secrets? +const config = { + projectId: SANITY_PROJECT_ID, + dataset: SANITY_DATASET, + apiVersion, + token: SANITY_API_TOKEN, + // make sure we have the freshest data when doing the diff with plugins.json + useCdn: false, +} + +/** + * @type: SanityClient + */ +const client = sanityClient(config) + +const query = `*[_type == "buildPlugin"] { + title, + description, + authors, + authors[]->{_id, name}, + packageName, + repoUrl, + version, + compatibility +}` + +// TODO: Add a retry mechanism to handle network errors +try { + const sanityPluginLookup = await getSanityPluginLookup(client.fetch(query, {})) + + console.log(JSON.stringify(sanityPluginLookup, null, 2)) +} catch (error) { + console.error(error) + throw new Error('Unable to retrieve plugins from CMS') +} +// })() diff --git a/bin/sync_plugins_sanity.ts b/bin/sync_plugins_sanity.ts deleted file mode 100644 index 028cc5304..000000000 --- a/bin/sync_plugins_sanity.ts +++ /dev/null @@ -1,98 +0,0 @@ -// eslint-env node -import type { SanityClient } from '@sanity/client' -import sanityClient from '@sanity/client' -import dotenv from 'dotenv' - -// Using dotenv for local development. When its running in a GitHub action it will use the GitHub action's environment variables -dotenv.config() - -const sanityFieldNameToPluginKeyLookup = { - title: 'name', - description: 'description', - // In sanity, the field is an array of authors, in plugins.json. it's one author - authors: 'author', - packageName: 'package', - repoUrl: 'repo', - version: 'version', - // an object that can be null - compatibility: 'compatibility', -} as const - -type SanityFieldNameToPluginKeyLookup = typeof sanityFieldNameToPluginKeyLookup - -interface SanityBuildPluginEntity { - authors: [ - { - _id: string - name: string | null - }, - ] - compatibility: null - description: string - packageName: string - repoUrl: string - title: string - version: string -} - -type SanityPluginLookup = Record - -// eslint-disable-next-line n/prefer-global/process -const { SANITY_API_TOKEN, SANITY_PROJECT_ID, SANITY_DATASET } = process.env -const [apiVersion] = new Date().toISOString().split('T') - -/** - * Retrieves a list of all the plugins stored in Sanity - * - * @param client Sanity client - * @param query Query to execute - * @returns A list of all the plugins stored in Sanity - */ -const getSanityPluginLookup = async (client: SanityClient, query: string) => { - const plugins = await client.fetch(query, {}) - const pluginLookup = plugins.reduce((sanitytPluginLookup: SanityPluginLookup, plugin: SanityBuildPluginEntity) => { - // eslint-disable-next-line no-param-reassign - sanitytPluginLookup[plugin.packageName] = plugin - - return sanitytPluginLookup - }, {}) - - return pluginLookup -} - -// TODO: projectId and dataset should be read from GH action secrets? -const config = { - projectId: SANITY_PROJECT_ID, - dataset: SANITY_DATASET, - apiVersion, - token: SANITY_API_TOKEN, - // make sure we have the freshest data when doing the diff with plugins.json - useCdn: false, -} - -/** - * @type: SanityClient - */ -const client = sanityClient(config) - -const query = `*[_type == "buildPlugin"] { - title, - description, - authors, - authors[]->{_id, name}, - packageName, - repoUrl, - version, - compatibility -}` - -// TODO: Add a retry mechanism to handle network errors -try { - const sanityPluginLookup = await getSanityPluginLookup(client, query) - - console.log(JSON.stringify(sanityPluginLookup, null, 2)) -} catch (error) { - console.error(error) - throw new Error('Unable to retrieve plugins from CMS') -} -// })() diff --git a/bin/utils.js b/bin/utils.js new file mode 100644 index 000000000..35d6679b8 --- /dev/null +++ b/bin/utils.js @@ -0,0 +1,50 @@ +// import type { SanityClient } from '@sanity/client' + +const sanityFieldNameToPluginKeyLookup = { + title: 'name', + description: 'description', + // In sanity, the field is an array of authors, in plugins.json. it's one author + authors: 'author', + packageName: 'package', + repoUrl: 'repo', + version: 'version', + // an object that can be null + compatibility: 'compatibility', +} + +// type SanityFieldNameToPluginKeyLookup = typeof sanityFieldNameToPluginKeyLookup + +// interface SanityBuildPluginEntity { +// authors: [ +// { +// _id: string +// name: string | null +// }, +// ] +// compatibility: null +// description: string +// packageName: string +// repoUrl: string +// title: string +// version: string +// } + +// type SanityPluginLookup = Record + +/** + * Retrieves a list of all the plugins stored in Sanity + * + * @param query {string} Query to execute + * @returns {object} A list of all the plugins stored in Sanity + */ +export const getSanityPluginLookup = async (query) => { + const plugins = await query + const pluginLookup = plugins.reduce((sanitytPluginLookup, plugin) => { + // eslint-disable-next-line no-param-reassign + sanitytPluginLookup[plugin.packageName] = plugin + + return sanitytPluginLookup + }, {}) + + return pluginLookup +} From a560cfd281546bd257085d6352b558f30dbd2caa Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Tue, 30 Aug 2022 13:44:59 -0400 Subject: [PATCH 05/42] test: added tests for getSanityPluginLookup --- bin/sync_plugins_sanity.js | 9 ++++- bin/utils.js | 32 ++++++----------- test/bin/utils.js | 73 ++++++++++++++++++++++++++++++++++++++ types/plugins.d.ts | 18 ++++++++++ 4 files changed, 109 insertions(+), 23 deletions(-) create mode 100644 test/bin/utils.js create mode 100644 types/plugins.d.ts diff --git a/bin/sync_plugins_sanity.js b/bin/sync_plugins_sanity.js index 983474cf0..5db7b4fdd 100644 --- a/bin/sync_plugins_sanity.js +++ b/bin/sync_plugins_sanity.js @@ -2,6 +2,10 @@ import sanityClient from '@sanity/client' import dotenv from 'dotenv' +/** + * @typedef { import("../types/plugins").SanityBuildPluginEntity } SanityBuildPluginEntity + */ + import { getSanityPluginLookup } from './utils.js' // Using dotenv for local development. When its running in a GitHub action it will use the GitHub action's environment variables @@ -22,7 +26,7 @@ const config = { } /** - * @type: SanityClient + * @type {SanityClient} */ const client = sanityClient(config) @@ -39,6 +43,9 @@ const query = `*[_type == "buildPlugin"] { // TODO: Add a retry mechanism to handle network errors try { + /** + * @type {SanityBuildPluginEntity[]} + */ const sanityPluginLookup = await getSanityPluginLookup(client.fetch(query, {})) console.log(JSON.stringify(sanityPluginLookup, null, 2)) diff --git a/bin/utils.js b/bin/utils.js index 35d6679b8..dd366d3ea 100644 --- a/bin/utils.js +++ b/bin/utils.js @@ -1,4 +1,8 @@ -// import type { SanityClient } from '@sanity/client' +/** + * @typedef { import("../types").SanityBuildPluginEntity } SanityBuildPluginEntity + * @typedef { import("../types/plugins").SanityPluginLookup } SanityPluginLookup + * @typedef { import("../types/plugins").BuildPluginEntity } BuildPluginEntity + */ const sanityFieldNameToPluginKeyLookup = { title: 'name', @@ -12,33 +16,17 @@ const sanityFieldNameToPluginKeyLookup = { compatibility: 'compatibility', } -// type SanityFieldNameToPluginKeyLookup = typeof sanityFieldNameToPluginKeyLookup - -// interface SanityBuildPluginEntity { -// authors: [ -// { -// _id: string -// name: string | null -// }, -// ] -// compatibility: null -// description: string -// packageName: string -// repoUrl: string -// title: string -// version: string -// } - -// type SanityPluginLookup = Record - /** * Retrieves a list of all the plugins stored in Sanity * - * @param query {string} Query to execute - * @returns {object} A list of all the plugins stored in Sanity + * @param query {Promise} Query to execute + * @returns A list of all the plugins stored in Sanity */ export const getSanityPluginLookup = async (query) => { const plugins = await query + /** + * @type {SanityPluginLookup} + */ const pluginLookup = plugins.reduce((sanitytPluginLookup, plugin) => { // eslint-disable-next-line no-param-reassign sanitytPluginLookup[plugin.packageName] = plugin diff --git a/test/bin/utils.js b/test/bin/utils.js new file mode 100644 index 000000000..55ce79afb --- /dev/null +++ b/test/bin/utils.js @@ -0,0 +1,73 @@ +/** + * @typedef { import("../../types/plugins").SanityBuildPluginEntity } SanityBuildPluginEntity + */ + +import test from 'ava' + +import { getSanityPluginLookup } from '../../bin/utils.js' + +test('should generate Sanity build plugin lookup', async (t) => { + /** + * @type {Promise} + */ + const query = Promise.resolve([ + { + authors: [{ _id: '03fb09e4-2f37-4242-a9f2-664daf4c7ff9', name: 'Ben Lmsc' }], + compatibility: null, + description: 'Make some environment variables available only at build time in the runtime of your application.', + packageName: 'netlify-plugin-use-env-in-runtime', + repoUrl: 'https://github.com/ARKHN3B/netlify-plugin-use-env-in-runtime', + title: 'Use Env in Runtime', + version: '1.2.1', + }, + { + authors: [{ _id: '1dccdb09-71f8-482a-aa0f-9bae32df2e2a', name: 'Bharathvaj Ganesan' }], + compatibility: null, + description: 'Automatically notifies Airbrake of new site deploys.', + packageName: '@bharathvaj/netlify-plugin-airbrake', + repoUrl: 'https://github.com/bharathvaj-ganesan/netlify-plugin-airbrake', + title: 'Airbrake', + version: '1.0.2', + }, + { + authors: [{ _id: 'eaf7029b-a72b-406f-a2cc-4b8b48fb50a3', name: null }], + compatibility: null, + description: 'Debug & verify the contents of your Netlify build cache', + packageName: 'netlify-plugin-debug-cache', + repoUrl: 'https://github.com/netlify-labs/netlify-plugin-debug-cache', + title: 'Debug cache', + version: '1.0.4', + }, + ]) + const expected = { + 'netlify-plugin-use-env-in-runtime': { + authors: [{ _id: '03fb09e4-2f37-4242-a9f2-664daf4c7ff9', name: 'Ben Lmsc' }], + compatibility: null, + description: 'Make some environment variables available only at build time in the runtime of your application.', + packageName: 'netlify-plugin-use-env-in-runtime', + repoUrl: 'https://github.com/ARKHN3B/netlify-plugin-use-env-in-runtime', + title: 'Use Env in Runtime', + version: '1.2.1', + }, + '@bharathvaj/netlify-plugin-airbrake': { + authors: [{ _id: '1dccdb09-71f8-482a-aa0f-9bae32df2e2a', name: 'Bharathvaj Ganesan' }], + compatibility: null, + description: 'Automatically notifies Airbrake of new site deploys.', + packageName: '@bharathvaj/netlify-plugin-airbrake', + repoUrl: 'https://github.com/bharathvaj-ganesan/netlify-plugin-airbrake', + title: 'Airbrake', + version: '1.0.2', + }, + 'netlify-plugin-debug-cache': { + authors: [{ _id: 'eaf7029b-a72b-406f-a2cc-4b8b48fb50a3', name: null }], + compatibility: null, + description: 'Debug & verify the contents of your Netlify build cache', + packageName: 'netlify-plugin-debug-cache', + repoUrl: 'https://github.com/netlify-labs/netlify-plugin-debug-cache', + title: 'Debug cache', + version: '1.0.4', + }, + } + const actual = await getSanityPluginLookup(query) + t.deepEqual(actual, expected) +}) diff --git a/types/plugins.d.ts b/types/plugins.d.ts new file mode 100644 index 000000000..c516c114e --- /dev/null +++ b/types/plugins.d.ts @@ -0,0 +1,18 @@ +export interface SanityBuildPluginEntity { + authors: [ + { + _id: string + name: string | null + }, + ] + compatibility: null + description: string + packageName: string + repoUrl: string + title: string + version: string +} + +export type SanityPluginLookup = Record + +export type BuildPluginEntity = {} From a059c6de4d40bed6f50a6bd6451673fd079ab528 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Tue, 30 Aug 2022 13:50:34 -0400 Subject: [PATCH 06/42] chore: added a new line at end of gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ecc9b628c..715b4a57c 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,4 @@ node_modules .vscode .DS_Store -.env \ No newline at end of file +.env From a01a0869704fb4aec5db6b2b6055b8b3106a4b52 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Tue, 30 Aug 2022 17:04:39 -0400 Subject: [PATCH 07/42] chore: added getPluginDiffsForSanity --- ...ns_sanity.js => sync_plugins_to_sanity.js} | 16 +- bin/utils.js | 41 ++ package-lock.json | 621 +++++++++++++++--- package.json | 1 + test/bin/utils.js | 147 ++++- 5 files changed, 738 insertions(+), 88 deletions(-) rename bin/{sync_plugins_sanity.js => sync_plugins_to_sanity.js} (70%) diff --git a/bin/sync_plugins_sanity.js b/bin/sync_plugins_to_sanity.js similarity index 70% rename from bin/sync_plugins_sanity.js rename to bin/sync_plugins_to_sanity.js index 5db7b4fdd..ec68bd702 100644 --- a/bin/sync_plugins_sanity.js +++ b/bin/sync_plugins_to_sanity.js @@ -1,12 +1,18 @@ // eslint-env node +import { promises } from 'fs' + import sanityClient from '@sanity/client' import dotenv from 'dotenv' +// TODO: The plugins file that changed should be passed in as an argument + /** * @typedef { import("../types/plugins").SanityBuildPluginEntity } SanityBuildPluginEntity */ -import { getSanityPluginLookup } from './utils.js' +import { getPluginDiffsForSanity, getSanityPluginLookup } from './utils.js' + +const fs = promises // Using dotenv for local development. When its running in a GitHub action it will use the GitHub action's environment variables dotenv.config() @@ -43,12 +49,18 @@ const query = `*[_type == "buildPlugin"] { // TODO: Add a retry mechanism to handle network errors try { + // TODO: Remove hardcoded path. This will be coming in as an argument + const filePath = '/Users/nicktaylor/dev/work/plugins/site/plugins.json' + const fileContents = await fs.readFile(filePath) + const plugins = JSON.parse(fileContents) + /** * @type {SanityBuildPluginEntity[]} */ const sanityPluginLookup = await getSanityPluginLookup(client.fetch(query, {})) + const pluginDiffs = getPluginDiffsForSanity(sanityPluginLookup, plugins) - console.log(JSON.stringify(sanityPluginLookup, null, 2)) + console.log(JSON.stringify(pluginDiffs, null, 2)) } catch (error) { console.error(error) throw new Error('Unable to retrieve plugins from CMS') diff --git a/bin/utils.js b/bin/utils.js index dd366d3ea..f0d4b0c0b 100644 --- a/bin/utils.js +++ b/bin/utils.js @@ -4,6 +4,9 @@ * @typedef { import("../types/plugins").BuildPluginEntity } BuildPluginEntity */ +// TODO: remove this an use assert.deepEqual once we support only node engines > 18 +import deepEqual from 'deep-equal' + const sanityFieldNameToPluginKeyLookup = { title: 'name', description: 'description', @@ -36,3 +39,41 @@ export const getSanityPluginLookup = async (query) => { return pluginLookup } + +/** + * + * @param {*} plugin + * @returns + */ +const convertSanityPluginToPlugin = (plugin) => { + const formattedPlugin = Object.keys(plugin).reduce((pluginToFormat, key) => { + // TODO: It appears for now at least, plugins.json only ever has one author. + const fieldValue = key === `authors` ? plugin[key][0].name : plugin[key] + + if (fieldValue !== null) { + // eslint-disable-next-line no-param-reassign + pluginToFormat[sanityFieldNameToPluginKeyLookup[key]] = fieldValue + } + + return pluginToFormat + }, {}) + + return formattedPlugin +} + +/** + * Gets the differences between the Sanity plugins and the plugins.json file + * + * @param {SanityPluginLookup} pluginLookup + * @param {BuildPluginEntity[]} plugins + * @returns + */ +export const getPluginDiffsForSanity = (pluginLookup, plugins) => + plugins.filter((plugin) => { + if (!(plugin.package in pluginLookup)) { + return false + } + const sanityPlugin = convertSanityPluginToPlugin(pluginLookup[plugin.package]) + + return !deepEqual(plugin, sanityPlugin) + }) diff --git a/package-lock.json b/package-lock.json index 986b53b59..9ab141c2b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "@sanity/client": "^3.3.6", "ava": "^4.3.3", "c8": "^7.11.0", + "deep-equal": "^2.0.5", "diff": "^5.0.0", "dotenv": "^16.0.1", "got": "^11.8.0", @@ -2272,6 +2273,18 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "node_modules/available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -3271,6 +3284,38 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/deep-equal": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.0.5.tgz", + "integrity": "sha512-nPiRgmbAtm1a3JsnLCf6/SLfXcjyN5v8L1TXzdCmHrXJ4hx+gW/w1YCcn7z8gJtSiDArZCgYtbao3QqLm/N1Sw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "es-get-iterator": "^1.1.1", + "get-intrinsic": "^1.0.1", + "is-arguments": "^1.0.4", + "is-date-object": "^1.0.2", + "is-regex": "^1.1.1", + "isarray": "^2.0.5", + "object-is": "^1.1.4", + "object-keys": "^1.1.1", + "object.assign": "^4.1.2", + "regexp.prototype.flags": "^1.3.0", + "side-channel": "^1.0.3", + "which-boxed-primitive": "^1.0.1", + "which-collection": "^1.0.1", + "which-typed-array": "^1.1.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/deep-equal/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -3287,15 +3332,19 @@ } }, "node_modules/define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", + "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", "dev": true, "dependencies": { - "object-keys": "^1.0.12" + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/del": { @@ -3551,31 +3600,34 @@ } }, "node_modules/es-abstract": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz", - "integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==", + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.1.tgz", + "integrity": "sha512-WEm2oBhfoI2sImeM4OF2zE2V3BYdSF+KnSi9Sidz51fQHd7+JuF8Xgcj9/0o+OWeIeIS/MiuNnlruQrJf16GQA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", + "function.prototype.name": "^1.1.5", "get-intrinsic": "^1.1.1", "get-symbol-description": "^1.0.0", "has": "^1.0.3", - "has-symbols": "^1.0.2", + "has-property-descriptors": "^1.0.0", + "has-symbols": "^1.0.3", "internal-slot": "^1.0.3", "is-callable": "^1.2.4", - "is-negative-zero": "^2.0.1", + "is-negative-zero": "^2.0.2", "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.1", + "is-shared-array-buffer": "^1.0.2", "is-string": "^1.0.7", - "is-weakref": "^1.0.1", - "object-inspect": "^1.11.0", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.0", "object-keys": "^1.1.1", "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.1" + "regexp.prototype.flags": "^1.4.3", + "string.prototype.trimend": "^1.0.5", + "string.prototype.trimstart": "^1.0.5", + "unbox-primitive": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -3584,6 +3636,31 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es-get-iterator": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.2.tgz", + "integrity": "sha512-+DTO8GYwbMCwbywjimwZMHp8AuYXOS2JZFWoi2AlPOS3ebnII9w/NLpNZtA7A0YLaVDw+O7KFCeoIV7OPvM7hQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.0", + "has-symbols": "^1.0.1", + "is-arguments": "^1.1.0", + "is-map": "^2.0.2", + "is-set": "^2.0.2", + "is-string": "^1.0.5", + "isarray": "^2.0.5" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-get-iterator/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, "node_modules/es-to-primitive": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", @@ -5145,6 +5222,15 @@ } } }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.3" + } + }, "node_modules/foreground-child": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", @@ -5262,12 +5348,39 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "node_modules/function.prototype.name": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", + "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0", + "functions-have-names": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/gauge": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.0.tgz", @@ -5586,9 +5699,9 @@ } }, "node_modules/has-bigints": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", - "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -5603,10 +5716,22 @@ "node": ">=4" } }, + "node_modules/has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-symbols": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "dev": true, "engines": { "node": ">= 0.4" @@ -5944,6 +6069,22 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -6115,6 +6256,15 @@ "integrity": "sha1-PZh3iZ5qU+/AFgUEzeFfgubwYdU=", "dev": true }, + "node_modules/is-map": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz", + "integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-negative-zero": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", @@ -6230,11 +6380,23 @@ "node": ">=0.10.0" } }, + "node_modules/is-set": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz", + "integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-shared-array-buffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", - "integrity": "sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -6293,6 +6455,25 @@ "node": ">=0.10.0" } }, + "node_modules/is-typed-array": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.9.tgz", + "integrity": "sha512-kfrlnTTn8pZkfpJMUgYD7YZ3qzeJgWUn8XfVYBARc4wnmNOmLbmuuaAs3q5fvB0UJOn6yHAKaGTPM7d6ezoD/A==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-abstract": "^1.20.0", + "for-each": "^0.3.3", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -6311,6 +6492,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-weakmap": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz", + "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-weakref": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", @@ -6323,6 +6513,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-weakset": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz", + "integrity": "sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -7776,6 +7979,22 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/object-is": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", + "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", @@ -8759,13 +8978,14 @@ } }, "node_modules/regexp.prototype.flags": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.1.tgz", - "integrity": "sha512-JiBdRBq91WlY7uRJ0ds7R+dU02i6LKi8r3BuQhNXn+kmeLN+EfHhfjqMRis1zJxnlu88hq/4dx0P2OP3APRTOA==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", + "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "define-properties": "^1.1.3", + "functions-have-names": "^1.2.2" }, "engines": { "node": ">= 0.4" @@ -9377,26 +9597,28 @@ } }, "node_modules/string.prototype.trimend": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", - "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", + "integrity": "sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/string.prototype.trimstart": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", - "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz", + "integrity": "sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -9814,14 +10036,14 @@ } }, "node_modules/unbox-primitive": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", - "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", "dev": true, "dependencies": { - "function-bind": "^1.1.1", - "has-bigints": "^1.0.1", - "has-symbols": "^1.0.2", + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", "which-boxed-primitive": "^1.0.2" }, "funding": { @@ -10005,6 +10227,41 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/which-collection": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz", + "integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==", + "dev": true, + "dependencies": { + "is-map": "^2.0.1", + "is-set": "^2.0.1", + "is-weakmap": "^2.0.1", + "is-weakset": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.8.tgz", + "integrity": "sha512-Jn4e5PItbcAHyLoRDwvPj1ypu27DJbtdYXUa5zsinrUx77Uvfb0cXwwnGMTn7cjUfhhqgVQnVJCwF+7cgU7tpw==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-abstract": "^1.20.0", + "for-each": "^0.3.3", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.9" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/wide-align": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", @@ -11804,6 +12061,12 @@ } } }, + "available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "dev": true + }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -12557,6 +12820,37 @@ } } }, + "deep-equal": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.0.5.tgz", + "integrity": "sha512-nPiRgmbAtm1a3JsnLCf6/SLfXcjyN5v8L1TXzdCmHrXJ4hx+gW/w1YCcn7z8gJtSiDArZCgYtbao3QqLm/N1Sw==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "es-get-iterator": "^1.1.1", + "get-intrinsic": "^1.0.1", + "is-arguments": "^1.0.4", + "is-date-object": "^1.0.2", + "is-regex": "^1.1.1", + "isarray": "^2.0.5", + "object-is": "^1.1.4", + "object-keys": "^1.1.1", + "object.assign": "^4.1.2", + "regexp.prototype.flags": "^1.3.0", + "side-channel": "^1.0.3", + "which-boxed-primitive": "^1.0.1", + "which-collection": "^1.0.1", + "which-typed-array": "^1.1.2" + }, + "dependencies": { + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + } + } + }, "deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -12570,12 +12864,13 @@ "dev": true }, "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", + "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", "dev": true, "requires": { - "object-keys": "^1.0.12" + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" } }, "del": { @@ -12770,31 +13065,58 @@ } }, "es-abstract": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz", - "integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==", + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.1.tgz", + "integrity": "sha512-WEm2oBhfoI2sImeM4OF2zE2V3BYdSF+KnSi9Sidz51fQHd7+JuF8Xgcj9/0o+OWeIeIS/MiuNnlruQrJf16GQA==", "dev": true, "requires": { "call-bind": "^1.0.2", "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", + "function.prototype.name": "^1.1.5", "get-intrinsic": "^1.1.1", "get-symbol-description": "^1.0.0", "has": "^1.0.3", - "has-symbols": "^1.0.2", + "has-property-descriptors": "^1.0.0", + "has-symbols": "^1.0.3", "internal-slot": "^1.0.3", "is-callable": "^1.2.4", - "is-negative-zero": "^2.0.1", + "is-negative-zero": "^2.0.2", "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.1", + "is-shared-array-buffer": "^1.0.2", "is-string": "^1.0.7", - "is-weakref": "^1.0.1", - "object-inspect": "^1.11.0", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.0", "object-keys": "^1.1.1", "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.1" + "regexp.prototype.flags": "^1.4.3", + "string.prototype.trimend": "^1.0.5", + "string.prototype.trimstart": "^1.0.5", + "unbox-primitive": "^1.0.2" + } + }, + "es-get-iterator": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.2.tgz", + "integrity": "sha512-+DTO8GYwbMCwbywjimwZMHp8AuYXOS2JZFWoi2AlPOS3ebnII9w/NLpNZtA7A0YLaVDw+O7KFCeoIV7OPvM7hQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.0", + "has-symbols": "^1.0.1", + "is-arguments": "^1.1.0", + "is-map": "^2.0.2", + "is-set": "^2.0.2", + "is-string": "^1.0.5", + "isarray": "^2.0.5" + }, + "dependencies": { + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + } } }, "es-to-primitive": { @@ -13833,6 +14155,15 @@ "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==", "dev": true }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "requires": { + "is-callable": "^1.1.3" + } + }, "foreground-child": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", @@ -13933,12 +14264,30 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "function.prototype.name": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", + "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0", + "functions-have-names": "^1.2.2" + } + }, "functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, + "functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true + }, "gauge": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.0.tgz", @@ -14181,9 +14530,9 @@ } }, "has-bigints": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", - "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", "dev": true }, "has-flag": { @@ -14192,10 +14541,19 @@ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, + "has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "dev": true, + "requires": { + "get-intrinsic": "^1.1.1" + } + }, "has-symbols": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "dev": true }, "has-tostringtag": { @@ -14442,6 +14800,16 @@ "is-decimal": "^1.0.0" } }, + "is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -14563,6 +14931,12 @@ "integrity": "sha1-PZh3iZ5qU+/AFgUEzeFfgubwYdU=", "dev": true }, + "is-map": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz", + "integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==", + "dev": true + }, "is-negative-zero": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", @@ -14636,12 +15010,21 @@ "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==", "dev": true }, - "is-shared-array-buffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", - "integrity": "sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==", + "is-set": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz", + "integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==", "dev": true }, + "is-shared-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2" + } + }, "is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -14675,6 +15058,19 @@ "text-extensions": "^1.0.0" } }, + "is-typed-array": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.9.tgz", + "integrity": "sha512-kfrlnTTn8pZkfpJMUgYD7YZ3qzeJgWUn8XfVYBARc4wnmNOmLbmuuaAs3q5fvB0UJOn6yHAKaGTPM7d6ezoD/A==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-abstract": "^1.20.0", + "for-each": "^0.3.3", + "has-tostringtag": "^1.0.0" + } + }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -14687,6 +15083,12 @@ "integrity": "sha512-wH+U77omcRzevfIG8dDhTS0V9zZyweakfD01FULl97+0EHiJTTZtJqxPSkIIo/SDPv/i07k/C9jAPY+jwLLeUQ==", "dev": true }, + "is-weakmap": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz", + "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==", + "dev": true + }, "is-weakref": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", @@ -14696,6 +15098,16 @@ "call-bind": "^1.0.2" } }, + "is-weakset": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz", + "integrity": "sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -15786,6 +16198,16 @@ "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", "dev": true }, + "object-is": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", + "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + } + }, "object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", @@ -16498,13 +16920,14 @@ "dev": true }, "regexp.prototype.flags": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.1.tgz", - "integrity": "sha512-JiBdRBq91WlY7uRJ0ds7R+dU02i6LKi8r3BuQhNXn+kmeLN+EfHhfjqMRis1zJxnlu88hq/4dx0P2OP3APRTOA==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", + "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", "dev": true, "requires": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "define-properties": "^1.1.3", + "functions-have-names": "^1.2.2" } }, "regexpp": { @@ -16946,23 +17369,25 @@ } }, "string.prototype.trimend": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", - "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", + "integrity": "sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==", "dev": true, "requires": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" } }, "string.prototype.trimstart": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", - "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz", + "integrity": "sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==", "dev": true, "requires": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" } }, "strip-ansi": { @@ -17254,14 +17679,14 @@ "dev": true }, "unbox-primitive": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", - "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", "dev": true, "requires": { - "function-bind": "^1.1.1", - "has-bigints": "^1.0.1", - "has-symbols": "^1.0.2", + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", "which-boxed-primitive": "^1.0.2" } }, @@ -17418,6 +17843,32 @@ "is-symbol": "^1.0.3" } }, + "which-collection": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz", + "integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==", + "dev": true, + "requires": { + "is-map": "^2.0.1", + "is-set": "^2.0.1", + "is-weakmap": "^2.0.1", + "is-weakset": "^2.0.1" + } + }, + "which-typed-array": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.8.tgz", + "integrity": "sha512-Jn4e5PItbcAHyLoRDwvPj1ypu27DJbtdYXUa5zsinrUx77Uvfb0cXwwnGMTn7cjUfhhqgVQnVJCwF+7cgU7tpw==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-abstract": "^1.20.0", + "for-each": "^0.3.3", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.9" + } + }, "wide-align": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", diff --git a/package.json b/package.json index 260065158..81acd417c 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "@sanity/client": "^3.3.6", "ava": "^4.3.3", "c8": "^7.11.0", + "deep-equal": "^2.0.5", "diff": "^5.0.0", "dotenv": "^16.0.1", "got": "^11.8.0", diff --git a/test/bin/utils.js b/test/bin/utils.js index 55ce79afb..375f7378b 100644 --- a/test/bin/utils.js +++ b/test/bin/utils.js @@ -1,10 +1,12 @@ +/* eslint-disable max-lines */ + /** * @typedef { import("../../types/plugins").SanityBuildPluginEntity } SanityBuildPluginEntity */ import test from 'ava' -import { getSanityPluginLookup } from '../../bin/utils.js' +import { getPluginDiffsForSanity, getSanityPluginLookup } from '../../bin/utils.js' test('should generate Sanity build plugin lookup', async (t) => { /** @@ -71,3 +73,146 @@ test('should generate Sanity build plugin lookup', async (t) => { const actual = await getSanityPluginLookup(query) t.deepEqual(actual, expected) }) + +test('should generate plugin diffs for Sanity', (t) => { + const pluginLookup = { + 'netlify-plugin-use-env-in-runtime': { + authors: [{ _id: '03fb09e4-2f37-4242-a9f2-664daf4c7ff9', name: 'Ben Lmsc' }], + compatibility: null, + description: 'Make some environment variables available only at build time in the runtime of your application.', + packageName: 'netlify-plugin-use-env-in-runtime', + repoUrl: 'https://github.com/ARKHN3B/netlify-plugin-use-env-in-runtime', + title: 'Use Env in Runtime', + version: '1.2.1', + }, + '@bharathvaj/netlify-plugin-airbrake': { + authors: [{ _id: '1dccdb09-71f8-482a-aa0f-9bae32df2e2a', name: 'Bharathvaj Ganesan' }], + compatibility: null, + description: 'Automatically notifies Airbrake of new site deploys.', + packageName: '@bharathvaj/netlify-plugin-airbrake', + repoUrl: 'https://github.com/bharathvaj-ganesan/netlify-plugin-airbrake', + title: 'Airbrake', + version: '1.0.2', + }, + 'netlify-plugin-debug-cache': { + authors: [{ _id: 'eaf7029b-a72b-406f-a2cc-4b8b48fb50a3', name: 'Bobby MacDougall' }], + compatibility: null, + description: 'Debug & verify the contents of your Netlify build cache', + packageName: 'netlify-plugin-debug-cache', + repoUrl: 'https://github.com/netlify-labs/netlify-plugin-debug-cache', + title: 'Debug cache', + version: '1.0.4', + }, + } + const plugins = [ + { + author: 'Ben Lmsc', + description: 'Make some environment variables available only at build time in the runtime of your application.', + package: 'netlify-plugin-use-env-in-runtime', + repo: 'https://github.com/ARKHN3B/netlify-plugin-use-env-in-runtime', + name: 'Use Env in Runtime', + version: '1.2.2', + }, + { + author: 'Bharathvaj Ganesan', + description: 'Automatically notifies Airbrake of new site deploys.', + package: '@bharathvaj/netlify-plugin-airbrake', + repo: 'https://github.com/bharathvaj-ganesan/netlify-plugin-airbrake', + name: 'Airbrake', + version: '1.0.2', + }, + { + author: 'Bobby MacDougall', + description: 'Debug & verify the contents of your Netlify build cache', + package: 'netlify-plugin-debug-cache', + repo: 'https://github.com/netlify-labs/netlify-plugin-debug-cache', + name: 'Debug Cache', + version: '1.0.4', + }, + ] + const expected = [ + { + author: 'Ben Lmsc', + description: 'Make some environment variables available only at build time in the runtime of your application.', + package: 'netlify-plugin-use-env-in-runtime', + repo: 'https://github.com/ARKHN3B/netlify-plugin-use-env-in-runtime', + name: 'Use Env in Runtime', + version: '1.2.2', + }, + { + author: 'Bobby MacDougall', + description: 'Debug & verify the contents of your Netlify build cache', + package: 'netlify-plugin-debug-cache', + repo: 'https://github.com/netlify-labs/netlify-plugin-debug-cache', + name: 'Debug Cache', + version: '1.0.4', + }, + ] + const actual = getPluginDiffsForSanity(pluginLookup, plugins) + + t.deepEqual(actual, expected) +}) + +test('should return no plugin diffs for Sanity if there are no changes', (t) => { + const pluginLookup = { + 'netlify-plugin-use-env-in-runtime': { + authors: [{ _id: '03fb09e4-2f37-4242-a9f2-664daf4c7ff9', name: 'Ben Lmsc' }], + compatibility: null, + description: 'Make some environment variables available only at build time in the runtime of your application.', + packageName: 'netlify-plugin-use-env-in-runtime', + repoUrl: 'https://github.com/ARKHN3B/netlify-plugin-use-env-in-runtime', + title: 'Use Env in Runtime', + version: '1.2.1', + }, + '@bharathvaj/netlify-plugin-airbrake': { + authors: [{ _id: '1dccdb09-71f8-482a-aa0f-9bae32df2e2a', name: 'Bharathvaj Ganesan' }], + compatibility: null, + description: 'Automatically notifies Airbrake of new site deploys.', + packageName: '@bharathvaj/netlify-plugin-airbrake', + repoUrl: 'https://github.com/bharathvaj-ganesan/netlify-plugin-airbrake', + title: 'Airbrake', + version: '1.0.2', + }, + 'netlify-plugin-debug-cache': { + authors: [{ _id: 'eaf7029b-a72b-406f-a2cc-4b8b48fb50a3', name: 'Bobby MacDougall' }], + compatibility: null, + description: 'Debug & verify the contents of your Netlify build cache', + packageName: 'netlify-plugin-debug-cache', + repoUrl: 'https://github.com/netlify-labs/netlify-plugin-debug-cache', + title: 'Debug cache', + version: '1.0.4', + }, + } + const plugins = [ + { + author: 'Ben Lmsc', + description: 'Make some environment variables available only at build time in the runtime of your application.', + package: 'netlify-plugin-use-env-in-runtime', + repo: 'https://github.com/ARKHN3B/netlify-plugin-use-env-in-runtime', + name: 'Use Env in Runtime', + version: '1.2.1', + }, + { + author: 'Bharathvaj Ganesan', + description: 'Automatically notifies Airbrake of new site deploys.', + package: '@bharathvaj/netlify-plugin-airbrake', + repo: 'https://github.com/bharathvaj-ganesan/netlify-plugin-airbrake', + name: 'Airbrake', + version: '1.0.2', + }, + { + author: 'Bobby MacDougall', + description: 'Debug & verify the contents of your Netlify build cache', + package: 'netlify-plugin-debug-cache', + repo: 'https://github.com/netlify-labs/netlify-plugin-debug-cache', + name: 'Debug cache', + version: '1.0.4', + }, + ] + const expected = [] + const actual = getPluginDiffsForSanity(pluginLookup, plugins) + + t.deepEqual(actual, expected) +}) + +/* eslint-enable max-lines */ From 78db1b0ab2548374b0bf1bf1bbd8ae36df34e8cf Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Tue, 30 Aug 2022 21:37:36 -0400 Subject: [PATCH 08/42] chore: refactor to avoid passing in a Promise --- bin/sync_plugins_to_sanity.js | 3 ++- bin/utils.js | 5 ++--- test/bin/utils.js | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/sync_plugins_to_sanity.js b/bin/sync_plugins_to_sanity.js index ec68bd702..7b0f03c4a 100644 --- a/bin/sync_plugins_to_sanity.js +++ b/bin/sync_plugins_to_sanity.js @@ -57,7 +57,8 @@ try { /** * @type {SanityBuildPluginEntity[]} */ - const sanityPluginLookup = await getSanityPluginLookup(client.fetch(query, {})) + const sanityBuildPlugins = await client.fetch(query, {}) + const sanityPluginLookup = await getSanityPluginLookup(sanityBuildPlugins) const pluginDiffs = getPluginDiffsForSanity(sanityPluginLookup, plugins) console.log(JSON.stringify(pluginDiffs, null, 2)) diff --git a/bin/utils.js b/bin/utils.js index f0d4b0c0b..558ce9bda 100644 --- a/bin/utils.js +++ b/bin/utils.js @@ -22,11 +22,10 @@ const sanityFieldNameToPluginKeyLookup = { /** * Retrieves a list of all the plugins stored in Sanity * - * @param query {Promise} Query to execute + * @param plugins {SanityBuildPluginEntity[]} Query to execute * @returns A list of all the plugins stored in Sanity */ -export const getSanityPluginLookup = async (query) => { - const plugins = await query +export const getSanityPluginLookup = (plugins) => { /** * @type {SanityPluginLookup} */ diff --git a/test/bin/utils.js b/test/bin/utils.js index 375f7378b..743234a51 100644 --- a/test/bin/utils.js +++ b/test/bin/utils.js @@ -8,11 +8,11 @@ import test from 'ava' import { getPluginDiffsForSanity, getSanityPluginLookup } from '../../bin/utils.js' -test('should generate Sanity build plugin lookup', async (t) => { +test('should generate Sanity build plugin lookup', (t) => { /** - * @type {Promise} + * @type {SanityBuildPluginEntity[]} */ - const query = Promise.resolve([ + const sanityBuildPlugins = [ { authors: [{ _id: '03fb09e4-2f37-4242-a9f2-664daf4c7ff9', name: 'Ben Lmsc' }], compatibility: null, @@ -40,7 +40,7 @@ test('should generate Sanity build plugin lookup', async (t) => { title: 'Debug cache', version: '1.0.4', }, - ]) + ] const expected = { 'netlify-plugin-use-env-in-runtime': { authors: [{ _id: '03fb09e4-2f37-4242-a9f2-664daf4c7ff9', name: 'Ben Lmsc' }], @@ -70,7 +70,7 @@ test('should generate Sanity build plugin lookup', async (t) => { version: '1.0.4', }, } - const actual = await getSanityPluginLookup(query) + const actual = getSanityPluginLookup(sanityBuildPlugins) t.deepEqual(actual, expected) }) From 836ec225714f1394c3dad069599da0b32914a8b7 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Tue, 30 Aug 2022 21:38:19 -0400 Subject: [PATCH 09/42] chore: removed commented out dead code --- bin/sync_plugins_to_sanity.js | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/sync_plugins_to_sanity.js b/bin/sync_plugins_to_sanity.js index 7b0f03c4a..92a3f992b 100644 --- a/bin/sync_plugins_to_sanity.js +++ b/bin/sync_plugins_to_sanity.js @@ -66,4 +66,3 @@ try { console.error(error) throw new Error('Unable to retrieve plugins from CMS') } -// })() From 6d62bb8be21f1a47a468c0b74e6f978037c43de2 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Tue, 30 Aug 2022 22:28:51 -0400 Subject: [PATCH 10/42] chore: fix type import for SanityClient --- bin/sync_plugins_to_sanity.js | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/sync_plugins_to_sanity.js b/bin/sync_plugins_to_sanity.js index 92a3f992b..425a9d6ad 100644 --- a/bin/sync_plugins_to_sanity.js +++ b/bin/sync_plugins_to_sanity.js @@ -8,6 +8,7 @@ import dotenv from 'dotenv' /** * @typedef { import("../types/plugins").SanityBuildPluginEntity } SanityBuildPluginEntity + * @typedef { import("@sanity/client").SanityClient } SanityClient */ import { getPluginDiffsForSanity, getSanityPluginLookup } from './utils.js' From 1f04cf3b7440e7b22bd0eb98385f857e8900120f Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Wed, 31 Aug 2022 16:02:14 -0400 Subject: [PATCH 11/42] chore: added GH action to synch plugins to CMS --- .github/workflows/sync-to-cms.yml | 29 +++++++++++++++++++++++++++++ bin/sync_plugins_to_sanity.js | 8 +++++--- 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/sync-to-cms.yml diff --git a/.github/workflows/sync-to-cms.yml b/.github/workflows/sync-to-cms.yml new file mode 100644 index 000000000..f222a0019 --- /dev/null +++ b/.github/workflows/sync-to-cms.yml @@ -0,0 +1,29 @@ +name: Sync Plugins to CMS +on: + push: + branches: [main] + tags: ['*'] + pull_request: + types: [opened, synchronize, reopened] +jobs: + sync-to-cms: + runs-on: ubuntu-latest + environment: + name: Sandbox + steps: + - name: Git checkout + uses: actions/checkout@v3 + - name: Using Node.js + uses: actions/setup-node@v3 + with: + node-version: '*' + cache: 'npm' + check-latest: true + - name: Install dependencies + run: npm install + - name: Sync plugins to CMS + env: + SANITY_API_TOKEN: ${{ secrets.SANITY_API_TOKEN }} + SANITY_PROJECT_ID: ${{ secrets.SANITY_PROJECT_ID }} + SANITY_DATASET: ${{ secrets.SANITY_DATASET }} + run: npx tsx bin/sync_plugins_to_sanity.js diff --git a/bin/sync_plugins_to_sanity.js b/bin/sync_plugins_to_sanity.js index 425a9d6ad..cff56a044 100644 --- a/bin/sync_plugins_to_sanity.js +++ b/bin/sync_plugins_to_sanity.js @@ -1,5 +1,6 @@ // eslint-env node import { promises } from 'fs' +import path from 'path' import sanityClient from '@sanity/client' import dotenv from 'dotenv' @@ -19,7 +20,7 @@ const fs = promises dotenv.config() // eslint-disable-next-line n/prefer-global/process -const { SANITY_API_TOKEN, SANITY_PROJECT_ID, SANITY_DATASET } = process.env +const { GITHUB_WORKSPACE, SANITY_API_TOKEN, SANITY_PROJECT_ID, SANITY_DATASET } = process.env const [apiVersion] = new Date().toISOString().split('T') // TODO: projectId and dataset should be read from GH action secrets? @@ -51,8 +52,9 @@ const query = `*[_type == "buildPlugin"] { // TODO: Add a retry mechanism to handle network errors try { // TODO: Remove hardcoded path. This will be coming in as an argument - const filePath = '/Users/nicktaylor/dev/work/plugins/site/plugins.json' - const fileContents = await fs.readFile(filePath) + const pluginsFilePath = path.join(GITHUB_WORKSPACE, '/site/plugins.json') + console.log(`Reading plugins file from ${pluginsFilePath}`) + const fileContents = await fs.readFile(pluginsFilePath) const plugins = JSON.parse(fileContents) /** From b32b98828cff932a0eb24cc64d19c2275d93360f Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Wed, 31 Aug 2022 16:35:52 -0400 Subject: [PATCH 12/42] chore: added some TODOs for going to production with the sync to CMS GH action --- .github/workflows/sync-to-cms.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/sync-to-cms.yml b/.github/workflows/sync-to-cms.yml index f222a0019..59843381b 100644 --- a/.github/workflows/sync-to-cms.yml +++ b/.github/workflows/sync-to-cms.yml @@ -3,12 +3,14 @@ on: push: branches: [main] tags: ['*'] + # TODO: remove pull_request section once this is ready for production, i.e. when this is about to be merged into the repo pull_request: types: [opened, synchronize, reopened] jobs: sync-to-cms: runs-on: ubuntu-latest environment: + # TODO: Rename this to Production once this is ready for production, i.e. when this is about to be merged into the repo name: Sandbox steps: - name: Git checkout From 0fa5977845d37f87ba5e0c872880be80a4cbcf05 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Wed, 31 Aug 2022 18:40:15 -0400 Subject: [PATCH 13/42] chore: cleaning up the script a bit --- bin/sync_plugins_to_sanity.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/bin/sync_plugins_to_sanity.js b/bin/sync_plugins_to_sanity.js index cff56a044..34bfd5807 100644 --- a/bin/sync_plugins_to_sanity.js +++ b/bin/sync_plugins_to_sanity.js @@ -1,11 +1,9 @@ // eslint-env node +/* eslint-disable n/prefer-global/process */ import { promises } from 'fs' import path from 'path' import sanityClient from '@sanity/client' -import dotenv from 'dotenv' - -// TODO: The plugins file that changed should be passed in as an argument /** * @typedef { import("../types/plugins").SanityBuildPluginEntity } SanityBuildPluginEntity @@ -16,10 +14,14 @@ import { getPluginDiffsForSanity, getSanityPluginLookup } from './utils.js' const fs = promises -// Using dotenv for local development. When its running in a GitHub action it will use the GitHub action's environment variables -dotenv.config() +if (process.env.NODE_ENV === 'development') { + // Using dotenv for local development. + console.log('running in development mode') + + const dotenv = await import('dotenv') + dotenv.config() +} -// eslint-disable-next-line n/prefer-global/process const { GITHUB_WORKSPACE, SANITY_API_TOKEN, SANITY_PROJECT_ID, SANITY_DATASET } = process.env const [apiVersion] = new Date().toISOString().split('T') @@ -51,7 +53,8 @@ const query = `*[_type == "buildPlugin"] { // TODO: Add a retry mechanism to handle network errors try { - // TODO: Remove hardcoded path. This will be coming in as an argument + // when testing this script locally, add a path in your .env for GITHUB_WORKSPACE or pass it in + // e.g. GITHUB_WORKSPACE="/Users/some-dev/dev/plugins/" npx tsx bin/sync_plugins_to_sanity.js const pluginsFilePath = path.join(GITHUB_WORKSPACE, '/site/plugins.json') console.log(`Reading plugins file from ${pluginsFilePath}`) const fileContents = await fs.readFile(pluginsFilePath) @@ -69,3 +72,5 @@ try { console.error(error) throw new Error('Unable to retrieve plugins from CMS') } + +/* eslint-enable n/prefer-global/process */ From b0101df1619cdb831ac3863a1ea1efcf37642fdd Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Wed, 31 Aug 2022 22:30:37 -0400 Subject: [PATCH 14/42] chore: added _id field to query so it can be used to retrieve full object for upsert to Sanity --- bin/sync_plugins_to_sanity.js | 1 + bin/utils.js | 6 ++++++ test/bin/utils.js | 14 ++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/bin/sync_plugins_to_sanity.js b/bin/sync_plugins_to_sanity.js index 34bfd5807..18737f7c0 100644 --- a/bin/sync_plugins_to_sanity.js +++ b/bin/sync_plugins_to_sanity.js @@ -41,6 +41,7 @@ const config = { const client = sanityClient(config) const query = `*[_type == "buildPlugin"] { + _id, title, description, authors, diff --git a/bin/utils.js b/bin/utils.js index 558ce9bda..e60418e81 100644 --- a/bin/utils.js +++ b/bin/utils.js @@ -8,6 +8,7 @@ import deepEqual from 'deep-equal' const sanityFieldNameToPluginKeyLookup = { + _id: '_id', title: 'name', description: 'description', // In sanity, the field is an array of authors, in plugins.json. it's one author @@ -72,6 +73,11 @@ export const getPluginDiffsForSanity = (pluginLookup, plugins) => if (!(plugin.package in pluginLookup)) { return false } + + // adding the _id field to the plugin object so that we can use it to update the plugin in Sanity + // eslint-disable-next-line no-param-reassign, no-underscore-dangle + plugin._id = pluginLookup[plugin.package]._id + const sanityPlugin = convertSanityPluginToPlugin(pluginLookup[plugin.package]) return !deepEqual(plugin, sanityPlugin) diff --git a/test/bin/utils.js b/test/bin/utils.js index 743234a51..113da2be2 100644 --- a/test/bin/utils.js +++ b/test/bin/utils.js @@ -14,6 +14,7 @@ test('should generate Sanity build plugin lookup', (t) => { */ const sanityBuildPlugins = [ { + _id: '1', authors: [{ _id: '03fb09e4-2f37-4242-a9f2-664daf4c7ff9', name: 'Ben Lmsc' }], compatibility: null, description: 'Make some environment variables available only at build time in the runtime of your application.', @@ -23,6 +24,7 @@ test('should generate Sanity build plugin lookup', (t) => { version: '1.2.1', }, { + _id: '2', authors: [{ _id: '1dccdb09-71f8-482a-aa0f-9bae32df2e2a', name: 'Bharathvaj Ganesan' }], compatibility: null, description: 'Automatically notifies Airbrake of new site deploys.', @@ -32,6 +34,7 @@ test('should generate Sanity build plugin lookup', (t) => { version: '1.0.2', }, { + _id: '3', authors: [{ _id: 'eaf7029b-a72b-406f-a2cc-4b8b48fb50a3', name: null }], compatibility: null, description: 'Debug & verify the contents of your Netlify build cache', @@ -43,6 +46,7 @@ test('should generate Sanity build plugin lookup', (t) => { ] const expected = { 'netlify-plugin-use-env-in-runtime': { + _id: '1', authors: [{ _id: '03fb09e4-2f37-4242-a9f2-664daf4c7ff9', name: 'Ben Lmsc' }], compatibility: null, description: 'Make some environment variables available only at build time in the runtime of your application.', @@ -52,6 +56,7 @@ test('should generate Sanity build plugin lookup', (t) => { version: '1.2.1', }, '@bharathvaj/netlify-plugin-airbrake': { + _id: '2', authors: [{ _id: '1dccdb09-71f8-482a-aa0f-9bae32df2e2a', name: 'Bharathvaj Ganesan' }], compatibility: null, description: 'Automatically notifies Airbrake of new site deploys.', @@ -61,6 +66,7 @@ test('should generate Sanity build plugin lookup', (t) => { version: '1.0.2', }, 'netlify-plugin-debug-cache': { + _id: '3', authors: [{ _id: 'eaf7029b-a72b-406f-a2cc-4b8b48fb50a3', name: null }], compatibility: null, description: 'Debug & verify the contents of your Netlify build cache', @@ -77,6 +83,7 @@ test('should generate Sanity build plugin lookup', (t) => { test('should generate plugin diffs for Sanity', (t) => { const pluginLookup = { 'netlify-plugin-use-env-in-runtime': { + _id: '1', authors: [{ _id: '03fb09e4-2f37-4242-a9f2-664daf4c7ff9', name: 'Ben Lmsc' }], compatibility: null, description: 'Make some environment variables available only at build time in the runtime of your application.', @@ -86,6 +93,7 @@ test('should generate plugin diffs for Sanity', (t) => { version: '1.2.1', }, '@bharathvaj/netlify-plugin-airbrake': { + _id: '2', authors: [{ _id: '1dccdb09-71f8-482a-aa0f-9bae32df2e2a', name: 'Bharathvaj Ganesan' }], compatibility: null, description: 'Automatically notifies Airbrake of new site deploys.', @@ -95,6 +103,7 @@ test('should generate plugin diffs for Sanity', (t) => { version: '1.0.2', }, 'netlify-plugin-debug-cache': { + _id: '3', authors: [{ _id: 'eaf7029b-a72b-406f-a2cc-4b8b48fb50a3', name: 'Bobby MacDougall' }], compatibility: null, description: 'Debug & verify the contents of your Netlify build cache', @@ -132,6 +141,7 @@ test('should generate plugin diffs for Sanity', (t) => { ] const expected = [ { + _id: '1', author: 'Ben Lmsc', description: 'Make some environment variables available only at build time in the runtime of your application.', package: 'netlify-plugin-use-env-in-runtime', @@ -140,6 +150,7 @@ test('should generate plugin diffs for Sanity', (t) => { version: '1.2.2', }, { + _id: '3', author: 'Bobby MacDougall', description: 'Debug & verify the contents of your Netlify build cache', package: 'netlify-plugin-debug-cache', @@ -156,6 +167,7 @@ test('should generate plugin diffs for Sanity', (t) => { test('should return no plugin diffs for Sanity if there are no changes', (t) => { const pluginLookup = { 'netlify-plugin-use-env-in-runtime': { + _id: '1', authors: [{ _id: '03fb09e4-2f37-4242-a9f2-664daf4c7ff9', name: 'Ben Lmsc' }], compatibility: null, description: 'Make some environment variables available only at build time in the runtime of your application.', @@ -165,6 +177,7 @@ test('should return no plugin diffs for Sanity if there are no changes', (t) => version: '1.2.1', }, '@bharathvaj/netlify-plugin-airbrake': { + _id: '2', authors: [{ _id: '1dccdb09-71f8-482a-aa0f-9bae32df2e2a', name: 'Bharathvaj Ganesan' }], compatibility: null, description: 'Automatically notifies Airbrake of new site deploys.', @@ -174,6 +187,7 @@ test('should return no plugin diffs for Sanity if there are no changes', (t) => version: '1.0.2', }, 'netlify-plugin-debug-cache': { + _id: '3', authors: [{ _id: 'eaf7029b-a72b-406f-a2cc-4b8b48fb50a3', name: 'Bobby MacDougall' }], compatibility: null, description: 'Debug & verify the contents of your Netlify build cache', From b80c77a9217d031f77e50cfbc3979faeadbdbc4c Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Wed, 31 Aug 2022 22:33:19 -0400 Subject: [PATCH 15/42] chore: now only number of diffs is logged instead of payload --- bin/sync_plugins_to_sanity.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/sync_plugins_to_sanity.js b/bin/sync_plugins_to_sanity.js index 18737f7c0..6d3fe65ff 100644 --- a/bin/sync_plugins_to_sanity.js +++ b/bin/sync_plugins_to_sanity.js @@ -68,7 +68,7 @@ try { const sanityPluginLookup = await getSanityPluginLookup(sanityBuildPlugins) const pluginDiffs = getPluginDiffsForSanity(sanityPluginLookup, plugins) - console.log(JSON.stringify(pluginDiffs, null, 2)) + console.log(`Found ${pluginDiffs.length} plugin diffs`) } catch (error) { console.error(error) throw new Error('Unable to retrieve plugins from CMS') From 69851489c642b0c266c10ac7d755f4e8062a040b Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Thu, 1 Sep 2022 20:19:25 -0400 Subject: [PATCH 16/42] chore: first iteration of updating CMS working --- bin/sync_plugins_to_sanity.js | 27 ++++++++++++++++-- bin/utils.js | 52 ++++++++++++++++++++++++++++------- test/bin/utils.js | 16 +++++------ 3 files changed, 75 insertions(+), 20 deletions(-) diff --git a/bin/sync_plugins_to_sanity.js b/bin/sync_plugins_to_sanity.js index 6d3fe65ff..5b7ca2e87 100644 --- a/bin/sync_plugins_to_sanity.js +++ b/bin/sync_plugins_to_sanity.js @@ -57,10 +57,12 @@ try { // when testing this script locally, add a path in your .env for GITHUB_WORKSPACE or pass it in // e.g. GITHUB_WORKSPACE="/Users/some-dev/dev/plugins/" npx tsx bin/sync_plugins_to_sanity.js const pluginsFilePath = path.join(GITHUB_WORKSPACE, '/site/plugins.json') - console.log(`Reading plugins file from ${pluginsFilePath}`) + console.log(`Reading existing plugins in repository from ${pluginsFilePath}`) const fileContents = await fs.readFile(pluginsFilePath) const plugins = JSON.parse(fileContents) + console.info('Detecting plugin diffs.') + /** * @type {SanityBuildPluginEntity[]} */ @@ -68,7 +70,28 @@ try { const sanityPluginLookup = await getSanityPluginLookup(sanityBuildPlugins) const pluginDiffs = getPluginDiffsForSanity(sanityPluginLookup, plugins) - console.log(`Found ${pluginDiffs.length} plugin diffs`) + console.info(`Found ${pluginDiffs.length} plugin diffs`) + + /** + * + * @param {BuildPluginEntity} pluginDiffs + * @returns + */ + const createUpdates = (transaction, patch, diffs) => + diffs.reduce((tx, plugin) => { + const { _id, ...pluginUpdates } = plugin + const update = patch(_id).set(pluginUpdates) + + tx.patch(update) + + return tx + }, transaction) + + console.info('Updating plugins...') + const transaction = createUpdates(client.transaction(), client.patch, pluginDiffs) + + client.mutate(transaction, { dryRun: false }) + console.info('Plugins were updated in the CMS.') } catch (error) { console.error(error) throw new Error('Unable to retrieve plugins from CMS') diff --git a/bin/utils.js b/bin/utils.js index e60418e81..d142effe2 100644 --- a/bin/utils.js +++ b/bin/utils.js @@ -20,6 +20,16 @@ const sanityFieldNameToPluginKeyLookup = { compatibility: 'compatibility', } +const pluginKeyToSanityFieldNameLookup = Object.entries(sanityFieldNameToPluginKeyLookup).reduce( + (lookup, [key, value]) => { + // eslint-disable-next-line no-param-reassign + lookup[value] = key + + return lookup + }, + {}, +) + /** * Retrieves a list of all the plugins stored in Sanity * @@ -40,6 +50,26 @@ export const getSanityPluginLookup = (plugins) => { return pluginLookup } +/** + * + * @param {BuildPluginEntity} plugin + * + * @returns {SanityBuildPluginEntity} + */ +const convertToSanityPlugin = (plugin) => { + const formattedPlugin = Object.keys(plugin).reduce((pluginToFormat, key) => { + // TODO: skipping authors for as they'd already be in Sanity and we're not displaying authors in the Integrations Hub for the time being. + if (key !== 'author') { + // eslint-disable-next-line no-param-reassign + pluginToFormat[pluginKeyToSanityFieldNameLookup[key]] = plugin[key] + } + + return pluginToFormat + }, {}) + + return formattedPlugin +} + /** * * @param {*} plugin @@ -69,16 +99,18 @@ const convertSanityPluginToPlugin = (plugin) => { * @returns */ export const getPluginDiffsForSanity = (pluginLookup, plugins) => - plugins.filter((plugin) => { - if (!(plugin.package in pluginLookup)) { - return false - } + plugins + .filter((plugin) => { + if (!(plugin.package in pluginLookup)) { + return false + } - // adding the _id field to the plugin object so that we can use it to update the plugin in Sanity - // eslint-disable-next-line no-param-reassign, no-underscore-dangle - plugin._id = pluginLookup[plugin.package]._id + // adding the _id field to the plugin object so that we can use it to update the plugin in Sanity + // eslint-disable-next-line no-param-reassign, no-underscore-dangle + plugin._id = pluginLookup[plugin.package]._id - const sanityPlugin = convertSanityPluginToPlugin(pluginLookup[plugin.package]) + const sanityPlugin = convertSanityPluginToPlugin(pluginLookup[plugin.package]) - return !deepEqual(plugin, sanityPlugin) - }) + return !deepEqual(plugin, sanityPlugin) + }) + .map(convertToSanityPlugin) diff --git a/test/bin/utils.js b/test/bin/utils.js index 113da2be2..36e602b2d 100644 --- a/test/bin/utils.js +++ b/test/bin/utils.js @@ -139,23 +139,23 @@ test('should generate plugin diffs for Sanity', (t) => { version: '1.0.4', }, ] + + // authors are not currently in here because for v1, we're not updating authors. const expected = [ { _id: '1', - author: 'Ben Lmsc', description: 'Make some environment variables available only at build time in the runtime of your application.', - package: 'netlify-plugin-use-env-in-runtime', - repo: 'https://github.com/ARKHN3B/netlify-plugin-use-env-in-runtime', - name: 'Use Env in Runtime', + packageName: 'netlify-plugin-use-env-in-runtime', + repoUrl: 'https://github.com/ARKHN3B/netlify-plugin-use-env-in-runtime', + title: 'Use Env in Runtime', version: '1.2.2', }, { _id: '3', - author: 'Bobby MacDougall', description: 'Debug & verify the contents of your Netlify build cache', - package: 'netlify-plugin-debug-cache', - repo: 'https://github.com/netlify-labs/netlify-plugin-debug-cache', - name: 'Debug Cache', + packageName: 'netlify-plugin-debug-cache', + repoUrl: 'https://github.com/netlify-labs/netlify-plugin-debug-cache', + title: 'Debug Cache', version: '1.0.4', }, ] From a92eedbe832f191558ffbe87af411dedb95d2ddf Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Thu, 1 Sep 2022 21:22:57 -0400 Subject: [PATCH 17/42] chore: plugin sync to CMS now includes plugin compatibility property --- bin/sync_plugins_to_sanity.js | 2 +- bin/utils.js | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/bin/sync_plugins_to_sanity.js b/bin/sync_plugins_to_sanity.js index 5b7ca2e87..110d9f8af 100644 --- a/bin/sync_plugins_to_sanity.js +++ b/bin/sync_plugins_to_sanity.js @@ -49,7 +49,7 @@ const query = `*[_type == "buildPlugin"] { packageName, repoUrl, version, - compatibility + compatibility[] }` // TODO: Add a retry mechanism to handle network errors diff --git a/bin/utils.js b/bin/utils.js index d142effe2..3145a68a8 100644 --- a/bin/utils.js +++ b/bin/utils.js @@ -59,9 +59,19 @@ export const getSanityPluginLookup = (plugins) => { const convertToSanityPlugin = (plugin) => { const formattedPlugin = Object.keys(plugin).reduce((pluginToFormat, key) => { // TODO: skipping authors for as they'd already be in Sanity and we're not displaying authors in the Integrations Hub for the time being. - if (key !== 'author') { - // eslint-disable-next-line no-param-reassign - pluginToFormat[pluginKeyToSanityFieldNameLookup[key]] = plugin[key] + switch (key) { + case 'author': + break + + case 'compatibility': + // eslint-disable-next-line no-param-reassign + pluginToFormat[pluginKeyToSanityFieldNameLookup[key]] = plugin[key] ? plugin[key].map(JSON.stringify) : null + break + + default: + // eslint-disable-next-line no-param-reassign + pluginToFormat[pluginKeyToSanityFieldNameLookup[key]] = plugin[key] + break } return pluginToFormat @@ -80,10 +90,8 @@ const convertSanityPluginToPlugin = (plugin) => { // TODO: It appears for now at least, plugins.json only ever has one author. const fieldValue = key === `authors` ? plugin[key][0].name : plugin[key] - if (fieldValue !== null) { - // eslint-disable-next-line no-param-reassign - pluginToFormat[sanityFieldNameToPluginKeyLookup[key]] = fieldValue - } + // eslint-disable-next-line no-param-reassign + pluginToFormat[sanityFieldNameToPluginKeyLookup[key]] = fieldValue return pluginToFormat }, {}) From 036dfad8ff7ce8b23e44aa74ccf912ae370d2c92 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Thu, 1 Sep 2022 21:43:56 -0400 Subject: [PATCH 18/42] chore: fixed some logic/tests --- bin/utils.js | 21 ++++++++++++++++++--- test/bin/utils.js | 4 ++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/bin/utils.js b/bin/utils.js index 3145a68a8..da44e3c50 100644 --- a/bin/utils.js +++ b/bin/utils.js @@ -87,11 +87,26 @@ const convertToSanityPlugin = (plugin) => { */ const convertSanityPluginToPlugin = (plugin) => { const formattedPlugin = Object.keys(plugin).reduce((pluginToFormat, key) => { + let fieldValue + // TODO: It appears for now at least, plugins.json only ever has one author. - const fieldValue = key === `authors` ? plugin[key][0].name : plugin[key] + switch (key) { + case 'authors': + fieldValue = plugin[key][0].name + break + case 'compatibility': + if (plugin[key]) { + fieldValue = plugin[key] + } + break + default: + fieldValue = plugin[key] + } - // eslint-disable-next-line no-param-reassign - pluginToFormat[sanityFieldNameToPluginKeyLookup[key]] = fieldValue + if (fieldValue) { + // eslint-disable-next-line no-param-reassign + pluginToFormat[sanityFieldNameToPluginKeyLookup[key]] = fieldValue + } return pluginToFormat }, {}) diff --git a/test/bin/utils.js b/test/bin/utils.js index 36e602b2d..274d597d1 100644 --- a/test/bin/utils.js +++ b/test/bin/utils.js @@ -117,6 +117,7 @@ test('should generate plugin diffs for Sanity', (t) => { { author: 'Ben Lmsc', description: 'Make some environment variables available only at build time in the runtime of your application.', + compatibility: [], package: 'netlify-plugin-use-env-in-runtime', repo: 'https://github.com/ARKHN3B/netlify-plugin-use-env-in-runtime', name: 'Use Env in Runtime', @@ -133,6 +134,7 @@ test('should generate plugin diffs for Sanity', (t) => { { author: 'Bobby MacDougall', description: 'Debug & verify the contents of your Netlify build cache', + compatibility: [], package: 'netlify-plugin-debug-cache', repo: 'https://github.com/netlify-labs/netlify-plugin-debug-cache', name: 'Debug Cache', @@ -145,6 +147,7 @@ test('should generate plugin diffs for Sanity', (t) => { { _id: '1', description: 'Make some environment variables available only at build time in the runtime of your application.', + compatibility: [], packageName: 'netlify-plugin-use-env-in-runtime', repoUrl: 'https://github.com/ARKHN3B/netlify-plugin-use-env-in-runtime', title: 'Use Env in Runtime', @@ -153,6 +156,7 @@ test('should generate plugin diffs for Sanity', (t) => { { _id: '3', description: 'Debug & verify the contents of your Netlify build cache', + compatibility: [], packageName: 'netlify-plugin-debug-cache', repoUrl: 'https://github.com/netlify-labs/netlify-plugin-debug-cache', title: 'Debug Cache', From 19a2b3157f588a2a557368ac12a50fff8585a50f Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Thu, 1 Sep 2022 22:28:34 -0400 Subject: [PATCH 19/42] chore: added some logging around plugin diffs found --- bin/utils.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/utils.js b/bin/utils.js index da44e3c50..085c2a798 100644 --- a/bin/utils.js +++ b/bin/utils.js @@ -136,4 +136,7 @@ export const getPluginDiffsForSanity = (pluginLookup, plugins) => return !deepEqual(plugin, sanityPlugin) }) - .map(convertToSanityPlugin) + .map((plugin) => { + console.info('Plugin diff found:', plugin.package) + return convertToSanityPlugin(plugin) + }) From de0661be2923a065f4023c44a277d3f4af71bcbf Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Thu, 1 Sep 2022 23:24:47 -0400 Subject: [PATCH 20/42] chore: fixed some issues around plugins sync in regards to authors --- bin/utils.js | 53 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/bin/utils.js b/bin/utils.js index 085c2a798..9d73120ae 100644 --- a/bin/utils.js +++ b/bin/utils.js @@ -12,7 +12,7 @@ const sanityFieldNameToPluginKeyLookup = { title: 'name', description: 'description', // In sanity, the field is an array of authors, in plugins.json. it's one author - authors: 'author', + // authors: 'author', packageName: 'package', repoUrl: 'repo', version: 'version', @@ -57,25 +57,31 @@ export const getSanityPluginLookup = (plugins) => { * @returns {SanityBuildPluginEntity} */ const convertToSanityPlugin = (plugin) => { - const formattedPlugin = Object.keys(plugin).reduce((pluginToFormat, key) => { - // TODO: skipping authors for as they'd already be in Sanity and we're not displaying authors in the Integrations Hub for the time being. - switch (key) { - case 'author': - break - - case 'compatibility': - // eslint-disable-next-line no-param-reassign - pluginToFormat[pluginKeyToSanityFieldNameLookup[key]] = plugin[key] ? plugin[key].map(JSON.stringify) : null - break - - default: - // eslint-disable-next-line no-param-reassign - pluginToFormat[pluginKeyToSanityFieldNameLookup[key]] = plugin[key] - break - } + const formattedPlugin = Object.keys(plugin).reduce( + (pluginToFormat, key) => { + // TODO: Skipping authors for now as they'd already be in Sanity and there in the plugins.json file it appears to be a github username, but in Sanity it's a person's name. + switch (key) { + case 'author': + break + + case 'compatibility': + // In Sanity, the compatibility field is an array of strings, but in plugins.json it's an array of objects. + // eslint-disable-next-line no-param-reassign + pluginToFormat[pluginKeyToSanityFieldNameLookup[key]] = plugin[key] ? plugin[key].map(JSON.stringify) : null + break + + default: + // eslint-disable-next-line no-param-reassign + pluginToFormat[pluginKeyToSanityFieldNameLookup[key]] = plugin[key] + break + } - return pluginToFormat - }, {}) + return pluginToFormat + // initializing with compatibility as null because in Sanity it will be null, but in plugins.json the compatibility property won't be null + // It won't exist. + }, + { compatibility: null }, + ) return formattedPlugin } @@ -92,11 +98,12 @@ const convertSanityPluginToPlugin = (plugin) => { // TODO: It appears for now at least, plugins.json only ever has one author. switch (key) { case 'authors': - fieldValue = plugin[key][0].name break case 'compatibility': if (plugin[key]) { - fieldValue = plugin[key] + // TODO: This is stored as an array of strings in Sanity at the moment, but there is no validation on the Sanity end as it's a string. + // For another iteration, we could store the compatibility field as an array of objects instead and avoid JSON.parse failing potentially. + fieldValue = plugin[key].map(JSON.parse) } break default: @@ -133,8 +140,10 @@ export const getPluginDiffsForSanity = (pluginLookup, plugins) => plugin._id = pluginLookup[plugin.package]._id const sanityPlugin = convertSanityPluginToPlugin(pluginLookup[plugin.package]) + // eslint-disable-next-line no-unused-vars + const { author, ...pluginWithoutAuthor } = plugin - return !deepEqual(plugin, sanityPlugin) + return !deepEqual(pluginWithoutAuthor, sanityPlugin) }) .map((plugin) => { console.info('Plugin diff found:', plugin.package) From 8751c558f149d21b1500e92af10a7dcc1f909855 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Thu, 1 Sep 2022 23:41:26 -0400 Subject: [PATCH 21/42] chore: improved log messaging --- bin/sync_plugins_to_sanity.js | 72 +++++++++++++++++++++++------------ 1 file changed, 47 insertions(+), 25 deletions(-) diff --git a/bin/sync_plugins_to_sanity.js b/bin/sync_plugins_to_sanity.js index 110d9f8af..dce2f6175 100644 --- a/bin/sync_plugins_to_sanity.js +++ b/bin/sync_plugins_to_sanity.js @@ -3,6 +3,9 @@ import { promises } from 'fs' import path from 'path' +// when testing this script locally, add a path in your .env for GITHUB_WORKSPACE or pass it in +// e.g. GITHUB_WORKSPACE="/Users/some-dev/dev/plugins/" npx tsx bin/sync_plugins_to_sanity.js + import sanityClient from '@sanity/client' /** @@ -35,6 +38,39 @@ const config = { useCdn: false, } +/** + * + * @param {*} transaction + * @param {*} patch + * @param {*} diffs + * @returns + */ +const createUpdates = (transaction, patch, diffs) => + diffs.reduce((tx, plugin) => { + const { _id, ...changes } = plugin + const fieldUpdates = {} + const fieldRemovals = [] + + for (const [key, value] of Object.entries(changes)) { + // any property that is null needs to be unset instead of being set to null + if (value === null) { + fieldRemovals.push(key) + } else { + fieldUpdates[key] = value + } + } + + const update = patch(_id).set(fieldUpdates) + + if (fieldRemovals.length !== 0) { + update.unset(fieldRemovals) + } + + tx.patch(update) + + return tx + }, transaction) + /** * @type {SanityClient} */ @@ -54,14 +90,11 @@ const query = `*[_type == "buildPlugin"] { // TODO: Add a retry mechanism to handle network errors try { - // when testing this script locally, add a path in your .env for GITHUB_WORKSPACE or pass it in - // e.g. GITHUB_WORKSPACE="/Users/some-dev/dev/plugins/" npx tsx bin/sync_plugins_to_sanity.js const pluginsFilePath = path.join(GITHUB_WORKSPACE, '/site/plugins.json') - console.log(`Reading existing plugins in repository from ${pluginsFilePath}`) const fileContents = await fs.readFile(pluginsFilePath) const plugins = JSON.parse(fileContents) - console.info('Detecting plugin diffs.') + console.info('Detecting plugin changes...') /** * @type {SanityBuildPluginEntity[]} @@ -70,31 +103,20 @@ try { const sanityPluginLookup = await getSanityPluginLookup(sanityBuildPlugins) const pluginDiffs = getPluginDiffsForSanity(sanityPluginLookup, plugins) - console.info(`Found ${pluginDiffs.length} plugin diffs`) - - /** - * - * @param {BuildPluginEntity} pluginDiffs - * @returns - */ - const createUpdates = (transaction, patch, diffs) => - diffs.reduce((tx, plugin) => { - const { _id, ...pluginUpdates } = plugin - const update = patch(_id).set(pluginUpdates) - - tx.patch(update) - - return tx - }, transaction) + if (pluginDiffs.length === 0) { + console.info('No plugin changes found.') + } else { + console.info(`Found ${pluginDiffs.length} plugins with changes`) + console.info('Updating plugins...') - console.info('Updating plugins...') - const transaction = createUpdates(client.transaction(), client.patch, pluginDiffs) + const transaction = createUpdates(client.transaction(), client.patch, pluginDiffs) - client.mutate(transaction, { dryRun: false }) - console.info('Plugins were updated in the CMS.') + client.mutate(transaction, { dryRun: false }) + console.info('Plugins were updated in the CMS.') + } } catch (error) { console.error(error) - throw new Error('Unable to retrieve plugins from CMS') + throw new Error('Unable to synchronize plugins to the CMS') } /* eslint-enable n/prefer-global/process */ From 4dedfa679fc2f9a870b3be7c5bf9869e2051cf5d Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Thu, 1 Sep 2022 23:50:15 -0400 Subject: [PATCH 22/42] chore: added some comments and more types --- bin/sync_plugins_to_sanity.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/sync_plugins_to_sanity.js b/bin/sync_plugins_to_sanity.js index dce2f6175..de423414f 100644 --- a/bin/sync_plugins_to_sanity.js +++ b/bin/sync_plugins_to_sanity.js @@ -11,6 +11,9 @@ import sanityClient from '@sanity/client' /** * @typedef { import("../types/plugins").SanityBuildPluginEntity } SanityBuildPluginEntity * @typedef { import("@sanity/client").SanityClient } SanityClient + * @typedef { import("@sanity/client").Transaction } Transaction + * @typedef { import("@sanity/client").Patch } Patch + * @typedef { import("../types/plugins").BuildPluginEntity } BuildPluginEntity */ import { getPluginDiffsForSanity, getSanityPluginLookup } from './utils.js' @@ -39,10 +42,11 @@ const config = { } /** + * Creates a transaction containing updates to to plugins for the CMS * - * @param {*} transaction - * @param {*} patch - * @param {*} diffs + * @param {Transaction} transaction + * @param {Patch} patch + * @param {BuildPluginEntity[]} diffs * @returns */ const createUpdates = (transaction, patch, diffs) => From dd211180776417c44e09770fda8f16e6c93d6563 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Thu, 1 Sep 2022 23:58:15 -0400 Subject: [PATCH 23/42] chore: renamed synchronization script --- .github/workflows/sync-to-cms.yml | 2 +- bin/{sync_plugins_to_sanity.js => sync_plugins_to_cms.js} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename bin/{sync_plugins_to_sanity.js => sync_plugins_to_cms.js} (99%) diff --git a/.github/workflows/sync-to-cms.yml b/.github/workflows/sync-to-cms.yml index 59843381b..225e6415c 100644 --- a/.github/workflows/sync-to-cms.yml +++ b/.github/workflows/sync-to-cms.yml @@ -28,4 +28,4 @@ jobs: SANITY_API_TOKEN: ${{ secrets.SANITY_API_TOKEN }} SANITY_PROJECT_ID: ${{ secrets.SANITY_PROJECT_ID }} SANITY_DATASET: ${{ secrets.SANITY_DATASET }} - run: npx tsx bin/sync_plugins_to_sanity.js + run: npx tsx bin/sync_plugins_to_cms.js diff --git a/bin/sync_plugins_to_sanity.js b/bin/sync_plugins_to_cms.js similarity index 99% rename from bin/sync_plugins_to_sanity.js rename to bin/sync_plugins_to_cms.js index de423414f..b4f0d6285 100644 --- a/bin/sync_plugins_to_sanity.js +++ b/bin/sync_plugins_to_cms.js @@ -4,7 +4,7 @@ import { promises } from 'fs' import path from 'path' // when testing this script locally, add a path in your .env for GITHUB_WORKSPACE or pass it in -// e.g. GITHUB_WORKSPACE="/Users/some-dev/dev/plugins/" npx tsx bin/sync_plugins_to_sanity.js +// e.g. GITHUB_WORKSPACE="/Users/some-dev/dev/plugins/" npx tsx bin/sync_plugins_to_cms.js import sanityClient from '@sanity/client' From d6e60af38ded87b570a4903392db0b62a63bd1da Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Fri, 2 Sep 2022 00:38:33 -0400 Subject: [PATCH 24/42] chore: removed dryrun config used for debugging purposes --- bin/sync_plugins_to_cms.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/sync_plugins_to_cms.js b/bin/sync_plugins_to_cms.js index b4f0d6285..0a04f6b5d 100644 --- a/bin/sync_plugins_to_cms.js +++ b/bin/sync_plugins_to_cms.js @@ -115,7 +115,7 @@ try { const transaction = createUpdates(client.transaction(), client.patch, pluginDiffs) - client.mutate(transaction, { dryRun: false }) + client.mutate(transaction) console.info('Plugins were updated in the CMS.') } } catch (error) { From 8ef77b4d0f63b67991c4ee6ce9ed31adbc6db6e3 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Fri, 2 Sep 2022 00:45:09 -0400 Subject: [PATCH 25/42] chore: updated a type --- types/plugins.d.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/types/plugins.d.ts b/types/plugins.d.ts index c516c114e..2570f607c 100644 --- a/types/plugins.d.ts +++ b/types/plugins.d.ts @@ -15,4 +15,22 @@ export interface SanityBuildPluginEntity { export type SanityPluginLookup = Record -export type BuildPluginEntity = {} +export type Compatibility = + | { + version: string + migrationGuide: strings + } + | { + version: string + nodeVersion: string + } + +export type BuildPluginEntity = { + author: string + description: string + name: string + package: string + repo: string + version: string + compatibility?: Compatibility[] +} From 5be7bf7e49e8cc150a5e0c78246dd822996c3fa2 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Fri, 2 Sep 2022 08:51:28 -0400 Subject: [PATCH 26/42] chore: cleaned up some comments --- bin/sync_plugins_to_cms.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/sync_plugins_to_cms.js b/bin/sync_plugins_to_cms.js index 0a04f6b5d..60e166e86 100644 --- a/bin/sync_plugins_to_cms.js +++ b/bin/sync_plugins_to_cms.js @@ -31,7 +31,6 @@ if (process.env.NODE_ENV === 'development') { const { GITHUB_WORKSPACE, SANITY_API_TOKEN, SANITY_PROJECT_ID, SANITY_DATASET } = process.env const [apiVersion] = new Date().toISOString().split('T') -// TODO: projectId and dataset should be read from GH action secrets? const config = { projectId: SANITY_PROJECT_ID, dataset: SANITY_DATASET, @@ -42,7 +41,7 @@ const config = { } /** - * Creates a transaction containing updates to to plugins for the CMS + * Creates a transaction containing updates to plugins for the CMS * * @param {Transaction} transaction * @param {Patch} patch From 905be79919637898b6ce3887ea41a6c4e9346378 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Fri, 2 Sep 2022 08:52:17 -0400 Subject: [PATCH 27/42] chore: promisises from fs is aliased now --- bin/sync_plugins_to_cms.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bin/sync_plugins_to_cms.js b/bin/sync_plugins_to_cms.js index 60e166e86..bfbc3c8a8 100644 --- a/bin/sync_plugins_to_cms.js +++ b/bin/sync_plugins_to_cms.js @@ -1,6 +1,6 @@ // eslint-env node /* eslint-disable n/prefer-global/process */ -import { promises } from 'fs' +import { promises as fs } from 'fs' import path from 'path' // when testing this script locally, add a path in your .env for GITHUB_WORKSPACE or pass it in @@ -18,8 +18,6 @@ import sanityClient from '@sanity/client' import { getPluginDiffsForSanity, getSanityPluginLookup } from './utils.js' -const fs = promises - if (process.env.NODE_ENV === 'development') { // Using dotenv for local development. console.log('running in development mode') From 55b1c0d1c539dd015c1747ed82309971e997ce3a Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Fri, 2 Sep 2022 11:37:30 -0400 Subject: [PATCH 28/42] chore: fixed a type typo --- types/plugins.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/plugins.d.ts b/types/plugins.d.ts index 2570f607c..afdbb01a5 100644 --- a/types/plugins.d.ts +++ b/types/plugins.d.ts @@ -18,7 +18,7 @@ export type SanityPluginLookup = Record export type Compatibility = | { version: string - migrationGuide: strings + migrationGuide: string } | { version: string From 599099d074a89268b029af45718756bb20143dd6 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Mon, 26 Sep 2022 11:22:59 -0400 Subject: [PATCH 29/42] chore: updated logic for compatibility field now that CMS schema has been updated --- bin/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/utils.js b/bin/utils.js index 9d73120ae..74e946453 100644 --- a/bin/utils.js +++ b/bin/utils.js @@ -67,7 +67,7 @@ const convertToSanityPlugin = (plugin) => { case 'compatibility': // In Sanity, the compatibility field is an array of strings, but in plugins.json it's an array of objects. // eslint-disable-next-line no-param-reassign - pluginToFormat[pluginKeyToSanityFieldNameLookup[key]] = plugin[key] ? plugin[key].map(JSON.stringify) : null + pluginToFormat[pluginKeyToSanityFieldNameLookup[key]] = plugin[key] || null break default: From 06ce3e5680ad947ad7c17d529876f22f0b5e87ca Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Mon, 26 Sep 2022 14:05:28 -0400 Subject: [PATCH 30/42] chore: updated comment on how to run script for local development --- bin/sync_plugins_to_cms.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/sync_plugins_to_cms.js b/bin/sync_plugins_to_cms.js index bfbc3c8a8..2fddcc386 100644 --- a/bin/sync_plugins_to_cms.js +++ b/bin/sync_plugins_to_cms.js @@ -4,7 +4,7 @@ import { promises as fs } from 'fs' import path from 'path' // when testing this script locally, add a path in your .env for GITHUB_WORKSPACE or pass it in -// e.g. GITHUB_WORKSPACE="/Users/some-dev/dev/plugins/" npx tsx bin/sync_plugins_to_cms.js +// e.g. GITHUB_WORKSPACE="$(pwd)" npx tsx bin/sync_plugins_to_cms.js import sanityClient from '@sanity/client' From 8e82935c1517a1d8c428a53b5616f8c6a510e4c9 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Mon, 26 Sep 2022 16:10:45 -0400 Subject: [PATCH 31/42] chore: added the Sanity uuid package to generate _key properties for array items --- package-lock.json | 48 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 49 insertions(+) diff --git a/package-lock.json b/package-lock.json index 534315c39..acf908abd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "devDependencies": { "@netlify/eslint-config-node": "^6.0.0", "@sanity/client": "^3.3.6", + "@sanity/uuid": "^3.0.1", "ava": "^4.3.3", "c8": "^7.11.0", "deep-equal": "^2.0.5", @@ -1361,6 +1362,16 @@ "node": ">=0.10.0" } }, + "node_modules/@sanity/uuid": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sanity/uuid/-/uuid-3.0.1.tgz", + "integrity": "sha512-cfWq8l/M6TiDYlp2VYJR2MNdrl0u/lkYWjJVflLHsiGjG8SZKbbRSsfG1fn7rSvdZg+o/xfBlKCfhFTtEiXKJg==", + "dev": true, + "dependencies": { + "@types/uuid": "^8.0.0", + "uuid": "^8.0.0" + } + }, "node_modules/@sindresorhus/is": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.2.1.tgz", @@ -1529,6 +1540,12 @@ "integrity": "sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==", "dev": true }, + "node_modules/@types/uuid": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz", + "integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==", + "dev": true + }, "node_modules/@types/yargs": { "version": "16.0.4", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", @@ -10130,6 +10147,15 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/v8-compile-cache": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", @@ -11417,6 +11443,16 @@ "integrity": "sha512-NBDKGj14g9Z+bopIvZcQKWCzJq5JSrdmzRR1CS+iyA3Gm8SnIWBfZa7I3mTg2X6Nu8LQXG0EPKXdOGozLS4i3w==", "dev": true }, + "@sanity/uuid": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sanity/uuid/-/uuid-3.0.1.tgz", + "integrity": "sha512-cfWq8l/M6TiDYlp2VYJR2MNdrl0u/lkYWjJVflLHsiGjG8SZKbbRSsfG1fn7rSvdZg+o/xfBlKCfhFTtEiXKJg==", + "dev": true, + "requires": { + "@types/uuid": "^8.0.0", + "uuid": "^8.0.0" + } + }, "@sindresorhus/is": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.2.1.tgz", @@ -11573,6 +11609,12 @@ "integrity": "sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==", "dev": true }, + "@types/uuid": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz", + "integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==", + "dev": true + }, "@types/yargs": { "version": "16.0.4", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", @@ -17765,6 +17807,12 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true + }, "v8-compile-cache": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", diff --git a/package.json b/package.json index 715c867e1..eac066ae7 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "devDependencies": { "@netlify/eslint-config-node": "^6.0.0", "@sanity/client": "^3.3.6", + "@sanity/uuid": "^3.0.1", "ava": "^4.3.3", "c8": "^7.11.0", "deep-equal": "^2.0.5", From b155978c6baf915ec124072e9c22a8550212ed03 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Mon, 26 Sep 2022 18:12:29 -0400 Subject: [PATCH 32/42] chore: clean up diff logic for plugins to Sanity sync --- bin/utils.js | 67 +++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/bin/utils.js b/bin/utils.js index 74e946453..c12619643 100644 --- a/bin/utils.js +++ b/bin/utils.js @@ -59,21 +59,25 @@ export const getSanityPluginLookup = (plugins) => { const convertToSanityPlugin = (plugin) => { const formattedPlugin = Object.keys(plugin).reduce( (pluginToFormat, key) => { - // TODO: Skipping authors for now as they'd already be in Sanity and there in the plugins.json file it appears to be a github username, but in Sanity it's a person's name. switch (key) { - case 'author': + // _id field was added from Sanity so there is a unique identifier for each plugin when pushing things back to Sanity. + case '_id': + // eslint-disable-next-line no-param-reassign + pluginToFormat[pluginKeyToSanityFieldNameLookup[key]] = plugin[key] break - case 'compatibility': - // In Sanity, the compatibility field is an array of strings, but in plugins.json it's an array of objects. // eslint-disable-next-line no-param-reassign pluginToFormat[pluginKeyToSanityFieldNameLookup[key]] = plugin[key] || null break - default: + case 'version': // eslint-disable-next-line no-param-reassign pluginToFormat[pluginKeyToSanityFieldNameLookup[key]] = plugin[key] break + + default: + // We only want to sync the version and compatibility fields for now. + break } return pluginToFormat @@ -92,31 +96,13 @@ const convertToSanityPlugin = (plugin) => { * @returns */ const convertSanityPluginToPlugin = (plugin) => { - const formattedPlugin = Object.keys(plugin).reduce((pluginToFormat, key) => { - let fieldValue - - // TODO: It appears for now at least, plugins.json only ever has one author. - switch (key) { - case 'authors': - break - case 'compatibility': - if (plugin[key]) { - // TODO: This is stored as an array of strings in Sanity at the moment, but there is no validation on the Sanity end as it's a string. - // For another iteration, we could store the compatibility field as an array of objects instead and avoid JSON.parse failing potentially. - fieldValue = plugin[key].map(JSON.parse) - } - break - default: - fieldValue = plugin[key] - } - - if (fieldValue) { - // eslint-disable-next-line no-param-reassign - pluginToFormat[sanityFieldNameToPluginKeyLookup[key]] = fieldValue - } - - return pluginToFormat - }, {}) + // These are the only fields we care about for now. + const formattedPlugin = { + // eslint-disable-next-line no-underscore-dangle + _id: plugin._id, + version: plugin.version, + compatibility: plugin.compatibility, + } return formattedPlugin } @@ -128,10 +114,11 @@ const convertSanityPluginToPlugin = (plugin) => { * @param {BuildPluginEntity[]} plugins * @returns */ -export const getPluginDiffsForSanity = (pluginLookup, plugins) => - plugins +export const getPluginDiffsForSanity = (pluginLookup, plugins) => { + const diffs = plugins .filter((plugin) => { if (!(plugin.package in pluginLookup)) { + // The plugin does not Exist in Sanity, so we filter it out. return false } @@ -139,13 +126,23 @@ export const getPluginDiffsForSanity = (pluginLookup, plugins) => // eslint-disable-next-line no-param-reassign, no-underscore-dangle plugin._id = pluginLookup[plugin.package]._id + // These are the only fields we care about for now. + const minimalPlugin = { + // eslint-disable-next-line no-underscore-dangle + _id: plugin._id, + version: plugin.version, + // In Sanity it's null, in plugins.json it's undefined + compatibility: plugin.compatibility || null, + } + const sanityPlugin = convertSanityPluginToPlugin(pluginLookup[plugin.package]) - // eslint-disable-next-line no-unused-vars - const { author, ...pluginWithoutAuthor } = plugin - return !deepEqual(pluginWithoutAuthor, sanityPlugin) + return !deepEqual(minimalPlugin, sanityPlugin) }) .map((plugin) => { console.info('Plugin diff found:', plugin.package) return convertToSanityPlugin(plugin) }) + + return diffs +} From 780d0c922a5885e6f2bb910f0adc16c9659bc3af Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Mon, 26 Sep 2022 18:20:08 -0400 Subject: [PATCH 33/42] chore: adds a _key field to compatibility items as required by Sanity --- bin/sync_plugins_to_cms.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/bin/sync_plugins_to_cms.js b/bin/sync_plugins_to_cms.js index 2fddcc386..e723db460 100644 --- a/bin/sync_plugins_to_cms.js +++ b/bin/sync_plugins_to_cms.js @@ -3,11 +3,12 @@ import { promises as fs } from 'fs' import path from 'path' +import sanityClient from '@sanity/client' +import { uuid } from '@sanity/uuid' + // when testing this script locally, add a path in your .env for GITHUB_WORKSPACE or pass it in // e.g. GITHUB_WORKSPACE="$(pwd)" npx tsx bin/sync_plugins_to_cms.js -import sanityClient from '@sanity/client' - /** * @typedef { import("../types/plugins").SanityBuildPluginEntity } SanityBuildPluginEntity * @typedef { import("@sanity/client").SanityClient } SanityClient @@ -93,7 +94,22 @@ const query = `*[_type == "buildPlugin"] { try { const pluginsFilePath = path.join(GITHUB_WORKSPACE, '/site/plugins.json') const fileContents = await fs.readFile(pluginsFilePath) - const plugins = JSON.parse(fileContents) + const plugins = JSON.parse(fileContents).map((plugin) => { + // Ensure if a compatibility field exists, that it has all the necessary fields to sync with Sanity + if (plugin.compatibility) { + // eslint-disable-next-line no-param-reassign + plugin.compatibility = plugin.compatibility.map((compatibilityItem) => { + const updatedCompatibilityItem = { + _key: uuid(), + ...compatibilityItem, + } + + return updatedCompatibilityItem + }) + } + + return plugin + }) console.info('Detecting plugin changes...') From c95dbd07f51b508f162d75ac9adb40d59fd9c099 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Mon, 26 Sep 2022 18:22:44 -0400 Subject: [PATCH 34/42] test: updated tests --- test/bin/utils.js | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/test/bin/utils.js b/test/bin/utils.js index 274d597d1..6f2062497 100644 --- a/test/bin/utils.js +++ b/test/bin/utils.js @@ -117,7 +117,15 @@ test('should generate plugin diffs for Sanity', (t) => { { author: 'Ben Lmsc', description: 'Make some environment variables available only at build time in the runtime of your application.', - compatibility: [], + compatibility: [ + { + version: '2.0.0', + }, + { + version: '1.3.0', + nodeVersion: '<12.0.0', + }, + ], package: 'netlify-plugin-use-env-in-runtime', repo: 'https://github.com/ARKHN3B/netlify-plugin-use-env-in-runtime', name: 'Use Env in Runtime', @@ -146,20 +154,20 @@ test('should generate plugin diffs for Sanity', (t) => { const expected = [ { _id: '1', - description: 'Make some environment variables available only at build time in the runtime of your application.', - compatibility: [], - packageName: 'netlify-plugin-use-env-in-runtime', - repoUrl: 'https://github.com/ARKHN3B/netlify-plugin-use-env-in-runtime', - title: 'Use Env in Runtime', + compatibility: [ + { + version: '2.0.0', + }, + { + version: '1.3.0', + nodeVersion: '<12.0.0', + }, + ], version: '1.2.2', }, { _id: '3', - description: 'Debug & verify the contents of your Netlify build cache', compatibility: [], - packageName: 'netlify-plugin-debug-cache', - repoUrl: 'https://github.com/netlify-labs/netlify-plugin-debug-cache', - title: 'Debug Cache', version: '1.0.4', }, ] From aa84c9fad19931f54e53d5b33976a0fc9d4bae38 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Mon, 26 Sep 2022 19:19:15 -0400 Subject: [PATCH 35/42] chore: removed unused fields for sync --- bin/sync_plugins_to_cms.js | 5 --- bin/utils.js | 5 --- test/bin/utils.js | 72 -------------------------------------- 3 files changed, 82 deletions(-) diff --git a/bin/sync_plugins_to_cms.js b/bin/sync_plugins_to_cms.js index e723db460..be010293d 100644 --- a/bin/sync_plugins_to_cms.js +++ b/bin/sync_plugins_to_cms.js @@ -80,12 +80,7 @@ const client = sanityClient(config) const query = `*[_type == "buildPlugin"] { _id, - title, - description, - authors, - authors[]->{_id, name}, packageName, - repoUrl, version, compatibility[] }` diff --git a/bin/utils.js b/bin/utils.js index c12619643..bdb3c718d 100644 --- a/bin/utils.js +++ b/bin/utils.js @@ -9,12 +9,7 @@ import deepEqual from 'deep-equal' const sanityFieldNameToPluginKeyLookup = { _id: '_id', - title: 'name', - description: 'description', - // In sanity, the field is an array of authors, in plugins.json. it's one author - // authors: 'author', packageName: 'package', - repoUrl: 'repo', version: 'version', // an object that can be null compatibility: 'compatibility', diff --git a/test/bin/utils.js b/test/bin/utils.js index 6f2062497..984b5ccb4 100644 --- a/test/bin/utils.js +++ b/test/bin/utils.js @@ -15,64 +15,40 @@ test('should generate Sanity build plugin lookup', (t) => { const sanityBuildPlugins = [ { _id: '1', - authors: [{ _id: '03fb09e4-2f37-4242-a9f2-664daf4c7ff9', name: 'Ben Lmsc' }], compatibility: null, - description: 'Make some environment variables available only at build time in the runtime of your application.', packageName: 'netlify-plugin-use-env-in-runtime', - repoUrl: 'https://github.com/ARKHN3B/netlify-plugin-use-env-in-runtime', - title: 'Use Env in Runtime', version: '1.2.1', }, { _id: '2', - authors: [{ _id: '1dccdb09-71f8-482a-aa0f-9bae32df2e2a', name: 'Bharathvaj Ganesan' }], compatibility: null, - description: 'Automatically notifies Airbrake of new site deploys.', packageName: '@bharathvaj/netlify-plugin-airbrake', - repoUrl: 'https://github.com/bharathvaj-ganesan/netlify-plugin-airbrake', - title: 'Airbrake', version: '1.0.2', }, { _id: '3', - authors: [{ _id: 'eaf7029b-a72b-406f-a2cc-4b8b48fb50a3', name: null }], compatibility: null, - description: 'Debug & verify the contents of your Netlify build cache', packageName: 'netlify-plugin-debug-cache', - repoUrl: 'https://github.com/netlify-labs/netlify-plugin-debug-cache', - title: 'Debug cache', version: '1.0.4', }, ] const expected = { 'netlify-plugin-use-env-in-runtime': { _id: '1', - authors: [{ _id: '03fb09e4-2f37-4242-a9f2-664daf4c7ff9', name: 'Ben Lmsc' }], compatibility: null, - description: 'Make some environment variables available only at build time in the runtime of your application.', packageName: 'netlify-plugin-use-env-in-runtime', - repoUrl: 'https://github.com/ARKHN3B/netlify-plugin-use-env-in-runtime', - title: 'Use Env in Runtime', version: '1.2.1', }, '@bharathvaj/netlify-plugin-airbrake': { _id: '2', - authors: [{ _id: '1dccdb09-71f8-482a-aa0f-9bae32df2e2a', name: 'Bharathvaj Ganesan' }], compatibility: null, - description: 'Automatically notifies Airbrake of new site deploys.', packageName: '@bharathvaj/netlify-plugin-airbrake', - repoUrl: 'https://github.com/bharathvaj-ganesan/netlify-plugin-airbrake', - title: 'Airbrake', version: '1.0.2', }, 'netlify-plugin-debug-cache': { _id: '3', - authors: [{ _id: 'eaf7029b-a72b-406f-a2cc-4b8b48fb50a3', name: null }], compatibility: null, - description: 'Debug & verify the contents of your Netlify build cache', packageName: 'netlify-plugin-debug-cache', - repoUrl: 'https://github.com/netlify-labs/netlify-plugin-debug-cache', - title: 'Debug cache', version: '1.0.4', }, } @@ -84,39 +60,25 @@ test('should generate plugin diffs for Sanity', (t) => { const pluginLookup = { 'netlify-plugin-use-env-in-runtime': { _id: '1', - authors: [{ _id: '03fb09e4-2f37-4242-a9f2-664daf4c7ff9', name: 'Ben Lmsc' }], compatibility: null, - description: 'Make some environment variables available only at build time in the runtime of your application.', packageName: 'netlify-plugin-use-env-in-runtime', - repoUrl: 'https://github.com/ARKHN3B/netlify-plugin-use-env-in-runtime', - title: 'Use Env in Runtime', version: '1.2.1', }, '@bharathvaj/netlify-plugin-airbrake': { _id: '2', - authors: [{ _id: '1dccdb09-71f8-482a-aa0f-9bae32df2e2a', name: 'Bharathvaj Ganesan' }], compatibility: null, - description: 'Automatically notifies Airbrake of new site deploys.', packageName: '@bharathvaj/netlify-plugin-airbrake', - repoUrl: 'https://github.com/bharathvaj-ganesan/netlify-plugin-airbrake', - title: 'Airbrake', version: '1.0.2', }, 'netlify-plugin-debug-cache': { _id: '3', - authors: [{ _id: 'eaf7029b-a72b-406f-a2cc-4b8b48fb50a3', name: 'Bobby MacDougall' }], compatibility: null, - description: 'Debug & verify the contents of your Netlify build cache', packageName: 'netlify-plugin-debug-cache', - repoUrl: 'https://github.com/netlify-labs/netlify-plugin-debug-cache', - title: 'Debug cache', version: '1.0.4', }, } const plugins = [ { - author: 'Ben Lmsc', - description: 'Make some environment variables available only at build time in the runtime of your application.', compatibility: [ { version: '2.0.0', @@ -127,25 +89,15 @@ test('should generate plugin diffs for Sanity', (t) => { }, ], package: 'netlify-plugin-use-env-in-runtime', - repo: 'https://github.com/ARKHN3B/netlify-plugin-use-env-in-runtime', - name: 'Use Env in Runtime', version: '1.2.2', }, { - author: 'Bharathvaj Ganesan', - description: 'Automatically notifies Airbrake of new site deploys.', package: '@bharathvaj/netlify-plugin-airbrake', - repo: 'https://github.com/bharathvaj-ganesan/netlify-plugin-airbrake', - name: 'Airbrake', version: '1.0.2', }, { - author: 'Bobby MacDougall', - description: 'Debug & verify the contents of your Netlify build cache', compatibility: [], package: 'netlify-plugin-debug-cache', - repo: 'https://github.com/netlify-labs/netlify-plugin-debug-cache', - name: 'Debug Cache', version: '1.0.4', }, ] @@ -180,58 +132,34 @@ test('should return no plugin diffs for Sanity if there are no changes', (t) => const pluginLookup = { 'netlify-plugin-use-env-in-runtime': { _id: '1', - authors: [{ _id: '03fb09e4-2f37-4242-a9f2-664daf4c7ff9', name: 'Ben Lmsc' }], compatibility: null, - description: 'Make some environment variables available only at build time in the runtime of your application.', packageName: 'netlify-plugin-use-env-in-runtime', - repoUrl: 'https://github.com/ARKHN3B/netlify-plugin-use-env-in-runtime', - title: 'Use Env in Runtime', version: '1.2.1', }, '@bharathvaj/netlify-plugin-airbrake': { _id: '2', - authors: [{ _id: '1dccdb09-71f8-482a-aa0f-9bae32df2e2a', name: 'Bharathvaj Ganesan' }], compatibility: null, - description: 'Automatically notifies Airbrake of new site deploys.', packageName: '@bharathvaj/netlify-plugin-airbrake', - repoUrl: 'https://github.com/bharathvaj-ganesan/netlify-plugin-airbrake', - title: 'Airbrake', version: '1.0.2', }, 'netlify-plugin-debug-cache': { _id: '3', - authors: [{ _id: 'eaf7029b-a72b-406f-a2cc-4b8b48fb50a3', name: 'Bobby MacDougall' }], compatibility: null, - description: 'Debug & verify the contents of your Netlify build cache', packageName: 'netlify-plugin-debug-cache', - repoUrl: 'https://github.com/netlify-labs/netlify-plugin-debug-cache', - title: 'Debug cache', version: '1.0.4', }, } const plugins = [ { - author: 'Ben Lmsc', - description: 'Make some environment variables available only at build time in the runtime of your application.', package: 'netlify-plugin-use-env-in-runtime', - repo: 'https://github.com/ARKHN3B/netlify-plugin-use-env-in-runtime', - name: 'Use Env in Runtime', version: '1.2.1', }, { - author: 'Bharathvaj Ganesan', - description: 'Automatically notifies Airbrake of new site deploys.', package: '@bharathvaj/netlify-plugin-airbrake', - repo: 'https://github.com/bharathvaj-ganesan/netlify-plugin-airbrake', - name: 'Airbrake', version: '1.0.2', }, { - author: 'Bobby MacDougall', - description: 'Debug & verify the contents of your Netlify build cache', package: 'netlify-plugin-debug-cache', - repo: 'https://github.com/netlify-labs/netlify-plugin-debug-cache', - name: 'Debug cache', version: '1.0.4', }, ] From 08e40049dd3f87d3759a03eb13b7eb6ab36a526c Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Mon, 26 Sep 2022 19:27:22 -0400 Subject: [PATCH 36/42] chore: added some more comments --- bin/sync_plugins_to_cms.js | 3 +++ bin/utils.js | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/sync_plugins_to_cms.js b/bin/sync_plugins_to_cms.js index be010293d..1844d04bf 100644 --- a/bin/sync_plugins_to_cms.js +++ b/bin/sync_plugins_to_cms.js @@ -78,6 +78,7 @@ const createUpdates = (transaction, patch, diffs) => */ const client = sanityClient(config) +// These are the only fields to synch for the moment. const query = `*[_type == "buildPlugin"] { _id, packageName, @@ -95,6 +96,8 @@ try { // eslint-disable-next-line no-param-reassign plugin.compatibility = plugin.compatibility.map((compatibilityItem) => { const updatedCompatibilityItem = { + // A _key property is required by Sanity so each array item can be identified in a collaborative way + // See https://www.sanity.io/docs/array-type#92296c6c45ea _key: uuid(), ...compatibilityItem, } diff --git a/bin/utils.js b/bin/utils.js index bdb3c718d..83b15cf52 100644 --- a/bin/utils.js +++ b/bin/utils.js @@ -72,12 +72,13 @@ const convertToSanityPlugin = (plugin) => { default: // We only want to sync the version and compatibility fields for now. + // _id is used to identify which documents in Sanity need to be updated. break } return pluginToFormat - // initializing with compatibility as null because in Sanity it will be null, but in plugins.json the compatibility property won't be null - // It won't exist. + // initializing with compatibility as null because in Sanity it will be null, but in plugins.json the compatibility + // property won't be null. It won't exist. }, { compatibility: null }, ) From 623313d8f6a9967094703cabbfedb83bb42ffcac Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Tue, 27 Sep 2022 00:20:03 -0400 Subject: [PATCH 37/42] chore: stripped _key property for compatibility array comparison --- bin/utils.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/bin/utils.js b/bin/utils.js index 83b15cf52..5a612abdd 100644 --- a/bin/utils.js +++ b/bin/utils.js @@ -7,6 +7,17 @@ // TODO: remove this an use assert.deepEqual once we support only node engines > 18 import deepEqual from 'deep-equal' +const sanitizeCompatibility = (compatibility) => + compatibility + ? compatibility.map((compatibilityItem) => { + // _keys will alwyas be different and they're not the data we care about comparing. + // eslint-disable-next-line no-unused-vars + const { _key, ...resetOfItem } = compatibilityItem + + return resetOfItem + }) + : null + const sanityFieldNameToPluginKeyLookup = { _id: '_id', packageName: 'package', @@ -97,7 +108,7 @@ const convertSanityPluginToPlugin = (plugin) => { // eslint-disable-next-line no-underscore-dangle _id: plugin._id, version: plugin.version, - compatibility: plugin.compatibility, + compatibility: sanitizeCompatibility(plugin.compatibility), } return formattedPlugin @@ -128,7 +139,7 @@ export const getPluginDiffsForSanity = (pluginLookup, plugins) => { _id: plugin._id, version: plugin.version, // In Sanity it's null, in plugins.json it's undefined - compatibility: plugin.compatibility || null, + compatibility: sanitizeCompatibility(plugin.compatibility), } const sanityPlugin = convertSanityPluginToPlugin(pluginLookup[plugin.package]) From 05d93ec0323df9c8804f407a09ca9dc2da958207 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Tue, 27 Sep 2022 08:54:51 -0400 Subject: [PATCH 38/42] test: updated test to ensure _key properties are in compatibility items --- test/bin/utils.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/bin/utils.js b/test/bin/utils.js index 984b5ccb4..399990c6f 100644 --- a/test/bin/utils.js +++ b/test/bin/utils.js @@ -81,9 +81,11 @@ test('should generate plugin diffs for Sanity', (t) => { { compatibility: [ { + _key: 'dfsfg3443sdfgdfgd', version: '2.0.0', }, { + _key: 'dfsfg3443sdfgdfg2', version: '1.3.0', nodeVersion: '<12.0.0', }, @@ -108,9 +110,11 @@ test('should generate plugin diffs for Sanity', (t) => { _id: '1', compatibility: [ { + _key: 'dfsfg3443sdfgdfgd', version: '2.0.0', }, { + _key: 'dfsfg3443sdfgdfg2', version: '1.3.0', nodeVersion: '<12.0.0', }, From 7859001fd30b2febcb77ececfe2bef441d1f1b20 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Tue, 27 Sep 2022 11:15:21 -0400 Subject: [PATCH 39/42] chore: removed environment config from sync GitHub action --- .github/workflows/sync-to-cms.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/sync-to-cms.yml b/.github/workflows/sync-to-cms.yml index 225e6415c..e4bfa0308 100644 --- a/.github/workflows/sync-to-cms.yml +++ b/.github/workflows/sync-to-cms.yml @@ -9,9 +9,6 @@ on: jobs: sync-to-cms: runs-on: ubuntu-latest - environment: - # TODO: Rename this to Production once this is ready for production, i.e. when this is about to be merged into the repo - name: Sandbox steps: - name: Git checkout uses: actions/checkout@v3 From 900b903cd66a0bf20893985743eaf2b7db11daff Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Tue, 27 Sep 2022 11:18:21 -0400 Subject: [PATCH 40/42] chore: removed running sync HG action on PR changes --- .github/workflows/sync-to-cms.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/sync-to-cms.yml b/.github/workflows/sync-to-cms.yml index e4bfa0308..6714ba9ea 100644 --- a/.github/workflows/sync-to-cms.yml +++ b/.github/workflows/sync-to-cms.yml @@ -3,9 +3,6 @@ on: push: branches: [main] tags: ['*'] - # TODO: remove pull_request section once this is ready for production, i.e. when this is about to be merged into the repo - pull_request: - types: [opened, synchronize, reopened] jobs: sync-to-cms: runs-on: ubuntu-latest From 3db01901662555923dbcbeefcebef23d85bc69d8 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Thu, 29 Sep 2022 10:21:36 -0400 Subject: [PATCH 41/42] chore: added a guard to not run repo to cms sync if cms_sync PR label is present --- .github/workflows/sync-to-cms.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sync-to-cms.yml b/.github/workflows/sync-to-cms.yml index 6714ba9ea..250ddd519 100644 --- a/.github/workflows/sync-to-cms.yml +++ b/.github/workflows/sync-to-cms.yml @@ -1,10 +1,11 @@ name: Sync Plugins to CMS on: - push: - branches: [main] - tags: ['*'] + pull_request: + types: + - closed jobs: sync-to-cms: + if: github.event.pull_request.merged && !contains(github.event.pull_request.labels.*.name, 'cms_sync') runs-on: ubuntu-latest steps: - name: Git checkout From 3dc374ea337d22350c5204c50b9061b2d33e44bb Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Thu, 29 Sep 2022 10:24:10 -0400 Subject: [PATCH 42/42] chore: added a comment about the GH action guard --- .github/workflows/sync-to-cms.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/sync-to-cms.yml b/.github/workflows/sync-to-cms.yml index 250ddd519..66d88322f 100644 --- a/.github/workflows/sync-to-cms.yml +++ b/.github/workflows/sync-to-cms.yml @@ -5,6 +5,7 @@ on: - closed jobs: sync-to-cms: + # Only run if the merged PR wasn't an automated PR for synching from the cms to the repo if: github.event.pull_request.merged && !contains(github.event.pull_request.labels.*.name, 'cms_sync') runs-on: ubuntu-latest steps: