@sanity/cli-build 0.0.0-20260527150220
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/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/_exports/_internal.d.ts +119 -0
- package/dist/_exports/_internal.js +11 -0
- package/dist/_exports/_internal.js.map +1 -0
- package/dist/actions/build/buildDebug.js +4 -0
- package/dist/actions/build/buildDebug.js.map +1 -0
- package/dist/actions/build/checkStudioDependencyVersions.js +155 -0
- package/dist/actions/build/checkStudioDependencyVersions.js.map +1 -0
- package/dist/actions/build/generateWebManifest.js +27 -0
- package/dist/actions/build/generateWebManifest.js.map +1 -0
- package/dist/actions/build/writeFavicons.js +31 -0
- package/dist/actions/build/writeFavicons.js.map +1 -0
- package/dist/actions/build/writeWebManifest.js +12 -0
- package/dist/actions/build/writeWebManifest.js.map +1 -0
- package/dist/actions/schema/extractSanitySchema.worker.js +32 -0
- package/dist/actions/schema/extractSanitySchema.worker.js.map +1 -0
- package/dist/actions/schema/getExtractOptions.js +23 -0
- package/dist/actions/schema/getExtractOptions.js.map +1 -0
- package/dist/actions/schema/runSchemaExtraction.js +39 -0
- package/dist/actions/schema/runSchemaExtraction.js.map +1 -0
- package/dist/actions/schema/types.js +9 -0
- package/dist/actions/schema/types.js.map +1 -0
- package/dist/actions/schema/utils/SchemaExtractionError.js +10 -0
- package/dist/actions/schema/utils/SchemaExtractionError.js.map +1 -0
- package/dist/actions/schema/utils/extractValidationFromSchemaError.js +12 -0
- package/dist/actions/schema/utils/extractValidationFromSchemaError.js.map +1 -0
- package/dist/util/copyDir.js +63 -0
- package/dist/util/copyDir.js.map +1 -0
- package/package.json +84 -0
- 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 +12 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Sanity.io
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { extractSchema } from "@sanity/schema/_internal";
|
|
2
|
+
import { Output } from "@sanity/cli-core";
|
|
3
|
+
import { ProjectRootResult } from "@sanity/cli-core";
|
|
4
|
+
import { SchemaValidationProblemGroup } from "@sanity/types";
|
|
5
|
+
|
|
6
|
+
export declare const buildDebug: import("debug").Debugger;
|
|
7
|
+
|
|
8
|
+
export declare function checkStudioDependencyVersions(
|
|
9
|
+
workDir: string,
|
|
10
|
+
output: Output,
|
|
11
|
+
{
|
|
12
|
+
packages,
|
|
13
|
+
}?: {
|
|
14
|
+
packages?: TrackedPackage[];
|
|
15
|
+
},
|
|
16
|
+
): Promise<void>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Copies a directory from one location to another
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
*
|
|
23
|
+
* @param srcDir - Source directory
|
|
24
|
+
* @param destDir - Destination directory
|
|
25
|
+
* @param skipExisting - Skip existing files
|
|
26
|
+
*/
|
|
27
|
+
export declare function copyDir(
|
|
28
|
+
srcDir: string,
|
|
29
|
+
destDir: string,
|
|
30
|
+
skipExisting?: boolean,
|
|
31
|
+
): Promise<void>;
|
|
32
|
+
|
|
33
|
+
export declare interface ExtractOptions {
|
|
34
|
+
configPath: string;
|
|
35
|
+
enforceRequiredFields: boolean;
|
|
36
|
+
format: string;
|
|
37
|
+
outputPath: string;
|
|
38
|
+
watchPatterns: string[];
|
|
39
|
+
workspace: string | undefined;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** @internal */
|
|
43
|
+
export declare interface ExtractSchemaWorkerError {
|
|
44
|
+
error: string;
|
|
45
|
+
type: "error";
|
|
46
|
+
validation?: SchemaValidationProblemGroup[];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Extracts validation problem groups from a SchemaError.
|
|
51
|
+
*/
|
|
52
|
+
export declare function extractValidationFromSchemaError(
|
|
53
|
+
error: unknown,
|
|
54
|
+
workDir: string,
|
|
55
|
+
): Promise<SchemaValidationProblemGroup[] | undefined>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
export declare function generateWebManifest(basePath: string): WebManifest;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
export declare function getDefaultFaviconsPath(): Promise<string>;
|
|
66
|
+
|
|
67
|
+
declare interface GetExtractOptions {
|
|
68
|
+
enforceRequiredFields: boolean | undefined;
|
|
69
|
+
format: string | undefined;
|
|
70
|
+
path: string | undefined;
|
|
71
|
+
projectRoot: ProjectRootResult;
|
|
72
|
+
watchPatterns: string[] | undefined;
|
|
73
|
+
workspace: string | undefined;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export declare function getExtractOptions(
|
|
77
|
+
options: GetExtractOptions,
|
|
78
|
+
): ExtractOptions;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Core schema extraction logic.
|
|
82
|
+
* Performs the extraction via worker and writes to file.
|
|
83
|
+
* Throws SchemaExtractionError on failure.
|
|
84
|
+
*/
|
|
85
|
+
export declare function runSchemaExtraction(
|
|
86
|
+
extractOptions: Omit<ExtractOptions, "watchPatterns">,
|
|
87
|
+
): Promise<ReturnType<typeof extractSchema>>;
|
|
88
|
+
|
|
89
|
+
export declare class SchemaExtractionError extends Error {
|
|
90
|
+
validation?: SchemaValidationProblemGroup[];
|
|
91
|
+
constructor(message: string, validation?: SchemaValidationProblemGroup[]);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
declare interface TrackedPackage {
|
|
95
|
+
deprecatedBelow: string | null;
|
|
96
|
+
name: string;
|
|
97
|
+
supported: string[];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @internal
|
|
102
|
+
*/
|
|
103
|
+
declare interface WebManifest {
|
|
104
|
+
icons: {
|
|
105
|
+
sizes: string;
|
|
106
|
+
src: string;
|
|
107
|
+
type: string;
|
|
108
|
+
}[];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
114
|
+
export declare function writeFavicons(
|
|
115
|
+
basePath: string,
|
|
116
|
+
destDir: string,
|
|
117
|
+
): Promise<void>;
|
|
118
|
+
|
|
119
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { buildDebug } from '../actions/build/buildDebug.js';
|
|
2
|
+
export { checkStudioDependencyVersions } from '../actions/build/checkStudioDependencyVersions.js';
|
|
3
|
+
export { generateWebManifest } from '../actions/build/generateWebManifest.js';
|
|
4
|
+
export { getDefaultFaviconsPath, writeFavicons } from '../actions/build/writeFavicons.js';
|
|
5
|
+
export { getExtractOptions } from '../actions/schema/getExtractOptions.js';
|
|
6
|
+
export { runSchemaExtraction } from '../actions/schema/runSchemaExtraction.js';
|
|
7
|
+
export { extractValidationFromSchemaError } from '../actions/schema/utils/extractValidationFromSchemaError.js';
|
|
8
|
+
export { SchemaExtractionError } from '../actions/schema/utils/SchemaExtractionError.js';
|
|
9
|
+
export { copyDir } from '../util/copyDir.js';
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=_internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/_exports/_internal.ts"],"sourcesContent":["export {buildDebug} from '../actions/build/buildDebug.js'\nexport {checkStudioDependencyVersions} from '../actions/build/checkStudioDependencyVersions.js'\nexport {generateWebManifest} from '../actions/build/generateWebManifest.js'\nexport {getDefaultFaviconsPath, writeFavicons} from '../actions/build/writeFavicons.js'\nexport {type ExtractOptions, getExtractOptions} from '../actions/schema/getExtractOptions.js'\nexport {runSchemaExtraction} from '../actions/schema/runSchemaExtraction.js'\nexport {type ExtractSchemaWorkerError} from '../actions/schema/types.js'\nexport {extractValidationFromSchemaError} from '../actions/schema/utils/extractValidationFromSchemaError.js'\nexport {SchemaExtractionError} from '../actions/schema/utils/SchemaExtractionError.js'\nexport {copyDir} from '../util/copyDir.js'\n"],"names":["buildDebug","checkStudioDependencyVersions","generateWebManifest","getDefaultFaviconsPath","writeFavicons","getExtractOptions","runSchemaExtraction","extractValidationFromSchemaError","SchemaExtractionError","copyDir"],"mappings":"AAAA,SAAQA,UAAU,QAAO,iCAAgC;AACzD,SAAQC,6BAA6B,QAAO,oDAAmD;AAC/F,SAAQC,mBAAmB,QAAO,0CAAyC;AAC3E,SAAQC,sBAAsB,EAAEC,aAAa,QAAO,oCAAmC;AACvF,SAA6BC,iBAAiB,QAAO,yCAAwC;AAC7F,SAAQC,mBAAmB,QAAO,2CAA0C;AAE5E,SAAQC,gCAAgC,QAAO,8DAA6D;AAC5G,SAAQC,qBAAqB,QAAO,mDAAkD;AACtF,SAAQC,OAAO,QAAO,qBAAoB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/actions/build/buildDebug.ts"],"sourcesContent":["import {subdebug} from '@sanity/cli-core'\n\nexport const buildDebug = subdebug('build')\n"],"names":["subdebug","buildDebug"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,mBAAkB;AAEzC,OAAO,MAAMC,aAAaD,SAAS,SAAQ"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { getLocalPackageVersion, readPackageJson } from '@sanity/cli-core';
|
|
3
|
+
import { coerce, gtr, ltr, rcompare, satisfies } from 'semver';
|
|
4
|
+
// NOTE: when doing changes here, also remember to update versions in help docs at
|
|
5
|
+
// https://sanity.io/admin/structure/docs;helpArticle;upgrade-packages
|
|
6
|
+
const DEFAULT_PACKAGES = [
|
|
7
|
+
{
|
|
8
|
+
deprecatedBelow: null,
|
|
9
|
+
name: 'react',
|
|
10
|
+
supported: [
|
|
11
|
+
'^19.2.2'
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
deprecatedBelow: null,
|
|
16
|
+
name: 'react-dom',
|
|
17
|
+
supported: [
|
|
18
|
+
'^19.2.2'
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
deprecatedBelow: null,
|
|
23
|
+
name: 'styled-components',
|
|
24
|
+
supported: [
|
|
25
|
+
'^6'
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
deprecatedBelow: '^3',
|
|
30
|
+
name: '@sanity/ui',
|
|
31
|
+
supported: [
|
|
32
|
+
'^2',
|
|
33
|
+
'^3'
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
export async function checkStudioDependencyVersions(workDir, output, { packages = DEFAULT_PACKAGES } = {}) {
|
|
38
|
+
const manifest = await readPackageJson(path.join(workDir, 'package.json'), {
|
|
39
|
+
skipSchemaValidation: true
|
|
40
|
+
});
|
|
41
|
+
const dependencies = {
|
|
42
|
+
...manifest?.dependencies,
|
|
43
|
+
...manifest?.devDependencies
|
|
44
|
+
};
|
|
45
|
+
const packageInfo = packages.map(async (pkg)=>{
|
|
46
|
+
const dependency = dependencies[pkg.name];
|
|
47
|
+
if (!dependency) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
const packageVersion = await getLocalPackageVersion(pkg.name, workDir);
|
|
51
|
+
const installed = coerce(packageVersion ?? dependency.replaceAll(/[\D.]/g, ''));
|
|
52
|
+
if (!installed) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
const supported = pkg.supported.join(' || ');
|
|
56
|
+
// "Untested" is usually the case where we have not upgraded the React version requirements
|
|
57
|
+
// before a release, but given that is usually works in a backwards-compatible way, we want
|
|
58
|
+
// to indicate that it's _untested_, not necessarily _unsupported_
|
|
59
|
+
// Ex: Installed is react@20.0.0, but we've only _tested_ with react@^19
|
|
60
|
+
const isUntested = !satisfies(installed, supported) && gtr(installed, supported);
|
|
61
|
+
// "Unsupported" in that the installed version is _lower than_ the minimum version
|
|
62
|
+
// Ex: Installed is react@18.0.0, but we require react@^19.2
|
|
63
|
+
const isUnsupported = !satisfies(installed, supported) && !isUntested;
|
|
64
|
+
// "Deprecated" in that we will stop supporting it at some point in the near future,
|
|
65
|
+
// so users should be prompted to upgrade
|
|
66
|
+
const isDeprecated = pkg.deprecatedBelow ? ltr(installed, pkg.deprecatedBelow) : false;
|
|
67
|
+
return {
|
|
68
|
+
...pkg,
|
|
69
|
+
installed,
|
|
70
|
+
isDeprecated,
|
|
71
|
+
isUnsupported,
|
|
72
|
+
isUntested
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
const installedPackages = (await Promise.all(packageInfo)).filter((inp)=>inp !== false);
|
|
76
|
+
const unsupported = installedPackages.filter((pkg)=>pkg.isUnsupported);
|
|
77
|
+
const deprecated = installedPackages.filter((pkg)=>!pkg.isUnsupported && pkg.isDeprecated);
|
|
78
|
+
const untested = installedPackages.filter((pkg)=>pkg.isUntested);
|
|
79
|
+
if (deprecated.length > 0) {
|
|
80
|
+
output.warn(`The following package versions have been deprecated and should be upgraded:
|
|
81
|
+
|
|
82
|
+
${listPackages(deprecated)}
|
|
83
|
+
|
|
84
|
+
Support for these will be removed in a future release!
|
|
85
|
+
|
|
86
|
+
${getUpgradeInstructions(deprecated)}
|
|
87
|
+
`);
|
|
88
|
+
}
|
|
89
|
+
if (untested.length > 0) {
|
|
90
|
+
output.warn(`The following package versions have not yet been marked as supported:
|
|
91
|
+
|
|
92
|
+
${listPackages(untested)}
|
|
93
|
+
|
|
94
|
+
You _may_ encounter bugs while using these versions.
|
|
95
|
+
|
|
96
|
+
${getDowngradeInstructions(untested)}
|
|
97
|
+
`);
|
|
98
|
+
}
|
|
99
|
+
if (unsupported.length > 0) {
|
|
100
|
+
output.error(`The following package versions are no longer supported and needs to be upgraded:
|
|
101
|
+
|
|
102
|
+
${listPackages(unsupported)}
|
|
103
|
+
|
|
104
|
+
${getUpgradeInstructions(unsupported)}
|
|
105
|
+
`, {
|
|
106
|
+
exit: 1
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function listPackages(pkgs) {
|
|
111
|
+
return pkgs.map((pkg)=>`${pkg.name} (installed: ${pkg.installed}, want: ${pkg.deprecatedBelow || pkg.supported.join(' || ')})`).join('\n ');
|
|
112
|
+
}
|
|
113
|
+
function getUpgradeInstructions(pkgs) {
|
|
114
|
+
const inst = pkgs.map((pkg)=>{
|
|
115
|
+
const [highestSupported] = pkg.supported.map((version)=>(coerce(version) || {
|
|
116
|
+
version: ''
|
|
117
|
+
}).version).toSorted(rcompare);
|
|
118
|
+
return `"${pkg.name}@^${highestSupported}"`;
|
|
119
|
+
}).join(' ');
|
|
120
|
+
return `To upgrade, run either:
|
|
121
|
+
|
|
122
|
+
npm install ${inst}
|
|
123
|
+
|
|
124
|
+
or
|
|
125
|
+
|
|
126
|
+
yarn add ${inst}
|
|
127
|
+
|
|
128
|
+
or
|
|
129
|
+
|
|
130
|
+
pnpm add ${inst}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
Read more at https://www.sanity.io/docs/help/upgrade-packages`;
|
|
134
|
+
}
|
|
135
|
+
function getDowngradeInstructions(pkgs) {
|
|
136
|
+
const inst = pkgs.map((pkg)=>{
|
|
137
|
+
const [highestSupported] = pkg.supported.map((version)=>(coerce(version) || {
|
|
138
|
+
version: ''
|
|
139
|
+
}).version).toSorted(rcompare);
|
|
140
|
+
return `"${pkg.name}@^${highestSupported}"`;
|
|
141
|
+
}).join(' ');
|
|
142
|
+
return `To downgrade, run either:
|
|
143
|
+
|
|
144
|
+
yarn add ${inst}
|
|
145
|
+
|
|
146
|
+
or
|
|
147
|
+
|
|
148
|
+
npm install ${inst}
|
|
149
|
+
|
|
150
|
+
or
|
|
151
|
+
|
|
152
|
+
pnpm install ${inst}`;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
//# sourceMappingURL=checkStudioDependencyVersions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/actions/build/checkStudioDependencyVersions.ts"],"sourcesContent":["import path from 'node:path'\n\nimport {getLocalPackageVersion, type Output, readPackageJson} from '@sanity/cli-core'\nimport {coerce, gtr, ltr, rcompare, satisfies, type SemVer} from 'semver'\n\ninterface PackageInfo {\n deprecatedBelow: string | null\n installed: SemVer\n isDeprecated: boolean\n isUnsupported: boolean\n isUntested: boolean\n name: string\n supported: string[]\n}\n\ninterface TrackedPackage {\n deprecatedBelow: string | null\n name: string\n supported: string[]\n}\n\n// NOTE: when doing changes here, also remember to update versions in help docs at\n// https://sanity.io/admin/structure/docs;helpArticle;upgrade-packages\nconst DEFAULT_PACKAGES: TrackedPackage[] = [\n {deprecatedBelow: null, name: 'react', supported: ['^19.2.2']},\n {deprecatedBelow: null, name: 'react-dom', supported: ['^19.2.2']},\n {deprecatedBelow: null, name: 'styled-components', supported: ['^6']},\n {deprecatedBelow: '^3', name: '@sanity/ui', supported: ['^2', '^3']},\n]\n\nexport async function checkStudioDependencyVersions(\n workDir: string,\n output: Output,\n {packages = DEFAULT_PACKAGES}: {packages?: TrackedPackage[]} = {},\n): Promise<void> {\n const manifest = await readPackageJson(path.join(workDir, 'package.json'), {\n skipSchemaValidation: true,\n })\n const dependencies = {...manifest?.dependencies, ...manifest?.devDependencies}\n\n const packageInfo = packages.map(async (pkg): Promise<false | PackageInfo> => {\n const dependency = dependencies[pkg.name]\n if (!dependency) {\n return false\n }\n\n const packageVersion = await getLocalPackageVersion(pkg.name, workDir)\n const installed = coerce(packageVersion ?? dependency.replaceAll(/[\\D.]/g, ''))\n\n if (!installed) {\n return false\n }\n\n const supported = pkg.supported.join(' || ')\n\n // \"Untested\" is usually the case where we have not upgraded the React version requirements\n // before a release, but given that is usually works in a backwards-compatible way, we want\n // to indicate that it's _untested_, not necessarily _unsupported_\n // Ex: Installed is react@20.0.0, but we've only _tested_ with react@^19\n const isUntested = !satisfies(installed, supported) && gtr(installed, supported)\n\n // \"Unsupported\" in that the installed version is _lower than_ the minimum version\n // Ex: Installed is react@18.0.0, but we require react@^19.2\n const isUnsupported = !satisfies(installed, supported) && !isUntested\n\n // \"Deprecated\" in that we will stop supporting it at some point in the near future,\n // so users should be prompted to upgrade\n const isDeprecated = pkg.deprecatedBelow ? ltr(installed, pkg.deprecatedBelow) : false\n\n return {\n ...pkg,\n installed,\n isDeprecated,\n isUnsupported,\n isUntested,\n }\n })\n\n const installedPackages = (await Promise.all(packageInfo)).filter(\n (inp): inp is PackageInfo => inp !== false,\n )\n const unsupported = installedPackages.filter((pkg) => pkg.isUnsupported)\n const deprecated = installedPackages.filter((pkg) => !pkg.isUnsupported && pkg.isDeprecated)\n const untested = installedPackages.filter((pkg) => pkg.isUntested)\n\n if (deprecated.length > 0) {\n output.warn(`The following package versions have been deprecated and should be upgraded:\n\n ${listPackages(deprecated)}\n\nSupport for these will be removed in a future release!\n\n ${getUpgradeInstructions(deprecated)}\n`)\n }\n\n if (untested.length > 0) {\n output.warn(`The following package versions have not yet been marked as supported:\n\n ${listPackages(untested)}\n\nYou _may_ encounter bugs while using these versions.\n\n ${getDowngradeInstructions(untested)}\n`)\n }\n\n if (unsupported.length > 0) {\n output.error(\n `The following package versions are no longer supported and needs to be upgraded:\n\n ${listPackages(unsupported)}\n\n ${getUpgradeInstructions(unsupported)}\n`,\n {exit: 1},\n )\n }\n}\n\nfunction listPackages(pkgs: PackageInfo[]) {\n return pkgs\n .map(\n (pkg) =>\n `${pkg.name} (installed: ${pkg.installed}, want: ${\n pkg.deprecatedBelow || pkg.supported.join(' || ')\n })`,\n )\n .join('\\n ')\n}\n\nfunction getUpgradeInstructions(pkgs: PackageInfo[]) {\n const inst = pkgs\n .map((pkg) => {\n const [highestSupported] = pkg.supported\n .map((version) => (coerce(version) || {version: ''}).version)\n .toSorted(rcompare)\n\n return `\"${pkg.name}@^${highestSupported}\"`\n })\n .join(' ')\n\n return `To upgrade, run either:\n\n npm install ${inst}\n\n or\n\n yarn add ${inst}\n\n or\n\n pnpm add ${inst}\n\n\nRead more at https://www.sanity.io/docs/help/upgrade-packages`\n}\n\nfunction getDowngradeInstructions(pkgs: PackageInfo[]) {\n const inst = pkgs\n .map((pkg) => {\n const [highestSupported] = pkg.supported\n .map((version) => (coerce(version) || {version: ''}).version)\n .toSorted(rcompare)\n\n return `\"${pkg.name}@^${highestSupported}\"`\n })\n .join(' ')\n\n return `To downgrade, run either:\n\n yarn add ${inst}\n\n or\n\n npm install ${inst}\n\n or\n\n pnpm install ${inst}`\n}\n"],"names":["path","getLocalPackageVersion","readPackageJson","coerce","gtr","ltr","rcompare","satisfies","DEFAULT_PACKAGES","deprecatedBelow","name","supported","checkStudioDependencyVersions","workDir","output","packages","manifest","join","skipSchemaValidation","dependencies","devDependencies","packageInfo","map","pkg","dependency","packageVersion","installed","replaceAll","isUntested","isUnsupported","isDeprecated","installedPackages","Promise","all","filter","inp","unsupported","deprecated","untested","length","warn","listPackages","getUpgradeInstructions","getDowngradeInstructions","error","exit","pkgs","inst","highestSupported","version","toSorted"],"mappings":"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"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/ export async function getDefaultFaviconsPath() {
|
|
9
|
+
const sanityCliPkgPath = (await readPackageUp({
|
|
10
|
+
cwd: import.meta.dirname
|
|
11
|
+
}))?.path;
|
|
12
|
+
if (!sanityCliPkgPath) {
|
|
13
|
+
throw new Error('Unable to resolve `@sanity/cli-build` module root');
|
|
14
|
+
}
|
|
15
|
+
return path.join(path.dirname(sanityCliPkgPath), 'static', 'favicons');
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/ export async function writeFavicons(basePath, destDir) {
|
|
20
|
+
const faviconsPath = await getDefaultFaviconsPath();
|
|
21
|
+
await fs.mkdir(destDir, {
|
|
22
|
+
recursive: true
|
|
23
|
+
});
|
|
24
|
+
await copyDir(faviconsPath, destDir, true);
|
|
25
|
+
await writeWebManifest(basePath, destDir);
|
|
26
|
+
// Copy the /static/favicon.ico to /favicon.ico as well, because some tools/browsers
|
|
27
|
+
// blindly expects it to be there before requesting the HTML containing the actual path
|
|
28
|
+
await fs.copyFile(path.join(destDir, 'favicon.ico'), path.join(destDir, '..', 'favicon.ico'));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=writeFavicons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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\n/**\n * @internal\n */\nexport async function getDefaultFaviconsPath(): Promise<string> {\n const sanityCliPkgPath = (await readPackageUp({cwd: import.meta.dirname}))?.path\n if (!sanityCliPkgPath) {\n throw new Error('Unable to resolve `@sanity/cli-build` module root')\n }\n\n return path.join(path.dirname(sanityCliPkgPath), 'static', 'favicons')\n}\n\n/**\n * @internal\n */\nexport async function writeFavicons(basePath: string, destDir: string): Promise<void> {\n const faviconsPath = await getDefaultFaviconsPath()\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","getDefaultFaviconsPath","sanityCliPkgPath","cwd","dirname","Error","join","writeFavicons","basePath","destDir","faviconsPath","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;;CAEC,GACD,OAAO,eAAeC;IACpB,MAAMC,mBAAoB,CAAA,MAAMJ,cAAc;QAACK,KAAK,YAAYC,OAAO;IAAA,EAAC,GAAIP;IAC5E,IAAI,CAACK,kBAAkB;QACrB,MAAM,IAAIG,MAAM;IAClB;IAEA,OAAOR,KAAKS,IAAI,CAACT,KAAKO,OAAO,CAACF,mBAAmB,UAAU;AAC7D;AAEA;;CAEC,GACD,OAAO,eAAeK,cAAcC,QAAgB,EAAEC,OAAe;IACnE,MAAMC,eAAe,MAAMT;IAE3B,MAAML,GAAGe,KAAK,CAACF,SAAS;QAACG,WAAW;IAAI;IACxC,MAAMb,QAAQW,cAAcD,SAAS;IACrC,MAAMT,iBAAiBQ,UAAUC;IAEjC,oFAAoF;IACpF,uFAAuF;IACvF,MAAMb,GAAGiB,QAAQ,CAAChB,KAAKS,IAAI,CAACG,SAAS,gBAAgBZ,KAAKS,IAAI,CAACG,SAAS,MAAM;AAChF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { isMainThread, parentPort, workerData } from 'node:worker_threads';
|
|
2
|
+
import { getStudioWorkspaces, getWorkspace } from '@sanity/cli-core';
|
|
3
|
+
import { extractSchema } from '@sanity/schema/_internal';
|
|
4
|
+
import { extractSchemaWorkerData } from './types.js';
|
|
5
|
+
import { extractValidationFromSchemaError } from './utils/extractValidationFromSchemaError.js';
|
|
6
|
+
if (isMainThread || !parentPort) {
|
|
7
|
+
throw new Error('Should only be run in a worker!');
|
|
8
|
+
}
|
|
9
|
+
const { configPath, enforceRequiredFields, workDir, workspaceName } = extractSchemaWorkerData.parse(workerData);
|
|
10
|
+
try {
|
|
11
|
+
const workspaces = await getStudioWorkspaces(configPath);
|
|
12
|
+
if (workspaces.length === 0) {
|
|
13
|
+
throw new Error('Failed to resolve configuration');
|
|
14
|
+
}
|
|
15
|
+
const workspace = getWorkspace(workspaces, workspaceName);
|
|
16
|
+
const schema = extractSchema(workspace.schema, {
|
|
17
|
+
enforceRequiredFields
|
|
18
|
+
});
|
|
19
|
+
parentPort.postMessage({
|
|
20
|
+
schema,
|
|
21
|
+
type: 'success'
|
|
22
|
+
});
|
|
23
|
+
} catch (error) {
|
|
24
|
+
const validation = await extractValidationFromSchemaError(error, workDir);
|
|
25
|
+
parentPort.postMessage({
|
|
26
|
+
error: error instanceof Error ? error.message : String(error),
|
|
27
|
+
type: 'error',
|
|
28
|
+
validation
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=extractSanitySchema.worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/actions/schema/extractSanitySchema.worker.ts"],"sourcesContent":["import {isMainThread, parentPort, workerData} from 'node:worker_threads'\n\nimport {getStudioWorkspaces, getWorkspace} from '@sanity/cli-core'\nimport {extractSchema} from '@sanity/schema/_internal'\n\nimport {extractSchemaWorkerData} from './types.js'\nimport {extractValidationFromSchemaError} from './utils/extractValidationFromSchemaError.js'\n\nif (isMainThread || !parentPort) {\n throw new Error('Should only be run in a worker!')\n}\n\nconst {configPath, enforceRequiredFields, workDir, workspaceName} =\n extractSchemaWorkerData.parse(workerData)\n\ntry {\n const workspaces = await getStudioWorkspaces(configPath)\n if (workspaces.length === 0) {\n throw new Error('Failed to resolve configuration')\n }\n\n const workspace = getWorkspace(workspaces, workspaceName)\n const schema = extractSchema(workspace.schema, {\n enforceRequiredFields,\n })\n\n parentPort.postMessage({\n schema,\n type: 'success',\n })\n} catch (error) {\n const validation = await extractValidationFromSchemaError(error, workDir)\n parentPort.postMessage({\n error: error instanceof Error ? error.message : String(error),\n type: 'error',\n validation,\n })\n}\n"],"names":["isMainThread","parentPort","workerData","getStudioWorkspaces","getWorkspace","extractSchema","extractSchemaWorkerData","extractValidationFromSchemaError","Error","configPath","enforceRequiredFields","workDir","workspaceName","parse","workspaces","length","workspace","schema","postMessage","type","error","validation","message","String"],"mappings":"AAAA,SAAQA,YAAY,EAAEC,UAAU,EAAEC,UAAU,QAAO,sBAAqB;AAExE,SAAQC,mBAAmB,EAAEC,YAAY,QAAO,mBAAkB;AAClE,SAAQC,aAAa,QAAO,2BAA0B;AAEtD,SAAQC,uBAAuB,QAAO,aAAY;AAClD,SAAQC,gCAAgC,QAAO,8CAA6C;AAE5F,IAAIP,gBAAgB,CAACC,YAAY;IAC/B,MAAM,IAAIO,MAAM;AAClB;AAEA,MAAM,EAACC,UAAU,EAAEC,qBAAqB,EAAEC,OAAO,EAAEC,aAAa,EAAC,GAC/DN,wBAAwBO,KAAK,CAACX;AAEhC,IAAI;IACF,MAAMY,aAAa,MAAMX,oBAAoBM;IAC7C,IAAIK,WAAWC,MAAM,KAAK,GAAG;QAC3B,MAAM,IAAIP,MAAM;IAClB;IAEA,MAAMQ,YAAYZ,aAAaU,YAAYF;IAC3C,MAAMK,SAASZ,cAAcW,UAAUC,MAAM,EAAE;QAC7CP;IACF;IAEAT,WAAWiB,WAAW,CAAC;QACrBD;QACAE,MAAM;IACR;AACF,EAAE,OAAOC,OAAO;IACd,MAAMC,aAAa,MAAMd,iCAAiCa,OAAOT;IACjEV,WAAWiB,WAAW,CAAC;QACrBE,OAAOA,iBAAiBZ,QAAQY,MAAME,OAAO,GAAGC,OAAOH;QACvDD,MAAM;QACNE;IACF;AACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { existsSync, statSync } from 'node:fs';
|
|
2
|
+
import { extname, join, resolve } from 'node:path';
|
|
3
|
+
export function getExtractOptions(options) {
|
|
4
|
+
const { enforceRequiredFields, format, path: pathFlag, projectRoot, watchPatterns, workspace } = options;
|
|
5
|
+
let outputPath;
|
|
6
|
+
if (pathFlag) {
|
|
7
|
+
const resolved = resolve(join(projectRoot.directory, pathFlag));
|
|
8
|
+
const isExistingDirectory = existsSync(resolved) && statSync(resolved).isDirectory();
|
|
9
|
+
outputPath = isExistingDirectory || !extname(resolved) ? join(resolved, 'schema.json') : resolved;
|
|
10
|
+
} else {
|
|
11
|
+
outputPath = resolve(join(projectRoot.directory, 'schema.json'));
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
configPath: projectRoot.path,
|
|
15
|
+
enforceRequiredFields: enforceRequiredFields ?? false,
|
|
16
|
+
format: format ?? 'groq-type-nodes',
|
|
17
|
+
outputPath,
|
|
18
|
+
watchPatterns: watchPatterns ?? [],
|
|
19
|
+
workspace
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=getExtractOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/actions/schema/getExtractOptions.ts"],"sourcesContent":["import {existsSync, statSync} from 'node:fs'\nimport {extname, join, resolve} from 'node:path'\n\nimport {type ProjectRootResult} from '@sanity/cli-core'\n\nexport interface ExtractOptions {\n configPath: string\n enforceRequiredFields: boolean\n format: string\n outputPath: string\n watchPatterns: string[]\n workspace: string | undefined\n}\n\ninterface GetExtractOptions {\n enforceRequiredFields: boolean | undefined\n format: string | undefined\n path: string | undefined\n projectRoot: ProjectRootResult\n watchPatterns: string[] | undefined\n workspace: string | undefined\n}\n\nexport function getExtractOptions(options: GetExtractOptions): ExtractOptions {\n const {\n enforceRequiredFields,\n format,\n path: pathFlag,\n projectRoot,\n watchPatterns,\n workspace,\n } = options\n let outputPath: string\n if (pathFlag) {\n const resolved = resolve(join(projectRoot.directory, pathFlag))\n const isExistingDirectory = existsSync(resolved) && statSync(resolved).isDirectory()\n\n outputPath =\n isExistingDirectory || !extname(resolved) ? join(resolved, 'schema.json') : resolved\n } else {\n outputPath = resolve(join(projectRoot.directory, 'schema.json'))\n }\n\n return {\n configPath: projectRoot.path,\n enforceRequiredFields: enforceRequiredFields ?? false,\n format: format ?? 'groq-type-nodes',\n outputPath,\n watchPatterns: watchPatterns ?? [],\n workspace,\n }\n}\n"],"names":["existsSync","statSync","extname","join","resolve","getExtractOptions","options","enforceRequiredFields","format","path","pathFlag","projectRoot","watchPatterns","workspace","outputPath","resolved","directory","isExistingDirectory","isDirectory","configPath"],"mappings":"AAAA,SAAQA,UAAU,EAAEC,QAAQ,QAAO,UAAS;AAC5C,SAAQC,OAAO,EAAEC,IAAI,EAAEC,OAAO,QAAO,YAAW;AAsBhD,OAAO,SAASC,kBAAkBC,OAA0B;IAC1D,MAAM,EACJC,qBAAqB,EACrBC,MAAM,EACNC,MAAMC,QAAQ,EACdC,WAAW,EACXC,aAAa,EACbC,SAAS,EACV,GAAGP;IACJ,IAAIQ;IACJ,IAAIJ,UAAU;QACZ,MAAMK,WAAWX,QAAQD,KAAKQ,YAAYK,SAAS,EAAEN;QACrD,MAAMO,sBAAsBjB,WAAWe,aAAad,SAASc,UAAUG,WAAW;QAElFJ,aACEG,uBAAuB,CAACf,QAAQa,YAAYZ,KAAKY,UAAU,iBAAiBA;IAChF,OAAO;QACLD,aAAaV,QAAQD,KAAKQ,YAAYK,SAAS,EAAE;IACnD;IAEA,OAAO;QACLG,YAAYR,YAAYF,IAAI;QAC5BF,uBAAuBA,yBAAyB;QAChDC,QAAQA,UAAU;QAClBM;QACAF,eAAeA,iBAAiB,EAAE;QAClCC;IACF;AACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { dirname } from 'node:path';
|
|
3
|
+
import { studioWorkerTask } from '@sanity/cli-core';
|
|
4
|
+
import { SchemaExtractionError } from './utils/SchemaExtractionError.js';
|
|
5
|
+
/**
|
|
6
|
+
* Core schema extraction logic.
|
|
7
|
+
* Performs the extraction via worker and writes to file.
|
|
8
|
+
* Throws SchemaExtractionError on failure.
|
|
9
|
+
*/ export async function runSchemaExtraction(extractOptions) {
|
|
10
|
+
const { configPath, enforceRequiredFields, format, outputPath, workspace } = extractOptions;
|
|
11
|
+
if (format !== 'groq-type-nodes') {
|
|
12
|
+
throw new Error(`Unsupported format: "${format}"`);
|
|
13
|
+
}
|
|
14
|
+
const workDir = dirname(configPath);
|
|
15
|
+
const outputDir = dirname(outputPath);
|
|
16
|
+
const result = await studioWorkerTask(new URL('extractSanitySchema.worker.js', import.meta.url), {
|
|
17
|
+
name: 'extractSanitySchema',
|
|
18
|
+
studioRootPath: workDir,
|
|
19
|
+
workerData: {
|
|
20
|
+
configPath,
|
|
21
|
+
enforceRequiredFields,
|
|
22
|
+
workDir,
|
|
23
|
+
workspaceName: workspace
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
if (result.type === 'error') {
|
|
27
|
+
throw new SchemaExtractionError(result.error, result.validation);
|
|
28
|
+
}
|
|
29
|
+
const schema = result.schema;
|
|
30
|
+
// Ensure output directory exists
|
|
31
|
+
await mkdir(outputDir, {
|
|
32
|
+
recursive: true
|
|
33
|
+
});
|
|
34
|
+
// Write schema to file
|
|
35
|
+
await writeFile(outputPath, `${JSON.stringify(schema, null, 2)}\n`);
|
|
36
|
+
return schema;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=runSchemaExtraction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/actions/schema/runSchemaExtraction.ts"],"sourcesContent":["import {mkdir, writeFile} from 'node:fs/promises'\nimport {dirname} from 'node:path'\n\nimport {studioWorkerTask} from '@sanity/cli-core'\nimport {type extractSchema as extractSchemaInternal} from '@sanity/schema/_internal'\n\nimport {type ExtractOptions} from './getExtractOptions.js'\nimport {type ExtractSchemaWorkerData, type ExtractSchemaWorkerError} from './types.js'\nimport {SchemaExtractionError} from './utils/SchemaExtractionError.js'\n\ninterface ExtractSchemaWorkerResult {\n schema: ReturnType<typeof extractSchemaInternal>\n type: 'success'\n}\n\ntype ExtractSchemaWorkerMessage = ExtractSchemaWorkerError | ExtractSchemaWorkerResult\n\n/**\n * Core schema extraction logic.\n * Performs the extraction via worker and writes to file.\n * Throws SchemaExtractionError on failure.\n */\nexport async function runSchemaExtraction(\n extractOptions: Omit<ExtractOptions, 'watchPatterns'>,\n): Promise<ReturnType<typeof extractSchemaInternal>> {\n const {configPath, enforceRequiredFields, format, outputPath, workspace} = extractOptions\n\n if (format !== 'groq-type-nodes') {\n throw new Error(`Unsupported format: \"${format}\"`)\n }\n\n const workDir = dirname(configPath)\n const outputDir = dirname(outputPath)\n\n const result = await studioWorkerTask<ExtractSchemaWorkerMessage>(\n new URL('extractSanitySchema.worker.js', import.meta.url),\n {\n name: 'extractSanitySchema',\n studioRootPath: workDir,\n workerData: {\n configPath,\n enforceRequiredFields,\n workDir,\n workspaceName: workspace,\n } satisfies ExtractSchemaWorkerData,\n },\n )\n\n if (result.type === 'error') {\n throw new SchemaExtractionError(result.error, result.validation)\n }\n\n const schema = result.schema\n\n // Ensure output directory exists\n await mkdir(outputDir, {recursive: true})\n\n // Write schema to file\n await writeFile(outputPath, `${JSON.stringify(schema, null, 2)}\\n`)\n\n return schema\n}\n"],"names":["mkdir","writeFile","dirname","studioWorkerTask","SchemaExtractionError","runSchemaExtraction","extractOptions","configPath","enforceRequiredFields","format","outputPath","workspace","Error","workDir","outputDir","result","URL","url","name","studioRootPath","workerData","workspaceName","type","error","validation","schema","recursive","JSON","stringify"],"mappings":"AAAA,SAAQA,KAAK,EAAEC,SAAS,QAAO,mBAAkB;AACjD,SAAQC,OAAO,QAAO,YAAW;AAEjC,SAAQC,gBAAgB,QAAO,mBAAkB;AAKjD,SAAQC,qBAAqB,QAAO,mCAAkC;AAStE;;;;CAIC,GACD,OAAO,eAAeC,oBACpBC,cAAqD;IAErD,MAAM,EAACC,UAAU,EAAEC,qBAAqB,EAAEC,MAAM,EAAEC,UAAU,EAAEC,SAAS,EAAC,GAAGL;IAE3E,IAAIG,WAAW,mBAAmB;QAChC,MAAM,IAAIG,MAAM,CAAC,qBAAqB,EAAEH,OAAO,CAAC,CAAC;IACnD;IAEA,MAAMI,UAAUX,QAAQK;IACxB,MAAMO,YAAYZ,QAAQQ;IAE1B,MAAMK,SAAS,MAAMZ,iBACnB,IAAIa,IAAI,iCAAiC,YAAYC,GAAG,GACxD;QACEC,MAAM;QACNC,gBAAgBN;QAChBO,YAAY;YACVb;YACAC;YACAK;YACAQ,eAAeV;QACjB;IACF;IAGF,IAAII,OAAOO,IAAI,KAAK,SAAS;QAC3B,MAAM,IAAIlB,sBAAsBW,OAAOQ,KAAK,EAAER,OAAOS,UAAU;IACjE;IAEA,MAAMC,SAASV,OAAOU,MAAM;IAE5B,iCAAiC;IACjC,MAAMzB,MAAMc,WAAW;QAACY,WAAW;IAAI;IAEvC,uBAAuB;IACvB,MAAMzB,UAAUS,YAAY,GAAGiB,KAAKC,SAAS,CAACH,QAAQ,MAAM,GAAG,EAAE,CAAC;IAElE,OAAOA;AACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/actions/schema/types.ts"],"sourcesContent":["import {type SchemaValidationProblemGroup} from '@sanity/types'\nimport {z} from 'zod/mini'\n\nexport const extractSchemaWorkerData = z.object({\n configPath: z.string(),\n enforceRequiredFields: z.boolean(),\n workDir: z.string(),\n workspaceName: z.optional(z.string()),\n})\n\nexport type ExtractSchemaWorkerData = z.infer<typeof extractSchemaWorkerData>\n\n/** @internal */\nexport interface ExtractSchemaWorkerError {\n error: string\n type: 'error'\n\n validation?: SchemaValidationProblemGroup[]\n}\n"],"names":["z","extractSchemaWorkerData","object","configPath","string","enforceRequiredFields","boolean","workDir","workspaceName","optional"],"mappings":"AACA,SAAQA,CAAC,QAAO,WAAU;AAE1B,OAAO,MAAMC,0BAA0BD,EAAEE,MAAM,CAAC;IAC9CC,YAAYH,EAAEI,MAAM;IACpBC,uBAAuBL,EAAEM,OAAO;IAChCC,SAASP,EAAEI,MAAM;IACjBI,eAAeR,EAAES,QAAQ,CAACT,EAAEI,MAAM;AACpC,GAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/schema/utils/SchemaExtractionError.ts"],"sourcesContent":["import {type SchemaValidationProblemGroup} from '@sanity/types'\n\nexport class SchemaExtractionError extends Error {\n validation?: SchemaValidationProblemGroup[]\n\n constructor(message: string, validation?: SchemaValidationProblemGroup[]) {\n super(message)\n this.name = 'SchemaExtractionError'\n this.validation = validation\n }\n}\n"],"names":["SchemaExtractionError","Error","validation","message","name"],"mappings":"AAEA,OAAO,MAAMA,8BAA8BC;IACzCC,WAA2C;IAE3C,YAAYC,OAAe,EAAED,UAA2C,CAAE;QACxE,KAAK,CAACC;QACN,IAAI,CAACC,IAAI,GAAG;QACZ,IAAI,CAACF,UAAU,GAAGA;IACpB;AACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { resolveLocalPackage } from '@sanity/cli-core';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts validation problem groups from a SchemaError.
|
|
4
|
+
*/ export async function extractValidationFromSchemaError(error, workDir) {
|
|
5
|
+
const { SchemaError } = await resolveLocalPackage('sanity', workDir);
|
|
6
|
+
if (error instanceof SchemaError) {
|
|
7
|
+
return error.schema._validation;
|
|
8
|
+
}
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=extractValidationFromSchemaError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/schema/utils/extractValidationFromSchemaError.ts"],"sourcesContent":["import {resolveLocalPackage} from '@sanity/cli-core'\nimport {type SchemaValidationProblemGroup} from '@sanity/types'\n\n/**\n * Extracts validation problem groups from a SchemaError.\n */\nexport async function extractValidationFromSchemaError(\n error: unknown,\n workDir: string,\n): Promise<SchemaValidationProblemGroup[] | undefined> {\n const {SchemaError} = await resolveLocalPackage<typeof import('sanity')>('sanity', workDir)\n\n if (error instanceof SchemaError) {\n return error.schema._validation\n }\n\n return undefined\n}\n"],"names":["resolveLocalPackage","extractValidationFromSchemaError","error","workDir","SchemaError","schema","_validation","undefined"],"mappings":"AAAA,SAAQA,mBAAmB,QAAO,mBAAkB;AAGpD;;CAEC,GACD,OAAO,eAAeC,iCACpBC,KAAc,EACdC,OAAe;IAEf,MAAM,EAACC,WAAW,EAAC,GAAG,MAAMJ,oBAA6C,UAAUG;IAEnF,IAAID,iBAAiBE,aAAa;QAChC,OAAOF,MAAMG,MAAM,CAACC,WAAW;IACjC;IAEA,OAAOC;AACT"}
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/package.json
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sanity/cli-build",
|
|
3
|
+
"version": "0.0.0-20260527150220",
|
|
4
|
+
"description": "Internal Sanity package for building studios and apps",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cli",
|
|
7
|
+
"cms",
|
|
8
|
+
"content",
|
|
9
|
+
"headless",
|
|
10
|
+
"realtime",
|
|
11
|
+
"sanity",
|
|
12
|
+
"tool"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/sanity-io/cli",
|
|
15
|
+
"bugs": "https://github.com/sanity-io/cli/issues",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"author": "Sanity.io <hello@sanity.io>",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/sanity-io/cli.git",
|
|
21
|
+
"directory": "packages/@sanity/cli-build"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"./dist",
|
|
25
|
+
"!./dist/**/__tests__",
|
|
26
|
+
"./static"
|
|
27
|
+
],
|
|
28
|
+
"type": "module",
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"main": "./dist/_exports/_internal.js",
|
|
31
|
+
"types": "./dist/_exports/_internal.d.ts",
|
|
32
|
+
"exports": {
|
|
33
|
+
"./_internal": {
|
|
34
|
+
"source": "./src/_exports/_internal.ts",
|
|
35
|
+
"default": "./dist/_exports/_internal.js"
|
|
36
|
+
},
|
|
37
|
+
"./package.json": "./package.json"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@sanity/schema": "^5.26.0",
|
|
44
|
+
"@sanity/types": "^5.26.0",
|
|
45
|
+
"read-package-up": "^12.0.0",
|
|
46
|
+
"semver": "^7.7.4",
|
|
47
|
+
"zod": "^4.3.6",
|
|
48
|
+
"@sanity/cli-core": "^0.0.0-20260527150220"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@eslint/compat": "^2.0.5",
|
|
52
|
+
"@sanity/pkg-utils": "^10.4.18",
|
|
53
|
+
"@swc/cli": "^0.8.1",
|
|
54
|
+
"@swc/core": "^1.15.33",
|
|
55
|
+
"@types/debug": "^4.1.13",
|
|
56
|
+
"@types/node": "^20.19.41",
|
|
57
|
+
"@types/semver": "^7.7.1",
|
|
58
|
+
"@vitest/coverage-istanbul": "^4.1.5",
|
|
59
|
+
"eslint": "^10.2.1",
|
|
60
|
+
"publint": "^0.3.18",
|
|
61
|
+
"sanity": "^5.26.0",
|
|
62
|
+
"typescript": "^5.9.3",
|
|
63
|
+
"vitest": "^4.1.5",
|
|
64
|
+
"@repo/package.config": "0.0.1",
|
|
65
|
+
"@repo/tsconfig": "3.70.0",
|
|
66
|
+
"@sanity/cli-test": "0.0.0-20260527150220",
|
|
67
|
+
"@sanity/eslint-config-cli": "^1.1.1"
|
|
68
|
+
},
|
|
69
|
+
"engines": {
|
|
70
|
+
"node": ">=20.19.1 <22 || >=22.12"
|
|
71
|
+
},
|
|
72
|
+
"scripts": {
|
|
73
|
+
"build": "swc --delete-dir-on-start --strip-leading-paths --out-dir dist/ src --ignore '**/*.test.ts' --ignore '**/__tests__/**'",
|
|
74
|
+
"build:types": "pkg-utils build --emitDeclarationOnly",
|
|
75
|
+
"check:types": "tsc --noEmit",
|
|
76
|
+
"lint": "eslint .",
|
|
77
|
+
"publint": "publint",
|
|
78
|
+
"test": "vitest run",
|
|
79
|
+
"posttest": "pnpm run lint",
|
|
80
|
+
"test:coverage": "vitest run --coverage",
|
|
81
|
+
"test:watch": "vitest",
|
|
82
|
+
"watch": "swc --delete-dir-on-start --strip-leading-paths --out-dir dist/ --watch src"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,12 @@
|
|
|
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>
|