create-nextly-app 0.0.2-alpha.73 → 0.0.2-alpha.74
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-CuWn_ITx.mjs → create-nextly-ChHdzG83.mjs} +152 -76
- package/dist/{create-nextly-CuWn_ITx.mjs.map → create-nextly-ChHdzG83.mjs.map} +1 -1
- package/dist/{create-nextly-Q62KZJib.cjs → create-nextly-Decg8dye.cjs} +152 -76
- package/dist/{create-nextly-Q62KZJib.cjs.map → create-nextly-Decg8dye.cjs.map} +1 -1
- 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 +9 -1
- package/templates/base/src/app/layout.tsx +5 -0
- package/templates/base/src/nextly/cached-read.ts +52 -0
- package/templates/blank/src/app/layout.tsx +5 -0
- package/templates/plugin/dev/src/app/layout.tsx +6 -0
- package/templates/plugin/dev/src/nextly/cached-read.ts +52 -0
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-Decg8dye.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-ChHdzG83.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.74",
|
|
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.74",
|
|
41
|
+
"@nextlyhq/module-specifiers": "0.0.2-alpha.74",
|
|
42
|
+
"@nextlyhq/telemetry": "0.0.2-alpha.74",
|
|
43
|
+
"@nextlyhq/tsconfig": "0.0.2-alpha.74",
|
|
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.74
|
|
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.74
|
|
12
12
|
---
|
|
13
13
|
|
|
14
14
|
# Install Nextly into an existing Next.js app
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { connection } from "next/server";
|
|
2
2
|
import { Suspense } from "react";
|
|
3
3
|
import { getBrandingCss } from "nextly/config";
|
|
4
|
+
import { checkAdminComponents } from "nextly/runtime";
|
|
4
5
|
|
|
5
6
|
import config from "../../../../nextly.config";
|
|
7
|
+
import { registeredComponentPaths } from "../../../types/generated/plugin-admin-components.generated";
|
|
6
8
|
|
|
7
9
|
const brandingCss = getBrandingCss(config.admin?.branding);
|
|
8
10
|
|
|
@@ -26,9 +28,15 @@ export default function AdminLayout({
|
|
|
26
28
|
/**
|
|
27
29
|
* The admin renders for each request, never from a cache another user's
|
|
28
30
|
* request filled. Beneath the layout's Suspense boundary, so under Cache
|
|
29
|
-
* Components the shell above it still prerenders
|
|
31
|
+
* Components the shell above it still prerenders: request work outside a
|
|
32
|
+
* boundary fails the build, in development too, where `checkAdminComponents`
|
|
33
|
+
* boots nextly.
|
|
30
34
|
*/
|
|
31
35
|
async function ForThisRequest({ children }: { children: React.ReactNode }) {
|
|
32
36
|
await connection();
|
|
37
|
+
// In development, the generated component map is written again when it
|
|
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.
|
|
40
|
+
await checkAdminComponents({ config, registeredComponentPaths });
|
|
33
41
|
return children;
|
|
34
42
|
}
|
|
@@ -3,6 +3,11 @@ import "@fontsource-variable/geist";
|
|
|
3
3
|
import "@fontsource-variable/geist-mono";
|
|
4
4
|
import "./globals.css";
|
|
5
5
|
import { SITE_URL } from "@/lib/site-url";
|
|
6
|
+
// Registers the app's "use cache" read function, and how Nextly starts when a
|
|
7
|
+
// read finds it not started, for every route before any of them reads,
|
|
8
|
+
// during `next build` too: under Cache Components Nextly's cached reads go
|
|
9
|
+
// through that function, and `<SiteCode>` refuses to read without it.
|
|
10
|
+
import "@/nextly/cached-read";
|
|
6
11
|
|
|
7
12
|
/**
|
|
8
13
|
* The faces are imported as STYLESHEETS from packages in `node_modules`, rather
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nextly's cached reads under Cache Components.
|
|
3
|
+
*
|
|
4
|
+
* Next.js caches non-fetch reads with `"use cache"` and `cacheTag` once Cache
|
|
5
|
+
* Components is on, and the directive works only in code Next.js compiles, so
|
|
6
|
+
* Nextly reads through this function of the app's own. It receives the read's
|
|
7
|
+
* key, its tags and its lifetime, and runs the reader Nextly registered for
|
|
8
|
+
* that key. The root layout imports this file, so it is registered on every
|
|
9
|
+
* route before anything is read: `<SiteCode>` refuses to read without it.
|
|
10
|
+
*
|
|
11
|
+
* The same import also tells Nextly how to start with the app's config when a
|
|
12
|
+
* read finds it not started, so the root layout's import both registers the
|
|
13
|
+
* cached read and covers a read made before any page starts Nextly, during
|
|
14
|
+
* `next build` too.
|
|
15
|
+
*
|
|
16
|
+
* It works with `cacheComponents: true` and Nextly's cache handlers in
|
|
17
|
+
* `next.config.ts`, as this app ships:
|
|
18
|
+
* https://nextlyhq.com/docs/guides/isr-caching#cache-components
|
|
19
|
+
*/
|
|
20
|
+
import { cacheLife, cacheTag } from "next/cache";
|
|
21
|
+
import { getNextly, registerNextlyStart } from "nextly";
|
|
22
|
+
import { registerCachedRead, runRegisteredRead } from "nextly/runtime";
|
|
23
|
+
|
|
24
|
+
import config from "@nextly-config";
|
|
25
|
+
|
|
26
|
+
export async function cachedRead(
|
|
27
|
+
key: string,
|
|
28
|
+
tags: string[],
|
|
29
|
+
revalidate: number | false
|
|
30
|
+
): Promise<unknown> {
|
|
31
|
+
"use cache";
|
|
32
|
+
cacheTag(...tags);
|
|
33
|
+
// `revalidate: false` is tag-only, as everywhere in Nextly: only a write
|
|
34
|
+
// expires the entry, never time. Next.js's "max" profile revalidates monthly.
|
|
35
|
+
if (revalidate === false) {
|
|
36
|
+
cacheLife({ revalidate: Infinity, expire: Infinity });
|
|
37
|
+
} else {
|
|
38
|
+
// Expired at twice the revalidate, and never within 5 minutes: Next.js
|
|
39
|
+
// leaves an entry that expires sooner out of a static prerender.
|
|
40
|
+
cacheLife({ revalidate, expire: Math.max(revalidate * 2, 300) });
|
|
41
|
+
}
|
|
42
|
+
return runRegisteredRead(key);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
registerCachedRead(cachedRead, process.env.__NEXT_CACHE_COMPONENTS);
|
|
46
|
+
|
|
47
|
+
// Tells Nextly how this app starts it, for a read that finds it not started,
|
|
48
|
+
// such as the root layout's `<SiteCode>` on `/_not-found` while `next build`
|
|
49
|
+
// prerenders, where nothing else starts it. Nothing starts here: a page that
|
|
50
|
+
// calls `getNextly` first is the start that counts. An app that passes
|
|
51
|
+
// `getNextly` more than its config passes the same options here.
|
|
52
|
+
registerNextlyStart(() => getNextly({ config }));
|
|
@@ -4,6 +4,11 @@ import "@fontsource-variable/jetbrains-mono";
|
|
|
4
4
|
|
|
5
5
|
import "./globals.css";
|
|
6
6
|
import { SITE_URL } from "@/lib/site-url";
|
|
7
|
+
// Registers the app's "use cache" read function, and how Nextly starts when a
|
|
8
|
+
// read finds it not started, for every route before any of them reads,
|
|
9
|
+
// during `next build` too: under Cache Components Nextly's cached reads go
|
|
10
|
+
// through that function, and `<SiteCode>` refuses to read without it.
|
|
11
|
+
import "@/nextly/cached-read";
|
|
7
12
|
|
|
8
13
|
/**
|
|
9
14
|
* The faces are imported as STYLESHEETS from packages in `node_modules`, rather
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
|
|
3
|
+
// Registers the dev app's "use cache" read function, and how Nextly starts
|
|
4
|
+
// when a read finds it not started, for every route before any of them
|
|
5
|
+
// reads, during `next build` too: under Cache Components Nextly's cached
|
|
6
|
+
// reads go through that function, and `<SiteCode>` refuses to read without it.
|
|
7
|
+
import "../nextly/cached-read";
|
|
8
|
+
|
|
3
9
|
export const metadata = {
|
|
4
10
|
title: "{{pluginName}} — dev playground",
|
|
5
11
|
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nextly's cached reads under Cache Components, for the plugin's dev app.
|
|
3
|
+
*
|
|
4
|
+
* Next.js caches non-fetch reads with `"use cache"` and `cacheTag` once Cache
|
|
5
|
+
* Components is on, and the directive works only in code Next.js compiles, so
|
|
6
|
+
* Nextly reads through this function of the app's own. It receives the read's
|
|
7
|
+
* key, its tags and its lifetime, and runs the reader Nextly registered for
|
|
8
|
+
* that key. The root layout imports this file, so it is registered on every
|
|
9
|
+
* route before anything is read, as in an app `create-nextly-app` makes.
|
|
10
|
+
*
|
|
11
|
+
* The same import also tells Nextly how to start with the app's config when a
|
|
12
|
+
* read finds it not started, so the root layout's import both registers the
|
|
13
|
+
* cached read and covers a read made before any page starts Nextly, during
|
|
14
|
+
* `next build` too.
|
|
15
|
+
*
|
|
16
|
+
* It works with `cacheComponents: true` and Nextly's cache handlers in
|
|
17
|
+
* `next.config.ts`, as this dev app ships:
|
|
18
|
+
* https://nextlyhq.com/docs/guides/isr-caching#cache-components
|
|
19
|
+
*/
|
|
20
|
+
import { cacheLife, cacheTag } from "next/cache";
|
|
21
|
+
import { getNextly, registerNextlyStart } from "nextly";
|
|
22
|
+
import { registerCachedRead, runRegisteredRead } from "nextly/runtime";
|
|
23
|
+
|
|
24
|
+
import config from "../../nextly.config";
|
|
25
|
+
|
|
26
|
+
export async function cachedRead(
|
|
27
|
+
key: string,
|
|
28
|
+
tags: string[],
|
|
29
|
+
revalidate: number | false
|
|
30
|
+
): Promise<unknown> {
|
|
31
|
+
"use cache";
|
|
32
|
+
cacheTag(...tags);
|
|
33
|
+
// `revalidate: false` is tag-only, as everywhere in Nextly: only a write
|
|
34
|
+
// expires the entry, never time. Next.js's "max" profile revalidates monthly.
|
|
35
|
+
if (revalidate === false) {
|
|
36
|
+
cacheLife({ revalidate: Infinity, expire: Infinity });
|
|
37
|
+
} else {
|
|
38
|
+
// Expired at twice the revalidate, and never within 5 minutes: Next.js
|
|
39
|
+
// leaves an entry that expires sooner out of a static prerender.
|
|
40
|
+
cacheLife({ revalidate, expire: Math.max(revalidate * 2, 300) });
|
|
41
|
+
}
|
|
42
|
+
return runRegisteredRead(key);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
registerCachedRead(cachedRead, process.env.__NEXT_CACHE_COMPONENTS);
|
|
46
|
+
|
|
47
|
+
// Tells Nextly how this app starts it, for a read that finds it not started,
|
|
48
|
+
// such as the root layout's `<SiteCode>` on `/_not-found` while `next build`
|
|
49
|
+
// prerenders, where nothing else starts it. Nothing starts here: a page that
|
|
50
|
+
// calls `getNextly` first is the start that counts. An app that passes
|
|
51
|
+
// `getNextly` more than its config passes the same options here.
|
|
52
|
+
registerNextlyStart(() => getNextly({ config }));
|