@sanity/cli 3.65.2-cops.39 → 3.65.2-corel.468
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/lib/_chunks-cjs/cli.js
CHANGED
@@ -27239,12 +27239,13 @@ async function tryApplyPackageName(root2, name) {
|
|
27239
27239
|
} catch {
|
27240
27240
|
}
|
27241
27241
|
}
|
27242
|
-
async function generateSanityApiReadToken(projectId, apiClient) {
|
27242
|
+
async function generateSanityApiReadToken(label, projectId, apiClient) {
|
27243
27243
|
return (await apiClient({ requireProject: !1, requireUser: !0 }).config({ apiVersion: "v2021-06-07" }).request({
|
27244
27244
|
uri: `/projects/${projectId}/tokens`,
|
27245
27245
|
method: "POST",
|
27246
27246
|
body: {
|
27247
|
-
label:
|
27247
|
+
label: `${label} (${Date.now()})`,
|
27248
|
+
// Add timestamp to ensure uniqueness
|
27248
27249
|
roleName: "viewer"
|
27249
27250
|
}
|
27250
27251
|
})).key;
|
@@ -48310,11 +48311,15 @@ function isInMercurialRepository(rootDir) {
|
|
48310
48311
|
}
|
48311
48312
|
const INITIAL_COMMIT_MESSAGE = "Initial commit from Sanity CLI";
|
48312
48313
|
async function bootstrapRemoteTemplate(opts, context) {
|
48313
|
-
const { outputPath, repoInfo, bearerToken, variables, packageName } = opts, { output, apiClient } = context, name = [repoInfo.username, repoInfo.name, repoInfo.filePath].filter(Boolean).join("/"), spinner = output.spinner(`Bootstrapping files from template "${name}"`).start();
|
48314
|
+
const { outputPath, repoInfo, bearerToken, variables, packageName, isCI: isCI2 } = opts, { output, apiClient } = context, name = [repoInfo.username, repoInfo.name, repoInfo.filePath].filter(Boolean).join("/"), spinner = output.spinner(`Bootstrapping files from template "${name}"`).start();
|
48314
48315
|
loadEnv.debug("Validating remote template");
|
48315
48316
|
const packages = await getMonoRepo(repoInfo, bearerToken);
|
48316
48317
|
await validateRemoteTemplate(repoInfo, packages, bearerToken), loadEnv.debug('Create new directory "%s"', outputPath), await fs.mkdir(outputPath, { recursive: !0 }), loadEnv.debug("Downloading and extracting repo to %s", outputPath), await downloadAndExtractRepo(outputPath, repoInfo, bearerToken), loadEnv.debug("Applying environment variables");
|
48317
|
-
const readToken = await generateSanityApiReadToken(
|
48318
|
+
const readToken = await generateSanityApiReadToken(
|
48319
|
+
isCI2 ? "ci-remote-template-test-token-please-add-email-filter" : "API Read Token",
|
48320
|
+
variables.projectId,
|
48321
|
+
apiClient
|
48322
|
+
), envName = await isNextJsTemplate(outputPath) ? ".env.local" : ".env";
|
48318
48323
|
for (const folder of packages ?? [""]) {
|
48319
48324
|
const path2 = path$2.join(outputPath, folder);
|
48320
48325
|
await applyEnvVariables(path2, { ...variables, readToken }, envName);
|
@@ -49119,7 +49124,7 @@ export const urlFor = (source) => {
|
|
49119
49124
|
}, structure["structure."] = useTypeScript ? blogStructureTS : blogStructureJS) : (structure.schemaTypes = {
|
49120
49125
|
"index.": useTypeScript ? schemaTS : schemaJS
|
49121
49126
|
}, structure["structure."] = useTypeScript ? structureTS : structureJS), structure;
|
49122
|
-
}, isCI = process.env.CI;
|
49127
|
+
}, isCI = !!process.env.CI;
|
49123
49128
|
async function initSanity(args, context) {
|
49124
49129
|
const {
|
49125
49130
|
output,
|
@@ -49689,7 +49694,8 @@ The default dataset configuration has a public dataset named "production".`;
|
|
49689
49694
|
packageName: sluggedName,
|
49690
49695
|
repoInfo: remoteTemplateInfo,
|
49691
49696
|
bearerToken: cliFlags["template-token"],
|
49692
|
-
variables: bootstrapVariables
|
49697
|
+
variables: bootstrapVariables,
|
49698
|
+
isCI
|
49693
49699
|
},
|
49694
49700
|
context
|
49695
49701
|
) : bootstrapLocalTemplate(
|