@sandboxsonny/ace-kit 0.7.0 → 0.7.1
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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/dist/astro-integration.js +1 -1
- package/dist/{chunk-T7DKI2U3.js → chunk-2W2NWDKV.js} +8 -6
- package/dist/cli.js +2 -2
- package/dist/{environment-J4VYOHDK.js → environment-TGMGSRJ3.js} +1 -1
- package/dist/{main-AGLPUGNN.js → main-IAQ2IL3M.js} +31 -44
- package/dist/vite.js +1 -1
- package/docs/astro.md +6 -8
- package/docs/command-line.md +2 -5
- package/docs/dev-sites.md +1 -1
- package/docs/react-router.md +4 -6
- package/docs/typed-content.md +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @sandboxsonny/ace-kit
|
|
2
2
|
|
|
3
|
+
## 0.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 98f4d58: The command line no longer shows where CMS Ace lives. `--help`, the messages and a new site's `.env.example` talk about CMS Ace, not an address, and connect to it without being told. `--api-url` and `ACE_API_URL` still work for a CMS on your own machine; they are just not advertised (see CONTRIBUTING.md).
|
|
8
|
+
|
|
3
9
|
## 0.7.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ const about = await getEntry("pages", "about");
|
|
|
58
58
|
| [API reference](docs/api-reference.md) | Every export |
|
|
59
59
|
| [Releasing](docs/releasing.md) | Versions, the changelog and publishing |
|
|
60
60
|
|
|
61
|
-
The same pages, with live examples of the React components, are in Storybook: `npm run storybook
|
|
61
|
+
The same pages, with live examples of the React components, are in Storybook: **https://sandboxsonny.github.io/ace-kit/** (or `npm run storybook` to run it yourself).
|
|
62
62
|
|
|
63
63
|
## Status
|
|
64
64
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { startDevSite, sectionSync } from './chunk-
|
|
1
|
+
import { startDevSite, sectionSync } from './chunk-2W2NWDKV.js';
|
|
2
2
|
import { domainFromSite, hostedAdminOrigin, hostedApiUrl } from './chunk-N5DIMG3X.js';
|
|
3
3
|
import { envField } from 'astro/config';
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
@@ -140,6 +140,13 @@ async function chooseLoginStore(options) {
|
|
|
140
140
|
return file;
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
+
|
|
144
|
+
// src/cli/api-url.ts
|
|
145
|
+
var cmsLabel = (apiUrl) => apiUrl === hostedApiUrl ? "CMS Ace" : apiUrl;
|
|
146
|
+
var loginCommandFor = (apiUrl) => apiUrl === hostedApiUrl ? "npx ace-kit login" : `npx ace-kit login --api-url ${apiUrl}`;
|
|
147
|
+
function isLocalApiUrl(apiUrl) {
|
|
148
|
+
return ["localhost", "127.0.0.1", "[::1]"].includes(new URL(apiUrl).hostname);
|
|
149
|
+
}
|
|
143
150
|
var runCommand = (command, commandArguments, input) => new Promise((resolve, reject) => {
|
|
144
151
|
const child = spawn(command, commandArguments, { stdio: ["pipe", "pipe", "ignore"] });
|
|
145
152
|
let stdout = "";
|
|
@@ -236,11 +243,6 @@ async function resolveLogin(options) {
|
|
|
236
243
|
return { token: stored.token, email: stored.email, source: options.store.description };
|
|
237
244
|
}
|
|
238
245
|
|
|
239
|
-
// src/cli/api-url.ts
|
|
240
|
-
function isLocalApiUrl(apiUrl) {
|
|
241
|
-
return ["localhost", "127.0.0.1", "[::1]"].includes(new URL(apiUrl).hostname);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
246
|
// src/dev-site/prepare-dev-site.ts
|
|
245
247
|
var off = ["false", "off", "no", "0"];
|
|
246
248
|
var on = ["true", "on", "yes", "1"];
|
|
@@ -305,7 +307,7 @@ async function startDevSite(options) {
|
|
|
305
307
|
return null;
|
|
306
308
|
case "waiting-for-login":
|
|
307
309
|
log.warn(
|
|
308
|
-
`You are not signed in to ${outcome.apiUrl}, so this is showing the live site and section sync is off. Run:
|
|
310
|
+
`You are not signed in to ${cmsLabel(outcome.apiUrl)}, so this is showing the live site and section sync is off. Run: ${loginCommandFor(outcome.apiUrl)}`
|
|
309
311
|
);
|
|
310
312
|
return null;
|
|
311
313
|
case "problem":
|
package/dist/cli.js
CHANGED
|
@@ -9,8 +9,8 @@ if (major < 22 || major === 22 && minor < 12) {
|
|
|
9
9
|
process.exit(1);
|
|
10
10
|
}
|
|
11
11
|
try {
|
|
12
|
-
const { createRealEnvironment } = await import("./environment-
|
|
13
|
-
const { runCli } = await import("./main-
|
|
12
|
+
const { createRealEnvironment } = await import("./environment-TGMGSRJ3.js");
|
|
13
|
+
const { runCli } = await import("./main-IAQ2IL3M.js");
|
|
14
14
|
const environment = await createRealEnvironment();
|
|
15
15
|
process.exit(await runCli(process.argv.slice(2), environment));
|
|
16
16
|
} catch (error) {
|
|
@@ -145,7 +145,7 @@ function createLastApiUrl(path) {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
// src/cli/version.ts
|
|
148
|
-
var aceKitVersion = true ? "0.7.
|
|
148
|
+
var aceKitVersion = true ? "0.7.1" : "development";
|
|
149
149
|
|
|
150
150
|
// src/cli/environment.ts
|
|
151
151
|
var runCommand = (command, commandArguments, input) => new Promise((resolve, reject) => {
|
|
@@ -126,12 +126,6 @@ async function createSite(options) {
|
|
|
126
126
|
text = replaceOnce(file, text, /site: "https?:\/\/[^"]+"/, `site: "https://${domain}"`);
|
|
127
127
|
if (text !== original) await writeFile(path, text);
|
|
128
128
|
}
|
|
129
|
-
const settings = [
|
|
130
|
-
"# Where CMS Ace runs. Leave these out for the hosted CMS Ace; they are for a CMS on your own machine.",
|
|
131
|
-
"# ACE_API_URL=http://localhost:8080",
|
|
132
|
-
"# ACE_PREVIEW_ADMIN_ORIGIN=http://localhost:5173",
|
|
133
|
-
""
|
|
134
|
-
];
|
|
135
129
|
const extraSettings = Object.entries(options.environmentSettings ?? {}).map(([name2, value]) => `${name2}=${value}`);
|
|
136
130
|
if (options.framework === "astro") {
|
|
137
131
|
await writeNew(
|
|
@@ -140,8 +134,7 @@ async function createSite(options) {
|
|
|
140
134
|
[
|
|
141
135
|
"# The site's domain in CMS Ace is the `site` setting in astro.config.mjs. Set this only to override it.",
|
|
142
136
|
"# ACE_SITE_DOMAIN=" + domain,
|
|
143
|
-
""
|
|
144
|
-
...settings
|
|
137
|
+
""
|
|
145
138
|
].join("\n")
|
|
146
139
|
);
|
|
147
140
|
if (extraSettings.length > 0) await writeNew(folder, ".env", `${extraSettings.join("\n")}
|
|
@@ -149,7 +142,7 @@ async function createSite(options) {
|
|
|
149
142
|
} else {
|
|
150
143
|
const domainLine = `ACE_SITE_DOMAIN=${domain}
|
|
151
144
|
`;
|
|
152
|
-
await writeNew(folder, ".env.example", [`# The site's domain in CMS Ace.`, domainLine
|
|
145
|
+
await writeNew(folder, ".env.example", [`# The site's domain in CMS Ace.`, domainLine].join("\n"));
|
|
153
146
|
await writeNew(folder, ".env", [domainLine.trim(), ...extraSettings].join("\n") + "\n");
|
|
154
147
|
}
|
|
155
148
|
await writeNew(folder, "README.md", readme({ name, domain, framework: options.framework }));
|
|
@@ -396,6 +389,9 @@ async function resolveApiUrl(fromOption, environment) {
|
|
|
396
389
|
return null;
|
|
397
390
|
}
|
|
398
391
|
}
|
|
392
|
+
var cmsName = (apiUrl) => apiUrl === hostedApiUrl ? "CMS Ace" : `the CMS at ${apiUrl}`;
|
|
393
|
+
var cmsLabel = (apiUrl) => apiUrl === hostedApiUrl ? "CMS Ace" : apiUrl;
|
|
394
|
+
var loginCommandFor = (apiUrl) => apiUrl === hostedApiUrl ? "npx ace-kit login" : `npx ace-kit login --api-url ${apiUrl}`;
|
|
399
395
|
function isLocalApiUrl(apiUrl) {
|
|
400
396
|
return ["localhost", "127.0.0.1", "[::1]"].includes(new URL(apiUrl).hostname);
|
|
401
397
|
}
|
|
@@ -525,13 +521,12 @@ async function waitForApproval(dependencies) {
|
|
|
525
521
|
var loginUsage = `ace-kit login: sign in to CMS Ace from the command line.
|
|
526
522
|
|
|
527
523
|
Usage:
|
|
528
|
-
ace-kit login
|
|
529
|
-
ace-kit logout
|
|
530
|
-
ace-kit whoami
|
|
524
|
+
ace-kit login Sign in. Opens the admin app, where you type the code shown here.
|
|
525
|
+
ace-kit logout Sign out, and forget the login kept on this machine.
|
|
526
|
+
ace-kit whoami Say who you are signed in as.
|
|
531
527
|
|
|
532
528
|
Options:
|
|
533
|
-
--
|
|
534
|
-
--help Show this message.
|
|
529
|
+
--help Show this message.
|
|
535
530
|
|
|
536
531
|
The login is kept in the macOS Keychain, or in a file only you can read on other systems. On a build server,
|
|
537
532
|
where nobody can approve a login in a browser, set ACE_TOKEN instead.
|
|
@@ -565,7 +560,7 @@ async function loginCommand(commandArguments, environment) {
|
|
|
565
560
|
const { apiUrl } = read;
|
|
566
561
|
if (apiUrl.startsWith("http://") && !isLocalApiUrl(apiUrl)) {
|
|
567
562
|
environment.error(
|
|
568
|
-
`Warning: ${apiUrl} is not encrypted (http://), so the login could be read on the way. Use https:// if you can.`
|
|
563
|
+
`Warning: ${cmsName(apiUrl)} is not encrypted (http://), so the login could be read on the way. Use https:// if you can.`
|
|
569
564
|
);
|
|
570
565
|
}
|
|
571
566
|
try {
|
|
@@ -589,7 +584,7 @@ async function signIn(apiUrl, environment) {
|
|
|
589
584
|
"unsupported",
|
|
590
585
|
"The CMS sent an approval address that isn't a web address, so it was not opened."
|
|
591
586
|
);
|
|
592
|
-
environment.out(`Signing in to ${apiUrl}
|
|
587
|
+
environment.out(`Signing in to ${cmsLabel(apiUrl)}
|
|
593
588
|
`);
|
|
594
589
|
environment.out(` 1. Go to ${page}`);
|
|
595
590
|
environment.out(` 2. Type ${request.userCode}
|
|
@@ -619,7 +614,7 @@ async function logoutCommand(commandArguments, environment) {
|
|
|
619
614
|
const { apiUrl } = read;
|
|
620
615
|
const stored = await environment.store.read(apiUrl);
|
|
621
616
|
if (!stored) {
|
|
622
|
-
environment.out(`Not signed in to ${apiUrl}.`);
|
|
617
|
+
environment.out(`Not signed in to ${cmsLabel(apiUrl)}.`);
|
|
623
618
|
return 0;
|
|
624
619
|
}
|
|
625
620
|
const ended = await environment.fetchImplementation(`${apiUrl}/auth/logout`, {
|
|
@@ -632,7 +627,7 @@ async function logoutCommand(commandArguments, environment) {
|
|
|
632
627
|
);
|
|
633
628
|
await environment.store.remove(apiUrl);
|
|
634
629
|
environment.out(
|
|
635
|
-
ended ? `Signed out of ${apiUrl}.` : `Forgot the login for ${apiUrl} on this machine, but could not reach the CMS to end it there. It ends by itself after 30 days unused; a super admin can also end it from the Sessions screen.`
|
|
630
|
+
ended ? `Signed out of ${cmsLabel(apiUrl)}.` : `Forgot the login for ${cmsLabel(apiUrl)} on this machine, but could not reach the CMS to end it there. It ends by itself after 30 days unused; a super admin can also end it from the Sessions screen.`
|
|
636
631
|
);
|
|
637
632
|
return 0;
|
|
638
633
|
}
|
|
@@ -651,7 +646,7 @@ async function whoamiCommand(commandArguments, environment) {
|
|
|
651
646
|
now: environment.now
|
|
652
647
|
});
|
|
653
648
|
if (!login) {
|
|
654
|
-
environment.out(`Not signed in to ${apiUrl}. Run:
|
|
649
|
+
environment.out(`Not signed in to ${cmsLabel(apiUrl)}. Run: ${loginCommandFor(apiUrl).replace("npx ", "")}`);
|
|
655
650
|
return 1;
|
|
656
651
|
}
|
|
657
652
|
try {
|
|
@@ -668,10 +663,10 @@ async function whoamiCommand(commandArguments, environment) {
|
|
|
668
663
|
return 1;
|
|
669
664
|
}
|
|
670
665
|
const me = await response.json();
|
|
671
|
-
environment.out(`Signed in to ${apiUrl} as ${String(me.email)}, using the login in ${login.source}.`);
|
|
666
|
+
environment.out(`Signed in to ${cmsLabel(apiUrl)} as ${String(me.email)}, using the login in ${login.source}.`);
|
|
672
667
|
return 0;
|
|
673
668
|
} catch {
|
|
674
|
-
environment.error(`Could not reach
|
|
669
|
+
environment.error(`Could not reach ${cmsName(apiUrl)}.`);
|
|
675
670
|
return 1;
|
|
676
671
|
}
|
|
677
672
|
}
|
|
@@ -680,7 +675,7 @@ async function whoamiCommand(commandArguments, environment) {
|
|
|
680
675
|
var createUsage = `ace-kit create: make a new site that uses CMS Ace.
|
|
681
676
|
|
|
682
677
|
Usage:
|
|
683
|
-
ace-kit create <folder> <domain> [--framework astro|react-router] [--name <name>]
|
|
678
|
+
ace-kit create <folder> <domain> [--framework astro|react-router] [--name <name>]
|
|
684
679
|
|
|
685
680
|
It signs you in if you aren't already (your browser opens to approve it), makes the site in CMS Ace with starter
|
|
686
681
|
content (a Pages type, Home, About and Contact, a main menu), and copies a starter site into the folder with your
|
|
@@ -691,7 +686,6 @@ Options:
|
|
|
691
686
|
<domain> The domain the site has in CMS Ace, e.g. example.com. (--site <domain> means the same.)
|
|
692
687
|
--framework astro (the default) or react-router.
|
|
693
688
|
--name The name shown to visitors (default: made from the folder's name, so my-site is "My Site").
|
|
694
|
-
--api-url Where the CMS Ace API lives (or set ACE_API_URL). Only for a CMS on your own machine.
|
|
695
689
|
--help Show this message.
|
|
696
690
|
`;
|
|
697
691
|
async function createCommand(commandArguments, environment) {
|
|
@@ -742,7 +736,7 @@ ${createUsage}`);
|
|
|
742
736
|
}
|
|
743
737
|
if (apiUrl.startsWith("http://") && !isLocalApiUrl(apiUrl)) {
|
|
744
738
|
environment.error(
|
|
745
|
-
`Warning: ${apiUrl} is not encrypted (http://), so your login could be read on the way. Use https:// if you can.`
|
|
739
|
+
`Warning: ${cmsName(apiUrl)} is not encrypted (http://), so your login could be read on the way. Use https:// if you can.`
|
|
746
740
|
);
|
|
747
741
|
}
|
|
748
742
|
let login = await resolveLogin({
|
|
@@ -797,7 +791,7 @@ Nothing was made.`);
|
|
|
797
791
|
switch (seeded.kind) {
|
|
798
792
|
case "seeded":
|
|
799
793
|
environment.out(
|
|
800
|
-
`Made ${created.domain} in CMS Ace (${apiUrl}) with a Pages type, ${seeded.entries} entries and a main menu.`
|
|
794
|
+
`Made ${created.domain} in ${apiUrl === hostedApiUrl ? "CMS Ace" : `CMS Ace (${apiUrl})`} with a Pages type, ${seeded.entries} entries and a main menu.`
|
|
801
795
|
);
|
|
802
796
|
break;
|
|
803
797
|
case "exists":
|
|
@@ -1014,7 +1008,7 @@ async function loadSchemas(files, root, importModule) {
|
|
|
1014
1008
|
var doctorUsage = `ace-kit doctor: check that this site is set up to work with CMS Ace.
|
|
1015
1009
|
|
|
1016
1010
|
Usage:
|
|
1017
|
-
ace-kit doctor [--site <domain>] [--
|
|
1011
|
+
ace-kit doctor [--site <domain>] [--dir <folder>]
|
|
1018
1012
|
|
|
1019
1013
|
Run it in your site's folder. It changes nothing and never prints your login. It checks your Node version, that Ace Kit
|
|
1020
1014
|
is installed, which CMS and site the settings point at, that the CMS can be reached and knows the site, that you are
|
|
@@ -1023,7 +1017,6 @@ says what to do. It exits with 1 if anything is wrong.
|
|
|
1023
1017
|
|
|
1024
1018
|
Options:
|
|
1025
1019
|
--site The domain your site has in the CMS (default: ACE_SITE_DOMAIN, else Astro's \`site\` setting).
|
|
1026
|
-
--api-url Where the CMS Ace API lives (default: ACE_API_URL, else the hosted CMS Ace).
|
|
1027
1020
|
--dir The folder holding your *.schema.ts files (default: src and app).
|
|
1028
1021
|
--help Show this message.
|
|
1029
1022
|
`;
|
|
@@ -1111,7 +1104,7 @@ async function doctorCommand(commandArguments, environment) {
|
|
|
1111
1104
|
let apiUrl = null;
|
|
1112
1105
|
try {
|
|
1113
1106
|
apiUrl = normaliseApiUrl(values["api-url"] ?? environment.variables.ACE_API_URL ?? hostedApiUrl);
|
|
1114
|
-
add("ok",
|
|
1107
|
+
add("ok", apiUrl === hostedApiUrl ? "Connected to CMS Ace" : `CMS: ${apiUrl}`);
|
|
1115
1108
|
} catch (error) {
|
|
1116
1109
|
add("fail", `The CMS address is wrong: ${error instanceof Error ? error.message : String(error)}`);
|
|
1117
1110
|
}
|
|
@@ -1147,7 +1140,7 @@ async function doctorCommand(commandArguments, environment) {
|
|
|
1147
1140
|
);
|
|
1148
1141
|
return;
|
|
1149
1142
|
}
|
|
1150
|
-
add("ok", "
|
|
1143
|
+
add("ok", "CMS Ace answers");
|
|
1151
1144
|
if (!siteDomain) return;
|
|
1152
1145
|
const asSite = { "X-Ace-Site-Domain": siteDomain };
|
|
1153
1146
|
const site = await request("/public/site", asSite);
|
|
@@ -1195,11 +1188,7 @@ async function doctorCommand(commandArguments, environment) {
|
|
|
1195
1188
|
now: environment.now
|
|
1196
1189
|
});
|
|
1197
1190
|
if (!login) {
|
|
1198
|
-
add(
|
|
1199
|
-
"warn",
|
|
1200
|
-
"Not signed in",
|
|
1201
|
-
`Run: npx ace-kit login${isLocalApiUrl(address) ? ` --api-url ${address}` : ""}. Section sync and dev sites need it.`
|
|
1202
|
-
);
|
|
1191
|
+
add("warn", "Not signed in", `Run: ${loginCommandFor(address)}. Section sync and dev sites need it.`);
|
|
1203
1192
|
return;
|
|
1204
1193
|
}
|
|
1205
1194
|
const authorised = { Authorization: `Bearer ${login.token}` };
|
|
@@ -1442,11 +1431,10 @@ export {};
|
|
|
1442
1431
|
var generateUsage = `ace-kit generate: write TypeScript types for your CMS Ace content types.
|
|
1443
1432
|
|
|
1444
1433
|
Usage:
|
|
1445
|
-
ace-kit generate [--site <domain>] [--
|
|
1434
|
+
ace-kit generate [--site <domain>] [--out <file>]
|
|
1446
1435
|
|
|
1447
1436
|
Options:
|
|
1448
1437
|
--site The domain your site has in the CMS, e.g. example.com (or set ACE_SITE_DOMAIN). --domain means the same.
|
|
1449
|
-
--api-url Where the CMS Ace API lives (or set ACE_API_URL). Only for a CMS on your own machine.
|
|
1450
1438
|
--out Where to write the types (default: src/ace-kit.generated.d.ts).
|
|
1451
1439
|
--help Show this message.
|
|
1452
1440
|
`;
|
|
@@ -1565,7 +1553,7 @@ async function syncSectionTypes(options) {
|
|
|
1565
1553
|
var syncUsage = `ace-kit sync: send the section types your code defines to CMS Ace.
|
|
1566
1554
|
|
|
1567
1555
|
Usage:
|
|
1568
|
-
ace-kit sync [--site <domain>] [--
|
|
1556
|
+
ace-kit sync [--site <domain>] [--dir <folder>]
|
|
1569
1557
|
|
|
1570
1558
|
It finds every *.schema.ts file in the folder (src and app by default), checks them, and makes the CMS's section types for your
|
|
1571
1559
|
site match. The dev server does this for you whenever a schema file is saved; run it yourself for a one-off sync, or on a
|
|
@@ -1575,9 +1563,8 @@ Nothing is deleted: a section type, block or field you take out of your code is
|
|
|
1575
1563
|
written in it survives. If any schema file can't be loaded, nothing is synced.
|
|
1576
1564
|
|
|
1577
1565
|
Options:
|
|
1578
|
-
--site The domain your site has in the CMS, e.g. example.com (
|
|
1566
|
+
--site The domain your site has in the CMS, e.g. example.com (or set ACE_SITE_DOMAIN).
|
|
1579
1567
|
(--domain means the same.)
|
|
1580
|
-
--api-url Where the CMS Ace API lives (default: ACE_API_URL, else the hosted CMS Ace). Only for a CMS on your own machine.
|
|
1581
1568
|
--dir The folder to look in (default: src and app).
|
|
1582
1569
|
--help Show this message.
|
|
1583
1570
|
`;
|
|
@@ -1635,7 +1622,7 @@ async function syncCommand(commandArguments, environment) {
|
|
|
1635
1622
|
now: environment.now
|
|
1636
1623
|
});
|
|
1637
1624
|
if (!login) {
|
|
1638
|
-
environment.out(`Section sync is waiting for you to sign in. Run:
|
|
1625
|
+
environment.out(`Section sync is waiting for you to sign in. Run: ${loginCommandFor(apiUrl)}`);
|
|
1639
1626
|
return automatic ? 0 : 1;
|
|
1640
1627
|
}
|
|
1641
1628
|
const loaded = await loadSchemas(files, environment.workingDirectory, environment.importModule);
|
|
@@ -1656,17 +1643,17 @@ async function syncCommand(commandArguments, environment) {
|
|
|
1656
1643
|
const defined = outcome.sections.filter((section) => !section.retired).map((section) => section.handle);
|
|
1657
1644
|
const retired = outcome.sections.filter((section) => section.retired).map((section) => section.handle);
|
|
1658
1645
|
environment.out(
|
|
1659
|
-
`Synced ${defined.length} section type${defined.length === 1 ? "" : "s"} (${defined.join(", ")}) to ${outcome.site.domain} (${apiUrl}).` + (retired.length > 0 ? ` No longer in your code, kept but hidden: ${retired.join(", ")}.` : "")
|
|
1646
|
+
`Synced ${defined.length} section type${defined.length === 1 ? "" : "s"} (${defined.join(", ")}) to ${outcome.site.domain}${apiUrl === hostedApiUrl ? "" : ` (${apiUrl})`}.` + (retired.length > 0 ? ` No longer in your code, kept but hidden: ${retired.join(", ")}.` : "")
|
|
1660
1647
|
);
|
|
1661
1648
|
for (const warning of outcome.warnings) environment.error(`Warning: ${warning}`);
|
|
1662
1649
|
return 0;
|
|
1663
1650
|
}
|
|
1664
1651
|
case "login-ended":
|
|
1665
|
-
environment.out(`Your login has ended. Run:
|
|
1652
|
+
environment.out(`Your login has ended. Run: ${loginCommandFor(apiUrl)}`);
|
|
1666
1653
|
return automatic ? 0 : 1;
|
|
1667
1654
|
case "site-not-found":
|
|
1668
1655
|
environment.error(
|
|
1669
|
-
|
|
1656
|
+
`${cmsName(apiUrl)} has no site with the domain "${outcome.domain}" that you can see` + (outcome.available.length > 0 ? ` (your sites: ${outcome.available.join(", ")})` : "") + ". Set ACE_SITE_DOMAIN or pass --site."
|
|
1670
1657
|
);
|
|
1671
1658
|
return 1;
|
|
1672
1659
|
case "forbidden":
|
|
@@ -1674,7 +1661,7 @@ async function syncCommand(commandArguments, environment) {
|
|
|
1674
1661
|
environment.error(outcome.message);
|
|
1675
1662
|
return 1;
|
|
1676
1663
|
case "unreachable":
|
|
1677
|
-
environment.error(`Could not reach
|
|
1664
|
+
environment.error(`Could not reach ${cmsName(apiUrl)}.`);
|
|
1678
1665
|
return 1;
|
|
1679
1666
|
}
|
|
1680
1667
|
}
|
package/dist/vite.js
CHANGED
package/docs/astro.md
CHANGED
|
@@ -15,21 +15,19 @@ export default defineConfig({
|
|
|
15
15
|
});
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
The integration declares
|
|
18
|
+
The integration declares the site's settings, adds the middleware that lets the CMS's admin app (and only it) frame the site for [live preview](./live-preview.md), and makes Vite process the kit. The settings are read when the server starts, not baked into the build, so one build runs anywhere:
|
|
19
19
|
|
|
20
|
-
| Setting
|
|
21
|
-
|
|
|
22
|
-
| `
|
|
23
|
-
| `ACE_SITE_DOMAIN` | the host of Astro's `site` setting, else `localhost` | the domain this site has in the CMS (the port is ignored) |
|
|
24
|
-
| `ACE_PREVIEW_ADMIN_ORIGIN` | `https://app.ace-cms.co.uk` | where the CMS admin app runs |
|
|
20
|
+
| Setting | Default | Meaning |
|
|
21
|
+
| ----------------- | ---------------------------------------------------- | --------------------------------------------------------- |
|
|
22
|
+
| `ACE_SITE_DOMAIN` | the host of Astro's `site` setting, else `localhost` | the domain this site has in the CMS (the port is ignored) |
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
A site connects to CMS Ace by itself and only needs to say which site it is, which it does with Astro's own `site` setting, which Astro needs for canonical addresses anyway:
|
|
27
25
|
|
|
28
26
|
```js
|
|
29
27
|
export default defineConfig({ site: "https://www.example.com", integrations: [ace()] });
|
|
30
28
|
```
|
|
31
29
|
|
|
32
|
-
To try a site without editing the config, `npm run dev -- --site https://www.example.com` does the same. `ACE_SITE_DOMAIN`, when set, wins.
|
|
30
|
+
To try a site without editing the config, `npm run dev -- --site https://www.example.com` does the same. `ACE_SITE_DOMAIN`, when set, wins.
|
|
33
31
|
|
|
34
32
|
## Pages
|
|
35
33
|
|
package/docs/command-line.md
CHANGED
|
@@ -12,7 +12,7 @@ npx ace-kit generate # write TypeScript types (see Typed content)
|
|
|
12
12
|
npx ace-kit sync # send your section types to the CMS (see Sections)
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
Commands
|
|
15
|
+
Commands connect to CMS Ace for you, so `ace-kit login` and `ace-kit whoami` need no flags at all. Commands about a site (`sync`, `generate`, `doctor`) take `--site example.com`, or read `ACE_SITE_DOMAIN`.
|
|
16
16
|
|
|
17
17
|
## Making a site
|
|
18
18
|
|
|
@@ -36,9 +36,6 @@ Your account must be a **partner or super admin** (only they can make sites). Th
|
|
|
36
36
|
| `<domain>` (or `--site <domain>`) | The domain the site has in CMS Ace. Required. |
|
|
37
37
|
| `--framework astro\|react-router` | `astro` (the default) or `react-router`. Both have the same three example sections. |
|
|
38
38
|
| `--name <name>` | The name shown to visitors. Default: made from the folder, so `my-site` is "My Site". |
|
|
39
|
-
| `--api-url <address>` | Only for a CMS on your own machine (or set `ACE_API_URL`). |
|
|
40
|
-
|
|
41
|
-
Against a CMS on your own machine (`--api-url` or `ACE_API_URL` set to `http://localhost:8080`), it also writes a `.env` in the new folder with `ACE_API_URL` and `ACE_PREVIEW_ADMIN_ORIGIN=http://localhost:5173`, and sets the site's Preview address to the local dev server (`http://localhost:4321`, or 4322 for React Router), so the site and live preview work with no more setup. Against the hosted CMS Ace none of that is needed.
|
|
42
39
|
|
|
43
40
|
The folder must not exist yet (or must be empty). The starter is a small server-rendered site with a header, footer, rich text, live preview and Prettier, ESLint, tests and a CI workflow. When it finishes: `cd my-site`, `npm install`, `npm run dev`.
|
|
44
41
|
|
|
@@ -64,7 +61,7 @@ Run it in your site's folder when something isn't working. It changes nothing, n
|
|
|
64
61
|
✓ The CMS has all of them
|
|
65
62
|
```
|
|
66
63
|
|
|
67
|
-
It checks your Node version, that Ace Kit is installed, which CMS and site your settings point at, that the CMS can be reached and knows the site, that the site has its Pages content, that you are signed in, the site's preview address, and that the section types in your code match the CMS. `✗` is a problem (the command exits with 1), `!` is a warning, `-` is a note. It takes `--site
|
|
64
|
+
It checks your Node version, that Ace Kit is installed, which CMS and site your settings point at, that the CMS can be reached and knows the site, that the site has its Pages content, that you are signed in, the site's preview address, and that the section types in your code match the CMS. `✗` is a problem (the command exits with 1), `!` is a warning, `-` is a note. It takes `--site` and `--dir` like `sync`.
|
|
68
65
|
|
|
69
66
|
## Signing in
|
|
70
67
|
|
package/docs/dev-sites.md
CHANGED
|
@@ -34,7 +34,7 @@ A dev site is never merged into the live site. When your change is ready, deploy
|
|
|
34
34
|
|
|
35
35
|
## If something stops it
|
|
36
36
|
|
|
37
|
-
The dev server says so once, and carries on showing the **live site**, read-only, with section sync off: you aren't signed in (run `npx ace-kit login
|
|
37
|
+
The dev server says so once, and carries on showing the **live site**, read-only, with section sync off: you aren't signed in (run `npx ace-kit login`), your account can't have a dev site, the site isn't one you can see, or the CMS can't be reached.
|
|
38
38
|
|
|
39
39
|
## Housekeeping
|
|
40
40
|
|
package/docs/react-router.md
CHANGED
|
@@ -26,13 +26,11 @@ export default defineConfig({ plugins: [ace(), reactRouter()] });
|
|
|
26
26
|
|
|
27
27
|
The settings are environment variables, read when the server starts, so one build runs anywhere. Put them in `.env` for development and in the host's environment for production:
|
|
28
28
|
|
|
29
|
-
| Variable
|
|
30
|
-
|
|
|
31
|
-
| `
|
|
32
|
-
| `ACE_SITE_DOMAIN` | `localhost` | the domain this site has in the CMS (the port is ignored) |
|
|
33
|
-
| `ACE_PREVIEW_ADMIN_ORIGIN` | `https://app.ace-cms.co.uk` | where the CMS admin app runs |
|
|
29
|
+
| Variable | Default | Meaning |
|
|
30
|
+
| ----------------- | ----------- | --------------------------------------------------------- |
|
|
31
|
+
| `ACE_SITE_DOMAIN` | `localhost` | the domain this site has in the CMS (the port is ignored) |
|
|
34
32
|
|
|
35
|
-
|
|
33
|
+
A site connects to CMS Ace by itself and only needs to say which site it is, with `ACE_SITE_DOMAIN`.
|
|
36
34
|
|
|
37
35
|
**2. The server entry**, which renders pages and lets the CMS's admin app (and only it) frame the site for [live preview](./live-preview.md):
|
|
38
36
|
|
package/docs/typed-content.md
CHANGED
|
@@ -12,7 +12,7 @@ or with the settings in the environment:
|
|
|
12
12
|
ACE_SITE_DOMAIN=www.example.com npx ace-kit generate
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
It reads `GET /public/content-types` (no login: it describes field names and kinds, never entries) and writes `src/ace-kit.generated.d.ts` (change it with `--out`). Make sure the file is inside your `tsconfig` `include`. Commit it, and run the command again whenever content types change (a good moment is a CI step, or a `generate` script next to `dev`).
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
18
|
// ace-kit.generated.d.ts (generated)
|
package/package.json
CHANGED