@nonext/husk 0.2.3
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/CHANGELOG.md +148 -0
- package/LICENSE +166 -0
- package/README.md +140 -0
- package/api/public-api.md +1070 -0
- package/dist/adapter-C_0mhENy.d.ts +320 -0
- package/dist/admin/admin.css +5 -0
- package/dist/admin/index.d.ts +265 -0
- package/dist/admin/index.js +393 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/tokens.css +597 -0
- package/dist/admin/ui.d.ts +3013 -0
- package/dist/admin/ui.js +9783 -0
- package/dist/admin/ui.js.map +1 -0
- package/dist/auth/index.d.ts +4 -0
- package/dist/auth/index.js +9 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth-B2gBtHl5.d.ts +28 -0
- package/dist/can-Chy7zmx7.d.ts +69 -0
- package/dist/chunk-3I6337WJ.js +83 -0
- package/dist/chunk-3I6337WJ.js.map +1 -0
- package/dist/chunk-4Z6P3XCE.js +62 -0
- package/dist/chunk-4Z6P3XCE.js.map +1 -0
- package/dist/chunk-6E3ZS5Z5.js +1007 -0
- package/dist/chunk-6E3ZS5Z5.js.map +1 -0
- package/dist/chunk-77JDRXXU.js +3 -0
- package/dist/chunk-77JDRXXU.js.map +1 -0
- package/dist/chunk-FHYWJCG6.js +171 -0
- package/dist/chunk-FHYWJCG6.js.map +1 -0
- package/dist/chunk-JAE7HHMM.js +506 -0
- package/dist/chunk-JAE7HHMM.js.map +1 -0
- package/dist/chunk-NPDBQBLW.js +68 -0
- package/dist/chunk-NPDBQBLW.js.map +1 -0
- package/dist/chunk-ORMYARXD.js +6 -0
- package/dist/chunk-ORMYARXD.js.map +1 -0
- package/dist/chunk-R4O7APIX.js +51 -0
- package/dist/chunk-R4O7APIX.js.map +1 -0
- package/dist/chunk-ROLKRJWI.js +187 -0
- package/dist/chunk-ROLKRJWI.js.map +1 -0
- package/dist/chunk-SOTQ3WP5.js +31 -0
- package/dist/chunk-SOTQ3WP5.js.map +1 -0
- package/dist/chunk-TCFFHTY3.js +97 -0
- package/dist/chunk-TCFFHTY3.js.map +1 -0
- package/dist/chunk-TS7Y7GEZ.js +7 -0
- package/dist/chunk-TS7Y7GEZ.js.map +1 -0
- package/dist/chunk-VLGR5PZX.js +3 -0
- package/dist/chunk-VLGR5PZX.js.map +1 -0
- package/dist/chunk-ZW2PUSVS.js +40 -0
- package/dist/chunk-ZW2PUSVS.js.map +1 -0
- package/dist/chunk-ZYNBMYJ6.js +392 -0
- package/dist/chunk-ZYNBMYJ6.js.map +1 -0
- package/dist/cli/nonext-husk.js +3360 -0
- package/dist/cli/nonext-husk.js.map +1 -0
- package/dist/cli/templates/firestore.rules +393 -0
- package/dist/cli/templates/storage.rules +165 -0
- package/dist/client/index.d.ts +27 -0
- package/dist/client/index.js +15 -0
- package/dist/client/index.js.map +1 -0
- package/dist/cms-9fSA3uQV.d.ts +158 -0
- package/dist/core/index.d.ts +1267 -0
- package/dist/core/index.js +12 -0
- package/dist/core/index.js.map +1 -0
- package/dist/entry-D3kiE8T1.d.ts +163 -0
- package/dist/field-Diyf5siF.d.ts +158 -0
- package/dist/field-type-D25Vojb0.d.ts +157 -0
- package/dist/firebase/index.d.ts +251 -0
- package/dist/firebase/index.js +991 -0
- package/dist/firebase/index.js.map +1 -0
- package/dist/index-5ylaMBUH.d.ts +155 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/permissions/index.d.ts +101 -0
- package/dist/permissions/index.js +7 -0
- package/dist/permissions/index.js.map +1 -0
- package/dist/registry-CUC25qay.d.ts +59 -0
- package/dist/richtext/index.d.ts +85 -0
- package/dist/richtext/index.js +127 -0
- package/dist/richtext/index.js.map +1 -0
- package/dist/schema/index.d.ts +50 -0
- package/dist/schema/index.js +5 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/server/index.d.ts +39 -0
- package/dist/server/index.js +25 -0
- package/dist/server/index.js.map +1 -0
- package/dist/types/index.d.ts +36 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/dist/write-limits-Djmm6L3R.d.ts +215 -0
- package/package.json +136 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# @nonext/husk
|
|
2
|
+
|
|
3
|
+
Release notes for the `@nonext/husk` package. Assembled from the changesets in
|
|
4
|
+
`.changeset/` by `pnpm changeset version`; the GitHub release body is generated from this
|
|
5
|
+
file. Never from `AGENTS.md`, which describes how this repository is worked on rather than
|
|
6
|
+
what shipped.
|
|
7
|
+
|
|
8
|
+
While the package is on `0.x` the minor version is where breaking changes go. A note that
|
|
9
|
+
describes a breaking change says so in its first line.
|
|
10
|
+
|
|
11
|
+
## 0.2.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Fixed a test in `packaging.test.ts` that still asserted `publishConfig.provenance` was
|
|
16
|
+
`true`, left over from before provenance was disabled in 0.2.2. This is what CI's
|
|
17
|
+
`pnpm verify` step for the v0.2.2 tag caught and failed on.
|
|
18
|
+
|
|
19
|
+
## 0.2.2
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Publishing with provenance requires a public source repository; this one is private, so
|
|
24
|
+
provenance is off for now (`publishConfig.provenance: false`, and the release workflow no
|
|
25
|
+
longer sets `NPM_CONFIG_PROVENANCE`). No functional change to the package itself. Filed as
|
|
26
|
+
a patch for the same reason as 0.2.1: nothing published under the prior version.
|
|
27
|
+
|
|
28
|
+
## 0.2.1
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Renamed the package from `@nonext/cms` to `@nonext/husk`, and the CLI command from
|
|
33
|
+
`nonext-cms` to `nonext-husk`. Filed as a patch rather than the minor version breaking
|
|
34
|
+
changes otherwise use on `0.x`, because nothing ever successfully published under the old
|
|
35
|
+
name: there is no real installed base to break.
|
|
36
|
+
|
|
37
|
+
## 0.2.0
|
|
38
|
+
|
|
39
|
+
### Minor Changes
|
|
40
|
+
|
|
41
|
+
- 2d76d63: `@nonext/husk/firebase` no longer exports the Firestore layout.
|
|
42
|
+
|
|
43
|
+
Removed: `bootstrapPath`, `BOOTSTRAP_KEY`, `contentPath`, `entriesPath`, `entryPath`,
|
|
44
|
+
`mediaPath`, `schemaPath`, `settingsPath`, `storageObjectPath`, `userPath`,
|
|
45
|
+
`RESERVED_COLLECTIONS`, `entryFromStored`, `metaFromStored`, `valuesFromStored`,
|
|
46
|
+
`valuesToStored`, `toIso`, `toTimestamp`, `userFromStored`, and the duplicate
|
|
47
|
+
`slugFieldKey` which is still exported from `.` and `/core`.
|
|
48
|
+
|
|
49
|
+
Read and write through `CmsAdapter`. Publishing the collection paths would have made every
|
|
50
|
+
future change to the Firestore layout a breaking change for every customer project, which is
|
|
51
|
+
the property the adapter boundary exists to provide. If something cannot be expressed
|
|
52
|
+
through `CmsAdapter`, the adapter is missing a method, which is the smaller problem.
|
|
53
|
+
|
|
54
|
+
Kept: `createFirestoreAdapter`, `createHuskAuth`, the claim-sync factories, the media
|
|
55
|
+
uploader, and the user directory. Those are the wiring a host cannot avoid, because Husk
|
|
56
|
+
ships no credentials and opens no connection of its own.
|
|
57
|
+
- 2d76d63: Breaking: `CmsAdapter` now requires a `migrations` member.
|
|
58
|
+
|
|
59
|
+
A hand-written adapter that compiled before this stops compiling. `migrations` holds the
|
|
60
|
+
three storage methods the migration runner drives (`select`, `read`, `write`), and they are
|
|
61
|
+
required rather than optional on purpose: an optional member lets an adapter silently have
|
|
62
|
+
no migration path, and the failure then arrives on the day somebody needs to move data
|
|
63
|
+
between schema versions. Projects using `createFirestoreAdapter` need no change.
|
|
64
|
+
|
|
65
|
+
Filed as `minor` because the package is on `0.x`, where the minor version is where breaking
|
|
66
|
+
changes go.
|
|
67
|
+
- 0042a29: `npx nonext-husk init` and `npx nonext-husk doctor`.
|
|
68
|
+
|
|
69
|
+
The package now ships a binary. `init` scaffolds Husk into an existing Next.js App Router
|
|
70
|
+
project: the admin routes and their host halves, `cms.config.ts` with a starter collection
|
|
71
|
+
and singleton, `firestore.rules`, `storage.rules`, `firestore.indexes.json` generated from
|
|
72
|
+
those content types, `firebase.json`, and the `.env.local` that carries
|
|
73
|
+
`FIREBASE_AUTH_EMULATOR_HOST`, without which the server verifier trusts nothing and every
|
|
74
|
+
admin route redirects to sign-in. It prompts for the Firebase project, the admin route, the
|
|
75
|
+
media library, authentication and the emulators, and `--yes` takes the defaults.
|
|
76
|
+
|
|
77
|
+
It refuses rather than overwriting. A generated file that exists and differs stops the whole
|
|
78
|
+
run, with a bounded diff per file and nothing written; `--force` is the way out and
|
|
79
|
+
`--dry-run` shows the plan. A project whose root layout cannot be moved into a route group
|
|
80
|
+
without orphaning a route is refused with the three steps that fix it, because Husk's admin
|
|
81
|
+
needs its own root layout.
|
|
82
|
+
|
|
83
|
+
`doctor` checks the config, the rules against the templates the installed package ships,
|
|
84
|
+
composite index coverage against the content types in `cms.config.ts`, version skew between
|
|
85
|
+
the installed package and the one the app was scaffolded with, the Firebase wiring and the
|
|
86
|
+
emulator environment. It reports what it cannot check without a real Firebase project as
|
|
87
|
+
`unchecked` with a reason rather than passing it.
|
|
88
|
+
|
|
89
|
+
New public type: `HuskConfig`, exported from `@nonext/husk` and `@nonext/husk/types`. It is
|
|
90
|
+
what `cms.config.ts` records about the scaffold, and it is read by `doctor` and by nothing
|
|
91
|
+
at runtime.
|
|
92
|
+
- 2d76d63: Breaking: `can()` no longer widens a permission when a content type's matrix lists a role.
|
|
93
|
+
|
|
94
|
+
Ticking `author` under `delete` used to make `can(author, "delete", { type })` answer
|
|
95
|
+
`true`, while `firestore.rules` answered permission-denied. A matrix narrows and never
|
|
96
|
+
widens; the resolver was reconciled to the rules rather than the other way round, because a
|
|
97
|
+
rule that reads a privilege out of a document is letting a document grant a privilege.
|
|
98
|
+
|
|
99
|
+
Nothing that previously worked stops working: the write was already being refused. What
|
|
100
|
+
changes for a consuming project is a UI affordance that used to be enabled and is now
|
|
101
|
+
correctly disabled.
|
|
102
|
+
- Add a `brand` icon (`sprout`) to the icon vocabulary for the sidebar brand row, and a `side?: "top" | "bottom"` prop to `Menu` so a trigger pinned to the bottom of a scrollable region (the sidebar's account menu) can open upward instead of pushing the region into a scrolled state. Both are additive: existing icon names and every existing `Menu` call site keep their current behavior unchanged.
|
|
103
|
+
|
|
104
|
+
## 0.1.0 (unreleased)
|
|
105
|
+
|
|
106
|
+
First packaged version. Nothing has been published yet, so no consuming project exists to
|
|
107
|
+
break. The two changes below are classified as if one did, because a changelog is where that
|
|
108
|
+
judgement is preserved and a judgement made after the fact is worth less.
|
|
109
|
+
|
|
110
|
+
### Breaking
|
|
111
|
+
|
|
112
|
+
- **`CmsAdapter` requires a `migrations` member.** A hand-written adapter that compiled
|
|
113
|
+
before this stops compiling. The three methods (`select`, `read`, `write`) are what the
|
|
114
|
+
migration runner drives, and they are required rather than optional deliberately: an
|
|
115
|
+
optional member would let an adapter silently have no migration path, and the failure
|
|
116
|
+
would arrive on the day somebody needed to move data between schema versions, which is the
|
|
117
|
+
worst possible day to discover it. Migration is checked against `manage-schema`, the same
|
|
118
|
+
permission that allows changing a shape. Consuming projects that use
|
|
119
|
+
`createFirestoreAdapter` need no change; the shipped adapter already implements it.
|
|
120
|
+
|
|
121
|
+
- **`can()` no longer widens a permission when a content type's matrix lists a role.**
|
|
122
|
+
Ticking `author` under `delete` used to make `can(author, "delete", { type })` answer
|
|
123
|
+
`true`, while `firestore.rules` answered permission-denied, because the rule resolves the
|
|
124
|
+
role default from the token and a matrix cannot grant an action the role does not have.
|
|
125
|
+
The resolver was reconciled to the rules rather than the other way round: a rule that
|
|
126
|
+
reads a privilege out of a document is letting a document grant a privilege. A matrix
|
|
127
|
+
narrows and never widens. The visible effect for a consuming project is a UI affordance
|
|
128
|
+
that used to be enabled and is now correctly disabled; nothing that previously worked
|
|
129
|
+
stops working, because the write was already refused.
|
|
130
|
+
|
|
131
|
+
### Added
|
|
132
|
+
|
|
133
|
+
- The `@nonext/husk` package itself: twelve entry points (`.`, `/admin`, `/admin/ui`,
|
|
134
|
+
`/auth`, `/client`, `/server`, `/core`, `/firebase`, `/permissions`, `/richtext`,
|
|
135
|
+
`/schema`, `/types`) plus `./admin.css`, built to ESM with type declarations.
|
|
136
|
+
- `packages/cms/api/public-api.md`: the reviewed public API report, shipped in the tarball.
|
|
137
|
+
|
|
138
|
+
### Changed
|
|
139
|
+
|
|
140
|
+
- **`@nonext/husk/firebase` no longer exports the Firestore layout.** Removed:
|
|
141
|
+
`bootstrapPath`, `BOOTSTRAP_KEY`, `contentPath`, `entriesPath`, `entryPath`, `mediaPath`,
|
|
142
|
+
`schemaPath`, `settingsPath`, `storageObjectPath`, `userPath`, `RESERVED_COLLECTIONS`,
|
|
143
|
+
`entryFromStored`, `metaFromStored`, `valuesFromStored`, `valuesToStored`, `toIso`,
|
|
144
|
+
`toTimestamp`, `userFromStored`, and the duplicate `slugFieldKey` (still exported from
|
|
145
|
+
`.` and `/core`). Read and write through `CmsAdapter`. Publishing the collection paths
|
|
146
|
+
would have made every future change to the Firestore layout a breaking change for every
|
|
147
|
+
customer project, which is the property the adapter exists to prevent. See
|
|
148
|
+
`.docs/decisions/2026-09-19-package-public-surface.md`.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# PolyForm Shield License 1.0.0
|
|
2
|
+
|
|
3
|
+
<https://polyformproject.org/licenses/shield/1.0.0>
|
|
4
|
+
|
|
5
|
+
Required Notice: Copyright Nonext (https://github.com/nonext-at/nonext-husk)
|
|
6
|
+
|
|
7
|
+
## Acceptance
|
|
8
|
+
|
|
9
|
+
In order to get any license under these terms, you must agree
|
|
10
|
+
to them as both strict obligations and conditions to all
|
|
11
|
+
your licenses.
|
|
12
|
+
|
|
13
|
+
## Copyright License
|
|
14
|
+
|
|
15
|
+
The licensor grants you a copyright license for the
|
|
16
|
+
software to do everything you might do with the software
|
|
17
|
+
that would otherwise infringe the licensor's copyright
|
|
18
|
+
in it for any permitted purpose. However, you may
|
|
19
|
+
only distribute the software according to [Distribution
|
|
20
|
+
License](#distribution-license) and make changes or new works
|
|
21
|
+
based on the software according to [Changes and New Works
|
|
22
|
+
License](#changes-and-new-works-license).
|
|
23
|
+
|
|
24
|
+
## Distribution License
|
|
25
|
+
|
|
26
|
+
The licensor grants you an additional copyright license
|
|
27
|
+
to distribute copies of the software. Your license
|
|
28
|
+
to distribute covers distributing the software with
|
|
29
|
+
changes and new works permitted by [Changes and New Works
|
|
30
|
+
License](#changes-and-new-works-license).
|
|
31
|
+
|
|
32
|
+
## Notices
|
|
33
|
+
|
|
34
|
+
You must ensure that anyone who gets a copy of any part of
|
|
35
|
+
the software from you also gets a copy of these terms or the
|
|
36
|
+
URL for them above, as well as copies of any plain-text lines
|
|
37
|
+
beginning with `Required Notice:` that the licensor provided
|
|
38
|
+
with the software. For example:
|
|
39
|
+
|
|
40
|
+
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
|
|
41
|
+
|
|
42
|
+
## Changes and New Works License
|
|
43
|
+
|
|
44
|
+
The licensor grants you an additional copyright license to
|
|
45
|
+
make changes and new works based on the software for any
|
|
46
|
+
permitted purpose.
|
|
47
|
+
|
|
48
|
+
## Patent License
|
|
49
|
+
|
|
50
|
+
The licensor grants you a patent license for the software that
|
|
51
|
+
covers patent claims the licensor can license, or becomes able
|
|
52
|
+
to license, that you would infringe by using the software.
|
|
53
|
+
|
|
54
|
+
## Noncompete
|
|
55
|
+
|
|
56
|
+
Any purpose is a permitted purpose, except for providing any
|
|
57
|
+
product that competes with the software or any product the
|
|
58
|
+
licensor or any of its affiliates provides using the software.
|
|
59
|
+
|
|
60
|
+
## Competition
|
|
61
|
+
|
|
62
|
+
Goods and services compete even when they provide functionality
|
|
63
|
+
through different kinds of interfaces or for different technical
|
|
64
|
+
platforms. Applications can compete with services, libraries
|
|
65
|
+
with plugins, frameworks with development tools, and so on,
|
|
66
|
+
even if they're written in different programming languages
|
|
67
|
+
or for different computer architectures. Goods and services
|
|
68
|
+
compete even when provided free of charge. If you market a
|
|
69
|
+
product as a practical substitute for the software or another
|
|
70
|
+
product, it definitely competes.
|
|
71
|
+
|
|
72
|
+
## New Products
|
|
73
|
+
|
|
74
|
+
If you are using the software to provide a product that does
|
|
75
|
+
not compete, but the licensor or any of its affiliates brings
|
|
76
|
+
your product into competition by providing a new version of
|
|
77
|
+
the software or another product using the software, you may
|
|
78
|
+
continue using versions of the software available under these
|
|
79
|
+
terms beforehand to provide your competing product, but not
|
|
80
|
+
any later versions.
|
|
81
|
+
|
|
82
|
+
## Discontinued Products
|
|
83
|
+
|
|
84
|
+
You may begin using the software to compete with a product
|
|
85
|
+
or service that the licensor or any of its affiliates has
|
|
86
|
+
stopped providing, unless the licensor includes a plain-text
|
|
87
|
+
line beginning with `Licensor Line of Business:` with the
|
|
88
|
+
software that mentions that line of business. For example:
|
|
89
|
+
|
|
90
|
+
> Licensor Line of Business: YoyodyneCMS Content Management
|
|
91
|
+
System (http://example.com/cms)
|
|
92
|
+
|
|
93
|
+
## Sales of Business
|
|
94
|
+
|
|
95
|
+
If the licensor or any of its affiliates sells a line of
|
|
96
|
+
business developing the software or using the software
|
|
97
|
+
to provide a product, the buyer can also enforce
|
|
98
|
+
[Noncompete](#noncompete) for that product.
|
|
99
|
+
|
|
100
|
+
## Fair Use
|
|
101
|
+
|
|
102
|
+
You may have "fair use" rights for the software under the
|
|
103
|
+
law. These terms do not limit them.
|
|
104
|
+
|
|
105
|
+
## No Other Rights
|
|
106
|
+
|
|
107
|
+
These terms do not allow you to sublicense or transfer any of
|
|
108
|
+
your licenses to anyone else, or prevent the licensor from
|
|
109
|
+
granting licenses to anyone else. These terms do not imply
|
|
110
|
+
any other licenses.
|
|
111
|
+
|
|
112
|
+
## Patent Defense
|
|
113
|
+
|
|
114
|
+
If you make any written claim that the software infringes or
|
|
115
|
+
contributes to infringement of any patent, your patent license
|
|
116
|
+
for the software granted under these terms ends immediately. If
|
|
117
|
+
your company makes such a claim, your patent license ends
|
|
118
|
+
immediately for work on behalf of your company.
|
|
119
|
+
|
|
120
|
+
## Violations
|
|
121
|
+
|
|
122
|
+
The first time you are notified in writing that you have
|
|
123
|
+
violated any of these terms, or done anything with the software
|
|
124
|
+
not covered by your licenses, your licenses can nonetheless
|
|
125
|
+
continue if you come into full compliance with these terms,
|
|
126
|
+
and take practical steps to correct past violations, within
|
|
127
|
+
32 days of receiving notice. Otherwise, all your licenses
|
|
128
|
+
end immediately.
|
|
129
|
+
|
|
130
|
+
## No Liability
|
|
131
|
+
|
|
132
|
+
***As far as the law allows, the software comes as is, without
|
|
133
|
+
any warranty or condition, and the licensor will not be liable
|
|
134
|
+
to you for any damages arising out of these terms or the use
|
|
135
|
+
or nature of the software, under any kind of legal claim.***
|
|
136
|
+
|
|
137
|
+
## Definitions
|
|
138
|
+
|
|
139
|
+
The **licensor** is the individual or entity offering these
|
|
140
|
+
terms, and the **software** is the software the licensor makes
|
|
141
|
+
available under these terms.
|
|
142
|
+
|
|
143
|
+
A **product** can be a good or service, or a combination
|
|
144
|
+
of them.
|
|
145
|
+
|
|
146
|
+
**You** refers to the individual or entity agreeing to these
|
|
147
|
+
terms.
|
|
148
|
+
|
|
149
|
+
**Your company** is any legal entity, sole proprietorship,
|
|
150
|
+
or other kind of organization that you work for, plus all
|
|
151
|
+
its affiliates.
|
|
152
|
+
|
|
153
|
+
**Affiliates** means the other organizations than an
|
|
154
|
+
organization has control over, is under the control of, or is
|
|
155
|
+
under common control with.
|
|
156
|
+
|
|
157
|
+
**Control** means ownership of substantially all the assets of
|
|
158
|
+
an entity, or the power to direct its management and policies
|
|
159
|
+
by vote, contract, or otherwise. Control can be direct or
|
|
160
|
+
indirect.
|
|
161
|
+
|
|
162
|
+
**Your licenses** are all the licenses granted to you for the
|
|
163
|
+
software under these terms.
|
|
164
|
+
|
|
165
|
+
**Use** means anything you do with the software requiring one
|
|
166
|
+
of your licenses.
|
package/README.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# @nonext/husk
|
|
2
|
+
|
|
3
|
+
Nonext CMS, spoken name **Husk**. A schema-driven CMS for Next.js and Firebase, mounted at
|
|
4
|
+
`/admin` inside the customer's own Next app.
|
|
5
|
+
|
|
6
|
+
The site stays a normal modern frontend. Husk adds an admin UI plus a typed read SDK, so an
|
|
7
|
+
editor changes content without touching Firebase, code, or a deployment.
|
|
8
|
+
|
|
9
|
+
- Content types generate the sidebar, the list views, the forms, the validation and the CRUD.
|
|
10
|
+
- Code-defined types (TypeScript, in git, lockable) coexist with types created in the admin
|
|
11
|
+
Schema Builder without a deploy.
|
|
12
|
+
- Firebase stays behind an adapter. Nothing in the SDK names a collection or a document id.
|
|
13
|
+
- One Firebase project per customer. No shared multi-tenant project.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
The package is not on npm yet. Until the public surface stops moving, customer projects
|
|
18
|
+
consume the git dependency.
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@nonext/husk": "github:nonext-at/nonext-husk#semver:^0.1.0"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
That resolves a git tag rather than a branch, so an install is reproducible and a push to
|
|
29
|
+
`main` does not change what a customer already has. Pinning one exact tag works too, and is
|
|
30
|
+
what a project that is not watching this repository should do:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{ "dependencies": { "@nonext/husk": "github:nonext-at/nonext-husk#v0.1.0" } }
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The repository is a pnpm workspace and the package lives in `packages/cms`, so a plain git
|
|
37
|
+
dependency on the repository root does not resolve the package by itself. Two working
|
|
38
|
+
options:
|
|
39
|
+
|
|
40
|
+
1. **A packed tarball**, which is what the release workflow attaches to every GitHub release:
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{ "dependencies": { "@nonext/husk": "https://github.com/nonext-at/nonext-husk/releases/download/v0.1.0/nonext-husk-0.1.0.tgz" } }
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
No build step at install time, identical bytes to what npm would serve, and it works with
|
|
47
|
+
npm, pnpm and yarn without further configuration. This is the recommended path.
|
|
48
|
+
|
|
49
|
+
2. **A git dependency plus `prepare`**, if a project must track a branch. The consuming
|
|
50
|
+
project needs pnpm, because the workspace has to install before the package can build.
|
|
51
|
+
|
|
52
|
+
Once the surface is stable the package is published and the install line becomes
|
|
53
|
+
`pnpm add @nonext/husk`. Nothing else about the wiring changes.
|
|
54
|
+
|
|
55
|
+
### Peer dependencies
|
|
56
|
+
|
|
57
|
+
Supplied by the customer app, never bundled by this package:
|
|
58
|
+
|
|
59
|
+
| Peer | Range |
|
|
60
|
+
|---|---|
|
|
61
|
+
| `next` | `^16.0.0` |
|
|
62
|
+
| `react` | `^19.0.0` |
|
|
63
|
+
| `react-dom` | `^19.0.0` |
|
|
64
|
+
| `firebase` | `^12.0.0` |
|
|
65
|
+
|
|
66
|
+
Two copies of React or of the Firebase SDK is two contexts, two app instances, and hooks
|
|
67
|
+
that throw, so this is enforced by a test rather than left to convention.
|
|
68
|
+
|
|
69
|
+
## Setting up a project
|
|
70
|
+
|
|
71
|
+
The package ships a binary. Inside an existing Next.js App Router project:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npx nonext-husk init # scaffold the admin, the config, the rules and the indexes
|
|
75
|
+
npx nonext-husk doctor # check an existing installation
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`init` asks for the Firebase project, the admin route, the media library, authentication
|
|
79
|
+
and the emulators; `--yes` takes the defaults. It refuses to overwrite a file that exists
|
|
80
|
+
and differs, and prints the difference rather than replacing your work. `doctor` exits
|
|
81
|
+
non-zero when it finds a problem and reports what it cannot check without a real Firebase
|
|
82
|
+
project as `unchecked`, with the reason.
|
|
83
|
+
|
|
84
|
+
The full six-step setup, including the parts Husk deliberately leaves to you outside an
|
|
85
|
+
emulator, is in `docs/getting-started.md` in the repository.
|
|
86
|
+
|
|
87
|
+
## Entry points
|
|
88
|
+
|
|
89
|
+
| Import | What it is |
|
|
90
|
+
|---|---|
|
|
91
|
+
| `@nonext/husk` | Schema, registry, validation, permissions, types. No React, no Next, no Firebase. |
|
|
92
|
+
| `@nonext/husk/core` | The same surface under a narrower name. |
|
|
93
|
+
| `@nonext/husk/types` | Types only. |
|
|
94
|
+
| `@nonext/husk/schema` | Validation and the field-type registry. |
|
|
95
|
+
| `@nonext/husk/permissions` | `can()`, the one permission truth table. |
|
|
96
|
+
| `@nonext/husk/server` | The read SDK for server code. Preview lives here. |
|
|
97
|
+
| `@nonext/husk/client` | The read SDK for browser code. No preview, by construction. |
|
|
98
|
+
| `@nonext/husk/richtext` | Rendering stored rich text. Separate so a project without a rich text field does not carry Tiptap. |
|
|
99
|
+
| `@nonext/husk/admin` | The server half of the admin: session, guard, route handlers, navigation as data. |
|
|
100
|
+
| `@nonext/husk/admin/ui` | The client half: every React component the admin renders. |
|
|
101
|
+
| `@nonext/husk/auth` | Sign-in, sign-up, roles, claims. |
|
|
102
|
+
| `@nonext/husk/firebase` | The wiring: adapter, auth and upload factories. Not the Firestore layout. |
|
|
103
|
+
| `@nonext/husk/admin.css` | The admin stylesheet. Import once. |
|
|
104
|
+
|
|
105
|
+
`@nonext/husk/admin` and `@nonext/husk/admin/ui` are separate on purpose, and merging them
|
|
106
|
+
back would break every admin route. A Next server component imports the first and gets no
|
|
107
|
+
React hook in its module graph.
|
|
108
|
+
|
|
109
|
+
`packages/cms/api/public-api.md`, shipped in this package as `api/public-api.md`, is the
|
|
110
|
+
reviewed list of every exported name with its type.
|
|
111
|
+
|
|
112
|
+
## Reading content
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
import { createServerCMS } from "@nonext/husk/server"
|
|
116
|
+
import { createFirestoreAdapter } from "@nonext/husk/firebase"
|
|
117
|
+
|
|
118
|
+
const cms = createServerCMS({
|
|
119
|
+
adapter: createFirestoreAdapter({ db }),
|
|
120
|
+
contentTypes: { projects, team },
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
const page = await cms.collection("projects").findMany({ limit: 12 })
|
|
124
|
+
const project = await cms.collection("projects").findBySlug(slug) // project.title is string
|
|
125
|
+
const home = await cms.single("home").get()
|
|
126
|
+
const cover = await cms.media().getById(project.cover.id)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The reader is published-only. `CmsQuery` has no `status`, so a draft cannot leak through a
|
|
130
|
+
forwarded query object or a URL parameter. Preview is a second instance
|
|
131
|
+
(`cms.preview()`) and exists on the server entry only.
|
|
132
|
+
|
|
133
|
+
## Versioning
|
|
134
|
+
|
|
135
|
+
`0.x`: the minor version is where breaking changes go, and a release note that describes one
|
|
136
|
+
says so in its first line. See `CHANGELOG.md`.
|
|
137
|
+
|
|
138
|
+
## License
|
|
139
|
+
|
|
140
|
+
UNLICENSED. Internal to Nonext customer projects.
|