@sanity/cli 6.5.0 → 6.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +190 -98
- package/dist/actions/build/buildApp.js +35 -14
- package/dist/actions/build/buildApp.js.map +1 -1
- package/dist/actions/build/buildStaticFiles.js +1 -2
- package/dist/actions/build/buildStaticFiles.js.map +1 -1
- package/dist/actions/build/buildStudio.js +54 -26
- package/dist/actions/build/buildStudio.js.map +1 -1
- package/dist/actions/build/buildVendorDependencies.js +3 -2
- package/dist/actions/build/buildVendorDependencies.js.map +1 -1
- package/dist/actions/build/checkRequiredDependencies.js +2 -5
- package/dist/actions/build/checkRequiredDependencies.js.map +1 -1
- package/dist/actions/build/checkStudioDependencyVersions.js +1 -2
- package/dist/actions/build/checkStudioDependencyVersions.js.map +1 -1
- package/dist/actions/build/getViteConfig.js +4 -9
- package/dist/actions/build/getViteConfig.js.map +1 -1
- package/dist/actions/codemods/reactIconsV3.js +1 -1
- package/dist/actions/codemods/reactIconsV3.js.map +1 -1
- package/dist/actions/deploy/deployApp.js +1 -1
- package/dist/actions/deploy/deployApp.js.map +1 -1
- package/dist/actions/deploy/deployStudio.js +1 -2
- package/dist/actions/deploy/deployStudio.js.map +1 -1
- package/dist/actions/dev/startStudioDevServer.js +1 -2
- package/dist/actions/dev/startStudioDevServer.js.map +1 -1
- package/dist/actions/manifest/extractAppManifest.js +3 -2
- package/dist/actions/manifest/extractAppManifest.js.map +1 -1
- package/dist/actions/manifest/types.js +9 -0
- package/dist/actions/manifest/types.js.map +1 -1
- package/dist/actions/manifest/writeManifestFile.js +1 -2
- package/dist/actions/manifest/writeManifestFile.js.map +1 -1
- package/dist/actions/schema/uploadSchemaToLexicon.js +1 -2
- package/dist/actions/schema/uploadSchemaToLexicon.js.map +1 -1
- package/dist/actions/versions/buildPackageArray.js +1 -1
- package/dist/actions/versions/buildPackageArray.js.map +1 -1
- package/dist/constants.js +8 -0
- package/dist/constants.js.map +1 -0
- package/dist/server/previewServer.js +1 -1
- package/dist/server/previewServer.js.map +1 -1
- package/dist/server/vite/plugin-sanity-favicons.js +1 -1
- package/dist/server/vite/plugin-sanity-favicons.js.map +1 -1
- package/dist/services/userApplications.js.map +1 -1
- package/dist/util/compareDependencyVersions.js +1 -2
- package/dist/util/compareDependencyVersions.js.map +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +9 -10
- package/dist/actions/build/generateWebManifest.js +0 -27
- package/dist/actions/build/generateWebManifest.js.map +0 -1
- package/dist/actions/build/writeFavicons.js +0 -24
- package/dist/actions/build/writeFavicons.js.map +0 -1
- package/dist/actions/build/writeWebManifest.js +0 -12
- package/dist/actions/build/writeWebManifest.js.map +0 -1
- package/dist/util/copyDir.js +0 -63
- package/dist/util/copyDir.js.map +0 -1
- package/dist/util/getLocalPackageVersion.js +0 -55
- package/dist/util/getLocalPackageVersion.js.map +0 -1
- package/static/favicons/apple-touch-icon.png +0 -0
- package/static/favicons/favicon-192.png +0 -0
- package/static/favicons/favicon-512.png +0 -0
- package/static/favicons/favicon-96.png +0 -0
- package/static/favicons/favicon.ico +0 -0
- package/static/favicons/favicon.svg +0 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/actions/versions/buildPackageArray.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../src/actions/versions/buildPackageArray.ts"],"sourcesContent":["import {getLocalPackageVersion} from '@sanity/cli-core'\nimport {valid} from 'semver'\n\nimport {trimHashFromVersion} from '../../util/trimHashFromVersion.js'\nimport {tryFindLatestVersion} from './tryFindLatestVersion.js'\n\n/**\n * Check if a version is pinned.\n *\n * @internal\n */\nfunction isPinnedVersion(version: string): boolean {\n return !!valid(version)\n}\n\n/**\n * @internal\n */\ninterface PromisedModuleVersionInfo {\n declared: string\n installed: Promise<string | undefined>\n isGlobal: boolean\n isPinned: boolean\n latest: Promise<string | undefined>\n name: string\n}\n\n/**\n * Build an array of package versions.\n *\n * @internal\n */\nexport function buildPackageArray(\n packages: Record<string, string>,\n workDir: string,\n cliVersion: string,\n): PromisedModuleVersionInfo[] {\n const modules = []\n const latest = tryFindLatestVersion('@sanity/cli')\n modules.push({\n declared: `^${cliVersion}`,\n installed: Promise.resolve(trimHashFromVersion(cliVersion)),\n isGlobal: true,\n isPinned: false,\n latest: latest.then((version) => version),\n name: '@sanity/cli',\n })\n\n return [\n ...modules,\n ...Object.keys(packages).map((pkgName) => {\n const latest = tryFindLatestVersion(pkgName)\n const localVersion = getLocalPackageVersion(pkgName, workDir)\n return {\n declared: packages[pkgName],\n installed: localVersion.then((version) =>\n version ? trimHashFromVersion(version) : undefined,\n ),\n isGlobal: false,\n isPinned: isPinnedVersion(packages[pkgName]),\n latest: latest.then((version) => version),\n name: pkgName,\n }\n }),\n ]\n}\n"],"names":["getLocalPackageVersion","valid","trimHashFromVersion","tryFindLatestVersion","isPinnedVersion","version","buildPackageArray","packages","workDir","cliVersion","modules","latest","push","declared","installed","Promise","resolve","isGlobal","isPinned","then","name","Object","keys","map","pkgName","localVersion","undefined"],"mappings":"AAAA,SAAQA,sBAAsB,QAAO,mBAAkB;AACvD,SAAQC,KAAK,QAAO,SAAQ;AAE5B,SAAQC,mBAAmB,QAAO,oCAAmC;AACrE,SAAQC,oBAAoB,QAAO,4BAA2B;AAE9D;;;;CAIC,GACD,SAASC,gBAAgBC,OAAe;IACtC,OAAO,CAAC,CAACJ,MAAMI;AACjB;AAcA;;;;CAIC,GACD,OAAO,SAASC,kBACdC,QAAgC,EAChCC,OAAe,EACfC,UAAkB;IAElB,MAAMC,UAAU,EAAE;IAClB,MAAMC,SAASR,qBAAqB;IACpCO,QAAQE,IAAI,CAAC;QACXC,UAAU,CAAC,CAAC,EAAEJ,YAAY;QAC1BK,WAAWC,QAAQC,OAAO,CAACd,oBAAoBO;QAC/CQ,UAAU;QACVC,UAAU;QACVP,QAAQA,OAAOQ,IAAI,CAAC,CAACd,UAAYA;QACjCe,MAAM;IACR;IAEA,OAAO;WACFV;WACAW,OAAOC,IAAI,CAACf,UAAUgB,GAAG,CAAC,CAACC;YAC5B,MAAMb,SAASR,qBAAqBqB;YACpC,MAAMC,eAAezB,uBAAuBwB,SAAShB;YACrD,OAAO;gBACLK,UAAUN,QAAQ,CAACiB,QAAQ;gBAC3BV,WAAWW,aAAaN,IAAI,CAAC,CAACd,UAC5BA,UAAUH,oBAAoBG,WAAWqB;gBAE3CT,UAAU;gBACVC,UAAUd,gBAAgBG,QAAQ,CAACiB,QAAQ;gBAC3Cb,QAAQA,OAAOQ,IAAI,CAAC,CAACd,UAAYA;gBACjCe,MAAMI;YACR;QACF;KACD;AACH"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Root directory (relative to the project) used by Sanity tooling for
|
|
3
|
+
* build-time artifacts and caches — Vite's `cacheDir` and the dev-time
|
|
4
|
+
* manifest output. Lives under `node_modules/` so it's out of `dist` and
|
|
5
|
+
* ignored by default in typical `.gitignore` files.
|
|
6
|
+
*/ export const SANITY_CACHE_DIR = 'node_modules/.sanity';
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Root directory (relative to the project) used by Sanity tooling for\n * build-time artifacts and caches — Vite's `cacheDir` and the dev-time\n * manifest output. Lives under `node_modules/` so it's out of `dist` and\n * ignored by default in typical `.gitignore` files.\n */\nexport const SANITY_CACHE_DIR = 'node_modules/.sanity'\n"],"names":["SANITY_CACHE_DIR"],"mappings":"AAAA;;;;;CAKC,GACD,OAAO,MAAMA,mBAAmB,uBAAsB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { styleText } from 'node:util';
|
|
4
|
+
import { getLocalPackageVersion } from '@sanity/cli-core';
|
|
4
5
|
import { preview } from 'vite';
|
|
5
6
|
import { extendViteConfigWithUserConfig } from '../actions/build/getViteConfig.js';
|
|
6
|
-
import { getLocalPackageVersion } from '../util/getLocalPackageVersion.js';
|
|
7
7
|
import { serverDebug } from './serverDebug.js';
|
|
8
8
|
import { sanityBasePathRedirectPlugin } from './vite/plugin-sanity-basepath-redirect.js';
|
|
9
9
|
const debug = serverDebug.extend('preview');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/server/previewServer.ts"],"sourcesContent":["import {readFile} from 'node:fs/promises'\nimport path from 'node:path'\nimport {styleText} from 'node:util'\n\nimport {type UserViteConfig} from '@sanity/cli-core'\nimport {type InlineConfig, preview} from 'vite'\n\nimport {extendViteConfigWithUserConfig} from '../actions/build/getViteConfig.js'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/server/previewServer.ts"],"sourcesContent":["import {readFile} from 'node:fs/promises'\nimport path from 'node:path'\nimport {styleText} from 'node:util'\n\nimport {getLocalPackageVersion, type UserViteConfig} from '@sanity/cli-core'\nimport {type InlineConfig, preview} from 'vite'\n\nimport {extendViteConfigWithUserConfig} from '../actions/build/getViteConfig.js'\nimport {serverDebug} from './serverDebug.js'\nimport {sanityBasePathRedirectPlugin} from './vite/plugin-sanity-basepath-redirect.js'\n\nconst debug = serverDebug.extend('preview')\n\n/**\n * @internal\n */\nexport interface PreviewServer {\n close(): Promise<void>\n urls: {local: string[]; network: string[]}\n}\n\ninterface PreviewServerOptions {\n cwd: string\n httpPort: number\n\n root: string\n\n workDir: string\n\n httpHost?: string\n isApp?: boolean\n vite?: UserViteConfig\n}\n\n/**\n * Starts a Vite preview server for the given build output directory\n *\n * @param options - Preview server options\n * @returns A promise that resolves to the started preview server\n * @internal\n */\nexport async function startPreviewServer(options: PreviewServerOptions): Promise<PreviewServer> {\n const {httpHost, httpPort, isApp, root, vite: extendViteConfig, workDir} = options\n const startTime = Date.now()\n\n const indexPath = path.join(root, 'index.html')\n let basePath: string | undefined\n try {\n const index = await readFile(indexPath, 'utf8')\n basePath = tryResolveBasePathFromIndex(index)\n } catch (err: unknown) {\n if (err instanceof Error && 'code' in err && err.code === 'ENOENT') {\n const error = new Error(`Could not find a production build in the '${root}' directory.`)\n error.name = 'BUILD_NOT_FOUND'\n throw error\n }\n\n throw err\n }\n\n const mode = 'production'\n let previewConfig: InlineConfig = {\n base: basePath || '/',\n // Needed for vite to not serve `root/dist`\n build: {\n outDir: root,\n },\n configFile: false,\n mode,\n plugins: [sanityBasePathRedirectPlugin(basePath)],\n preview: {\n host: httpHost,\n port: httpPort,\n strictPort: true,\n },\n root: workDir,\n }\n\n // Extend Vite configuration with user-provided config\n if (extendViteConfig) {\n previewConfig = await extendViteConfigWithUserConfig(\n {command: 'serve', mode},\n previewConfig,\n extendViteConfig,\n )\n }\n\n debug('Creating vite server')\n const server = await preview(previewConfig)\n const warn = server.config.logger.warn\n const info = server.config.logger.info\n const url = server.resolvedUrls!.local[0]\n\n if (basePath === undefined) {\n warn('Could not determine base path from index.html, using \"/\" as default')\n } else if (basePath && basePath !== '/') {\n info(`Using resolved base path from static build: ${styleText('cyan', basePath)}`)\n }\n\n const startupDuration = Date.now() - startTime\n\n const viteVersion = await getLocalPackageVersion('vite', import.meta.url)\n\n info(\n `Sanity ${isApp ? 'application' : 'Studio'} ` +\n `using ${styleText('cyan', `vite@${viteVersion}`)} ` +\n `ready in ${styleText('cyan', `${Math.ceil(startupDuration)}ms`)} ` +\n `and running at ${styleText('cyan', url)} (production preview mode)`,\n )\n\n return {\n close: () =>\n new Promise((resolve, reject) =>\n server.httpServer.close((err) => (err ? reject(err) : resolve())),\n ),\n urls: server.resolvedUrls!,\n }\n}\n\nfunction tryResolveBasePathFromIndex(index: string): string | undefined {\n // <script ... src=\"/some-base-path/static/sanity-a3cc3d86.js\"></script>\n const basePath = index.match(/<script[^>]+src=\"(.*?)\\/static\\/sanity-/)?.[1]\n\n // We _expect_ to be able to find the base path. If we can't, we should warn.\n // Note that we're checking for `undefined` here, since an empty string is a\n // valid base path.\n if (basePath === undefined) {\n return undefined\n }\n\n // In the case of an empty base path, we still want to return `/` to indicate\n // that we _found_ the basepath - it just happens to be empty. Eg:\n // <script ... src = \"/static/sanity-a3cc3d86.js\"></script>\n // Which differs from not being able to find the script tag at all, in which\n // case we'll want to show a warning to indicate that it is an abnormality.\n return basePath === '' ? '/' : basePath\n}\n"],"names":["readFile","path","styleText","getLocalPackageVersion","preview","extendViteConfigWithUserConfig","serverDebug","sanityBasePathRedirectPlugin","debug","extend","startPreviewServer","options","httpHost","httpPort","isApp","root","vite","extendViteConfig","workDir","startTime","Date","now","indexPath","join","basePath","index","tryResolveBasePathFromIndex","err","Error","code","error","name","mode","previewConfig","base","build","outDir","configFile","plugins","host","port","strictPort","command","server","warn","config","logger","info","url","resolvedUrls","local","undefined","startupDuration","viteVersion","Math","ceil","close","Promise","resolve","reject","httpServer","urls","match"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,mBAAkB;AACzC,OAAOC,UAAU,YAAW;AAC5B,SAAQC,SAAS,QAAO,YAAW;AAEnC,SAAQC,sBAAsB,QAA4B,mBAAkB;AAC5E,SAA2BC,OAAO,QAAO,OAAM;AAE/C,SAAQC,8BAA8B,QAAO,oCAAmC;AAChF,SAAQC,WAAW,QAAO,mBAAkB;AAC5C,SAAQC,4BAA4B,QAAO,4CAA2C;AAEtF,MAAMC,QAAQF,YAAYG,MAAM,CAAC;AAuBjC;;;;;;CAMC,GACD,OAAO,eAAeC,mBAAmBC,OAA6B;IACpE,MAAM,EAACC,QAAQ,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,IAAI,EAAEC,MAAMC,gBAAgB,EAAEC,OAAO,EAAC,GAAGP;IAC3E,MAAMQ,YAAYC,KAAKC,GAAG;IAE1B,MAAMC,YAAYrB,KAAKsB,IAAI,CAACR,MAAM;IAClC,IAAIS;IACJ,IAAI;QACF,MAAMC,QAAQ,MAAMzB,SAASsB,WAAW;QACxCE,WAAWE,4BAA4BD;IACzC,EAAE,OAAOE,KA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,GAAGoD,KAAKC,IAAI,CAACH,iBAAiB,EAAE,CAAC,EAAE,CAAC,CAAC,GACnE,CAAC,eAAe,EAAElD,UAAU,QAAQ8C,KAAK,0BAA0B,CAAC;IAGxE,OAAO;QACLQ,OAAO,IACL,IAAIC,QAAQ,CAACC,SAASC,SACpBhB,OAAOiB,UAAU,CAACJ,KAAK,CAAC,CAAC7B,MAASA,MAAMgC,OAAOhC,OAAO+B;QAE1DG,MAAMlB,OAAOM,YAAY;IAC3B;AACF;AAEA,SAASvB,4BAA4BD,KAAa;IAChD,wEAAwE;IACxE,MAAMD,WAAWC,MAAMqC,KAAK,CAAC,4CAA4C,CAAC,EAAE;IAE5E,6EAA6E;IAC7E,4EAA4E;IAC5E,mBAAmB;IACnB,IAAItC,aAAa2B,WAAW;QAC1B,OAAOA;IACT;IAEA,6EAA6E;IAC7E,kEAAkE;IAClE,2DAA2D;IAC3D,4EAA4E;IAC5E,2EAA2E;IAC3E,OAAO3B,aAAa,KAAK,MAAMA;AACjC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { generateWebManifest } from '
|
|
3
|
+
import { generateWebManifest } from '@sanity/cli-build/_internal';
|
|
4
4
|
const mimeTypes = {
|
|
5
5
|
'.ico': 'image/x-icon',
|
|
6
6
|
'.png': 'image/png',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/vite/plugin-sanity-favicons.ts"],"sourcesContent":["import fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport {type Plugin} from 'vite'\n\nimport {generateWebManifest} from '
|
|
1
|
+
{"version":3,"sources":["../../../src/server/vite/plugin-sanity-favicons.ts"],"sourcesContent":["import fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport {type Plugin} from 'vite'\n\nimport {generateWebManifest} from '@sanity/cli-build/_internal'\n\nconst mimeTypes: Record<string, string | undefined> = {\n '.ico': 'image/x-icon',\n '.png': 'image/png',\n '.svg': 'image/svg+xml',\n}\n\n/**\n * Fallback favicons plugin for Sanity.\n *\n * If a favicon is not found in the static folder, this plugin will serve the default\n * Sanity favicons from the npm bundle. If a custom `favicon.ico` is found in the static\n * folder, it will also be served for a root `/favicon.ico` request.\n *\n * @param options - Options for the plugin\n * @returns A Vite plugin\n * @internal\n */\nexport function sanityFaviconsPlugin({\n customFaviconsPath,\n defaultFaviconsPath,\n staticUrlPath,\n}: {\n customFaviconsPath: string\n defaultFaviconsPath: string\n staticUrlPath: string\n}): Plugin {\n const cache: {favicons?: string[]} = {}\n\n async function getFavicons(): Promise<string[]> {\n if (cache.favicons) {\n return cache.favicons\n }\n\n cache.favicons = await fs.readdir(defaultFaviconsPath)\n return cache.favicons\n }\n\n async function hasCustomFavicon(fileName: string): Promise<boolean> {\n try {\n await fs.access(path.join(customFaviconsPath, fileName))\n return true\n } catch {\n return false\n }\n }\n\n return {\n apply: 'serve',\n configureServer(viteDevServer) {\n const webManifest = JSON.stringify(generateWebManifest(staticUrlPath), null, 2)\n const webManifestPath = `${staticUrlPath}/manifest.webmanifest`\n\n viteDevServer.middlewares.use(async (req, res, next) => {\n if (req.url?.endsWith(webManifestPath)) {\n res.writeHead(200, 'OK', {'content-type': 'application/manifest+json'})\n res.write(webManifest)\n res.end()\n return\n }\n\n const parsedUrl =\n typeof req === 'object' &&\n req !== null &&\n '_parsedUrl' in req &&\n req._parsedUrl instanceof URL\n ? req._parsedUrl\n : new URL(req.url || '/', 'http://localhost:3333')\n\n const pathName = parsedUrl.pathname || ''\n const fileName = path.basename(pathName || '')\n const icons = await getFavicons()\n const isIconRequest =\n pathName.startsWith('/favicon.ico') ||\n (icons.includes(fileName) && pathName.includes(staticUrlPath))\n\n if (!isIconRequest) {\n next()\n return\n }\n\n const faviconPath = (await hasCustomFavicon(fileName))\n ? path.join(customFaviconsPath, fileName)\n : path.join(defaultFaviconsPath, fileName)\n\n const mimeType = mimeTypes[path.extname(fileName)] || 'application/octet-stream'\n res.writeHead(200, 'OK', {'content-type': mimeType})\n res.write(await fs.readFile(faviconPath))\n res.end()\n })\n },\n name: 'sanity/server/sanity-favicons',\n }\n}\n"],"names":["fs","path","generateWebManifest","mimeTypes","sanityFaviconsPlugin","customFaviconsPath","defaultFaviconsPath","staticUrlPath","cache","getFavicons","favicons","readdir","hasCustomFavicon","fileName","access","join","apply","configureServer","viteDevServer","webManifest","JSON","stringify","webManifestPath","middlewares","use","req","res","next","url","endsWith","writeHead","write","end","parsedUrl","_parsedUrl","URL","pathName","pathname","basename","icons","isIconRequest","startsWith","includes","faviconPath","mimeType","extname","readFile","name"],"mappings":"AAAA,OAAOA,QAAQ,mBAAkB;AACjC,OAAOC,UAAU,YAAW;AAI5B,SAAQC,mBAAmB,QAAO,8BAA6B;AAE/D,MAAMC,YAAgD;IACpD,QAAQ;IACR,QAAQ;IACR,QAAQ;AACV;AAEA;;;;;;;;;;CAUC,GACD,OAAO,SAASC,qBAAqB,EACnCC,kBAAkB,EAClBC,mBAAmB,EACnBC,aAAa,EAKd;IACC,MAAMC,QAA+B,CAAC;IAEtC,eAAeC;QACb,IAAID,MAAME,QAAQ,EAAE;YAClB,OAAOF,MAAME,QAAQ;QACvB;QAEAF,MAAME,QAAQ,GAAG,MAAMV,GAAGW,OAAO,CAACL;QAClC,OAAOE,MAAME,QAAQ;IACvB;IAEA,eAAeE,iBAAiBC,QAAgB;QAC9C,IAAI;YACF,MAAMb,GAAGc,MAAM,CAACb,KAAKc,IAAI,CAACV,oBAAoBQ;YAC9C,OAAO;QACT,EAAE,OAAM;YACN,OAAO;QACT;IACF;IAEA,OAAO;QACLG,OAAO;QACPC,iBAAgBC,aAAa;YAC3B,MAAMC,cAAcC,KAAKC,SAAS,CAACnB,oBAAoBK,gBAAgB,MAAM;YAC7E,MAAMe,kBAAkB,GAAGf,cAAc,qBAAqB,CAAC;YAE/DW,cAAcK,WAAW,CAACC,GAAG,CAAC,OAAOC,KAAKC,KAAKC;gBAC7C,IAAIF,IAAIG,GAAG,EAAEC,SAASP,kBAAkB;oBACtCI,IAAII,SAAS,CAAC,KAAK,MAAM;wBAAC,gBAAgB;oBAA2B;oBACrEJ,IAAIK,KAAK,CAACZ;oBACVO,IAAIM,GAAG;oBACP;gBACF;gBAEA,MAAMC,YACJ,OAAOR,QAAQ,YACfA,QAAQ,QACR,gBAAgBA,OAChBA,IAAIS,UAAU,YAAYC,MACtBV,IAAIS,UAAU,GACd,IAAIC,IAAIV,IAAIG,GAAG,IAAI,KAAK;gBAE9B,MAAMQ,WAAWH,UAAUI,QAAQ,IAAI;gBACvC,MAAMxB,WAAWZ,KAAKqC,QAAQ,CAACF,YAAY;gBAC3C,MAAMG,QAAQ,MAAM9B;gBACpB,MAAM+B,gBACJJ,SAASK,UAAU,CAAC,mBACnBF,MAAMG,QAAQ,CAAC7B,aAAauB,SAASM,QAAQ,CAACnC;gBAEjD,IAAI,CAACiC,eAAe;oBAClBb;oBACA;gBACF;gBAEA,MAAMgB,cAAc,AAAC,MAAM/B,iBAAiBC,YACxCZ,KAAKc,IAAI,CAACV,oBAAoBQ,YAC9BZ,KAAKc,IAAI,CAACT,qBAAqBO;gBAEnC,MAAM+B,WAAWzC,SAAS,CAACF,KAAK4C,OAAO,CAAChC,UAAU,IAAI;gBACtDa,IAAII,SAAS,CAAC,KAAK,MAAM;oBAAC,gBAAgBc;gBAAQ;gBAClDlB,IAAIK,KAAK,CAAC,MAAM/B,GAAG8C,QAAQ,CAACH;gBAC5BjB,IAAIM,GAAG;YACT;QACF;QACAe,MAAM;IACR;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/services/userApplications.ts"],"sourcesContent":["import {PassThrough} from 'node:stream'\nimport {type Gzip} from 'node:zlib'\n\nimport {debug, getGlobalCliClient} from '@sanity/cli-core'\nimport FormData from 'form-data'\nimport {type StudioManifest} from 'sanity'\n\nimport {type AppManifest} from '../actions/manifest/types.js'\n\nexport const USER_APPLICATIONS_API_VERSION = 'v2024-08-01'\n\ninterface ActiveDeployment {\n createdAt: string\n deployedAt: string\n deployedBy: string\n isActiveDeployment: boolean\n isAutoUpdating: boolean | null\n size: string | null\n updatedAt: string\n version: string\n}\n\nexport interface UserApplication {\n appHost: string\n createdAt: string\n id: string\n organizationId: string | null\n projectId: string | null\n title: string | null\n type: 'coreApp' | 'studio'\n updatedAt: string\n urlType: 'external' | 'internal'\n\n activeDeployment?: ActiveDeployment | null\n}\n\ntype GetUserApplicationOptions =\n | {appHost?: never; appId: string; isSdkApp: true; projectId?: never}\n | {appHost?: string; appId?: string; isSdkApp: false; projectId: string}\n\nexport async function getUserApplication({\n appHost,\n appId,\n isSdkApp,\n projectId,\n}: GetUserApplicationOptions): Promise<UserApplication | null> {\n let query: Record<string, string | string[]> | undefined\n let uri: string\n\n // set the uri\n if (isSdkApp) {\n uri = appId ? `/user-applications/${appId}` : '/user-applications'\n } else {\n uri = appId\n ? `/projects/${projectId}/user-applications/${appId}`\n : `/projects/${projectId}/user-applications`\n }\n\n // set the query\n if (isSdkApp) {\n query = {appType: 'coreApp'}\n } else if (!appId) {\n // In practice, this function isn't called if we don't have at least one of appHost or appId,\n // so the default case won't be called. But leaving this ternary in for now (from old CLI code) just in case.\n query = appHost ? {appHost, appType: 'studio'} : {default: 'true'}\n }\n\n const client = await getGlobalCliClient({\n apiVersion: USER_APPLICATIONS_API_VERSION,\n requireUser: true,\n })\n\n try {\n const options = query ? {query, uri} : {uri}\n return await client.request(options)\n } catch (err) {\n if (err?.statusCode === 404) {\n return null\n }\n\n debug('Error getting user application', err)\n throw err\n }\n}\n\ninterface DeleteUserApplicationOptions {\n applicationId: string\n appType: 'coreApp' | 'studio'\n}\n\nexport async function deleteUserApplication({\n applicationId,\n appType,\n}: DeleteUserApplicationOptions): Promise<void> {\n const client = await getGlobalCliClient({\n apiVersion: USER_APPLICATIONS_API_VERSION,\n requireUser: true,\n })\n\n await client.request({\n method: 'DELETE',\n query: {appType},\n uri: `/user-applications/${applicationId}`,\n })\n}\n\ninterface UpdateUserApplicationBody {\n title?: string\n}\n\ninterface UpdateUserApplicationOptions {\n applicationId: string\n // Updating studio properties requires further UX thought\n // (because of workspaces et al.)\n appType: 'coreApp'\n body: UpdateUserApplicationBody\n}\n\nexport async function updateUserApplication({\n applicationId,\n appType,\n body,\n}: UpdateUserApplicationOptions): Promise<UserApplication> {\n const client = await getGlobalCliClient({\n apiVersion: USER_APPLICATIONS_API_VERSION,\n requireUser: true,\n })\n\n return client.request({\n body,\n method: 'PATCH',\n query: {appType},\n uri: `/user-applications/${applicationId}`,\n })\n}\n\nexport async function getUserApplications(options: {\n appType: 'studio'\n projectId: string\n}): Promise<UserApplication[]>\nexport async function getUserApplications(options: {\n appType: 'coreApp'\n organizationId: string\n}): Promise<UserApplication[]>\nexport async function getUserApplications(\n options:\n | {\n appType: 'coreApp'\n organizationId?: string\n }\n | {\n appType: 'studio'\n projectId?: string\n },\n): Promise<UserApplication[] | null> {\n const {appType} = options\n const client = await getGlobalCliClient({\n apiVersion: USER_APPLICATIONS_API_VERSION,\n requireUser: true,\n })\n\n if (appType === 'studio') {\n const {projectId} = options as {appType: 'studio'; projectId?: string}\n return await client.request({\n query: {appType: 'studio'},\n uri: `/projects/${projectId}/user-applications`,\n })\n }\n\n const {organizationId} = options as {appType: 'coreApp'; organizationId?: string}\n\n try {\n return await client.request({\n query: {appType: 'coreApp', organizationId: organizationId!},\n uri: `/user-applications`,\n })\n } catch (error) {\n // User doesn't have permission to view applications for the org,\n // or the organization ID doesn’t exist\n if (error?.statusCode === 403) {\n throw error\n }\n\n debug('Error finding user applications', error)\n return null\n }\n}\n\nexport async function createUserApplication(options: {\n appType: 'coreApp'\n body: Pick<UserApplication, 'appHost' | 'type' | 'urlType'> & {\n title?: string\n }\n organizationId?: string\n}): Promise<UserApplication>\nexport async function createUserApplication(options: {\n appType: 'studio'\n body: Pick<UserApplication, 'appHost' | 'type' | 'urlType'> & {\n title?: string\n }\n projectId: string\n}): Promise<UserApplication>\nexport async function createUserApplication(options: {\n appType: 'coreApp' | 'studio'\n body: Pick<UserApplication, 'appHost' | 'type' | 'urlType'> & {\n title?: string\n }\n organizationId?: string\n projectId?: string\n}): Promise<UserApplication> {\n const {appType, body} = options\n\n const client = await getGlobalCliClient({\n apiVersion: USER_APPLICATIONS_API_VERSION,\n requireUser: true,\n })\n\n let uri\n let query\n\n // If we have an organizationId, we're creating a core app\n if (appType === 'coreApp') {\n const {organizationId} = options as {appType: 'coreApp'; organizationId?: string}\n uri = '/user-applications'\n query = {appType: 'coreApp', organizationId: organizationId!}\n } else {\n const {projectId} = options as {appType: 'studio'; projectId?: string}\n uri = `/projects/${projectId}/user-applications`\n query = {appType: 'studio'}\n }\n\n return client.request({body, method: 'POST', query, uri})\n}\n\ninterface CreateDeploymentOptions {\n applicationId: string\n isAutoUpdating: boolean\n version: string\n\n isApp?: boolean\n\n manifest?: AppManifest | StudioManifest | null\n\n projectId?: string\n\n tarball?: Gzip\n}\n\nexport async function createDeployment({\n applicationId,\n isApp,\n isAutoUpdating,\n manifest,\n projectId,\n tarball,\n version,\n}: CreateDeploymentOptions): Promise<{location: string}> {\n const client = await getGlobalCliClient({\n apiVersion: USER_APPLICATIONS_API_VERSION,\n requireUser: true,\n })\n\n const formData = new FormData()\n formData.append('isAutoUpdating', isAutoUpdating.toString())\n formData.append('version', version)\n if (manifest) {\n formData.append('manifest', JSON.stringify(manifest))\n }\n\n if (tarball) {\n formData.append('tarball', tarball, {contentType: 'application/gzip', filename: 'app.tar.gz'})\n }\n\n let uri\n let query\n\n if (isApp) {\n uri = `/user-applications/${applicationId}/deployments`\n query = {appType: 'coreApp'}\n } else {\n uri = `/projects/${projectId}/user-applications/${applicationId}/deployments`\n query = {appType: 'studio'}\n }\n\n return client.request({\n body: formData.pipe(new PassThrough()),\n headers: formData.getHeaders(),\n method: 'POST',\n query,\n uri,\n })\n}\n"],"names":["PassThrough","debug","getGlobalCliClient","FormData","USER_APPLICATIONS_API_VERSION","getUserApplication","appHost","appId","isSdkApp","projectId","query","uri","appType","default","client","apiVersion","requireUser","options","request","err","statusCode","deleteUserApplication","applicationId","method","updateUserApplication","body","getUserApplications","organizationId","error","createUserApplication","createDeployment","isApp","isAutoUpdating","manifest","tarball","version","formData","append","toString","JSON","stringify","contentType","filename","pipe","headers","getHeaders"],"mappings":"AAAA,SAAQA,WAAW,QAAO,cAAa;AAGvC,SAAQC,KAAK,EAAEC,kBAAkB,QAAO,mBAAkB;AAC1D,OAAOC,cAAc,YAAW;AAKhC,OAAO,MAAMC,gCAAgC,cAAa;AA+B1D,OAAO,eAAeC,mBAAmB,EACvCC,OAAO,EACPC,KAAK,EACLC,QAAQ,EACRC,SAAS,EACiB;IAC1B,IAAIC;IACJ,IAAIC;IAEJ,cAAc;IACd,IAAIH,UAAU;QACZG,MAAMJ,QAAQ,CAAC,mBAAmB,EAAEA,OAAO,GAAG;IAChD,OAAO;QACLI,MAAMJ,QACF,CAAC,UAAU,EAAEE,UAAU,mBAAmB,EAAEF,OAAO,GACnD,CAAC,UAAU,EAAEE,UAAU,kBAAkB,CAAC;IAChD;IAEA,gBAAgB;IAChB,IAAID,UAAU;QACZE,QAAQ;YAACE,SAAS;QAAS;IAC7B,OAAO,IAAI,CAACL,OAAO;QACjB,6FAA6F;QAC7F,6GAA6G;QAC7GG,QAAQJ,UAAU;YAACA;YAASM,SAAS;QAAQ,IAAI;YAACC,SAAS;QAAM;IACnE;IAEA,MAAMC,SAAS,MAAMZ,mBAAmB;QACtCa,YAAYX;QACZY,aAAa;IACf;IAEA,IAAI;QACF,MAAMC,UAAUP,QAAQ;YAACA;YAAOC;QAAG,IAAI;YAACA;QAAG;QAC3C,OAAO,MAAMG,OAAOI,OAAO,CAACD;IAC9B,EAAE,OAAOE,KAAK;QACZ,IAAIA,KAAKC,eAAe,KAAK;YAC3B,OAAO;QACT;QAEAnB,MAAM,kCAAkCkB;QACxC,MAAMA;IACR;AACF;AAOA,OAAO,eAAeE,sBAAsB,EAC1CC,aAAa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AAO,CAAC;QACpBO,MAAMW,SAASO,IAAI,CAAC,IAAI3C;QACxB4C,SAASR,SAASS,UAAU;QAC5BtB,QAAQ;QACRb;QACAC;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/services/userApplications.ts"],"sourcesContent":["import {PassThrough} from 'node:stream'\nimport {type Gzip} from 'node:zlib'\n\nimport {debug, getGlobalCliClient} from '@sanity/cli-core'\nimport FormData from 'form-data'\nimport {type StudioManifest} from 'sanity'\n\nimport {type CoreAppManifest} from '../actions/manifest/types.js'\n\nexport const USER_APPLICATIONS_API_VERSION = 'v2024-08-01'\n\ninterface ActiveDeployment {\n createdAt: string\n deployedAt: string\n deployedBy: string\n isActiveDeployment: boolean\n isAutoUpdating: boolean | null\n size: string | null\n updatedAt: string\n version: string\n}\n\nexport interface UserApplication {\n appHost: string\n createdAt: string\n id: string\n organizationId: string | null\n projectId: string | null\n title: string | null\n type: 'coreApp' | 'studio'\n updatedAt: string\n urlType: 'external' | 'internal'\n\n activeDeployment?: ActiveDeployment | null\n}\n\ntype GetUserApplicationOptions =\n | {appHost?: never; appId: string; isSdkApp: true; projectId?: never}\n | {appHost?: string; appId?: string; isSdkApp: false; projectId: string}\n\nexport async function getUserApplication({\n appHost,\n appId,\n isSdkApp,\n projectId,\n}: GetUserApplicationOptions): Promise<UserApplication | null> {\n let query: Record<string, string | string[]> | undefined\n let uri: string\n\n // set the uri\n if (isSdkApp) {\n uri = appId ? `/user-applications/${appId}` : '/user-applications'\n } else {\n uri = appId\n ? `/projects/${projectId}/user-applications/${appId}`\n : `/projects/${projectId}/user-applications`\n }\n\n // set the query\n if (isSdkApp) {\n query = {appType: 'coreApp'}\n } else if (!appId) {\n // In practice, this function isn't called if we don't have at least one of appHost or appId,\n // so the default case won't be called. But leaving this ternary in for now (from old CLI code) just in case.\n query = appHost ? {appHost, appType: 'studio'} : {default: 'true'}\n }\n\n const client = await getGlobalCliClient({\n apiVersion: USER_APPLICATIONS_API_VERSION,\n requireUser: true,\n })\n\n try {\n const options = query ? {query, uri} : {uri}\n return await client.request(options)\n } catch (err) {\n if (err?.statusCode === 404) {\n return null\n }\n\n debug('Error getting user application', err)\n throw err\n }\n}\n\ninterface DeleteUserApplicationOptions {\n applicationId: string\n appType: 'coreApp' | 'studio'\n}\n\nexport async function deleteUserApplication({\n applicationId,\n appType,\n}: DeleteUserApplicationOptions): Promise<void> {\n const client = await getGlobalCliClient({\n apiVersion: USER_APPLICATIONS_API_VERSION,\n requireUser: true,\n })\n\n await client.request({\n method: 'DELETE',\n query: {appType},\n uri: `/user-applications/${applicationId}`,\n })\n}\n\ninterface UpdateUserApplicationBody {\n title?: string\n}\n\ninterface UpdateUserApplicationOptions {\n applicationId: string\n // Updating studio properties requires further UX thought\n // (because of workspaces et al.)\n appType: 'coreApp'\n body: UpdateUserApplicationBody\n}\n\nexport async function updateUserApplication({\n applicationId,\n appType,\n body,\n}: UpdateUserApplicationOptions): Promise<UserApplication> {\n const client = await getGlobalCliClient({\n apiVersion: USER_APPLICATIONS_API_VERSION,\n requireUser: true,\n })\n\n return client.request({\n body,\n method: 'PATCH',\n query: {appType},\n uri: `/user-applications/${applicationId}`,\n })\n}\n\nexport async function getUserApplications(options: {\n appType: 'studio'\n projectId: string\n}): Promise<UserApplication[]>\nexport async function getUserApplications(options: {\n appType: 'coreApp'\n organizationId: string\n}): Promise<UserApplication[]>\nexport async function getUserApplications(\n options:\n | {\n appType: 'coreApp'\n organizationId?: string\n }\n | {\n appType: 'studio'\n projectId?: string\n },\n): Promise<UserApplication[] | null> {\n const {appType} = options\n const client = await getGlobalCliClient({\n apiVersion: USER_APPLICATIONS_API_VERSION,\n requireUser: true,\n })\n\n if (appType === 'studio') {\n const {projectId} = options as {appType: 'studio'; projectId?: string}\n return await client.request({\n query: {appType: 'studio'},\n uri: `/projects/${projectId}/user-applications`,\n })\n }\n\n const {organizationId} = options as {appType: 'coreApp'; organizationId?: string}\n\n try {\n return await client.request({\n query: {appType: 'coreApp', organizationId: organizationId!},\n uri: `/user-applications`,\n })\n } catch (error) {\n // User doesn't have permission to view applications for the org,\n // or the organization ID doesn’t exist\n if (error?.statusCode === 403) {\n throw error\n }\n\n debug('Error finding user applications', error)\n return null\n }\n}\n\nexport async function createUserApplication(options: {\n appType: 'coreApp'\n body: Pick<UserApplication, 'appHost' | 'type' | 'urlType'> & {\n title?: string\n }\n organizationId?: string\n}): Promise<UserApplication>\nexport async function createUserApplication(options: {\n appType: 'studio'\n body: Pick<UserApplication, 'appHost' | 'type' | 'urlType'> & {\n title?: string\n }\n projectId: string\n}): Promise<UserApplication>\nexport async function createUserApplication(options: {\n appType: 'coreApp' | 'studio'\n body: Pick<UserApplication, 'appHost' | 'type' | 'urlType'> & {\n title?: string\n }\n organizationId?: string\n projectId?: string\n}): Promise<UserApplication> {\n const {appType, body} = options\n\n const client = await getGlobalCliClient({\n apiVersion: USER_APPLICATIONS_API_VERSION,\n requireUser: true,\n })\n\n let uri\n let query\n\n // If we have an organizationId, we're creating a core app\n if (appType === 'coreApp') {\n const {organizationId} = options as {appType: 'coreApp'; organizationId?: string}\n uri = '/user-applications'\n query = {appType: 'coreApp', organizationId: organizationId!}\n } else {\n const {projectId} = options as {appType: 'studio'; projectId?: string}\n uri = `/projects/${projectId}/user-applications`\n query = {appType: 'studio'}\n }\n\n return client.request({body, method: 'POST', query, uri})\n}\n\ninterface CreateDeploymentOptions {\n applicationId: string\n isAutoUpdating: boolean\n version: string\n\n isApp?: boolean\n\n manifest?: CoreAppManifest | StudioManifest | null\n\n projectId?: string\n\n tarball?: Gzip\n}\n\nexport async function createDeployment({\n applicationId,\n isApp,\n isAutoUpdating,\n manifest,\n projectId,\n tarball,\n version,\n}: CreateDeploymentOptions): Promise<{location: string}> {\n const client = await getGlobalCliClient({\n apiVersion: USER_APPLICATIONS_API_VERSION,\n requireUser: true,\n })\n\n const formData = new FormData()\n formData.append('isAutoUpdating', isAutoUpdating.toString())\n formData.append('version', version)\n if (manifest) {\n formData.append('manifest', JSON.stringify(manifest))\n }\n\n if (tarball) {\n formData.append('tarball', tarball, {contentType: 'application/gzip', filename: 'app.tar.gz'})\n }\n\n let uri\n let query\n\n if (isApp) {\n uri = `/user-applications/${applicationId}/deployments`\n query = {appType: 'coreApp'}\n } else {\n uri = `/projects/${projectId}/user-applications/${applicationId}/deployments`\n query = {appType: 'studio'}\n }\n\n return client.request({\n body: formData.pipe(new PassThrough()),\n headers: formData.getHeaders(),\n method: 'POST',\n query,\n uri,\n })\n}\n"],"names":["PassThrough","debug","getGlobalCliClient","FormData","USER_APPLICATIONS_API_VERSION","getUserApplication","appHost","appId","isSdkApp","projectId","query","uri","appType","default","client","apiVersion","requireUser","options","request","err","statusCode","deleteUserApplication","applicationId","method","updateUserApplication","body","getUserApplications","organizationId","error","createUserApplication","createDeployment","isApp","isAutoUpdating","manifest","tarball","version","formData","append","toString","JSON","stringify","contentType","filename","pipe","headers","getHeaders"],"mappings":"AAAA,SAAQA,WAAW,QAAO,cAAa;AAGvC,SAAQC,KAAK,EAAEC,kBAAkB,QAAO,mBAAkB;AAC1D,OAAOC,cAAc,YAAW;AAKhC,OAAO,MAAMC,gCAAgC,cAAa;AA+B1D,OAAO,eAAeC,mBAAmB,EACvCC,OAAO,EACPC,KAAK,EACLC,QAAQ,EACRC,SAAS,EACiB;IAC1B,IAAIC;IACJ,IAAIC;IAEJ,cAAc;IACd,IAAIH,UAAU;QACZG,MAAMJ,QAAQ,CAAC,mBAAmB,EAAEA,OAAO,GAAG;IAChD,OAAO;QACLI,MAAMJ,QACF,CAAC,UAAU,EAAEE,UAAU,mBAAmB,EAAEF,OAAO,GACnD,CAAC,UAAU,EAAEE,UAAU,kBAAkB,CAAC;IAChD;IAEA,gBAAgB;IAChB,IAAID,UAAU;QACZE,QAAQ;YAACE,SAAS;QAAS;IAC7B,OAAO,IAAI,CAACL,OAAO;QACjB,6FAA6F;QAC7F,6GAA6G;QAC7GG,QAAQJ,UAAU;YAACA;YAASM,SAAS;QAAQ,IAAI;YAACC,SA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AS;QACXE,SAASC,MAAM,CAAC,WAAWH,SAAS;YAACO,aAAa;YAAoBC,UAAU;QAAY;IAC9F;IAEA,IAAI/B;IACJ,IAAID;IAEJ,IAAIqB,OAAO;QACTpB,MAAM,CAAC,mBAAmB,EAAEW,cAAc,YAAY,CAAC;QACvDZ,QAAQ;YAACE,SAAS;QAAS;IAC7B,OAAO;QACLD,MAAM,CAAC,UAAU,EAAEF,UAAU,mBAAmB,EAAEa,cAAc,YAAY,CAAC;QAC7EZ,QAAQ;YAACE,SAAS;QAAQ;IAC5B;IAEA,OAAOE,OAAOI,OAAO,CAAC;QACpBO,MAAMW,SAASO,IAAI,CAAC,IAAI3C;QACxB4C,SAASR,SAASS,UAAU;QAC5BtB,QAAQ;QACRb;QACAC;IACF;AACF"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import { readPackageJson } from '@sanity/cli-core';
|
|
2
|
+
import { getLocalPackageVersion, readPackageJson } from '@sanity/cli-core';
|
|
3
3
|
import { createRequester } from '@sanity/cli-core/request';
|
|
4
4
|
import { coerce, eq, prerelease, parse as semverParse } from 'semver';
|
|
5
5
|
import { getModuleUrl } from '../actions/build/getAutoUpdatesImportMap.js';
|
|
6
|
-
import { getLocalPackageVersion } from './getLocalPackageVersion.js';
|
|
7
6
|
const defaultRequester = createRequester({
|
|
8
7
|
middleware: {
|
|
9
8
|
httpErrors: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/util/compareDependencyVersions.ts"],"sourcesContent":["import path from 'node:path'\n\nimport {readPackageJson} from '@sanity/cli-core'\nimport {createRequester} from '@sanity/cli-core/request'\nimport {coerce, eq, prerelease, parse as semverParse} from 'semver'\n\nimport {getModuleUrl} from '../actions/build/getAutoUpdatesImportMap.js'\
|
|
1
|
+
{"version":3,"sources":["../../src/util/compareDependencyVersions.ts"],"sourcesContent":["import path from 'node:path'\n\nimport {getLocalPackageVersion, readPackageJson} from '@sanity/cli-core'\nimport {createRequester} from '@sanity/cli-core/request'\nimport {coerce, eq, prerelease, parse as semverParse} from 'semver'\n\nimport {getModuleUrl} from '../actions/build/getAutoUpdatesImportMap.js'\n\nconst defaultRequester = createRequester({\n middleware: {httpErrors: false, promise: {onlyBody: false}},\n})\n\ninterface CompareDependencyVersions {\n installed: string\n pkg: string\n remote: string\n}\n\nexport interface UnresolvedPrerelease {\n pkg: string\n version: string\n}\n\ninterface CompareDependencyVersionsResult {\n mismatched: Array<CompareDependencyVersions>\n unresolvedPrerelease: Array<UnresolvedPrerelease>\n}\n\ninterface CompareDependencyVersionsOptions {\n /** When provided, uses the app-specific module endpoint instead of the default endpoint. */\n appId?: string\n /** Optional requester for dependency injection (primarily for testing). */\n requester?: typeof defaultRequester\n}\n\n/**\n * @internal\n *\n * Compares the versions of dependencies in the studio or app with their remote versions.\n *\n * This function reads the package.json file in the provided working directory, and compares the versions of the dependencies\n * specified in the `autoUpdatesImports` parameter with their remote versions. If the versions do not match, the dependency is\n * added to a list of failed dependencies, which is returned by the function.\n *\n * The failed dependencies are anything that does not strictly match the remote version.\n * This means that if a version is lower or greater by even a patch it will be marked as failed.\n *\n * @param packages - An array of packages with their name and version to compare against remote.\n * @param workDir - The path to the working directory containing the package.json file.\n * @param options - Optional configuration for version comparison.\n *\n * @returns A promise that resolves to an object containing `mismatched` (packages whose local and remote versions differ)\n * and `unresolvedPrerelease` (packages with prerelease versions that could not be resolved remotely).\n *\n * @throws Throws an error if the remote version of a non-prerelease package cannot be fetched, or if the local version\n * of a package cannot be parsed.\n */\nexport async function compareDependencyVersions(\n packages: {name: string; version: string}[],\n workDir: string,\n {appId, requester = defaultRequester}: CompareDependencyVersionsOptions = {},\n): Promise<CompareDependencyVersionsResult> {\n const manifest = await readPackageJson(path.join(workDir, 'package.json'), {\n skipSchemaValidation: true,\n })\n const dependencies = {...manifest?.dependencies, ...manifest?.devDependencies}\n\n const mismatched: Array<CompareDependencyVersions> = []\n const unresolvedPrerelease: Array<UnresolvedPrerelease> = []\n\n for (const pkg of packages) {\n // Skip packages that are not declared in the local package.json\n if (!dependencies[pkg.name]) {\n continue\n }\n\n const resolvedVersion = await getRemoteResolvedVersion(getModuleUrl(pkg, {appId}), requester)\n\n if (resolvedVersion === null) {\n if (prerelease(pkg.version)) {\n unresolvedPrerelease.push({pkg: pkg.name, version: pkg.version})\n continue\n }\n throw new Error(\n `Failed to resolve remote version for ${pkg.name}@${pkg.version}: package not found`,\n )\n }\n\n const packageVersion = await getLocalPackageVersion(pkg.name, workDir)\n\n const manifestVersion = dependencies[pkg.name]\n\n const installed = coerce(packageVersion ? semverParse(packageVersion) : coerce(manifestVersion))\n\n if (!installed) {\n throw new Error(`Failed to parse installed version for ${pkg.name}`)\n }\n\n if (!eq(resolvedVersion, installed.version)) {\n mismatched.push({\n installed: installed.version,\n pkg: pkg.name,\n remote: resolvedVersion,\n })\n }\n }\n\n return {mismatched, unresolvedPrerelease}\n}\n\nasync function getRemoteResolvedVersion(\n url: string,\n request: typeof defaultRequester,\n): Promise<string | null> {\n let response\n try {\n response = await request({\n maxRedirects: 0,\n method: 'HEAD',\n url,\n })\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err)\n throw new Error(`Failed to fetch remote version for ${url}: ${message}`, {cause: err})\n }\n\n // 302 is expected, but lets also handle 2xx\n if (response.statusCode < 400) {\n const resolved = response.headers['x-resolved-version']\n if (!resolved) {\n throw new Error(`Missing 'x-resolved-version' header on response from HEAD ${url}`)\n }\n return resolved\n }\n\n if (response.statusCode === 404) {\n return null\n }\n\n throw new Error(`Unexpected HTTP response: ${response.statusCode} ${response.statusMessage}`)\n}\n"],"names":["path","getLocalPackageVersion","readPackageJson","createRequester","coerce","eq","prerelease","parse","semverParse","getModuleUrl","defaultRequester","middleware","httpErrors","promise","onlyBody","compareDependencyVersions","packages","workDir","appId","requester","manifest","join","skipSchemaValidation","dependencies","devDependencies","mismatched","unresolvedPrerelease","pkg","name","resolvedVersion","getRemoteResolvedVersion","version","push","Error","packageVersion","manifestVersion","installed","remote","url","request","response","maxRedirects","method","err","message","String","cause","statusCode","resolved","headers","statusMessage"],"mappings":"AAAA,OAAOA,UAAU,YAAW;AAE5B,SAAQC,sBAAsB,EAAEC,eAAe,QAAO,mBAAkB;AACxE,SAAQC,eAAe,QAAO,2BAA0B;AACxD,SAAQC,MAAM,EAAEC,EAAE,EAAEC,UAAU,EAAEC,SAASC,WAAW,QAAO,SAAQ;AAEnE,SAAQC,YAAY,QAAO,8CAA6C;AAExE,MAAMC,mBAAmBP,gBAAgB;IACvCQ,YAAY;QAACC,YAAY;QAAOC,SAAS;YAACC,UAAU;QAAK;IAAC;AAC5D;AAyBA;;;;;;;;;;;;;;;;;;;;;CAqBC,GACD,OAAO,eAAeC,0BACpBC,QAA2C,EAC3CC,OAAe,EACf,EAACC,KAAK,EAAEC,YAAYT,gBAAgB,EAAmC,GAAG,CAAC,CAAC;IAE5E,MAAMU,WAAW,MAAMlB,gBAAgBF,KAAKqB,IAAI,CAACJ,SAAS,iBAAiB;QACzEK,sBAAsB;IACxB;IACA,MAAMC,eAAe;QAAC,GAAGH,UAAUG,YAAY;QAAE,GAAGH,UAAUI,eAAe;IAAA;IAE7E,MAAMC,aAA+C,EAAE;IACvD,MAAMC,uBAAoD,EAAE;IAE5D,KAAK,MAAMC,OAAOX,SAAU;QAC1B,gEAAgE;QAChE,IAAI,CAACO,YAAY,CAACI,IAAIC,IAAI,CAAC,EAAE;YAC3B;QACF;QAEA,MAAMC,kBAAkB,MAAMC,yBAAyBrB,aAAakB,KAAK;YAACT;QAAK,IAAIC;QAEnF,IAAIU,oBAAoB,MAAM;YAC5B,IAAIvB,WAAWqB,IAAII,OAAO,GAAG;gBAC3BL,qBAAqBM,IAAI,CAAC;oBAACL,KAAKA,IAAIC,IAAI;oBAAEG,SAASJ,IAAII,OAAO;gBAAA;gBAC9D;YACF;YACA,MAAM,IAAIE,MACR,CAAC,qCAAqC,EAAEN,IAAIC,IAAI,CAAC,CAAC,EAAED,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ifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/cli",
|
|
3
|
-
"version": "6.5.
|
|
3
|
+
"version": "6.5.2",
|
|
4
4
|
"description": "Sanity CLI tool for managing Sanity projects and organizations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"!./dist/**/__tests__",
|
|
31
31
|
"./oclif.config.js",
|
|
32
32
|
"./oclif.manifest.json",
|
|
33
|
-
"./static",
|
|
34
33
|
"./templates"
|
|
35
34
|
],
|
|
36
35
|
"type": "module",
|
|
@@ -63,7 +62,7 @@
|
|
|
63
62
|
"@sanity/id-utils": "^1.0.0",
|
|
64
63
|
"@sanity/import": "^6.0.1",
|
|
65
64
|
"@sanity/migrate": "^6.1.2",
|
|
66
|
-
"@sanity/runtime-cli": "^
|
|
65
|
+
"@sanity/runtime-cli": "^15.0.2",
|
|
67
66
|
"@sanity/schema": "^5.23.0",
|
|
68
67
|
"@sanity/telemetry": "^0.9.0",
|
|
69
68
|
"@sanity/template-validator": "^3.1.0",
|
|
@@ -104,7 +103,6 @@
|
|
|
104
103
|
"react": "^19.2.4",
|
|
105
104
|
"react-dom": "^19.2.4",
|
|
106
105
|
"react-is": "^19.2.4",
|
|
107
|
-
"read-package-up": "^12.0.0",
|
|
108
106
|
"rxjs": "^7.8.2",
|
|
109
107
|
"semver": "^7.7.4",
|
|
110
108
|
"smol-toml": "^1.6.1",
|
|
@@ -116,15 +114,16 @@
|
|
|
116
114
|
"typeid-js": "^1.2.0",
|
|
117
115
|
"vite": "^7.3.2",
|
|
118
116
|
"which": "^6.0.1",
|
|
119
|
-
"yaml": "^2.8.
|
|
117
|
+
"yaml": "^2.8.4",
|
|
120
118
|
"zod": "^4.3.6",
|
|
121
|
-
"@sanity/cli-
|
|
119
|
+
"@sanity/cli-build": "^0.1.0",
|
|
120
|
+
"@sanity/cli-core": "^1.3.2"
|
|
122
121
|
},
|
|
123
122
|
"devDependencies": {
|
|
124
123
|
"@eslint/compat": "^2.0.5",
|
|
125
124
|
"@sanity/pkg-utils": "^10.4.18",
|
|
126
125
|
"@swc/cli": "^0.8.1",
|
|
127
|
-
"@swc/core": "^1.15.
|
|
126
|
+
"@swc/core": "^1.15.33",
|
|
128
127
|
"@types/debug": "^4.1.13",
|
|
129
128
|
"@types/gunzip-maybe": "^1.4.3",
|
|
130
129
|
"@types/jsdom": "^28.0.1",
|
|
@@ -143,7 +142,7 @@
|
|
|
143
142
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
144
143
|
"eslint": "^10.2.1",
|
|
145
144
|
"jsdom": "^29.0.2",
|
|
146
|
-
"nock": "^14.0.
|
|
145
|
+
"nock": "^14.0.14",
|
|
147
146
|
"oclif": "^4.23.0",
|
|
148
147
|
"publint": "^0.3.18",
|
|
149
148
|
"rimraf": "^6.0.1",
|
|
@@ -153,8 +152,8 @@
|
|
|
153
152
|
"vitest": "^4.1.5",
|
|
154
153
|
"@repo/package.config": "0.0.1",
|
|
155
154
|
"@repo/tsconfig": "3.70.0",
|
|
156
|
-
"@sanity/
|
|
157
|
-
"@sanity/cli
|
|
155
|
+
"@sanity/cli-test": "0.3.3",
|
|
156
|
+
"@sanity/eslint-config-cli": "1.1.1"
|
|
158
157
|
},
|
|
159
158
|
"engines": {
|
|
160
159
|
"node": ">=20.19.1 <22 || >=22.12"
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal
|
|
3
|
-
*/ /**
|
|
4
|
-
* @internal
|
|
5
|
-
*/ export function generateWebManifest(basePath) {
|
|
6
|
-
return {
|
|
7
|
-
icons: [
|
|
8
|
-
{
|
|
9
|
-
sizes: '96x96',
|
|
10
|
-
src: `${basePath}/favicon-96.png`,
|
|
11
|
-
type: 'image/png'
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
sizes: '192x192',
|
|
15
|
-
src: `${basePath}/favicon-192.png`,
|
|
16
|
-
type: 'image/png'
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
sizes: '512x512',
|
|
20
|
-
src: `${basePath}/favicon-512.png`,
|
|
21
|
-
type: 'image/png'
|
|
22
|
-
}
|
|
23
|
-
]
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
//# sourceMappingURL=generateWebManifest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/actions/build/generateWebManifest.ts"],"sourcesContent":["/**\n * @internal\n */\ninterface WebManifest {\n icons: {\n sizes: string\n src: string\n type: string\n }[]\n}\n\n/**\n * @internal\n */\nexport function generateWebManifest(basePath: string): WebManifest {\n return {\n icons: [\n {sizes: '96x96', src: `${basePath}/favicon-96.png`, type: 'image/png'},\n {sizes: '192x192', src: `${basePath}/favicon-192.png`, type: 'image/png'},\n {sizes: '512x512', src: `${basePath}/favicon-512.png`, type: 'image/png'},\n ],\n }\n}\n"],"names":["generateWebManifest","basePath","icons","sizes","src","type"],"mappings":"AAAA;;CAEC,GASD;;CAEC,GACD,OAAO,SAASA,oBAAoBC,QAAgB;IAClD,OAAO;QACLC,OAAO;YACL;gBAACC,OAAO;gBAASC,KAAK,GAAGH,SAAS,eAAe,CAAC;gBAAEI,MAAM;YAAW;YACrE;gBAACF,OAAO;gBAAWC,KAAK,GAAGH,SAAS,gBAAgB,CAAC;gBAAEI,MAAM;YAAW;YACxE;gBAACF,OAAO;gBAAWC,KAAK,GAAGH,SAAS,gBAAgB,CAAC;gBAAEI,MAAM;YAAW;SACzE;IACH;AACF"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { readPackageUp } from 'read-package-up';
|
|
4
|
-
import { copyDir } from '../../util/copyDir.js';
|
|
5
|
-
import { writeWebManifest } from './writeWebManifest.js';
|
|
6
|
-
export async function writeFavicons(basePath, destDir) {
|
|
7
|
-
const sanityPkgPath = (await readPackageUp({
|
|
8
|
-
cwd: import.meta.dirname
|
|
9
|
-
}))?.path;
|
|
10
|
-
const faviconsPath = sanityPkgPath ? path.join(path.dirname(sanityPkgPath), 'static', 'favicons') : undefined;
|
|
11
|
-
if (!faviconsPath) {
|
|
12
|
-
throw new Error('Unable to resolve `@sanity/cli` module root');
|
|
13
|
-
}
|
|
14
|
-
await fs.mkdir(destDir, {
|
|
15
|
-
recursive: true
|
|
16
|
-
});
|
|
17
|
-
await copyDir(faviconsPath, destDir, true);
|
|
18
|
-
await writeWebManifest(basePath, destDir);
|
|
19
|
-
// Copy the /static/favicon.ico to /favicon.ico as well, because some tools/browsers
|
|
20
|
-
// blindly expects it to be there before requesting the HTML containing the actual path
|
|
21
|
-
await fs.copyFile(path.join(destDir, 'favicon.ico'), path.join(destDir, '..', 'favicon.ico'));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
//# sourceMappingURL=writeFavicons.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/actions/build/writeFavicons.ts"],"sourcesContent":["import fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport {readPackageUp} from 'read-package-up'\n\nimport {copyDir} from '../../util/copyDir.js'\nimport {writeWebManifest} from './writeWebManifest.js'\n\nexport async function writeFavicons(basePath: string, destDir: string): Promise<void> {\n const sanityPkgPath = (await readPackageUp({cwd: import.meta.dirname}))?.path\n\n const faviconsPath = sanityPkgPath\n ? path.join(path.dirname(sanityPkgPath), 'static', 'favicons')\n : undefined\n\n if (!faviconsPath) {\n throw new Error('Unable to resolve `@sanity/cli` module root')\n }\n\n await fs.mkdir(destDir, {recursive: true})\n await copyDir(faviconsPath, destDir, true)\n await writeWebManifest(basePath, destDir)\n\n // Copy the /static/favicon.ico to /favicon.ico as well, because some tools/browsers\n // blindly expects it to be there before requesting the HTML containing the actual path\n await fs.copyFile(path.join(destDir, 'favicon.ico'), path.join(destDir, '..', 'favicon.ico'))\n}\n"],"names":["fs","path","readPackageUp","copyDir","writeWebManifest","writeFavicons","basePath","destDir","sanityPkgPath","cwd","dirname","faviconsPath","join","undefined","Error","mkdir","recursive","copyFile"],"mappings":"AAAA,OAAOA,QAAQ,mBAAkB;AACjC,OAAOC,UAAU,YAAW;AAE5B,SAAQC,aAAa,QAAO,kBAAiB;AAE7C,SAAQC,OAAO,QAAO,wBAAuB;AAC7C,SAAQC,gBAAgB,QAAO,wBAAuB;AAEtD,OAAO,eAAeC,cAAcC,QAAgB,EAAEC,OAAe;IACnE,MAAMC,gBAAiB,CAAA,MAAMN,cAAc;QAACO,KAAK,YAAYC,OAAO;IAAA,EAAC,GAAIT;IAEzE,MAAMU,eAAeH,gBACjBP,KAAKW,IAAI,CAACX,KAAKS,OAAO,CAACF,gBAAgB,UAAU,cACjDK;IAEJ,IAAI,CAACF,cAAc;QACjB,MAAM,IAAIG,MAAM;IAClB;IAEA,MAAMd,GAAGe,KAAK,CAACR,SAAS;QAACS,WAAW;IAAI;IACxC,MAAMb,QAAQQ,cAAcJ,SAAS;IACrC,MAAMH,iBAAiBE,UAAUC;IAEjC,oFAAoF;IACpF,uFAAuF;IACvF,MAAMP,GAAGiB,QAAQ,CAAChB,KAAKW,IAAI,CAACL,SAAS,gBAAgBN,KAAKW,IAAI,CAACL,SAAS,MAAM;AAChF"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { skipIfExistsError } from '../../util/copyDir.js';
|
|
4
|
-
import { generateWebManifest } from './generateWebManifest.js';
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
*/ export async function writeWebManifest(basePath, destDir) {
|
|
8
|
-
const content = JSON.stringify(generateWebManifest(basePath), null, 2);
|
|
9
|
-
await fs.writeFile(path.join(destDir, 'manifest.webmanifest'), content, 'utf8').catch(skipIfExistsError);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
//# sourceMappingURL=writeWebManifest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/actions/build/writeWebManifest.ts"],"sourcesContent":["import fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport {skipIfExistsError} from '../../util/copyDir.js'\nimport {generateWebManifest} from './generateWebManifest.js'\n\n/**\n * @internal\n */\nexport async function writeWebManifest(basePath: string, destDir: string): Promise<void> {\n const content = JSON.stringify(generateWebManifest(basePath), null, 2)\n await fs\n .writeFile(path.join(destDir, 'manifest.webmanifest'), content, 'utf8')\n .catch(skipIfExistsError)\n}\n"],"names":["fs","path","skipIfExistsError","generateWebManifest","writeWebManifest","basePath","destDir","content","JSON","stringify","writeFile","join","catch"],"mappings":"AAAA,OAAOA,QAAQ,mBAAkB;AACjC,OAAOC,UAAU,YAAW;AAE5B,SAAQC,iBAAiB,QAAO,wBAAuB;AACvD,SAAQC,mBAAmB,QAAO,2BAA0B;AAE5D;;CAEC,GACD,OAAO,eAAeC,iBAAiBC,QAAgB,EAAEC,OAAe;IACtE,MAAMC,UAAUC,KAAKC,SAAS,CAACN,oBAAoBE,WAAW,MAAM;IACpE,MAAML,GACHU,SAAS,CAACT,KAAKU,IAAI,CAACL,SAAS,yBAAyBC,SAAS,QAC/DK,KAAK,CAACV;AACX"}
|
package/dist/util/copyDir.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { constants as fsConstants } from 'node:fs';
|
|
2
|
-
import fs from 'node:fs/promises';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
/**
|
|
5
|
-
* Tries to read a directory, and returns an empty array if the directory does not exist
|
|
6
|
-
*
|
|
7
|
-
* @internal
|
|
8
|
-
*
|
|
9
|
-
* @param dir - Directory to read
|
|
10
|
-
* @returns List of files in the directory
|
|
11
|
-
*/ async function tryReadDir(dir) {
|
|
12
|
-
try {
|
|
13
|
-
const content = await fs.readdir(dir);
|
|
14
|
-
return content;
|
|
15
|
-
} catch (err) {
|
|
16
|
-
if (err.code === 'ENOENT') {
|
|
17
|
-
return [];
|
|
18
|
-
}
|
|
19
|
-
throw err;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Skips an error if the file already exists
|
|
24
|
-
*
|
|
25
|
-
* @internal
|
|
26
|
-
*
|
|
27
|
-
* @param err - Error to check
|
|
28
|
-
*/ export function skipIfExistsError(err) {
|
|
29
|
-
if (err.code === 'EEXIST') {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
throw err;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Copies a directory from one location to another
|
|
36
|
-
*
|
|
37
|
-
* @internal
|
|
38
|
-
*
|
|
39
|
-
* @param srcDir - Source directory
|
|
40
|
-
* @param destDir - Destination directory
|
|
41
|
-
* @param skipExisting - Skip existing files
|
|
42
|
-
*/ export async function copyDir(srcDir, destDir, skipExisting) {
|
|
43
|
-
await fs.mkdir(destDir, {
|
|
44
|
-
recursive: true
|
|
45
|
-
});
|
|
46
|
-
for (const file of (await tryReadDir(srcDir))){
|
|
47
|
-
const srcFile = path.resolve(srcDir, file);
|
|
48
|
-
if (srcFile === destDir) {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
const destFile = path.resolve(destDir, file);
|
|
52
|
-
const stat = await fs.stat(srcFile);
|
|
53
|
-
if (stat.isDirectory()) {
|
|
54
|
-
await copyDir(srcFile, destFile, skipExisting);
|
|
55
|
-
} else if (skipExisting) {
|
|
56
|
-
await fs.copyFile(srcFile, destFile, fsConstants.COPYFILE_EXCL).catch(skipIfExistsError);
|
|
57
|
-
} else {
|
|
58
|
-
await fs.copyFile(srcFile, destFile);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
//# sourceMappingURL=copyDir.js.map
|
package/dist/util/copyDir.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/util/copyDir.ts"],"sourcesContent":["import {constants as fsConstants} from 'node:fs'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\n\n/**\n * Tries to read a directory, and returns an empty array if the directory does not exist\n *\n * @internal\n *\n * @param dir - Directory to read\n * @returns List of files in the directory\n */\nasync function tryReadDir(dir: string): Promise<string[]> {\n try {\n const content = await fs.readdir(dir)\n return content\n } catch (err) {\n if (err.code === 'ENOENT') {\n return []\n }\n\n throw err\n }\n}\n\n/**\n * Skips an error if the file already exists\n *\n * @internal\n *\n * @param err - Error to check\n */\nexport function skipIfExistsError(err: Error & {code: string}) {\n if (err.code === 'EEXIST') {\n return\n }\n\n throw err\n}\n\n/**\n * Copies a directory from one location to another\n *\n * @internal\n *\n * @param srcDir - Source directory\n * @param destDir - Destination directory\n * @param skipExisting - Skip existing files\n */\nexport async function copyDir(\n srcDir: string,\n destDir: string,\n skipExisting?: boolean,\n): Promise<void> {\n await fs.mkdir(destDir, {recursive: true})\n\n for (const file of await tryReadDir(srcDir)) {\n const srcFile = path.resolve(srcDir, file)\n if (srcFile === destDir) {\n continue\n }\n\n const destFile = path.resolve(destDir, file)\n const stat = await fs.stat(srcFile)\n\n if (stat.isDirectory()) {\n await copyDir(srcFile, destFile, skipExisting)\n } else if (skipExisting) {\n await fs.copyFile(srcFile, destFile, fsConstants.COPYFILE_EXCL).catch(skipIfExistsError)\n } else {\n await fs.copyFile(srcFile, destFile)\n }\n }\n}\n"],"names":["constants","fsConstants","fs","path","tryReadDir","dir","content","readdir","err","code","skipIfExistsError","copyDir","srcDir","destDir","skipExisting","mkdir","recursive","file","srcFile","resolve","destFile","stat","isDirectory","copyFile","COPYFILE_EXCL","catch"],"mappings":"AAAA,SAAQA,aAAaC,WAAW,QAAO,UAAS;AAChD,OAAOC,QAAQ,mBAAkB;AACjC,OAAOC,UAAU,YAAW;AAE5B;;;;;;;CAOC,GACD,eAAeC,WAAWC,GAAW;IACnC,IAAI;QACF,MAAMC,UAAU,MAAMJ,GAAGK,OAAO,CAACF;QACjC,OAAOC;IACT,EAAE,OAAOE,KAAK;QACZ,IAAIA,IAAIC,IAAI,KAAK,UAAU;YACzB,OAAO,EAAE;QACX;QAEA,MAAMD;IACR;AACF;AAEA;;;;;;CAMC,GACD,OAAO,SAASE,kBAAkBF,GAA2B;IAC3D,IAAIA,IAAIC,IAAI,KAAK,UAAU;QACzB;IACF;IAEA,MAAMD;AACR;AAEA;;;;;;;;CAQC,GACD,OAAO,eAAeG,QACpBC,MAAc,EACdC,OAAe,EACfC,YAAsB;IAEtB,MAAMZ,GAAGa,KAAK,CAACF,SAAS;QAACG,WAAW;IAAI;IAExC,KAAK,MAAMC,QAAQ,CAAA,MAAMb,WAAWQ,OAAM,EAAG;QAC3C,MAAMM,UAAUf,KAAKgB,OAAO,CAACP,QAAQK;QACrC,IAAIC,YAAYL,SAAS;YACvB;QACF;QAEA,MAAMO,WAAWjB,KAAKgB,OAAO,CAACN,SAASI;QACvC,MAAMI,OAAO,MAAMnB,GAAGmB,IAAI,CAACH;QAE3B,IAAIG,KAAKC,WAAW,IAAI;YACtB,MAAMX,QAAQO,SAASE,UAAUN;QACnC,OAAO,IAAIA,cAAc;YACvB,MAAMZ,GAAGqB,QAAQ,CAACL,SAASE,UAAUnB,YAAYuB,aAAa,EAAEC,KAAK,CAACf;QACxE,OAAO;YACL,MAAMR,GAAGqB,QAAQ,CAACL,SAASE;QAC7B;IACF;AACF"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { dirname, join, normalize, resolve } from 'node:path';
|
|
2
|
-
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
3
|
-
import { readPackageJson } from '@sanity/cli-core';
|
|
4
|
-
import { moduleResolve } from 'import-meta-resolve';
|
|
5
|
-
/**
|
|
6
|
-
* Get the version of a package installed locally.
|
|
7
|
-
*
|
|
8
|
-
* @param moduleName - The name of the package in npm.
|
|
9
|
-
* @param workDir - The working directory to resolve the module from. (aka project root)
|
|
10
|
-
* @returns The version of the package installed locally.
|
|
11
|
-
* @internal
|
|
12
|
-
*/ export async function getLocalPackageVersion(moduleName, workDir) {
|
|
13
|
-
try {
|
|
14
|
-
const packageDir = getLocalPackageDir(moduleName, workDir);
|
|
15
|
-
return (await readPackageJson(join(packageDir, 'package.json'))).version;
|
|
16
|
-
} catch {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Resolve the filesystem directory of a locally installed package using Node
|
|
22
|
-
* module resolution. Works correctly with hoisted packages in monorepos/workspaces,
|
|
23
|
-
* pnpm symlinks, and other non-standard node_modules layouts.
|
|
24
|
-
*
|
|
25
|
-
* @param moduleName - The name of the package in npm.
|
|
26
|
-
* @param workDir - The working directory to resolve the module from. (aka project root)
|
|
27
|
-
* @returns The absolute path to the package directory.
|
|
28
|
-
* @internal
|
|
29
|
-
*/ export function getLocalPackageDir(moduleName, workDir) {
|
|
30
|
-
// Handle import.meta.url being passed instead of a directory path
|
|
31
|
-
const dir = workDir.startsWith('file://') ? dirname(fileURLToPath(workDir)) : workDir;
|
|
32
|
-
const dirUrl = pathToFileURL(resolve(dir, 'noop.js'));
|
|
33
|
-
try {
|
|
34
|
-
const packageJsonUrl = moduleResolve(`${moduleName}/package.json`, dirUrl);
|
|
35
|
-
return dirname(fileURLToPath(packageJsonUrl));
|
|
36
|
-
} catch (err) {
|
|
37
|
-
if (!isErrPackagePathNotExported(err)) {
|
|
38
|
-
throw err;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
// Fallback: resolve main entry point and derive package root
|
|
42
|
-
const mainUrl = moduleResolve(moduleName, dirUrl);
|
|
43
|
-
const mainPath = fileURLToPath(mainUrl);
|
|
44
|
-
const normalizedName = normalize(moduleName);
|
|
45
|
-
const idx = mainPath.lastIndexOf(normalizedName);
|
|
46
|
-
if (idx === -1) {
|
|
47
|
-
throw new Error(`Could not determine package directory for '${moduleName}'`);
|
|
48
|
-
}
|
|
49
|
-
return mainPath.slice(0, idx + normalizedName.length);
|
|
50
|
-
}
|
|
51
|
-
function isErrPackagePathNotExported(err) {
|
|
52
|
-
return err instanceof Error && 'code' in err && err.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED';
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
//# sourceMappingURL=getLocalPackageVersion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/util/getLocalPackageVersion.ts"],"sourcesContent":["import {dirname, join, normalize, resolve} from 'node:path'\nimport {fileURLToPath, pathToFileURL} from 'node:url'\n\nimport {readPackageJson} from '@sanity/cli-core'\nimport {moduleResolve} from 'import-meta-resolve'\n\n/**\n * Get the version of a package installed locally.\n *\n * @param moduleName - The name of the package in npm.\n * @param workDir - The working directory to resolve the module from. (aka project root)\n * @returns The version of the package installed locally.\n * @internal\n */\nexport async function getLocalPackageVersion(\n moduleName: string,\n workDir: string,\n): Promise<string | null> {\n try {\n const packageDir = getLocalPackageDir(moduleName, workDir)\n return (await readPackageJson(join(packageDir, 'package.json'))).version\n } catch {\n return null\n }\n}\n\n/**\n * Resolve the filesystem directory of a locally installed package using Node\n * module resolution. Works correctly with hoisted packages in monorepos/workspaces,\n * pnpm symlinks, and other non-standard node_modules layouts.\n *\n * @param moduleName - The name of the package in npm.\n * @param workDir - The working directory to resolve the module from. (aka project root)\n * @returns The absolute path to the package directory.\n * @internal\n */\nexport function getLocalPackageDir(moduleName: string, workDir: string): string {\n // Handle import.meta.url being passed instead of a directory path\n const dir = workDir.startsWith('file://') ? dirname(fileURLToPath(workDir)) : workDir\n const dirUrl = pathToFileURL(resolve(dir, 'noop.js'))\n\n try {\n const packageJsonUrl = moduleResolve(`${moduleName}/package.json`, dirUrl)\n return dirname(fileURLToPath(packageJsonUrl))\n } catch (err: unknown) {\n if (!isErrPackagePathNotExported(err)) {\n throw err\n }\n }\n\n // Fallback: resolve main entry point and derive package root\n const mainUrl = moduleResolve(moduleName, dirUrl)\n const mainPath = fileURLToPath(mainUrl)\n const normalizedName = normalize(moduleName)\n const idx = mainPath.lastIndexOf(normalizedName)\n if (idx === -1) {\n throw new Error(`Could not determine package directory for '${moduleName}'`)\n }\n return mainPath.slice(0, idx + normalizedName.length)\n}\n\nfunction isErrPackagePathNotExported(err: unknown): boolean {\n return err instanceof Error && 'code' in err && err.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED'\n}\n"],"names":["dirname","join","normalize","resolve","fileURLToPath","pathToFileURL","readPackageJson","moduleResolve","getLocalPackageVersion","moduleName","workDir","packageDir","getLocalPackageDir","version","dir","startsWith","dirUrl","packageJsonUrl","err","isErrPackagePathNotExported","mainUrl","mainPath","normalizedName","idx","lastIndexOf","Error","slice","length","code"],"mappings":"AAAA,SAAQA,OAAO,EAAEC,IAAI,EAAEC,SAAS,EAAEC,OAAO,QAAO,YAAW;AAC3D,SAAQC,aAAa,EAAEC,aAAa,QAAO,WAAU;AAErD,SAAQC,eAAe,QAAO,mBAAkB;AAChD,SAAQC,aAAa,QAAO,sBAAqB;AAEjD;;;;;;;CAOC,GACD,OAAO,eAAeC,uBACpBC,UAAkB,EAClBC,OAAe;IAEf,IAAI;QACF,MAAMC,aAAaC,mBAAmBH,YAAYC;QAClD,OAAO,AAAC,CAAA,MAAMJ,gBAAgBL,KAAKU,YAAY,gBAAe,EAAGE,OAAO;IAC1E,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAEA;;;;;;;;;CASC,GACD,OAAO,SAASD,mBAAmBH,UAAkB,EAAEC,OAAe;IACpE,kEAAkE;IAClE,MAAMI,MAAMJ,QAAQK,UAAU,CAAC,aAAaf,QAAQI,cAAcM,YAAYA;IAC9E,MAAMM,SAASX,cAAcF,QAAQW,KAAK;IAE1C,IAAI;QACF,MAAMG,iBAAiBV,cAAc,GAAGE,WAAW,aAAa,CAAC,EAAEO;QACnE,OAAOhB,QAAQI,cAAca;IAC/B,EAAE,OAAOC,KAAc;QACrB,IAAI,CAACC,4BAA4BD,MAAM;YACrC,MAAMA;QACR;IACF;IAEA,6DAA6D;IAC7D,MAAME,UAAUb,cAAcE,YAAYO;IAC1C,MAAMK,WAAWjB,cAAcgB;IAC/B,MAAME,iBAAiBpB,UAAUO;IACjC,MAAMc,MAAMF,SAASG,WAAW,CAACF;IACjC,IAAIC,QAAQ,CAAC,GAAG;QACd,MAAM,IAAIE,MAAM,CAAC,2CAA2C,EAAEhB,WAAW,CAAC,CAAC;IAC7E;IACA,OAAOY,SAASK,KAAK,CAAC,GAAGH,MAAMD,eAAeK,MAAM;AACtD;AAEA,SAASR,4BAA4BD,GAAY;IAC/C,OAAOA,eAAeO,SAAS,UAAUP,OAAOA,IAAIU,IAAI,KAAK;AAC/D"}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<rect width="512" height="512" fill="#0B0B0B"/>
|
|
3
|
-
<rect width="256" height="256" fill="#0B0B0B"/>
|
|
4
|
-
<g clip-path="url(#clip0_261_6485)">
|
|
5
|
-
<path d="M431.519 304.966L417.597 280.733L350.26 321.759L425.051 226.504L436.358 219.867L433.56 215.662L438.697 209.096L415.097 189.445L404.295 203.215L186.253 330.829L266.869 233.849L417.024 151.513L402.758 123.926L320.972 168.755L361.246 120.336L338.174 100L247.535 209.026L157.515 258.413L226.435 167.267L269.621 144.782L255.906 116.888L130.085 182.407L164.396 136.987L140.429 117.785L68 213.678L69.1238 214.576L82.6554 242.139L162.951 200.31L89.7653 297.077L101.76 306.69L108.893 320.484L193.431 274.12L100.338 386.121L123.411 406.457L128.044 400.883L352.623 269.018L278.061 364.014L279.277 365.029L279.162 365.1L294.62 392.002L393.791 331.561L355.604 393.207L381.199 410L442 311.863L431.519 304.966Z" fill="white"/>
|
|
6
|
-
</g>
|
|
7
|
-
<defs>
|
|
8
|
-
<clipPath id="clip0_261_6485">
|
|
9
|
-
<rect width="374" height="310" fill="white" transform="translate(68 100)"/>
|
|
10
|
-
</clipPath>
|
|
11
|
-
</defs>
|
|
12
|
-
</svg>
|