create-nextly-app 0.0.2-alpha.74 → 0.0.2-alpha.76
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/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/{create-nextly-ChHdzG83.mjs → create-nextly-BmGN2BX8.mjs} +119 -3
- package/dist/create-nextly-BmGN2BX8.mjs.map +1 -0
- package/dist/{create-nextly-Decg8dye.cjs → create-nextly-CXsN4jfA.cjs} +119 -3
- package/dist/create-nextly-CXsN4jfA.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +5 -5
- package/skills/nextly-authentication/SKILL.md +1 -1
- package/skills/nextly-collections/SKILL.md +1 -1
- package/skills/nextly-deploy/SKILL.md +1 -1
- package/skills/nextly-install/SKILL.md +1 -1
- package/templates/base/src/app/admin/[[...params]]/layout.tsx +70 -14
- package/templates/base/src/types/generated/plugin-admin-imports.generated.ts +2 -0
- package/templates/blank/src/instrumentation.ts +4 -1
- package/templates/plugin/AGENTS.md.template +2 -2
- package/templates/plugin/dev/src/instrumentation.ts +4 -1
- package/templates/plugin/dev/src/types/generated/plugin-admin-imports.generated.ts +2 -2
- package/templates/plugin/src/admin/index.ts +4 -14
- package/dist/create-nextly-ChHdzG83.mjs.map +0 -1
- package/dist/create-nextly-Decg8dye.cjs.map +0 -1
- package/templates/plugin/dev/src/app/admin/[[...params]]/layout.tsx +0 -24
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_create_nextly = require("./create-nextly-
|
|
2
|
+
const require_create_nextly = require("./create-nextly-CXsN4jfA.cjs");
|
|
3
3
|
exports.createNextly = require_create_nextly.createNextly;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as createNextly } from "./create-nextly-
|
|
1
|
+
export { t as createNextly } from "./create-nextly-BmGN2BX8.mjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-nextly-app",
|
|
3
|
-
"version": "0.0.2-alpha.
|
|
3
|
+
"version": "0.0.2-alpha.76",
|
|
4
4
|
"description": "CLI to scaffold Nextly in your Next.js project",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@babel/types": "^7.29.7",
|
|
40
|
-
"@nextlyhq/eslint-plugin": "0.0.2-alpha.
|
|
41
|
-
"@nextlyhq/module-specifiers": "0.0.2-alpha.
|
|
42
|
-
"@nextlyhq/telemetry": "0.0.2-alpha.
|
|
43
|
-
"@nextlyhq/tsconfig": "0.0.2-alpha.
|
|
40
|
+
"@nextlyhq/eslint-plugin": "0.0.2-alpha.76",
|
|
41
|
+
"@nextlyhq/module-specifiers": "0.0.2-alpha.76",
|
|
42
|
+
"@nextlyhq/telemetry": "0.0.2-alpha.76",
|
|
43
|
+
"@nextlyhq/tsconfig": "0.0.2-alpha.76",
|
|
44
44
|
"@testing-library/react": "^16.3.0",
|
|
45
45
|
"@types/fs-extra": "^11.0.4",
|
|
46
46
|
"@types/node": "^22.20.5",
|
|
@@ -7,7 +7,7 @@ description: >-
|
|
|
7
7
|
code, and extra fields on users. Also use when asked to add login or
|
|
8
8
|
sign-up to a Nextly site, so the answer matches what Nextly provides.
|
|
9
9
|
metadata:
|
|
10
|
-
nextly-version: 0.0.2-alpha.
|
|
10
|
+
nextly-version: 0.0.2-alpha.76
|
|
11
11
|
---
|
|
12
12
|
|
|
13
13
|
# Authentication and access in Nextly
|
|
@@ -8,7 +8,7 @@ description: >-
|
|
|
8
8
|
Nextly install shows no collections, fails to load nextly.config.ts, or its
|
|
9
9
|
admin panel misbehaves after setup.
|
|
10
10
|
metadata:
|
|
11
|
-
nextly-version: 0.0.2-alpha.
|
|
11
|
+
nextly-version: 0.0.2-alpha.76
|
|
12
12
|
---
|
|
13
13
|
|
|
14
14
|
# Install Nextly into an existing Next.js app
|
|
@@ -1,13 +1,48 @@
|
|
|
1
1
|
import { connection } from "next/server";
|
|
2
2
|
import { Suspense } from "react";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
ADMIN_BRANDING_ELEMENT_ID,
|
|
5
|
+
ADMIN_STARTUP_SCREENS_ELEMENT_ID,
|
|
6
|
+
adminBrandingJson,
|
|
7
|
+
adminMetadataFor,
|
|
8
|
+
adminStartupScreensJson,
|
|
9
|
+
getBrandingCss,
|
|
10
|
+
} from "nextly/config";
|
|
5
11
|
|
|
6
12
|
import config from "../../../../nextly.config";
|
|
7
13
|
import { registeredComponentPaths } from "../../../types/generated/plugin-admin-components.generated";
|
|
8
14
|
|
|
9
15
|
const brandingCss = getBrandingCss(config.admin?.branding);
|
|
16
|
+
// The configured logo, name and favicon, read by the admin before any request
|
|
17
|
+
// answers, so they are right from the first paint.
|
|
18
|
+
const brandingJson = adminBrandingJson(config.admin?.branding);
|
|
19
|
+
// What each plugin page reads as it opens, so the admin asks for it in its
|
|
20
|
+
// first request when a tab opens on that page.
|
|
21
|
+
const startupScreensJson = adminStartupScreensJson(config.plugins);
|
|
10
22
|
|
|
23
|
+
/**
|
|
24
|
+
* The admin is never a page for search results: `noindex, nofollow` in the
|
|
25
|
+
* head of the first HTML the server sends, whatever plugins the site runs,
|
|
26
|
+
* and the configured favicon's link beside it.
|
|
27
|
+
*/
|
|
28
|
+
export const metadata = adminMetadataFor(config.admin?.branding);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* `/admin` itself is built ahead, so it is served from the build's files. The
|
|
32
|
+
* admin's other paths are drawn by the same page in the browser, and are
|
|
33
|
+
* served the same prebuilt shell.
|
|
34
|
+
*/
|
|
35
|
+
export function generateStaticParams(): { params: string[] }[] {
|
|
36
|
+
return [{ params: [] }];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Prebuilt in production: the same page for every visitor, built once, with
|
|
41
|
+
* no request-time work and nothing read from the database. Everything about
|
|
42
|
+
* the person comes from the admin's own requests once it loads, so a CDN or
|
|
43
|
+
* the browser may keep the page, and it is served while the server is still
|
|
44
|
+
* starting.
|
|
45
|
+
*/
|
|
11
46
|
export default function AdminLayout({
|
|
12
47
|
children,
|
|
13
48
|
}: {
|
|
@@ -18,25 +53,46 @@ export default function AdminLayout({
|
|
|
18
53
|
{brandingCss && (
|
|
19
54
|
<style dangerouslySetInnerHTML={{ __html: brandingCss }} />
|
|
20
55
|
)}
|
|
21
|
-
|
|
22
|
-
<
|
|
23
|
-
|
|
56
|
+
{brandingJson && (
|
|
57
|
+
<script
|
|
58
|
+
type="application/json"
|
|
59
|
+
id={ADMIN_BRANDING_ELEMENT_ID}
|
|
60
|
+
dangerouslySetInnerHTML={{ __html: brandingJson }}
|
|
61
|
+
/>
|
|
62
|
+
)}
|
|
63
|
+
{startupScreensJson && (
|
|
64
|
+
<script
|
|
65
|
+
type="application/json"
|
|
66
|
+
id={ADMIN_STARTUP_SCREENS_ELEMENT_ID}
|
|
67
|
+
dangerouslySetInnerHTML={{ __html: startupScreensJson }}
|
|
68
|
+
/>
|
|
69
|
+
)}
|
|
70
|
+
{process.env.NODE_ENV === "development" ? (
|
|
71
|
+
<Suspense fallback={null}>
|
|
72
|
+
<ComponentMapKeptCurrent>{children}</ComponentMapKeptCurrent>
|
|
73
|
+
</Suspense>
|
|
74
|
+
) : (
|
|
75
|
+
children
|
|
76
|
+
)}
|
|
24
77
|
</>
|
|
25
78
|
);
|
|
26
79
|
}
|
|
27
80
|
|
|
28
81
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
82
|
+
* Development only: before any admin page, the generated component map is
|
|
83
|
+
* written again when it falls behind the config. A production build serves
|
|
84
|
+
* the map it was built with, so it drops this, and the page with it is
|
|
85
|
+
* prebuilt. Beneath a Suspense boundary, as request work outside one fails a
|
|
86
|
+
* Cache Components build, in development too. The check is loaded here, so a
|
|
87
|
+
* production page never loads the runtime it lives in.
|
|
34
88
|
*/
|
|
35
|
-
async function
|
|
89
|
+
async function ComponentMapKeptCurrent({
|
|
90
|
+
children,
|
|
91
|
+
}: {
|
|
92
|
+
children: React.ReactNode;
|
|
93
|
+
}) {
|
|
36
94
|
await connection();
|
|
37
|
-
|
|
38
|
-
// falls behind the config, so a plugin added while `next dev` runs draws
|
|
39
|
-
// its components without a command. In production it does nothing.
|
|
95
|
+
const { checkAdminComponents } = await import("nextly/runtime");
|
|
40
96
|
await checkAdminComponents({ config, registeredComponentPaths });
|
|
41
97
|
return children;
|
|
42
98
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* string (pages, settings, views, slots, field-type editors) so they load
|
|
4
4
|
* without manual host imports. */
|
|
5
5
|
|
|
6
|
+
import { registerComponentMap } from "@nextlyhq/admin";
|
|
6
7
|
import { registeredComponentPaths as listed } from "./plugin-admin-components.generated";
|
|
7
8
|
|
|
8
9
|
const registered = {};
|
|
@@ -29,4 +30,5 @@ if (
|
|
|
29
30
|
);
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
registerComponentMap(registered);
|
|
32
34
|
export const registeredComponentPaths = listed;
|
|
@@ -26,8 +26,11 @@ export async function register(): Promise<void> {
|
|
|
26
26
|
// Next.js writes its Cache Components setting into this file as it builds
|
|
27
27
|
// it. Nextly, loaded from node_modules, cannot read that for itself. With
|
|
28
28
|
// it off, Nextly warns at start; with it on, a cached read that finds no
|
|
29
|
-
// "use cache" read function says so.
|
|
29
|
+
// "use cache" read function says so. The same holds for the build's newest
|
|
30
|
+
// migration, which withNextly sets: a production start compares it with
|
|
31
|
+
// the database's schema version and warns when the database is behind.
|
|
30
32
|
await createRegister(config, {
|
|
31
33
|
cacheComponents: process.env.__NEXT_CACHE_COMPONENTS,
|
|
34
|
+
buildSchemaVersion: process.env.NEXTLY_BUILD_SCHEMA_VERSION,
|
|
32
35
|
})();
|
|
33
36
|
}
|
|
@@ -41,8 +41,8 @@ working on an app.
|
|
|
41
41
|
- **Plugin APIs come from `@nextlyhq/plugin-sdk`; schema APIs come from
|
|
42
42
|
`nextly/config`.** The SDK is the stability boundary for everything a plugin
|
|
43
43
|
does AS a plugin: `definePlugin`, field factories, `pluginField` and
|
|
44
|
-
`NextlyError` from `@nextlyhq/plugin-sdk`; `registerComponents`
|
|
45
|
-
|
|
44
|
+
`NextlyError` from `@nextlyhq/plugin-sdk`; `registerComponents` from
|
|
45
|
+
`@nextlyhq/plugin-sdk/admin`; `createTestNextly`
|
|
46
46
|
from `@nextlyhq/plugin-sdk/testing`. Collections and singles are defined the same way an app defines
|
|
47
47
|
them, with `defineCollection` from `nextly/config` — which is what
|
|
48
48
|
`src/collections/example.ts` does.
|
|
@@ -10,9 +10,12 @@ export async function register(): Promise<void> {
|
|
|
10
10
|
// Next.js writes its Cache Components setting into this file as it builds
|
|
11
11
|
// it. Nextly, loaded from node_modules, cannot read that for itself. With
|
|
12
12
|
// it off, Nextly warns at start; with it on, a cached read that finds no
|
|
13
|
-
// "use cache" read function says so.
|
|
13
|
+
// "use cache" read function says so. The same holds for the build's newest
|
|
14
|
+
// migration, which withNextly sets: a production start compares it with
|
|
15
|
+
// the database's schema version and warns when the database is behind.
|
|
14
16
|
await createRegister(config, {
|
|
15
17
|
cacheComponents: process.env.__NEXT_CACHE_COMPONENTS,
|
|
18
|
+
buildSchemaVersion: process.env.NEXTLY_BUILD_SCHEMA_VERSION,
|
|
16
19
|
})();
|
|
17
20
|
|
|
18
21
|
// Create the user admin.devAutoLogin signs in as (see seed-dev-user.ts).
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* string (pages, settings, views, slots, field-type editors) so they load
|
|
4
4
|
* without manual host imports. */
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { registerComponentMap } from "@nextlyhq/admin";
|
|
7
7
|
import * as _p0 from "{{pluginName}}/admin";
|
|
8
8
|
import { registeredComponentPaths as listed } from "./plugin-admin-components.generated";
|
|
9
9
|
|
|
@@ -33,5 +33,5 @@ if (
|
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
registerComponentMap(registered);
|
|
37
37
|
export const registeredComponentPaths = listed;
|
|
@@ -1,24 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Admin component registration
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* the eager + lazy registration below is the fallback.
|
|
2
|
+
* Admin component registration. Importing this module registers the React
|
|
3
|
+
* components referenced by `contributes.admin` string paths so the host admin
|
|
4
|
+
* can resolve them. The host's generated component map imports it for you.
|
|
6
5
|
*/
|
|
7
|
-
import {
|
|
8
|
-
registerComponents,
|
|
9
|
-
registerKnownPlugin,
|
|
10
|
-
} from "@nextlyhq/plugin-sdk/admin";
|
|
6
|
+
import { registerComponents } from "@nextlyhq/plugin-sdk/admin";
|
|
11
7
|
|
|
12
8
|
import { SettingsPage } from "./SettingsPage";
|
|
13
9
|
|
|
14
10
|
const SETTINGS_PATH = "{{pluginName}}/admin#SettingsPage";
|
|
15
11
|
|
|
16
|
-
// Eager: register on module load.
|
|
17
12
|
registerComponents({ [SETTINGS_PATH]: SettingsPage });
|
|
18
13
|
|
|
19
|
-
// Lazy fallback: the host can trigger registration on demand by package prefix.
|
|
20
|
-
registerKnownPlugin("{{pluginName}}", async () => {
|
|
21
|
-
registerComponents({ [SETTINGS_PATH]: SettingsPage });
|
|
22
|
-
});
|
|
23
|
-
|
|
24
14
|
export { SettingsPage };
|