@nocode-factory/sanity-kit 2.70.2 → 2.70.4-rc.1
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 +49 -1
- package/README.md +2 -2
- package/bin/ncf-kit.mjs +6 -3
- package/dist/index.d.ts +17 -4
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useKitUpdate.ts +1 -1
- package/src/index.ts +1 -1
- package/src/lib/mainDocuments.ts +21 -6
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# Journal des versions
|
|
2
2
|
|
|
3
|
+
## 2.70.4 : Presentation retrouve le document des pages avec Sanity 6.24
|
|
4
|
+
|
|
5
|
+
### Corrigé
|
|
6
|
+
|
|
7
|
+
- **`ncfMainDocuments` : document principal introuvable, puis plantage de Presentation**
|
|
8
|
+
(Sanity >= 6.24, « Cannot read properties of null (reading '_id') »). Sanity passe le
|
|
9
|
+
paramètre répété des routes `<dossier>/:slug+` sous forme de LISTE de segments
|
|
10
|
+
(`["about-us"]`, `["telecom", "projets"]`) : le filtre `slug.current == $slug` ne
|
|
11
|
+
trouvait plus aucune page ni fiche de collection, et Presentation affichait « Missing a
|
|
12
|
+
main document » ou plantait. Ces routes passent par un `resolve` qui recolle les
|
|
13
|
+
segments (« telecom/projets ») ; une valeur déjà en texte reste inchangée. Filtres
|
|
14
|
+
identiques (mêmes types, même langue). Les autres routes (accueil, design system, pages
|
|
15
|
+
codées) n'utilisent pas `$slug` et ne changent pas.
|
|
16
|
+
- **Type `MainDocumentRoute`** : `{route, filter}` ou `{route, resolve}`, toujours accepté
|
|
17
|
+
tel quel par `defineDocuments`.
|
|
18
|
+
- Cas non couvert, propre à Sanity : un brouillon dont le slug diffère de la version
|
|
19
|
+
publiée n'a plus de document à ce slug en mode brouillon, et Sanity 6.24 plante encore
|
|
20
|
+
(vérification de null manquante chez Sanity).
|
|
21
|
+
|
|
22
|
+
### À brancher dans le projet
|
|
23
|
+
|
|
24
|
+
Rien. Un projet qui avait recopié ce correctif dans `studio/sanity.config.ts` (Circet USA)
|
|
25
|
+
le retire et revient à `defineDocuments(ncfMainDocuments(ncfOptions, {siteRoutes: routes}))`.
|
|
26
|
+
|
|
27
|
+
## 2.70.3 : instructions Claude du dépôt, docs renommées
|
|
28
|
+
|
|
29
|
+
### Modifié
|
|
30
|
+
|
|
31
|
+
- **`doctor`, Langues : consignes** : cherche les trois règles des langues dans `CLAUDE.md` ET
|
|
32
|
+
dans `.claude/rules/*.md`. Le starter range désormais ces règles dans
|
|
33
|
+
`.claude/rules/i18n.md` : sans ce changement, un projet créé depuis le nouveau starter
|
|
34
|
+
recevrait une fausse alerte.
|
|
35
|
+
- **Consigne copiée par le bouton « Kit x.y.z » du Studio** : « push a branch to preprod »
|
|
36
|
+
devient « commit on `preprod` and push `preprod` (never another branch, never `main`) ».
|
|
37
|
+
L'ancienne formule faisait pousser une branche de travail par mise à jour sur GitHub,
|
|
38
|
+
contraire à la règle Git des projets (preprod, puis main après validation explicite).
|
|
39
|
+
- **`doctor`, purge du cache (webhook)** : le message renvoie à `docs/handover.md` du
|
|
40
|
+
starter (anciennement `PASSATION.md`, nom toujours valable dans les projets plus anciens).
|
|
41
|
+
- **Dépôt du kit** : un `CLAUDE.md` (aucune consigne n'était chargée par Claude Code) et
|
|
42
|
+
des docs renommées en anglais, en minuscules avec tirets : `install.md`,
|
|
43
|
+
`new-project-setup.md`, `conventions.md`, `decisions.md`, `publishing.md`,
|
|
44
|
+
`original-brief.md` (ex-`BRIEF.md` à la racine). `CHANGELOG.md` garde son nom (lu par
|
|
45
|
+
le code du kit).
|
|
46
|
+
|
|
47
|
+
### À brancher dans le projet
|
|
48
|
+
|
|
49
|
+
Rien.
|
|
50
|
+
|
|
3
51
|
## 2.70.2 : création dans chaque langue (correction de la consigne de la 2.70.1)
|
|
4
52
|
|
|
5
53
|
### Corrigé
|
|
@@ -2322,5 +2370,5 @@ columns 5, faq 4`, blocs imbriqués dans `section.columns` compris.
|
|
|
2322
2370
|
### À savoir
|
|
2323
2371
|
|
|
2324
2372
|
- Le playground utilise le dataset `staging` du projet `xrwnc0un`
|
|
2325
|
-
(voir `docs/
|
|
2373
|
+
(voir `docs/decisions.md`, point 6).
|
|
2326
2374
|
- Les trois outils n'affichent pas encore de données réelles : phases 2 à 4.
|
package/README.md
CHANGED
|
@@ -262,6 +262,6 @@ fetchpriority). `doctor` vérifie l'étape de CI.
|
|
|
262
262
|
|
|
263
263
|
## Documentation
|
|
264
264
|
|
|
265
|
-
Dans le dépôt `nocode-factory/ncf-sanity-kit` : `docs/
|
|
266
|
-
`docs/
|
|
265
|
+
Dans le dépôt `nocode-factory/ncf-sanity-kit` : `docs/install.md` (options),
|
|
266
|
+
`docs/new-project-setup.md` (prompt d'installation), `docs/CHANGELOG.md`. Le
|
|
267
267
|
starter `nocode-factory/sanity-next-starter` est déjà câblé de bout en bout.
|
package/bin/ncf-kit.mjs
CHANGED
|
@@ -549,8 +549,11 @@ async function doctor() {
|
|
|
549
549
|
: ok('Langues : titres du registre', 'complets')
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
|
-
|
|
553
|
-
|
|
552
|
+
// Consignes Claude : CLAUDE.md, et depuis le starter de nov. 2026 les règles par domaine (.claude/rules/).
|
|
553
|
+
const rulesDir = join(root, '.claude', 'rules')
|
|
554
|
+
const ruleFiles = existsSync(rulesDir) ? readdirSync(rulesDir).filter((f) => f.endsWith('.md')).map((f) => join(rulesDir, f)) : []
|
|
555
|
+
const rules = [join(root, 'CLAUDE.md'), ...ruleFiles].map(read).join('\n')
|
|
556
|
+
rules.trim() && !/trois règles/i.test(rules) && warn('Langues : consignes', need('les trois règles des langues dans les consignes Claude (CLAUDE.md ou .claude/rules/)', 'Claude ne les connaîtrait pas dans ce projet', 'reprendre .claude/rules/i18n.md du starter (bloc « LANGUES » du CLAUDE.md dans les anciens projets).'))
|
|
554
557
|
}
|
|
555
558
|
const hasDefaults = studioFiles.some((f) => /defineComponentDefaults\(|name:\s*['"]componentDefaults['"]/.test(read(f)))
|
|
556
559
|
if (!hasDefaults) {
|
|
@@ -718,7 +721,7 @@ async function doctor() {
|
|
|
718
721
|
const host = new URL(previewUrl).host
|
|
719
722
|
const hook = hooks.find((h) => typeof h.url === 'string' && /\/api\/revalidate/.test(h.url) && h.url.includes(host))
|
|
720
723
|
if (!list.ok) warn('Purge du cache (webhook)', `webhooks Sanity illisibles (${list.status}) : le jeton administre-t-il ce projet ?`)
|
|
721
|
-
else if (!hook) ko('Purge du cache (webhook)', `le kit a besoin d'un webhook Sanity vers ${endpoint} (purge du cache à la publication, relayée à la préprod) ; le projet ne l'a pas : Sanity → API → Webhooks, avec le secret SANITY_REVALIDATE_SECRET (voir
|
|
724
|
+
else if (!hook) ko('Purge du cache (webhook)', `le kit a besoin d'un webhook Sanity vers ${endpoint} (purge du cache à la publication, relayée à la préprod) ; le projet ne l'a pas : Sanity → API → Webhooks, avec le secret SANITY_REVALIDATE_SECRET (voir docs/handover.md du starter ; PASSATION.md dans les projets plus anciens).`)
|
|
722
725
|
else if (hook.isDisabled || hook.isDisabledByUser) ko('Purge du cache (webhook)', `webhook « ${hook.name} » désactivé : la publication ne purge plus le cache.`)
|
|
723
726
|
else ok('Purge du cache (webhook)', `« ${hook.name} » → ${hook.url.split('?')[0]}`) // jamais le secret à l'écran
|
|
724
727
|
} else warn('Purge du cache (webhook)', 'non vérifié : SANITY_STUDIO_PROJECT_ID ou jeton Sanity absent (npx sanity login).')
|
package/dist/index.d.ts
CHANGED
|
@@ -1509,7 +1509,7 @@ export declare function ActorName(props: {
|
|
|
1509
1509
|
* quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
|
|
1510
1510
|
* le vérifie.
|
|
1511
1511
|
*/
|
|
1512
|
-
export declare const KIT_VERSION = "2.70.
|
|
1512
|
+
export declare const KIT_VERSION = "2.70.4-rc.1";
|
|
1513
1513
|
/**
|
|
1514
1514
|
* Données de la page proposées comme colonnes.
|
|
1515
1515
|
*
|
|
@@ -2198,11 +2198,24 @@ export declare function toCsv(rows: readonly CollectionRow[], columns: readonly
|
|
|
2198
2198
|
* Excel. No-op hors navigateur (rendu serveur, tests).
|
|
2199
2199
|
*/
|
|
2200
2200
|
export declare function downloadText(filename: string, text: string, mime?: string, withBom?: boolean): void;
|
|
2201
|
+
/**
|
|
2202
|
+
* Contexte passé par Presentation à `resolve`. Le type de Sanity annonce des textes,
|
|
2203
|
+
* mais un paramètre répété (`:slug+`) arrive en LISTE de segments (Sanity >= 6.24).
|
|
2204
|
+
*/
|
|
2205
|
+
interface MainDocumentContext {
|
|
2206
|
+
params: Record<string, string | string[] | undefined>;
|
|
2207
|
+
}
|
|
2201
2208
|
/** Une entrée de `presentationTool({resolve: {mainDocuments: defineDocuments([...])}})`. */
|
|
2202
|
-
|
|
2209
|
+
type MainDocumentRoute = {
|
|
2203
2210
|
route: string;
|
|
2204
2211
|
filter: string;
|
|
2205
|
-
}
|
|
2212
|
+
} | {
|
|
2213
|
+
route: string;
|
|
2214
|
+
resolve: (ctx: MainDocumentContext) => {
|
|
2215
|
+
filter: string;
|
|
2216
|
+
params: Record<string, string>;
|
|
2217
|
+
};
|
|
2218
|
+
};
|
|
2206
2219
|
/**
|
|
2207
2220
|
* Presentation : le document du panneau de droite est TOUJOURS celui de la page
|
|
2208
2221
|
* affichée, DANS SA LANGUE. Sans cette liste, changer de langue (ou de page) dans
|
|
@@ -2231,5 +2244,5 @@ export declare const NCF_DESIGN_SYSTEM_TOOL = "ncf-design-system";
|
|
|
2231
2244
|
export declare const NCF_ASSETS_TOOL = "ncf-assets";
|
|
2232
2245
|
export declare const NCF_TOOL_NAMES: readonly ["ncf-pages", "ncf-components", "ncf-history", "ncf-design-system", "ncf-assets"];
|
|
2233
2246
|
export declare const ncfKit: import("sanity").Plugin<NcfKitConfig>;
|
|
2234
|
-
export { type AddColumnInput, type Annotation, type AnnotationsState, type AssetAssignment, type AssetDoc, type AssetFolder, type AssetMetaState, type AssetSortKey, type AssetTypeFilter, type AssetUploadState, type AssetUsageFilter, type BlockOccurrence, type BlockTypeInfo, type BoardEdge, type BoardGraph, type BoardLayoutState, type BoardNode, CONTENT_SCAN_LIMIT as OCCURRENCE_SCAN_LIMIT, type Change, type ChangeKind, CodeEditorInput, CodeEmbedInput, type CodeEmbedTypeOptions, type CodeLanguage, type CollectedLinks, type CollectionCell, type CollectionColumn, type CollectionColumnKind, type CollectionDoc, type CollectionFilters, type CollectionRow, type CollectionSort, type CollectionState, type ColorBy, type ColorOptions, type ComponentEntry, type ComponentGroup, type ComponentGrouping, type ConfigIssue, type CrossLanguageReport, DEFAULT_COMPONENT_DEFAULTS_TYPE, type DeriveOptions, type FolderSelection, type GroupBy, type GroupOptions, type HistoryDetail, type HistoryEvent, type IssueLevel, type KitContextValue, type KitUpdate, type LayoutMode, type MainDocumentRoute, type MergedDoc, type NcfBoardTag, type NcfChoiceInputsOptions, type NcfCollectionsConfig, type NcfComponentPreviewConfig, type NcfDocumentColumn, type NcfEnvironment, type NcfHistoryConfig, type NcfI18nConfig, type NcfInternalField, type NcfInternalFieldOption, type NcfKitConfig, type NcfPageTypeConfig, type NcfPageTypeInput, type NcfToolName, type NcfToolsConfig, type NodeLayout, type NodePosition, type OccurrenceInput, type OccurrencePage, type OccurrencesState, type PageBuilderResolution, type PageContent, type PageContentsState, type PageDoc, type PageFilters, type PageRow, type PageStatus, type PagesState, type PathInput, type Positioned, type PresentationOptions, type PreviewGrant, type PreviewPerspective, type PreviewTargetState, type ProjectStatus, type Registration, type ResolvedCollections, type ResolvedComponentPreview, type ResolvedDocumentColumn, type ResolvedHistory, type ResolvedI18n, type ResolvedKitConfig, type ResolvedPageType, type RowColor, type RowGroup, type SchemaFieldLike, type SchemaTypeInfo, type SchemaTypeLike, type SectionLayout, type SectionMapNode, type SectionOrder, type SectionsMapOptions, type Segment, type SiteRoutesRegistry, type SortDirection, type SortKey, type ThumbnailInput, type VersionedDoc, codeEditorInput, componentDefaultsMainDocument, componentDefaultsMainDocuments, defaultsFieldName, defineCodeEmbedType, defineComponentDefaults, filterRows as filterCollectionRows, filterRows$1 as filterRows, fixCrossLanguageReferences, pageTypesFromSiteRoutes, requiredUnlessDefault, requiredUnlessDefaultFor, sortRows as sortCollectionRows, sortRows$1 as sortRows, withSameLanguageReferences };
|
|
2247
|
+
export { type AddColumnInput, type Annotation, type AnnotationsState, type AssetAssignment, type AssetDoc, type AssetFolder, type AssetMetaState, type AssetSortKey, type AssetTypeFilter, type AssetUploadState, type AssetUsageFilter, type BlockOccurrence, type BlockTypeInfo, type BoardEdge, type BoardGraph, type BoardLayoutState, type BoardNode, CONTENT_SCAN_LIMIT as OCCURRENCE_SCAN_LIMIT, type Change, type ChangeKind, CodeEditorInput, CodeEmbedInput, type CodeEmbedTypeOptions, type CodeLanguage, type CollectedLinks, type CollectionCell, type CollectionColumn, type CollectionColumnKind, type CollectionDoc, type CollectionFilters, type CollectionRow, type CollectionSort, type CollectionState, type ColorBy, type ColorOptions, type ComponentEntry, type ComponentGroup, type ComponentGrouping, type ConfigIssue, type CrossLanguageReport, DEFAULT_COMPONENT_DEFAULTS_TYPE, type DeriveOptions, type FolderSelection, type GroupBy, type GroupOptions, type HistoryDetail, type HistoryEvent, type IssueLevel, type KitContextValue, type KitUpdate, type LayoutMode, type MainDocumentContext, type MainDocumentRoute, type MergedDoc, type NcfBoardTag, type NcfChoiceInputsOptions, type NcfCollectionsConfig, type NcfComponentPreviewConfig, type NcfDocumentColumn, type NcfEnvironment, type NcfHistoryConfig, type NcfI18nConfig, type NcfInternalField, type NcfInternalFieldOption, type NcfKitConfig, type NcfPageTypeConfig, type NcfPageTypeInput, type NcfToolName, type NcfToolsConfig, type NodeLayout, type NodePosition, type OccurrenceInput, type OccurrencePage, type OccurrencesState, type PageBuilderResolution, type PageContent, type PageContentsState, type PageDoc, type PageFilters, type PageRow, type PageStatus, type PagesState, type PathInput, type Positioned, type PresentationOptions, type PreviewGrant, type PreviewPerspective, type PreviewTargetState, type ProjectStatus, type Registration, type ResolvedCollections, type ResolvedComponentPreview, type ResolvedDocumentColumn, type ResolvedHistory, type ResolvedI18n, type ResolvedKitConfig, type ResolvedPageType, type RowColor, type RowGroup, type SchemaFieldLike, type SchemaTypeInfo, type SchemaTypeLike, type SectionLayout, type SectionMapNode, type SectionOrder, type SectionsMapOptions, type Segment, type SiteRoutesRegistry, type SortDirection, type SortKey, type ThumbnailInput, type VersionedDoc, codeEditorInput, componentDefaultsMainDocument, componentDefaultsMainDocuments, defaultsFieldName, defineCodeEmbedType, defineComponentDefaults, filterRows as filterCollectionRows, filterRows$1 as filterRows, fixCrossLanguageReferences, pageTypesFromSiteRoutes, requiredUnlessDefault, requiredUnlessDefaultFor, sortRows as sortCollectionRows, sortRows$1 as sortRows, withSameLanguageReferences };
|
|
2235
2248
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1485,7 +1485,7 @@ function explainGrantError(error) {
|
|
|
1485
1485
|
* quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
|
|
1486
1486
|
* le vérifie.
|
|
1487
1487
|
*/
|
|
1488
|
-
const KIT_VERSION = "2.70.
|
|
1488
|
+
const KIT_VERSION = "2.70.4-rc.1";
|
|
1489
1489
|
/**
|
|
1490
1490
|
* Signale ce Studio au service du kit, une fois par montage.
|
|
1491
1491
|
*
|
|
@@ -1969,7 +1969,7 @@ function upgradePrompt(latest) {
|
|
|
1969
1969
|
`1. From studio/, run \`${UPGRADE_COMMAND}\` (never a plain npm install: it shows nothing of what is left to do).`,
|
|
1970
1970
|
"2. Wire everything it lists under \"À brancher dans le projet\", taking the code from the starter (nocode-factory/sanity-next-starter).",
|
|
1971
1971
|
"3. Fix every ✖ reported by `npx ncf-kit doctor` until there are none (list items without _type: `npx ncf-kit item-types`, then `--apply`).",
|
|
1972
|
-
"4. Typecheck and build web/, deploy the Studio (`npm run deploy` in studio/),
|
|
1972
|
+
"4. Typecheck and build web/, deploy the Studio (`npm run deploy` in studio/), commit on `preprod` and push `preprod` (never another branch, never `main`: production only after my explicit validation), then tell me in plain words what changed and what to check."
|
|
1973
1973
|
].join("\n");
|
|
1974
1974
|
}
|
|
1975
1975
|
/**
|
|
@@ -1993,7 +1993,7 @@ function useKitUpdate() {
|
|
|
1993
1993
|
!controller.signal.aborted && body?.version && setLatest(body.version);
|
|
1994
1994
|
}).catch(() => {}), () => controller.abort();
|
|
1995
1995
|
}, []);
|
|
1996
|
-
let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.70.
|
|
1996
|
+
let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.70.4-rc.1") > 0);
|
|
1997
1997
|
return {
|
|
1998
1998
|
current: KIT_VERSION,
|
|
1999
1999
|
latest,
|
|
@@ -14598,6 +14598,10 @@ function ncfCollections(S, context, options) {
|
|
|
14598
14598
|
return schemaType?.icon ? item.icon(schemaType.icon) : item;
|
|
14599
14599
|
});
|
|
14600
14600
|
}
|
|
14601
|
+
/** `$slug` en texte : segments d'un paramètre répété recollés par « / ». */
|
|
14602
|
+
function slugParam(value) {
|
|
14603
|
+
return Array.isArray(value) ? value.join("/") : value ?? "";
|
|
14604
|
+
}
|
|
14601
14605
|
const SAFE = /^[A-Za-z0-9_.-]+$/, quote = (value) => JSON.stringify(value);
|
|
14602
14606
|
/**
|
|
14603
14607
|
* Presentation : le document du panneau de droite est TOUJOURS celui de la page
|
|
@@ -14644,10 +14648,13 @@ function ncfMainDocuments(options, extra = {}) {
|
|
|
14644
14648
|
byBase.set(base, [...byBase.get(base) ?? [], t]);
|
|
14645
14649
|
}
|
|
14646
14650
|
for (let [base, types] of byBase) {
|
|
14647
|
-
let match = types.map((t) => `(_type == ${quote(t.type)} && ${t.slugField}.current == $slug)`)
|
|
14651
|
+
let match = types.map((t) => `(_type == ${quote(t.type)} && ${t.slugField}.current == $slug)`), filter = types.length === 1 && types[0] ? `_type == ${quote(types[0].type)} && ${types[0].slugField}.current == $slug${lang}` : `(${match.join(" || ")})${lang}`;
|
|
14648
14652
|
out.push({
|
|
14649
14653
|
route: at(`${base}/:slug+`),
|
|
14650
|
-
|
|
14654
|
+
resolve: (ctx) => ({
|
|
14655
|
+
filter,
|
|
14656
|
+
params: { slug: slugParam(ctx.params.slug) }
|
|
14657
|
+
})
|
|
14651
14658
|
});
|
|
14652
14659
|
}
|
|
14653
14660
|
}
|