@nocode-factory/sanity-kit 2.61.1 → 2.62.0-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 +16 -0
- package/dist/index.d.ts +13 -4
- package/dist/index.js +60 -71
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useKitUpdate.ts +22 -2
- package/src/index.ts +1 -1
- package/src/tools/navbar/KitUpdate.tsx +17 -22
- package/src/version.ts +1 -1
package/package.json
CHANGED
|
@@ -10,8 +10,27 @@ export interface KitUpdate {
|
|
|
10
10
|
latest: string | null
|
|
11
11
|
/** Vrai seulement quand une version stable dépasse celle qui s'exécute. */
|
|
12
12
|
available: boolean
|
|
13
|
-
/** Commande à
|
|
13
|
+
/** Commande de mise à jour (la seule qui affiche ce qu'il reste à brancher). */
|
|
14
14
|
command: string
|
|
15
|
+
/**
|
|
16
|
+
* Consigne complète à coller dans Claude Code : mise à jour, branchements listés,
|
|
17
|
+
* corrections signalées par doctor (`_type` compris), déploiement du Studio,
|
|
18
|
+
* préprod. Ce que copie le bouton : une seule action pour l'équipe.
|
|
19
|
+
*/
|
|
20
|
+
prompt: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const UPGRADE_COMMAND = `npx -y ${PACKAGE}@latest upgrade`
|
|
24
|
+
|
|
25
|
+
/** Consigne copiée par le bouton de mise à jour (testée : test/kit-update.test.ts). */
|
|
26
|
+
export function upgradePrompt(latest: string | null): string {
|
|
27
|
+
return [
|
|
28
|
+
`Update the NCF kit (${PACKAGE}) on this project${latest ? ` to ${latest}` : ''}:`,
|
|
29
|
+
`1. From studio/, run \`${UPGRADE_COMMAND}\` (never a plain npm install: it shows nothing of what is left to do).`,
|
|
30
|
+
`2. Wire everything it lists under "À brancher dans le projet", taking the code from the starter (nocode-factory/sanity-next-starter).`,
|
|
31
|
+
`3. Fix every ✖ reported by \`npx ncf-kit doctor\` until there are none (list items without _type: \`npx ncf-kit item-types\`, then \`--apply\`).`,
|
|
32
|
+
`4. Typecheck and build web/, deploy the Studio (\`npm run deploy\` in studio/), push a branch to preprod (not main), then tell me in plain words what changed and what to check.`,
|
|
33
|
+
].join('\n')
|
|
15
34
|
}
|
|
16
35
|
|
|
17
36
|
/**
|
|
@@ -51,6 +70,7 @@ export function useKitUpdate(): KitUpdate {
|
|
|
51
70
|
current: KIT_VERSION,
|
|
52
71
|
latest,
|
|
53
72
|
available,
|
|
54
|
-
command:
|
|
73
|
+
command: UPGRADE_COMMAND,
|
|
74
|
+
prompt: upgradePrompt(latest),
|
|
55
75
|
}
|
|
56
76
|
}
|
package/src/index.ts
CHANGED
|
@@ -400,7 +400,7 @@ export type {CodeEmbedTypeOptions} from './form/codeEmbedType'
|
|
|
400
400
|
export {CodeEditorInput, codeEditorInput} from './form/CodeEditorInput'
|
|
401
401
|
export type {CodeLanguage} from './form/CodeEditorInput'
|
|
402
402
|
export {CodeEmbedInput} from './form/CodeEmbedInput'
|
|
403
|
-
export {useKitUpdate} from './hooks/useKitUpdate'
|
|
403
|
+
export {useKitUpdate, upgradePrompt, UPGRADE_COMMAND} from './hooks/useKitUpdate'
|
|
404
404
|
export type {KitUpdate} from './hooks/useKitUpdate'
|
|
405
405
|
export {compareVersions, isPrerelease} from './lib/version'
|
|
406
406
|
export {SharePreview} from './tools/pages/SharePreview'
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {useState} from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import {Button, Flex, Stack, Text} from '@sanity/ui'
|
|
3
3
|
import {ArrowUpIcon} from '@sanity/icons/ArrowUp'
|
|
4
4
|
import {CheckmarkIcon} from '@sanity/icons/Checkmark'
|
|
5
5
|
import {CopyIcon} from '@sanity/icons/Copy'
|
|
6
6
|
import {InlinePopover} from '../../ui/Popover'
|
|
7
7
|
import {useKitUpdate} from '../../hooks/useKitUpdate'
|
|
8
|
-
import {BORDER, MONO} from '../../ui/tokens'
|
|
9
8
|
|
|
10
9
|
const CHANGELOG = 'https://github.com/nocode-factory/ncf-sanity-kit/blob/main/docs/CHANGELOG.md'
|
|
11
10
|
|
|
@@ -14,8 +13,8 @@ const CHANGELOG = 'https://github.com/nocode-factory/ncf-sanity-kit/blob/main/do
|
|
|
14
13
|
*
|
|
15
14
|
* **Il ne met pas à jour.** Un Studio tourne dans un navigateur : il ne peut
|
|
16
15
|
* ni installer un paquet sur le poste d'un développeur, ni se redéployer. Ce
|
|
17
|
-
* bouton dit ce qui manque et
|
|
18
|
-
*
|
|
16
|
+
* bouton dit ce qui manque et copie la consigne complète à donner à Claude Code
|
|
17
|
+
* (mise à jour, branchements, corrections, déploiement) : une seule action.
|
|
19
18
|
*
|
|
20
19
|
* Invisible tant que le kit est à jour : un bouton permanent qui ne dit rien
|
|
21
20
|
* finit par ne plus être lu.
|
|
@@ -28,7 +27,7 @@ export function NcfKitUpdate(props: {inline?: boolean}) {
|
|
|
28
27
|
|
|
29
28
|
const copy = async () => {
|
|
30
29
|
try {
|
|
31
|
-
await navigator.clipboard.writeText(update.
|
|
30
|
+
await navigator.clipboard.writeText(update.prompt)
|
|
32
31
|
setCopied(true)
|
|
33
32
|
} catch {
|
|
34
33
|
// Presse-papiers refusé : la commande reste sélectionnable à la main.
|
|
@@ -42,11 +41,12 @@ export function NcfKitUpdate(props: {inline?: boolean}) {
|
|
|
42
41
|
trigger={({toggle}) => (
|
|
43
42
|
<Button
|
|
44
43
|
mode="bleed"
|
|
45
|
-
tone="
|
|
44
|
+
tone="critical"
|
|
46
45
|
fontSize={1}
|
|
47
46
|
padding={props.inline ? 2 : 3}
|
|
48
47
|
icon={ArrowUpIcon}
|
|
49
|
-
|
|
48
|
+
// Rouge et gras : une mise à jour en attente doit se voir.
|
|
49
|
+
text={<span style={{fontWeight: 700}}>{`Kit ${update.latest}`}</span>}
|
|
50
50
|
title={`A newer version of the kit is available (you are running ${update.current})`}
|
|
51
51
|
justify={props.inline ? undefined : 'flex-start'}
|
|
52
52
|
onClick={toggle}
|
|
@@ -64,20 +64,15 @@ export function NcfKitUpdate(props: {inline?: boolean}) {
|
|
|
64
64
|
</Text>
|
|
65
65
|
</Stack>
|
|
66
66
|
|
|
67
|
-
<Card padding={2} radius={2} style={{border: `1px solid ${BORDER}`}}>
|
|
68
|
-
<Text size={0} style={{...MONO, wordBreak: 'break-all'}}>
|
|
69
|
-
{update.command}
|
|
70
|
-
</Text>
|
|
71
|
-
</Card>
|
|
72
|
-
|
|
73
67
|
<Flex gap={2} wrap="wrap">
|
|
74
68
|
<Button
|
|
75
69
|
mode="default"
|
|
76
|
-
tone="
|
|
70
|
+
tone="critical"
|
|
77
71
|
fontSize={1}
|
|
78
72
|
padding={2}
|
|
79
73
|
icon={copied ? CheckmarkIcon : CopyIcon}
|
|
80
|
-
|
|
74
|
+
// Libellé versionné (« Copy Kit 2.62.0 ») ; copie la consigne pour Claude Code.
|
|
75
|
+
text={<span style={{fontWeight: 700}}>{copied ? 'Copied' : `Copy Kit ${update.latest}`}</span>}
|
|
81
76
|
onClick={copy}
|
|
82
77
|
/>
|
|
83
78
|
<Button
|
|
@@ -92,13 +87,13 @@ export function NcfKitUpdate(props: {inline?: boolean}) {
|
|
|
92
87
|
/>
|
|
93
88
|
</Flex>
|
|
94
89
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
</
|
|
90
|
+
{/* Pas de texte de la consigne ici : le panneau (240 px) le couperait et
|
|
91
|
+
cacherait le bouton. Le bouton suffit ; la consigne est dans le presse-papiers. */}
|
|
92
|
+
<Text size={0} muted>
|
|
93
|
+
Copies the full instructions for Claude Code. Paste them into Claude Code, opened
|
|
94
|
+
on this project: it updates the kit, wires what the project needs and redeploys
|
|
95
|
+
the Studio.
|
|
96
|
+
</Text>
|
|
102
97
|
</Stack>
|
|
103
98
|
)}
|
|
104
99
|
</InlinePopover>
|
package/src/version.ts
CHANGED