create-grist-widget 0.2.10 → 0.2.11
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/package.json
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { useState } from "react"
|
|
2
|
+
|
|
1
3
|
import { Button } from "@/components/ui/button"
|
|
2
4
|
import { DEV_URL, formatDate, useVersions, versionUrl } from "@/lib/showcase-versions"
|
|
3
5
|
|
|
@@ -11,6 +13,43 @@ import { DEV_URL, formatDate, useVersions, versionUrl } from "@/lib/showcase-ver
|
|
|
11
13
|
// for this repo's own showcase as for a real scaffolded widget that happens
|
|
12
14
|
// to have something deployed at its own bare root; the only per-deploy
|
|
13
15
|
// difference is which /v<version>/ dirs actually exist upstream.
|
|
16
|
+
|
|
17
|
+
// A ready-to-paste instruction for an AI coding agent, not a human. Written
|
|
18
|
+
// to work first-shot: it explains *why* to scaffold into a subdirectory
|
|
19
|
+
// (create-grist-widget's CLI refuses a non-empty target -- and a repo
|
|
20
|
+
// Claude Code is already connected to always has a .git folder) rather than
|
|
21
|
+
// just saying "scaffold and push", which left room for the agent to try
|
|
22
|
+
// (and fail) `npm create grist-widget .` in place.
|
|
23
|
+
const CLAUDE_CODE_PROMPT = `Scaffold a new Grist custom widget here using \`npm create grist-widget\` (https://www.npmjs.com/package/create-grist-widget). This repo is an empty git clone already connected to GitHub, so scaffold into a new subdirectory first -- the CLI refuses a non-empty target directory, and this one already has a .git folder. Then push the scaffold's \`main\` and \`dev\` branches to this repository's own \`origin\` remote, so the bundled GitHub Pages deploy workflow runs. Report back the /latest/ and /v<version>/ GitHub Pages URLs once it's live.`
|
|
24
|
+
|
|
25
|
+
function CopyableBlock({ text }: { text: string }) {
|
|
26
|
+
const [copied, setCopied] = useState(false)
|
|
27
|
+
|
|
28
|
+
function copy() {
|
|
29
|
+
navigator.clipboard.writeText(text).then(() => {
|
|
30
|
+
setCopied(true)
|
|
31
|
+
setTimeout(() => setCopied(false), 1500)
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div className="relative">
|
|
37
|
+
<pre className="overflow-x-auto rounded-lg bg-muted p-4 pr-16 text-xs whitespace-pre-wrap">
|
|
38
|
+
<code>{text}</code>
|
|
39
|
+
</pre>
|
|
40
|
+
<Button
|
|
41
|
+
type="button"
|
|
42
|
+
variant="secondary"
|
|
43
|
+
size="sm"
|
|
44
|
+
className="absolute top-2 right-2"
|
|
45
|
+
onClick={copy}
|
|
46
|
+
>
|
|
47
|
+
{copied ? "Copied" : "Copy"}
|
|
48
|
+
</Button>
|
|
49
|
+
</div>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
14
53
|
export function TemplateLanding() {
|
|
15
54
|
const { versions, error } = useVersions()
|
|
16
55
|
|
|
@@ -21,7 +60,7 @@ export function TemplateLanding() {
|
|
|
21
60
|
grist-widget-template
|
|
22
61
|
</p>
|
|
23
62
|
<h1 className="font-heading text-3xl font-semibold tracking-tight">
|
|
24
|
-
Build
|
|
63
|
+
Build your own Grist custom widget
|
|
25
64
|
</h1>
|
|
26
65
|
<p className="mx-auto mt-3 max-w-md text-sm text-muted-foreground">
|
|
27
66
|
A React + TypeScript + Tailwind starting point for{" "}
|
|
@@ -34,12 +73,23 @@ export function TemplateLanding() {
|
|
|
34
73
|
<h2 className="mb-3 font-heading text-base font-semibold">
|
|
35
74
|
Using Claude Code?
|
|
36
75
|
</h2>
|
|
37
|
-
<ol className="
|
|
38
|
-
<li>
|
|
76
|
+
<ol className="list-inside list-decimal space-y-3 text-sm text-muted-foreground">
|
|
77
|
+
<li>
|
|
78
|
+
Create a new, empty GitHub repo for the widget.
|
|
79
|
+
<div className="mt-2 ml-5">
|
|
80
|
+
<Button asChild>
|
|
81
|
+
<a href="https://github.com/new" target="_blank" rel="noreferrer">
|
|
82
|
+
Create a new repository
|
|
83
|
+
</a>
|
|
84
|
+
</Button>
|
|
85
|
+
</div>
|
|
86
|
+
</li>
|
|
39
87
|
<li>
|
|
40
88
|
Install the{" "}
|
|
41
89
|
<a
|
|
42
90
|
href="https://github.com/apps/claude"
|
|
91
|
+
target="_blank"
|
|
92
|
+
rel="noreferrer"
|
|
43
93
|
className="underline underline-offset-4 hover:text-foreground"
|
|
44
94
|
>
|
|
45
95
|
Claude GitHub App
|
|
@@ -47,11 +97,20 @@ export function TemplateLanding() {
|
|
|
47
97
|
on that repo.
|
|
48
98
|
</li>
|
|
49
99
|
<li>
|
|
50
|
-
Start a Claude Code session connected to it and
|
|
51
|
-
|
|
100
|
+
Start a Claude Code session connected to it and paste this
|
|
101
|
+
prompt:
|
|
102
|
+
<div className="mt-2 ml-5">
|
|
103
|
+
<CopyableBlock text={CLAUDE_CODE_PROMPT} />
|
|
104
|
+
</div>
|
|
52
105
|
</li>
|
|
53
106
|
</ol>
|
|
54
|
-
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<details className="mb-10 rounded-lg border p-4 text-sm text-muted-foreground">
|
|
110
|
+
<summary className="cursor-pointer font-medium text-foreground">
|
|
111
|
+
Prefer to run it yourself?
|
|
112
|
+
</summary>
|
|
113
|
+
<pre className="mt-3 overflow-x-auto rounded-lg bg-muted p-4 text-xs">
|
|
55
114
|
<code>{`npm create grist-widget my-widget
|
|
56
115
|
cd my-widget
|
|
57
116
|
|
|
@@ -59,12 +118,7 @@ git remote add origin https://github.com/<owner>/<repo>.git
|
|
|
59
118
|
git push -u origin main
|
|
60
119
|
git push origin dev`}</code>
|
|
61
120
|
</pre>
|
|
62
|
-
|
|
63
|
-
<a href="https://github.com/new" target="_blank" rel="noreferrer">
|
|
64
|
-
Create a new repository
|
|
65
|
-
</a>
|
|
66
|
-
</Button>
|
|
67
|
-
</div>
|
|
121
|
+
</details>
|
|
68
122
|
|
|
69
123
|
<section>
|
|
70
124
|
<div className="mb-3 flex items-center justify-between">
|