@@ -279,29 +279,38 @@ function buildPlugins(previewUrl: string): PluginOptions[] {
279279}
280280
281281// ── Workspace definitions ────────────────────────────────────────────
282- export default defineConfig ( [
283- {
284- name : "production" ,
285- title : "CodingCat.dev (Production)" ,
286- projectId,
287- dataset : "production" ,
288- basePath : "/production" ,
289- schema : { types : schemaTypes } ,
290- document : { actions : documentActions } ,
291- plugins : buildPlugins (
292- isLocal ? localPreviewOrigin : "https://codingcat.dev" ,
293- ) ,
294- } ,
295- {
296- name : "dev" ,
297- title : "CodingCat.dev (Dev)" ,
298- projectId,
299- dataset : "dev" ,
300- basePath : "/dev" ,
301- schema : { types : schemaTypes } ,
302- document : { actions : documentActions } ,
303- plugins : buildPlugins (
304- isLocal ? localPreviewOrigin : "https://dev.codingcat.dev" ,
305- ) ,
306- } ,
307- ] ) ;
282+ const targetDataset = process . env . SANITY_STUDIO_DATASET ;
283+
284+ const devWorkspace = {
285+ name : "dev" ,
286+ title : "CodingCat.dev (Dev)" ,
287+ projectId,
288+ dataset : "dev" ,
289+ basePath : targetDataset === "dev" ? "/" : "/dev" ,
290+ schema : { types : schemaTypes } ,
291+ document : { actions : documentActions } ,
292+ plugins : buildPlugins (
293+ isLocal ? localPreviewOrigin : "https://dev.codingcat.dev" ,
294+ ) ,
295+ } ;
296+
297+ const prodWorkspace = {
298+ name : "production" ,
299+ title : "CodingCat.dev (Production)" ,
300+ projectId,
301+ dataset : "production" ,
302+ basePath : targetDataset === "production" ? "/" : "/production" ,
303+ schema : { types : schemaTypes } ,
304+ document : { actions : documentActions } ,
305+ plugins : buildPlugins (
306+ isLocal ? localPreviewOrigin : "https://codingcat.dev" ,
307+ ) ,
308+ } ;
309+
310+ export default defineConfig (
311+ targetDataset === "dev"
312+ ? [ devWorkspace ]
313+ : targetDataset === "production"
314+ ? [ prodWorkspace ]
315+ : [ prodWorkspace , devWorkspace ] ,
316+ ) ;
0 commit comments