Fix scope
This commit is contained in:
@@ -37,7 +37,7 @@ export default defineConfig({
|
||||
```javascript
|
||||
import cloudflare from "@astrojs/cloudflare";
|
||||
import react from "@astrojs/react";
|
||||
import { d1, r2 } from "@emdashcms/cloudflare";
|
||||
import { d1, r2 } from "@emdash-cms/cloudflare";
|
||||
import { defineConfig } from "astro/config";
|
||||
import emdash from "emdash/astro";
|
||||
|
||||
@@ -88,7 +88,7 @@ Requires a `wrangler.jsonc` with D1 and R2 bindings:
|
||||
Register plugins in `astro.config.mjs`:
|
||||
|
||||
```javascript
|
||||
import { auditLogPlugin } from "@emdashcms/plugin-audit-log";
|
||||
import { auditLogPlugin } from "@emdash-cms/plugin-audit-log";
|
||||
|
||||
emdash({
|
||||
database: sqlite({ url: "file:./data.db" }),
|
||||
@@ -181,7 +181,7 @@ Key dependencies for a Node.js site:
|
||||
}
|
||||
```
|
||||
|
||||
For Cloudflare, replace `@astrojs/node` with `@astrojs/cloudflare` and add `@emdashcms/cloudflare`.
|
||||
For Cloudflare, replace `@astrojs/node` with `@astrojs/cloudflare` and add `@emdash-cms/cloudflare`.
|
||||
|
||||
## Dev Server
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ React components. Use `usePluginAPI()` to call plugin routes.
|
||||
```typescript
|
||||
// src/components/SettingsPage.tsx
|
||||
import { useState, useEffect } from "react";
|
||||
import { usePluginAPI } from "@emdashcms/admin";
|
||||
import { usePluginAPI } from "@emdash-cms/admin";
|
||||
|
||||
export function SettingsPage() {
|
||||
const api = usePluginAPI();
|
||||
@@ -94,7 +94,7 @@ Dashboard cards with at-a-glance info.
|
||||
```typescript
|
||||
// src/components/StatusWidget.tsx
|
||||
import { useState, useEffect } from "react";
|
||||
import { usePluginAPI } from "@emdashcms/admin";
|
||||
import { usePluginAPI } from "@emdash-cms/admin";
|
||||
|
||||
export function StatusWidget() {
|
||||
const api = usePluginAPI();
|
||||
@@ -134,10 +134,10 @@ const result = await api.get("history?limit=50"); // Query params
|
||||
|
||||
## Admin Components
|
||||
|
||||
Pre-built components from `@emdashcms/admin`:
|
||||
Pre-built components from `@emdash-cms/admin`:
|
||||
|
||||
```typescript
|
||||
import { Card, Button, Input, Select, Toggle, Table, Loading, Alert } from "@emdashcms/admin";
|
||||
import { Card, Button, Input, Select, Toggle, Table, Loading, Alert } from "@emdash-cms/admin";
|
||||
```
|
||||
|
||||
## Auto-Generated Settings
|
||||
@@ -166,11 +166,11 @@ export default {
|
||||
},
|
||||
format: "esm",
|
||||
dts: true,
|
||||
external: ["react", "react-dom", "emdash", "@emdashcms/admin"],
|
||||
external: ["react", "react-dom", "emdash", "@emdash-cms/admin"],
|
||||
};
|
||||
```
|
||||
|
||||
Keep React and `@emdashcms/admin` as externals to avoid bundling duplicates.
|
||||
Keep React and `@emdash-cms/admin` as externals to avoid bundling duplicates.
|
||||
|
||||
## Plugin Descriptor
|
||||
|
||||
|
||||
@@ -245,7 +245,7 @@ definePlugin({
|
||||
## Calling from Admin UI
|
||||
|
||||
```typescript
|
||||
import { usePluginAPI } from "@emdashcms/admin";
|
||||
import { usePluginAPI } from "@emdash-cms/admin";
|
||||
|
||||
const api = usePluginAPI();
|
||||
const data = await api.get("status");
|
||||
|
||||
@@ -329,10 +329,10 @@ Show/hide fields based on other field values. Evaluated client-side, no round-tr
|
||||
|
||||
## Builder Helpers
|
||||
|
||||
`@emdashcms/blocks` provides TypeScript helpers:
|
||||
`@emdash-cms/blocks` provides TypeScript helpers:
|
||||
|
||||
```typescript
|
||||
import { blocks, elements } from "@emdashcms/blocks";
|
||||
import { blocks, elements } from "@emdash-cms/blocks";
|
||||
|
||||
const { header, form, section, stats, timeseriesChart, customChart, banner: bannerBlock } = blocks;
|
||||
const { textInput, toggle, select, button } = elements;
|
||||
|
||||
@@ -31,7 +31,7 @@ The bundle command uses `package.json` exports to find entrypoints:
|
||||
|
||||
| Export | Purpose | Built as |
|
||||
| ------------- | ----------------------------- | ------------------------------------ |
|
||||
| `"."` | Main entry — extract manifest | Externals: `emdash`, `@emdashcms/*` |
|
||||
| `"."` | Main entry — extract manifest | Externals: `emdash`, `@emdash-cms/*` |
|
||||
| `"./sandbox"` | Backend code for the sandbox | Fully self-contained (no externals) |
|
||||
| `"./admin"` | Admin UI components | Fully self-contained |
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import cloudflare from "@astrojs/cloudflare";
|
||||
import react from "@astrojs/react";
|
||||
import { d1, r2, sandbox } from "@emdashcms/cloudflare";
|
||||
import { formsPlugin } from "@emdashcms/plugin-forms";
|
||||
import { webhookNotifierPlugin } from "@emdashcms/plugin-webhook-notifier";
|
||||
import { d1, r2, sandbox } from "@emdash-cms/cloudflare";
|
||||
import { formsPlugin } from "@emdash-cms/plugin-forms";
|
||||
import { webhookNotifierPlugin } from "@emdash-cms/plugin-webhook-notifier";
|
||||
import { defineConfig } from "astro/config";
|
||||
import emdash from "emdash/astro";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@emdashcms/template-blog-cloudflare",
|
||||
"name": "@emdash-cms/template-blog-cloudflare",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
@@ -15,9 +15,9 @@
|
||||
"dependencies": {
|
||||
"@astrojs/cloudflare": "catalog:",
|
||||
"@astrojs/react": "catalog:",
|
||||
"@emdashcms/cloudflare": "workspace:*",
|
||||
"@emdashcms/plugin-forms": "workspace:*",
|
||||
"@emdashcms/plugin-webhook-notifier": "workspace:*",
|
||||
"@emdash-cms/cloudflare": "workspace:*",
|
||||
"@emdash-cms/plugin-forms": "workspace:*",
|
||||
"@emdash-cms/plugin-webhook-notifier": "workspace:*",
|
||||
"astro": "catalog:",
|
||||
"emdash": "workspace:*",
|
||||
"react": "catalog:",
|
||||
|
||||
Reference in New Issue
Block a user