create-nextly-app 0.0.2-alpha.7 → 0.0.2-alpha.71
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/README.md +36 -9
- package/dist/cli.cjs +3047 -32460
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.mjs +3048 -3602
- package/dist/cli.mjs.map +1 -1
- package/dist/create-nextly-5wiGMVI6.mjs +52550 -0
- package/dist/create-nextly-5wiGMVI6.mjs.map +1 -0
- package/dist/create-nextly-BbKGDrEC.cjs +52628 -0
- package/dist/create-nextly-BbKGDrEC.cjs.map +1 -0
- package/dist/index.cjs +3 -24861
- package/dist/index.d.cts +40 -34
- package/dist/index.d.ts +40 -34
- package/dist/index.mjs +1 -6
- package/package.json +28 -19
- package/skills/nextly-authentication/SKILL.md +187 -0
- package/skills/nextly-collections/SKILL.md +215 -0
- package/skills/nextly-deploy/SKILL.md +248 -0
- package/skills/nextly-install/SKILL.md +121 -0
- package/templates/base/.env.example +21 -6
- package/templates/base/AGENTS.md.template +226 -0
- package/templates/base/CLAUDE.md.template +1 -0
- package/templates/base/gitignore +42 -0
- package/templates/base/next.config.ts +11 -17
- package/templates/base/src/app/admin/[[...params]]/page.tsx +3 -0
- package/templates/base/src/app/admin/api/media/[[...path]]/route.ts +26 -0
- package/templates/base/src/app/globals.css +15 -2
- package/templates/base/src/app/layout.tsx +32 -18
- package/templates/base/src/lib/site-url.ts +55 -0
- package/templates/base/src/types/generated/nextly-types.ts +6 -4
- package/templates/base/src/types/generated/plugin-admin-components.generated.ts +6 -0
- package/templates/base/src/types/generated/plugin-admin-imports.generated.ts +32 -0
- package/templates/base/tsconfig.json +8 -1
- package/templates/blank/src/{components → app/(frontend)/components}/ThemeToggle.tsx +55 -24
- package/templates/blank/src/app/(frontend)/page.tsx +2 -2
- package/templates/blank/src/app/globals.css +37 -1
- package/templates/blank/src/app/layout.tsx +28 -18
- package/templates/blank/src/instrumentation.ts +32 -0
- package/templates/plugin/AGENTS.md.template +125 -0
- package/templates/plugin/CLAUDE.md.template +1 -0
- package/templates/plugin/README.md +48 -0
- package/templates/plugin/dev/.env.example +11 -0
- package/templates/plugin/dev/next.config.ts +43 -0
- package/templates/plugin/dev/nextly.config.ts +17 -0
- package/templates/plugin/dev/src/app/admin/[[...params]]/page.tsx +24 -0
- package/templates/plugin/dev/src/app/admin/api/[[...params]]/route.ts +19 -0
- package/templates/plugin/dev/src/app/layout.tsx +13 -0
- package/templates/plugin/dev/src/instrumentation.ts +25 -0
- package/templates/plugin/dev/src/seed-dev-user.ts +51 -0
- package/templates/plugin/dev/src/types/generated/plugin-admin-components.generated.ts +8 -0
- package/templates/plugin/dev/src/types/generated/plugin-admin-imports.generated.ts +37 -0
- package/templates/plugin/dev/tsconfig.json +22 -0
- package/templates/plugin/eslint.config.mjs +19 -0
- package/templates/plugin/gitignore +13 -0
- package/templates/plugin/src/admin/SettingsPage.tsx +57 -0
- package/templates/plugin/src/admin/index.ts +24 -0
- package/templates/plugin/src/collections/example.ts +13 -0
- package/templates/plugin/src/index.ts +6 -0
- package/templates/plugin/src/plugin.test.ts +35 -0
- package/templates/plugin/src/plugin.ts +48 -0
- package/templates/plugin/src/types.ts +17 -0
- package/templates/plugin/template.json +14 -0
- package/templates/plugin/tsconfig.json +18 -0
- package/templates/plugin/tsdown.config.ts +30 -0
- package/templates/plugin/vitest.config.ts +27 -0
- package/dist/chunk-RPGFJSDP.mjs +0 -28835
- package/dist/chunk-RPGFJSDP.mjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/templates/blank/src/access/README.md +0 -22
- package/templates/blank/src/collections/README.md +0 -22
- package/templates/blank/src/lib/README.md +0 -15
- package/templates/blank/src/singles/README.md +0 -19
- /package/templates/blank/src/{components → app/(frontend)/components}/README.md +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { definePlugin } from "@nextlyhq/plugin-sdk";
|
|
2
|
+
|
|
3
|
+
import { Examples } from "./collections/example";
|
|
4
|
+
import type { MyPluginOptions } from "./types";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Your plugin factory. Call it in a host app's `defineConfig({ plugins: [...] })`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { myPlugin } from "{{pluginName}}";
|
|
12
|
+
* export default defineConfig({ plugins: [myPlugin({ greeting: "Hi" })] });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export const myPlugin = (opts: MyPluginOptions = {}) =>
|
|
16
|
+
definePlugin({
|
|
17
|
+
name: "{{pluginName}}",
|
|
18
|
+
version: "0.1.0",
|
|
19
|
+
nextly: "{{nextlyRange}}",
|
|
20
|
+
enabled: opts.enabled,
|
|
21
|
+
contributes: {
|
|
22
|
+
collections: [Examples],
|
|
23
|
+
permissions: [
|
|
24
|
+
{ action: "manage", resource: "examples", label: "Manage Examples" },
|
|
25
|
+
],
|
|
26
|
+
admin: {
|
|
27
|
+
menu: [
|
|
28
|
+
{
|
|
29
|
+
label: "Examples",
|
|
30
|
+
to: "/admin/collections/examples",
|
|
31
|
+
icon: "Sparkles",
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
settings: { component: "{{pluginName}}/admin#SettingsPage" },
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
init(ctx) {
|
|
38
|
+
const greeting = opts.greeting ?? "Hello";
|
|
39
|
+
// Resolve your own slug via ctx.self so this keeps working if the host
|
|
40
|
+
// renames the collection (D54). React to the post-commit create event.
|
|
41
|
+
ctx.events.on(`collection.${ctx.self.collections.examples}.created`, () =>
|
|
42
|
+
ctx.logger.info(`${greeting} from {{pluginName}} — example created`)
|
|
43
|
+
);
|
|
44
|
+
},
|
|
45
|
+
destroy() {
|
|
46
|
+
// Clean up here (subscriptions are auto-dropped on registry reset).
|
|
47
|
+
},
|
|
48
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options accepted by your plugin factory. These are JSDoc-documented so editors
|
|
3
|
+
* surface them at the call site (D44).
|
|
4
|
+
*/
|
|
5
|
+
export interface MyPluginOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Greeting prefix used by the example collection's `afterCreate` hook.
|
|
8
|
+
* @default "Hello"
|
|
9
|
+
*/
|
|
10
|
+
greeting?: string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Disable the plugin's behavior (init/hooks/events/routes/admin) while still
|
|
14
|
+
* applying its schema contributions. Default `true`.
|
|
15
|
+
*/
|
|
16
|
+
enabled?: boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "plugin",
|
|
3
|
+
"label": "Plugin",
|
|
4
|
+
"description": "Build a reusable Nextly plugin (publishable npm package)",
|
|
5
|
+
"hint": "Plugin package + embedded /dev playground; no schema approach",
|
|
6
|
+
"approaches": [],
|
|
7
|
+
"defaultApproach": null,
|
|
8
|
+
"collections": [],
|
|
9
|
+
"singles": [],
|
|
10
|
+
"hasDemoData": false,
|
|
11
|
+
"hasFrontendPages": false,
|
|
12
|
+
"recommendedDatabase": "sqlite",
|
|
13
|
+
"release": "alpha"
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"noEmit": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"verbatimModuleSyntax": false
|
|
15
|
+
},
|
|
16
|
+
"include": ["src"],
|
|
17
|
+
"exclude": ["node_modules", "dist", "dev"]
|
|
18
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineConfig } from "tsdown";
|
|
2
|
+
|
|
3
|
+
// The host provides these. Each name and its subpaths stay external: bundling
|
|
4
|
+
// one would ship a second copy of code the host already provides.
|
|
5
|
+
const HOST_PACKAGES = [
|
|
6
|
+
"nextly",
|
|
7
|
+
"@nextlyhq/admin",
|
|
8
|
+
"@nextlyhq/plugin-sdk",
|
|
9
|
+
"@nextlyhq/ui",
|
|
10
|
+
"react",
|
|
11
|
+
"react-dom",
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
// Builds the publishable plugin. `dev/` is NOT an entry — it never ships.
|
|
15
|
+
export default defineConfig({
|
|
16
|
+
entry: ["src/index.ts", "src/admin/index.ts"],
|
|
17
|
+
format: ["esm"],
|
|
18
|
+
dts: true,
|
|
19
|
+
clean: true,
|
|
20
|
+
sourcemap: true,
|
|
21
|
+
treeshake: true,
|
|
22
|
+
deps: {
|
|
23
|
+
neverBundle: id =>
|
|
24
|
+
HOST_PACKAGES.some(name => id === name || id.startsWith(`${name}/`)),
|
|
25
|
+
},
|
|
26
|
+
// `.mjs` and `.d.ts`, the names the package's exports map publishes.
|
|
27
|
+
outExtensions() {
|
|
28
|
+
return { js: ".mjs", dts: ".d.ts" };
|
|
29
|
+
},
|
|
30
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineConfig } from "vitest/config";
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
environment: "node",
|
|
6
|
+
include: ["src/**/*.test.ts"],
|
|
7
|
+
/*
|
|
8
|
+
* Sized for an instance boot, because that is what this suite does.
|
|
9
|
+
*
|
|
10
|
+
* `plugin.test.ts` calls `createTestNextly` in `beforeEach`, which builds a
|
|
11
|
+
* DI container, registers the plugin's schema and runs auto-sync against a
|
|
12
|
+
* real SQLite database. Vitest's defaults are sized for a unit test that
|
|
13
|
+
* touches none of that: 5s for a case and 10s for a hook. A boot is about a
|
|
14
|
+
* second and a half on a warm machine, and the first run of a freshly
|
|
15
|
+
* scaffolded project is the least warm moment there is - a cold install, no
|
|
16
|
+
* build cache, whatever the laptop or CI container is doing.
|
|
17
|
+
*
|
|
18
|
+
* This is the first command a new plugin author runs, so a timeout here
|
|
19
|
+
* reads as "the scaffold ships a broken test" rather than "the budget was
|
|
20
|
+
* tight". The monorepo solves the same problem by routing boots to a lane
|
|
21
|
+
* with a 30s budget; a single-package project has one lane and nothing to
|
|
22
|
+
* contend with, so it states the budget instead.
|
|
23
|
+
*/
|
|
24
|
+
testTimeout: 30_000,
|
|
25
|
+
hookTimeout: 30_000,
|
|
26
|
+
},
|
|
27
|
+
});
|