@sandboxsonny/ace-kit 0.5.0 → 0.6.0

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/astro-integration.js +1 -1
  3. package/dist/chunk-7M26C36M.js +35 -0
  4. package/dist/cli.js +14 -1179
  5. package/dist/environment-T5K5ZJ2M.js +222 -0
  6. package/dist/main-YRQQWLHX.js +1454 -0
  7. package/dist/vite.js +1 -1
  8. package/docs/command-line.md +30 -1
  9. package/docs/getting-started.md +8 -0
  10. package/package.json +5 -2
  11. package/templates/astro/.dockerignore +7 -0
  12. package/templates/astro/.github/dependabot.yml +19 -0
  13. package/templates/astro/.github/workflows/ci.yml +23 -0
  14. package/templates/astro/.prettierignore +6 -0
  15. package/templates/astro/.prettierrc.json +20 -0
  16. package/templates/astro/.vscode/extensions.json +4 -0
  17. package/templates/astro/.vscode/launch.json +11 -0
  18. package/templates/astro/AGENTS.md +22 -0
  19. package/templates/astro/Dockerfile +17 -0
  20. package/templates/astro/_gitignore +26 -0
  21. package/templates/astro/astro.config.mjs +18 -0
  22. package/templates/astro/eslint.config.js +56 -0
  23. package/templates/astro/package.json +41 -0
  24. package/templates/astro/public/favicon.ico +0 -0
  25. package/templates/astro/public/favicon.svg +9 -0
  26. package/templates/astro/src/ace-kit.generated.d.ts +24 -0
  27. package/templates/astro/src/components/PageContent.astro +113 -0
  28. package/templates/astro/src/components/SiteFooter.astro +19 -0
  29. package/templates/astro/src/components/SiteHeader.astro +121 -0
  30. package/templates/astro/src/components/sections/Faq.astro +54 -0
  31. package/templates/astro/src/components/sections/Faq.schema.ts +17 -0
  32. package/templates/astro/src/components/sections/Gallery.astro +74 -0
  33. package/templates/astro/src/components/sections/Gallery.schema.ts +20 -0
  34. package/templates/astro/src/components/sections/Hero.astro +58 -0
  35. package/templates/astro/src/components/sections/Hero.schema.ts +14 -0
  36. package/templates/astro/src/layouts/BaseLayout.astro +36 -0
  37. package/templates/astro/src/pages/[...slug].astro +31 -0
  38. package/templates/astro/src/styles/global.css +56 -0
  39. package/templates/astro/src/types/page.d.ts +4 -0
  40. package/templates/astro/tsconfig.json +11 -0
  41. package/templates/astro/vitest.config.ts +4 -0
  42. package/templates/astro.section-types.json +109 -0
  43. package/templates/react-router/.prettierignore +5 -0
  44. package/templates/react-router/.prettierrc.json +11 -0
  45. package/templates/react-router/_gitignore +7 -0
  46. package/templates/react-router/app/ace-kit.generated.d.ts +18 -0
  47. package/templates/react-router/app/app.css +172 -0
  48. package/templates/react-router/app/components/page-content.tsx +32 -0
  49. package/templates/react-router/app/components/site-footer.tsx +9 -0
  50. package/templates/react-router/app/components/site-header.tsx +49 -0
  51. package/templates/react-router/app/entry.server.tsx +1 -0
  52. package/templates/react-router/app/root.tsx +75 -0
  53. package/templates/react-router/app/routes/page.test.tsx +64 -0
  54. package/templates/react-router/app/routes/page.tsx +22 -0
  55. package/templates/react-router/app/routes.ts +4 -0
  56. package/templates/react-router/app/types/page.d.ts +4 -0
  57. package/templates/react-router/eslint.config.js +76 -0
  58. package/templates/react-router/package.json +51 -0
  59. package/templates/react-router/public/favicon.svg +9 -0
  60. package/templates/react-router/react-router.config.ts +6 -0
  61. package/templates/react-router/tsconfig.json +22 -0
  62. package/templates/react-router/vite.config.ts +10 -0
  63. package/templates/react-router/vitest.config.ts +15 -0
  64. /package/dist/{chunk-WM5NOQE3.js → chunk-G5FGBOFT.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @sandboxsonny/ace-kit
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 6235a3b: Add `ace-kit create <folder> <domain>`: signs you in, makes the site in CMS Ace with starter content (a Pages type, Home, About and Contact, a main menu and example sections), and copies an Astro or React Router starter into the folder (`--framework`, `--name`). Needs a CMS Ace that lets a command-line login set up the site it just made.
8
+
3
9
  ## 0.5.0
4
10
 
5
11
  ### Minor Changes
@@ -1,4 +1,4 @@
1
- import { startDevSite, sectionSync } from './chunk-WM5NOQE3.js';
1
+ import { startDevSite, sectionSync } from './chunk-G5FGBOFT.js';
2
2
  import { domainFromSite, hostedAdminOrigin, hostedApiUrl } from './chunk-N5DIMG3X.js';
3
3
  import { envField } from 'astro/config';
4
4
  import { fileURLToPath } from 'url';
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/auth/login-store.ts
4
+ function normaliseApiUrl(address) {
5
+ let parsed;
6
+ try {
7
+ parsed = new URL(address.trim());
8
+ } catch {
9
+ throw new Error(`"${address}" is not a web address. Write the API address like http://localhost:8080.`);
10
+ }
11
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
12
+ throw new Error(`The API address must start with http:// or https:// (it was "${address}").`);
13
+ }
14
+ if (parsed.username || parsed.password) {
15
+ throw new Error("The API address must not contain a username or password.");
16
+ }
17
+ return `${parsed.origin}${parsed.pathname.replace(/\/+$/, "")}`;
18
+ }
19
+ function hasExpired(login, now) {
20
+ const endsAt = Date.parse(login.expiresAt);
21
+ return Number.isNaN(endsAt) || endsAt <= now;
22
+ }
23
+ function parseStoredLogin(value) {
24
+ if (typeof value !== "object" || value === null) return null;
25
+ const { token, expiresAt, email } = value;
26
+ if (typeof token !== "string" || token === "" || typeof expiresAt !== "string" || typeof email !== "string")
27
+ return null;
28
+ return { token, expiresAt, email };
29
+ }
30
+
31
+ export {
32
+ normaliseApiUrl,
33
+ hasExpired,
34
+ parseStoredLogin
35
+ };