diff --git a/src/commands/field-add-boolean.ts b/src/commands/field-add-boolean.ts
index 6f856a9..18cf5c2 100644
--- a/src/commands/field-add-boolean.ts
+++ b/src/commands/field-add-boolean.ts
@@ -4,7 +4,12 @@ import { capitalCase } from "change-case";
import { getHost, getToken } from "../auth";
import { CommandError, createCommand, type CommandConfig } from "../lib/command";
-import { resolveFieldTarget, resolveModel, TARGET_OPTIONS } from "../models";
+import {
+ getPostFieldAddMessage,
+ resolveFieldTarget,
+ resolveModel,
+ TARGET_OPTIONS,
+} from "../models";
import { getRepositoryName } from "../project";
const config = {
@@ -34,7 +39,7 @@ export default createCommand(config, async ({ positionals, values }) => {
const token = await getToken();
const host = await getHost();
- const [fields, saveModel] = await resolveModel(values, { repo, token, host });
+ const [fields, saveModel, modelKind] = await resolveModel(values, { repo, token, host });
const [targetFields, fieldId] = resolveFieldTarget(fields, id);
const field: BooleanField = {
@@ -52,4 +57,7 @@ export default createCommand(config, async ({ positionals, values }) => {
await saveModel();
console.info(`Field added: ${id}`);
+
+ const targetId = values["to-slice"] ?? values["to-type"]!;
+ console.info(getPostFieldAddMessage({ targetId, modelKind }));
});
diff --git a/src/commands/field-add-color.ts b/src/commands/field-add-color.ts
index ac0daf6..55baa7c 100644
--- a/src/commands/field-add-color.ts
+++ b/src/commands/field-add-color.ts
@@ -4,7 +4,12 @@ import { capitalCase } from "change-case";
import { getHost, getToken } from "../auth";
import { CommandError, createCommand, type CommandConfig } from "../lib/command";
-import { resolveFieldTarget, resolveModel, TARGET_OPTIONS } from "../models";
+import {
+ getPostFieldAddMessage,
+ resolveFieldTarget,
+ resolveModel,
+ TARGET_OPTIONS,
+} from "../models";
import { getRepositoryName } from "../project";
const config = {
@@ -26,7 +31,7 @@ export default createCommand(config, async ({ positionals, values }) => {
const token = await getToken();
const host = await getHost();
- const [fields, saveModel] = await resolveModel(values, { repo, token, host });
+ const [fields, saveModel, modelKind] = await resolveModel(values, { repo, token, host });
const [targetFields, fieldId] = resolveFieldTarget(fields, id);
const field: Color = {
@@ -42,4 +47,7 @@ export default createCommand(config, async ({ positionals, values }) => {
await saveModel();
console.info(`Field added: ${id}`);
+
+ const targetId = values["to-slice"] ?? values["to-type"]!;
+ console.info(getPostFieldAddMessage({ targetId, modelKind }));
});
diff --git a/src/commands/field-add-content-relationship.ts b/src/commands/field-add-content-relationship.ts
index 03fb30e..0b3e39d 100644
--- a/src/commands/field-add-content-relationship.ts
+++ b/src/commands/field-add-content-relationship.ts
@@ -5,7 +5,13 @@ import { capitalCase } from "change-case";
import { getHost, getToken } from "../auth";
import { getCustomType } from "../clients/custom-types";
import { CommandError, createCommand, type CommandConfig } from "../lib/command";
-import { resolveFieldSelection, resolveFieldTarget, resolveModel, TARGET_OPTIONS } from "../models";
+import {
+ getPostFieldAddMessage,
+ resolveFieldSelection,
+ resolveFieldTarget,
+ resolveModel,
+ TARGET_OPTIONS,
+} from "../models";
import { getRepositoryName } from "../project";
const config = {
@@ -63,7 +69,7 @@ export default createCommand(config, async ({ positionals, values }) => {
const token = await getToken();
const host = await getHost();
- const [fields, saveModel] = await resolveModel(values, { repo, token, host });
+ const [fields, saveModel, modelKind] = await resolveModel(values, { repo, token, host });
const [targetFields, fieldId] = resolveFieldTarget(fields, id);
let resolvedCustomTypes: NonNullable["customtypes"] = customtypes;
@@ -94,4 +100,7 @@ export default createCommand(config, async ({ positionals, values }) => {
await saveModel();
console.info(`Field added: ${id}`);
+
+ const targetId = values["to-slice"] ?? values["to-type"]!;
+ console.info(getPostFieldAddMessage({ targetId, modelKind }));
});
diff --git a/src/commands/field-add-date.ts b/src/commands/field-add-date.ts
index f0d3c8a..d5989ec 100644
--- a/src/commands/field-add-date.ts
+++ b/src/commands/field-add-date.ts
@@ -4,7 +4,12 @@ import { capitalCase } from "change-case";
import { getHost, getToken } from "../auth";
import { CommandError, createCommand, type CommandConfig } from "../lib/command";
-import { resolveFieldTarget, resolveModel, TARGET_OPTIONS } from "../models";
+import {
+ getPostFieldAddMessage,
+ resolveFieldTarget,
+ resolveModel,
+ TARGET_OPTIONS,
+} from "../models";
import { getRepositoryName } from "../project";
const config = {
@@ -27,7 +32,7 @@ export default createCommand(config, async ({ positionals, values }) => {
const token = await getToken();
const host = await getHost();
- const [fields, saveModel] = await resolveModel(values, { repo, token, host });
+ const [fields, saveModel, modelKind] = await resolveModel(values, { repo, token, host });
const [targetFields, fieldId] = resolveFieldTarget(fields, id);
const field: DateField = {
@@ -44,4 +49,7 @@ export default createCommand(config, async ({ positionals, values }) => {
await saveModel();
console.info(`Field added: ${id}`);
+
+ const targetId = values["to-slice"] ?? values["to-type"]!;
+ console.info(getPostFieldAddMessage({ targetId, modelKind }));
});
diff --git a/src/commands/field-add-embed.ts b/src/commands/field-add-embed.ts
index c58a249..1abda71 100644
--- a/src/commands/field-add-embed.ts
+++ b/src/commands/field-add-embed.ts
@@ -4,7 +4,12 @@ import { capitalCase } from "change-case";
import { getHost, getToken } from "../auth";
import { CommandError, createCommand, type CommandConfig } from "../lib/command";
-import { resolveFieldTarget, resolveModel, TARGET_OPTIONS } from "../models";
+import {
+ getPostFieldAddMessage,
+ resolveFieldTarget,
+ resolveModel,
+ TARGET_OPTIONS,
+} from "../models";
import { getRepositoryName } from "../project";
const config = {
@@ -26,7 +31,7 @@ export default createCommand(config, async ({ positionals, values }) => {
const token = await getToken();
const host = await getHost();
- const [fields, saveModel] = await resolveModel(values, { repo, token, host });
+ const [fields, saveModel, modelKind] = await resolveModel(values, { repo, token, host });
const [targetFields, fieldId] = resolveFieldTarget(fields, id);
const field: Embed = {
@@ -42,4 +47,7 @@ export default createCommand(config, async ({ positionals, values }) => {
await saveModel();
console.info(`Field added: ${id}`);
+
+ const targetId = values["to-slice"] ?? values["to-type"]!;
+ console.info(getPostFieldAddMessage({ targetId, modelKind }));
});
diff --git a/src/commands/field-add-geopoint.ts b/src/commands/field-add-geopoint.ts
index 07d8e76..682492f 100644
--- a/src/commands/field-add-geopoint.ts
+++ b/src/commands/field-add-geopoint.ts
@@ -4,7 +4,12 @@ import { capitalCase } from "change-case";
import { getHost, getToken } from "../auth";
import { CommandError, createCommand, type CommandConfig } from "../lib/command";
-import { resolveFieldTarget, resolveModel, TARGET_OPTIONS } from "../models";
+import {
+ getPostFieldAddMessage,
+ resolveFieldTarget,
+ resolveModel,
+ TARGET_OPTIONS,
+} from "../models";
import { getRepositoryName } from "../project";
const config = {
@@ -25,7 +30,7 @@ export default createCommand(config, async ({ positionals, values }) => {
const token = await getToken();
const host = await getHost();
- const [fields, saveModel] = await resolveModel(values, { repo, token, host });
+ const [fields, saveModel, modelKind] = await resolveModel(values, { repo, token, host });
const [targetFields, fieldId] = resolveFieldTarget(fields, id);
const field: GeoPoint = {
@@ -40,4 +45,7 @@ export default createCommand(config, async ({ positionals, values }) => {
await saveModel();
console.info(`Field added: ${id}`);
+
+ const targetId = values["to-slice"] ?? values["to-type"]!;
+ console.info(getPostFieldAddMessage({ targetId, modelKind }));
});
diff --git a/src/commands/field-add-group.ts b/src/commands/field-add-group.ts
index 6b5a0e6..1047f70 100644
--- a/src/commands/field-add-group.ts
+++ b/src/commands/field-add-group.ts
@@ -4,7 +4,12 @@ import { capitalCase } from "change-case";
import { getHost, getToken } from "../auth";
import { CommandError, createCommand, type CommandConfig } from "../lib/command";
-import { resolveFieldTarget, resolveModel, TARGET_OPTIONS } from "../models";
+import {
+ getPostFieldAddMessage,
+ resolveFieldTarget,
+ resolveModel,
+ TARGET_OPTIONS,
+} from "../models";
import { getRepositoryName } from "../project";
const config = {
@@ -25,7 +30,7 @@ export default createCommand(config, async ({ positionals, values }) => {
const token = await getToken();
const host = await getHost();
- const [fields, saveModel] = await resolveModel(values, { repo, token, host });
+ const [fields, saveModel, modelKind] = await resolveModel(values, { repo, token, host });
const [targetFields, fieldId] = resolveFieldTarget(fields, id);
const field: Group = {
@@ -40,4 +45,7 @@ export default createCommand(config, async ({ positionals, values }) => {
await saveModel();
console.info(`Field added: ${id}`);
+
+ const targetId = values["to-slice"] ?? values["to-type"]!;
+ console.info(getPostFieldAddMessage({ targetId, modelKind }));
});
diff --git a/src/commands/field-add-image.ts b/src/commands/field-add-image.ts
index ea19993..aba3011 100644
--- a/src/commands/field-add-image.ts
+++ b/src/commands/field-add-image.ts
@@ -4,7 +4,12 @@ import { capitalCase } from "change-case";
import { getHost, getToken } from "../auth";
import { CommandError, createCommand, type CommandConfig } from "../lib/command";
-import { resolveFieldTarget, resolveModel, TARGET_OPTIONS } from "../models";
+import {
+ getPostFieldAddMessage,
+ resolveFieldTarget,
+ resolveModel,
+ TARGET_OPTIONS,
+} from "../models";
import { getRepositoryName } from "../project";
const config = {
@@ -26,7 +31,7 @@ export default createCommand(config, async ({ positionals, values }) => {
const token = await getToken();
const host = await getHost();
- const [fields, saveModel] = await resolveModel(values, { repo, token, host });
+ const [fields, saveModel, modelKind] = await resolveModel(values, { repo, token, host });
const [targetFields, fieldId] = resolveFieldTarget(fields, id);
const field: Image = {
@@ -42,4 +47,7 @@ export default createCommand(config, async ({ positionals, values }) => {
await saveModel();
console.info(`Field added: ${id}`);
+
+ const targetId = values["to-slice"] ?? values["to-type"]!;
+ console.info(getPostFieldAddMessage({ targetId, modelKind }));
});
diff --git a/src/commands/field-add-integration.ts b/src/commands/field-add-integration.ts
index 5489e54..e02bb8a 100644
--- a/src/commands/field-add-integration.ts
+++ b/src/commands/field-add-integration.ts
@@ -4,7 +4,12 @@ import { capitalCase } from "change-case";
import { getHost, getToken } from "../auth";
import { CommandError, createCommand, type CommandConfig } from "../lib/command";
-import { resolveFieldTarget, resolveModel, TARGET_OPTIONS } from "../models";
+import {
+ getPostFieldAddMessage,
+ resolveFieldTarget,
+ resolveModel,
+ TARGET_OPTIONS,
+} from "../models";
import { getRepositoryName } from "../project";
const config = {
@@ -27,7 +32,7 @@ export default createCommand(config, async ({ positionals, values }) => {
const token = await getToken();
const host = await getHost();
- const [fields, saveModel] = await resolveModel(values, { repo, token, host });
+ const [fields, saveModel, modelKind] = await resolveModel(values, { repo, token, host });
const [targetFields, fieldId] = resolveFieldTarget(fields, id);
const field: IntegrationField = {
@@ -44,4 +49,7 @@ export default createCommand(config, async ({ positionals, values }) => {
await saveModel();
console.info(`Field added: ${id}`);
+
+ const targetId = values["to-slice"] ?? values["to-type"]!;
+ console.info(getPostFieldAddMessage({ targetId, modelKind }));
});
diff --git a/src/commands/field-add-link.ts b/src/commands/field-add-link.ts
index b28bb26..d27160b 100644
--- a/src/commands/field-add-link.ts
+++ b/src/commands/field-add-link.ts
@@ -4,7 +4,12 @@ import { capitalCase } from "change-case";
import { getHost, getToken } from "../auth";
import { CommandError, createCommand, type CommandConfig } from "../lib/command";
-import { resolveFieldTarget, resolveModel, TARGET_OPTIONS } from "../models";
+import {
+ getPostFieldAddMessage,
+ resolveFieldTarget,
+ resolveModel,
+ TARGET_OPTIONS,
+} from "../models";
import { getRepositoryName } from "../project";
const config = {
@@ -49,7 +54,7 @@ export default createCommand(config, async ({ positionals, values }) => {
const token = await getToken();
const host = await getHost();
- const [fields, saveModel] = await resolveModel(values, { repo, token, host });
+ const [fields, saveModel, modelKind] = await resolveModel(values, { repo, token, host });
const [targetFields, fieldId] = resolveFieldTarget(fields, id);
const field: Link = {
@@ -69,4 +74,7 @@ export default createCommand(config, async ({ positionals, values }) => {
await saveModel();
console.info(`Field added: ${id}`);
+
+ const targetId = values["to-slice"] ?? values["to-type"]!;
+ console.info(getPostFieldAddMessage({ targetId, modelKind }));
});
diff --git a/src/commands/field-add-number.ts b/src/commands/field-add-number.ts
index 68756d4..2653ca8 100644
--- a/src/commands/field-add-number.ts
+++ b/src/commands/field-add-number.ts
@@ -4,7 +4,12 @@ import { capitalCase } from "change-case";
import { getHost, getToken } from "../auth";
import { CommandError, createCommand, type CommandConfig } from "../lib/command";
-import { resolveFieldTarget, resolveModel, TARGET_OPTIONS } from "../models";
+import {
+ getPostFieldAddMessage,
+ resolveFieldTarget,
+ resolveModel,
+ TARGET_OPTIONS,
+} from "../models";
import { getRepositoryName } from "../project";
const config = {
@@ -33,7 +38,7 @@ export default createCommand(config, async ({ positionals, values }) => {
const token = await getToken();
const host = await getHost();
- const [fields, saveModel] = await resolveModel(values, { repo, token, host });
+ const [fields, saveModel, modelKind] = await resolveModel(values, { repo, token, host });
const [targetFields, fieldId] = resolveFieldTarget(fields, id);
const field: NumberField = {
@@ -52,6 +57,9 @@ export default createCommand(config, async ({ positionals, values }) => {
await saveModel();
console.info(`Field added: ${id}`);
+
+ const targetId = values["to-slice"] ?? values["to-type"]!;
+ console.info(getPostFieldAddMessage({ targetId, modelKind }));
});
function parseNumber(value: string | undefined, optionName: string): number | undefined {
diff --git a/src/commands/field-add-rich-text.ts b/src/commands/field-add-rich-text.ts
index 61d4a65..269da6f 100644
--- a/src/commands/field-add-rich-text.ts
+++ b/src/commands/field-add-rich-text.ts
@@ -4,7 +4,12 @@ import { capitalCase } from "change-case";
import { getHost, getToken } from "../auth";
import { CommandError, createCommand, type CommandConfig } from "../lib/command";
-import { resolveFieldTarget, resolveModel, TARGET_OPTIONS } from "../models";
+import {
+ getPostFieldAddMessage,
+ resolveFieldTarget,
+ resolveModel,
+ TARGET_OPTIONS,
+} from "../models";
import { getRepositoryName } from "../project";
const ALL_BLOCKS =
@@ -49,7 +54,7 @@ export default createCommand(config, async ({ positionals, values }) => {
const token = await getToken();
const host = await getHost();
- const [fields, saveModel] = await resolveModel(values, { repo, token, host });
+ const [fields, saveModel, modelKind] = await resolveModel(values, { repo, token, host });
const [targetFields, fieldId] = resolveFieldTarget(fields, id);
const field: RichText = {
@@ -67,4 +72,7 @@ export default createCommand(config, async ({ positionals, values }) => {
await saveModel();
console.info(`Field added: ${id}`);
+
+ const targetId = values["to-slice"] ?? values["to-type"]!;
+ console.info(getPostFieldAddMessage({ targetId, modelKind }));
});
diff --git a/src/commands/field-add-select.ts b/src/commands/field-add-select.ts
index 949d946..972c777 100644
--- a/src/commands/field-add-select.ts
+++ b/src/commands/field-add-select.ts
@@ -4,7 +4,12 @@ import { capitalCase } from "change-case";
import { getHost, getToken } from "../auth";
import { CommandError, createCommand, type CommandConfig } from "../lib/command";
-import { resolveFieldTarget, resolveModel, TARGET_OPTIONS } from "../models";
+import {
+ getPostFieldAddMessage,
+ resolveFieldTarget,
+ resolveModel,
+ TARGET_OPTIONS,
+} from "../models";
import { getRepositoryName } from "../project";
const config = {
@@ -38,7 +43,7 @@ export default createCommand(config, async ({ positionals, values }) => {
const token = await getToken();
const host = await getHost();
- const [fields, saveModel] = await resolveModel(values, { repo, token, host });
+ const [fields, saveModel, modelKind] = await resolveModel(values, { repo, token, host });
const [targetFields, fieldId] = resolveFieldTarget(fields, id);
const field: Select = {
@@ -56,4 +61,7 @@ export default createCommand(config, async ({ positionals, values }) => {
await saveModel();
console.info(`Field added: ${id}`);
+
+ const targetId = values["to-slice"] ?? values["to-type"]!;
+ console.info(getPostFieldAddMessage({ targetId, modelKind }));
});
diff --git a/src/commands/field-add-table.ts b/src/commands/field-add-table.ts
index 624d94b..59bd1a7 100644
--- a/src/commands/field-add-table.ts
+++ b/src/commands/field-add-table.ts
@@ -4,7 +4,12 @@ import { capitalCase } from "change-case";
import { getHost, getToken } from "../auth";
import { CommandError, createCommand, type CommandConfig } from "../lib/command";
-import { resolveFieldTarget, resolveModel, TARGET_OPTIONS } from "../models";
+import {
+ getPostFieldAddMessage,
+ resolveFieldTarget,
+ resolveModel,
+ TARGET_OPTIONS,
+} from "../models";
import { getRepositoryName } from "../project";
const config = {
@@ -25,7 +30,7 @@ export default createCommand(config, async ({ positionals, values }) => {
const token = await getToken();
const host = await getHost();
- const [fields, saveModel] = await resolveModel(values, { repo, token, host });
+ const [fields, saveModel, modelKind] = await resolveModel(values, { repo, token, host });
const [targetFields, fieldId] = resolveFieldTarget(fields, id);
const field: Table = {
@@ -40,4 +45,7 @@ export default createCommand(config, async ({ positionals, values }) => {
await saveModel();
console.info(`Field added: ${id}`);
+
+ const targetId = values["to-slice"] ?? values["to-type"]!;
+ console.info(getPostFieldAddMessage({ targetId, modelKind }));
});
diff --git a/src/commands/field-add-text.ts b/src/commands/field-add-text.ts
index 3787517..7f1f2ea 100644
--- a/src/commands/field-add-text.ts
+++ b/src/commands/field-add-text.ts
@@ -4,7 +4,12 @@ import { capitalCase } from "change-case";
import { getHost, getToken } from "../auth";
import { CommandError, createCommand, type CommandConfig } from "../lib/command";
-import { resolveFieldTarget, resolveModel, TARGET_OPTIONS } from "../models";
+import {
+ getPostFieldAddMessage,
+ resolveFieldTarget,
+ resolveModel,
+ TARGET_OPTIONS,
+} from "../models";
import { getRepositoryName } from "../project";
const config = {
@@ -26,7 +31,7 @@ export default createCommand(config, async ({ positionals, values }) => {
const token = await getToken();
const host = await getHost();
- const [fields, saveModel] = await resolveModel(values, { repo, token, host });
+ const [fields, saveModel, modelKind] = await resolveModel(values, { repo, token, host });
const [targetFields, fieldId] = resolveFieldTarget(fields, id);
const field: Text = {
@@ -42,4 +47,7 @@ export default createCommand(config, async ({ positionals, values }) => {
await saveModel();
console.info(`Field added: ${id}`);
+
+ const targetId = values["to-slice"] ?? values["to-type"]!;
+ console.info(getPostFieldAddMessage({ targetId, modelKind }));
});
diff --git a/src/commands/field-add-timestamp.ts b/src/commands/field-add-timestamp.ts
index 669dc12..0ef03a3 100644
--- a/src/commands/field-add-timestamp.ts
+++ b/src/commands/field-add-timestamp.ts
@@ -4,7 +4,12 @@ import { capitalCase } from "change-case";
import { getHost, getToken } from "../auth";
import { CommandError, createCommand, type CommandConfig } from "../lib/command";
-import { resolveFieldTarget, resolveModel, TARGET_OPTIONS } from "../models";
+import {
+ getPostFieldAddMessage,
+ resolveFieldTarget,
+ resolveModel,
+ TARGET_OPTIONS,
+} from "../models";
import { getRepositoryName } from "../project";
const config = {
@@ -27,7 +32,7 @@ export default createCommand(config, async ({ positionals, values }) => {
const token = await getToken();
const host = await getHost();
- const [fields, saveModel] = await resolveModel(values, { repo, token, host });
+ const [fields, saveModel, modelKind] = await resolveModel(values, { repo, token, host });
const [targetFields, fieldId] = resolveFieldTarget(fields, id);
const field: Timestamp = {
@@ -44,4 +49,7 @@ export default createCommand(config, async ({ positionals, values }) => {
await saveModel();
console.info(`Field added: ${id}`);
+
+ const targetId = values["to-slice"] ?? values["to-type"]!;
+ console.info(getPostFieldAddMessage({ targetId, modelKind }));
});
diff --git a/src/commands/field-add-uid.ts b/src/commands/field-add-uid.ts
index cc3bb6f..5dafbe9 100644
--- a/src/commands/field-add-uid.ts
+++ b/src/commands/field-add-uid.ts
@@ -2,7 +2,7 @@ import type { UID } from "@prismicio/types-internal/lib/customtypes";
import { getHost, getToken } from "../auth";
import { CommandError, createCommand, type CommandConfig } from "../lib/command";
-import { resolveModel } from "../models";
+import { getPostFieldAddMessage, resolveModel } from "../models";
import { getRepositoryName } from "../project";
const config = {
@@ -22,7 +22,7 @@ export default createCommand(config, async ({ values }) => {
const token = await getToken();
const host = await getHost();
- const [fields, saveModel] = await resolveModel(values, { repo, token, host });
+ const [fields, saveModel, modelKind] = await resolveModel(values, { repo, token, host });
const field: UID = {
type: "UID",
@@ -37,4 +37,7 @@ export default createCommand(config, async ({ values }) => {
await saveModel();
console.info("Field added: uid");
+
+ const targetId = values["to-type"]!;
+ console.info(getPostFieldAddMessage({ targetId, modelKind }));
});
diff --git a/src/commands/init.ts b/src/commands/init.ts
index f403af1..2057ed6 100644
--- a/src/commands/init.ts
+++ b/src/commands/init.ts
@@ -153,4 +153,6 @@ export default createCommand(config, async ({ values }) => {
await adapter.syncModels({ repo, token, host });
console.info(`\nInitialized Prismic for repository "${repo}".`);
+ console.info("Run `prismic type create ` to create a content type.");
+ console.info("Run `prismic sync` to sync models from Prismic.");
});
diff --git a/src/commands/preview-add.ts b/src/commands/preview-add.ts
index e4cf7bd..fa1f85c 100644
--- a/src/commands/preview-add.ts
+++ b/src/commands/preview-add.ts
@@ -50,4 +50,5 @@ export default createCommand(config, async ({ positionals, values }) => {
}
console.info(`Preview added: ${previewUrl}`);
+ console.info("Run `prismic preview set-simulator ` to set the slice simulator URL.");
});
diff --git a/src/commands/repo-create.ts b/src/commands/repo-create.ts
index d0ea8f8..e20e9a2 100644
--- a/src/commands/repo-create.ts
+++ b/src/commands/repo-create.ts
@@ -40,6 +40,7 @@ export default createCommand(config, async ({ values }) => {
console.info(`Repository created: ${domain}`);
console.info(`URL: https://${domain}.${host}/`);
+ console.info(`Run \`prismic init --repo ${domain}\` to initialize a project.`);
});
async function findAvailableDomain(config: {
diff --git a/src/commands/slice-create.ts b/src/commands/slice-create.ts
index c8f71a8..4405096 100644
--- a/src/commands/slice-create.ts
+++ b/src/commands/slice-create.ts
@@ -60,4 +60,6 @@ export default createCommand(config, async ({ positionals, values }) => {
await adapter.generateTypes();
console.info(`Created slice "${name}" (id: "${id}")`);
+ console.info(`Run \`prismic field add --to-slice ${id}\` to add fields.`);
+ console.info(`Run \`prismic slice connect ${id} --to \` to connect the slice to a type.`);
});
diff --git a/src/commands/token-create.ts b/src/commands/token-create.ts
index 73e25c0..2fb3728 100644
--- a/src/commands/token-create.ts
+++ b/src/commands/token-create.ts
@@ -39,10 +39,11 @@ export default createCommand(config, async ({ values }) => {
const token = await getToken();
const host = await getHost();
+ let createdToken: string;
try {
if (write) {
const writeToken = await createWriteToken(CLI_APP_NAME, { repo, token, host });
- console.info(`Token created: ${writeToken.token}`);
+ createdToken = writeToken.token;
} else {
const scope = allowReleases ? "master+releases" : "master";
@@ -52,7 +53,7 @@ export default createCommand(config, async ({ values }) => {
if (!app) app = await createOAuthApp(CLI_APP_NAME, { repo, token, host });
const accessToken = await createOAuthAuthorization(app.id, scope, { repo, token, host });
- console.info(`Token created: ${accessToken.token}`);
+ createdToken = accessToken.token;
}
} catch (error) {
if (error instanceof UnknownRequestError) {
@@ -61,4 +62,8 @@ export default createCommand(config, async ({ values }) => {
}
throw error;
}
+
+ console.info(`Token created: ${createdToken}`);
+ const envVar = write ? "PRISMIC_WRITE_TOKEN" : "PRISMIC_ACCESS_TOKEN";
+ console.info(`Add it to your .env file: ${envVar}=${createdToken}`);
});
diff --git a/src/commands/type-create.ts b/src/commands/type-create.ts
index db6f364..ef6c32c 100644
--- a/src/commands/type-create.ts
+++ b/src/commands/type-create.ts
@@ -113,4 +113,6 @@ export default createCommand(config, async ({ positionals, values }) => {
await adapter.generateTypes();
console.info(`Created type "${name}" (id: "${id}", format: "${format}")`);
+ console.info(`Run \`prismic field add --to-type ${id}\` to add fields.`);
+ console.info(`Run \`prismic type view ${id}\` to view the type.`);
});
diff --git a/src/commands/webhook-create.ts b/src/commands/webhook-create.ts
index 19c15f8..884f031 100644
--- a/src/commands/webhook-create.ts
+++ b/src/commands/webhook-create.ts
@@ -82,4 +82,5 @@ export default createCommand(config, async ({ positionals, values }) => {
}
console.info(`Webhook created: ${webhookUrl}`);
+ console.info(`Run \`prismic webhook set-triggers ${webhookUrl}\` to configure triggers.`);
});
diff --git a/src/models.ts b/src/models.ts
index e78d730..acf6cd9 100644
--- a/src/models.ts
+++ b/src/models.ts
@@ -435,3 +435,16 @@ function validateLeafField(id: string, fields: Record, context: s
);
}
}
+
+export function getPostFieldAddMessage(args: {
+ targetId: string;
+ modelKind: "slice" | "customType";
+}): string {
+ const { modelKind, targetId } = args;
+
+ if (modelKind === "slice") {
+ return `Run \`prismic slice view ${targetId}\` to view the updated slice.`;
+ } else {
+ return `Run \`prismic type view ${targetId}\` to view the updated type.`;
+ }
+}
diff --git a/test/token-create.test.ts b/test/token-create.test.ts
index 46cf18e..aa9b5c9 100644
--- a/test/token-create.test.ts
+++ b/test/token-create.test.ts
@@ -12,7 +12,8 @@ it("creates an access token", async ({ expect, prismic, repo, token, host }) =>
expect(exitCode).toBe(0);
expect(stdout).toContain("Token created:");
- const createdToken = stdout.replace("Token created:", "").trim();
+ const createdToken = stdout.match(/Token created: (.+)/)?.[1];
+ expect(createdToken).toBeDefined();
const apps = await getAccessTokens({ repo, token, host });
const app = apps.find((a) => a.name === "Prismic CLI");
@@ -32,7 +33,8 @@ it("creates an access token with --allow-releases", async ({
expect(exitCode).toBe(0);
expect(stdout).toContain("Token created:");
- const createdToken = stdout.replace("Token created:", "").trim();
+ const createdToken = stdout.match(/Token created: (.+)/)?.[1];
+ expect(createdToken).toBeDefined();
const apps = await getAccessTokens({ repo, token, host });
const app = apps.find((a) => a.name === "Prismic CLI");
@@ -47,7 +49,8 @@ it("creates a write token", async ({ expect, prismic, repo, token, host }) => {
expect(exitCode).toBe(0);
expect(stdout).toContain("Token created:");
- const createdToken = stdout.replace("Token created:", "").trim();
+ const createdToken = stdout.match(/Token created: (.+)/)?.[1];
+ expect(createdToken).toBeDefined();
const writeTokensInfo = await getWriteTokens({ repo, token, host });
const found = writeTokensInfo.tokens.find((t) => t.token === createdToken);