create-pincast 0.1.0 → 0.2.0
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 +12 -5
- package/package.json +16 -5
- package/src/cli.js +5 -173
- package/src/api.js +0 -138
- package/src/firstrun.js +0 -83
- package/src/starter.js +0 -156
- package/template/LICENSE +0 -21
- package/template/README.md +0 -91
- package/template/_env.example +0 -8
- package/template/_gitignore +0 -5
- package/template/_package-lock.json +0 -2626
- package/template/data/sample-collects.json +0 -12
- package/template/data/set.json +0 -14
- package/template/index.html +0 -12
- package/template/package.json +0 -28
- package/template/server/collection.js +0 -23
- package/template/server/index.js +0 -45
- package/template/server/route.js +0 -74
- package/template/shared/app.js +0 -11
- package/template/src/App.vue +0 -19
- package/template/src/lantern.css +0 -35
- package/template/src/main.js +0 -7
- package/template/src/tabletop.js +0 -27
- package/template/test/conformance.test.js +0 -18
- package/template/test/goldens/lantern-walk.table-laptop.html +0 -366
- package/template/test/goldens/lantern-walk.table-phone.html +0 -366
- package/template/test/mock-api.js +0 -48
- package/template/test/route.test.js +0 -142
- package/template/vite.config.js +0 -16
- package/template.json +0 -29
package/template/README.md
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
# Lantern Walk
|
|
2
|
-
|
|
3
|
-
A small app that shows a person's cards on the [Placecard kit's](https://www.npmjs.com/package/@pincast/placecard-kit) card table. Clone it and you'll have cards on screen with no account and no key. Add a key, and the same table shows real collects.
|
|
4
|
-
|
|
5
|
-
It's built with Vite and Vue, and the only Pincast code in it is the public kit.
|
|
6
|
-
|
|
7
|
-
## Run it
|
|
8
|
-
|
|
9
|
-
You need Node 20.12 or later.
|
|
10
|
-
|
|
11
|
-
```sh
|
|
12
|
-
git clone <this repository>
|
|
13
|
-
cd pincast-kit-example
|
|
14
|
-
npm ci
|
|
15
|
-
npm run dev
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Open http://localhost:5173. Five sample cards are on the table, and three more wait under the Missing chip. With no key, the app never calls Pincast.
|
|
19
|
-
|
|
20
|
-
## Go live
|
|
21
|
-
|
|
22
|
-
Every Pincast key is live, so anything you write with one is real. [Test and live](https://docs.pincast.fm/concepts/test-and-live) covers how to get a key and how to keep experiments out of sight.
|
|
23
|
-
|
|
24
|
-
1. Copy the settings file, then put your key in `PINCAST_KEY`:
|
|
25
|
-
|
|
26
|
-
```sh
|
|
27
|
-
cp .env.example .env
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
2. In `shared/app.js`, change `APP.id` to your app's id: the part of your key between `pck_` and the next underscore. The app refuses a key for any other app.
|
|
31
|
-
|
|
32
|
-
3. Write the goldens again, because they carry the app id:
|
|
33
|
-
|
|
34
|
-
```sh
|
|
35
|
-
UPDATE_GOLDENS=1 npm test
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
4. Register the set. Its `meta.listed` is `false`, which keeps it off the Placecard map and front page.
|
|
39
|
-
|
|
40
|
-
```sh
|
|
41
|
-
set -a; . ./.env; set +a
|
|
42
|
-
curl -X PUT https://api.pincast.fm/v1/sets/old-town-lanterns \
|
|
43
|
-
-H "X-Pincast-Key: $PINCAST_KEY" \
|
|
44
|
-
-H "Content-Type: application/json" \
|
|
45
|
-
-d @data/set.json
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
5. Record one collect for a guest:
|
|
49
|
-
|
|
50
|
-
```sh
|
|
51
|
-
curl -X POST https://api.pincast.fm/v1/sets/old-town-lanterns/collects \
|
|
52
|
-
-H "X-Pincast-Key: $PINCAST_KEY" \
|
|
53
|
-
-H "Content-Type: application/json" \
|
|
54
|
-
-d '{ "card": "lantern:ferry-steps", "actor": { "id": "guest-lantern-1", "source": "anonymous" } }'
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
6. Set `PINCAST_ACTOR=guest-lantern-1` in `.env` and run `npm run dev` again. The line at the top of the page reads "Live from the Pincast API."
|
|
58
|
-
|
|
59
|
-
## Where things are
|
|
60
|
-
|
|
61
|
-
| File | What it does |
|
|
62
|
-
| :- | :- |
|
|
63
|
-
| `shared/app.js` | The app's id, name and color, its set, its face and its rarity words. |
|
|
64
|
-
| `data/set.json` | The set and its cards: the exact body of `PUT /v1/sets/:set`. The API doesn't send a set's cards back, so the app keeps this copy. |
|
|
65
|
-
| `data/sample-collects.json` | A saved answer of `GET /v1/sets/:set/collects`, used when there's no key. |
|
|
66
|
-
| `server/collection.js` | Turns the set and one person's collects into the kit's collection with `ttFromAppSet`. |
|
|
67
|
-
| `server/route.js` | `GET /api/collection`, the one route. It holds the key and calls the API. |
|
|
68
|
-
| `server/index.js` | The production server. In development, Vite mounts the same route. |
|
|
69
|
-
| `src/tabletop.js` | The table's config for `createTabletop`. |
|
|
70
|
-
| `src/lantern.css` | The theme, and the app's own face under `.ttf[data-face="lantern"]`. |
|
|
71
|
-
| `test/conformance.test.js` | The kit's `ttConformance` suite, run on this app's config. |
|
|
72
|
-
| `test/route.test.js` | The route against a local mock of the API. The tests never reach Pincast. |
|
|
73
|
-
|
|
74
|
-
## Two rules this app follows
|
|
75
|
-
|
|
76
|
-
- **The key stays on the server.** Only `server/route.js` reads it. The page gets the finished collection.
|
|
77
|
-
- **The browser doesn't choose the person.** The route reads `PINCAST_ACTOR` from the server's settings, and a real app takes the person from its own sign-in session. If the browser could send the id, anyone could read anyone's cards through your key.
|
|
78
|
-
|
|
79
|
-
## Check it
|
|
80
|
-
|
|
81
|
-
```sh
|
|
82
|
-
npm test # the route tests and the kit's conformance suite
|
|
83
|
-
npm run build # builds the page into dist
|
|
84
|
-
npm start # serves dist and the route on http://127.0.0.1:4173
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
A change to the theme or the face's markup changes the goldens in `test/goldens`. Read the difference, then write them again with `UPDATE_GOLDENS=1 npm test`.
|
|
88
|
-
|
|
89
|
-
## License
|
|
90
|
-
|
|
91
|
-
MIT. See [LICENSE](LICENSE).
|
package/template/_env.example
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Leave PINCAST_KEY empty and the app shows its sample cards, with no network call.
|
|
2
|
-
|
|
3
|
-
# Your app's key. It stays on the server: only server/route.js reads it.
|
|
4
|
-
PINCAST_KEY=
|
|
5
|
-
|
|
6
|
-
# The person whose cards to show: the id your app sends in collects.
|
|
7
|
-
# In a real app this comes from your own sign-in session, never from the browser.
|
|
8
|
-
PINCAST_ACTOR=
|