@doikayt/typescript-build-config 0.1.25 → 0.1.27
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 +80 -47
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -6,15 +6,14 @@ Shared build configuration presets for TypeScript-based projects.
|
|
|
6
6
|
- [@doikayt/typescript-build-config](#doikayttypescript-build-config)
|
|
7
7
|
- [Purpose](#purpose)
|
|
8
8
|
- [Quick start](#quick-start)
|
|
9
|
+
- [Trying it out](#trying-it-out)
|
|
9
10
|
- [Design Goals](#design-goals)
|
|
10
11
|
- [What each component is for](#what-each-component-is-for)
|
|
11
12
|
- [Installation](#installation)
|
|
12
13
|
- [Usage](#usage)
|
|
13
14
|
- [The canonical script set](#the-canonical-script-set)
|
|
14
|
-
- [
|
|
15
|
-
- [UI / web project (with Playwright e2e)](#ui--web-project-with-playwright-e2e)
|
|
15
|
+
- [Optional Playwright config for Web / UI testing](#optional-playwright-config-for-web--ui-testing)
|
|
16
16
|
- [Existing project](#existing-project)
|
|
17
|
-
- [Trying it out (demo + scratch repo)](#trying-it-out-demo--scratch-repo)
|
|
18
17
|
- [Dependency Strategy](#dependency-strategy)
|
|
19
18
|
- [Current Contents](#current-contents)
|
|
20
19
|
- [Delivery Model](#delivery-model)
|
|
@@ -44,11 +43,15 @@ via the pipeline files it installs into each consumer repo and the canonical rel
|
|
|
44
43
|
|
|
45
44
|
## Quick start
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
These steps set up — in a fresh "new-developer" environment — a local git repo
|
|
47
|
+
with a skeleton demo app plus all the standard Doikayt build configuration:
|
|
48
|
+
tooling that auto-documents the code in the repo and lets it be pushed to
|
|
49
|
+
GitHub, built, and (for a library) published to npm. Steps are minimal here —
|
|
50
|
+
each links to the section that explains _what_ and _why_.
|
|
49
51
|
|
|
50
|
-
**1. One-time machine setup.** Clone this base repo and
|
|
51
|
-
[shell aliases](#team-shell-aliases)
|
|
52
|
+
**1. One-time machine setup — once per machine.** Clone this base repo and
|
|
53
|
+
install the shared team [shell aliases](#team-shell-aliases). This only sets up
|
|
54
|
+
the aliases (`dk-scaffold`, `mkrepo`); it does **not** configure any project:
|
|
52
55
|
|
|
53
56
|
```bash
|
|
54
57
|
git clone git@github.com:doikayt/typescript-build-config.git
|
|
@@ -57,9 +60,12 @@ cd typescript-build-config
|
|
|
57
60
|
exec $SHELL # reload
|
|
58
61
|
```
|
|
59
62
|
|
|
60
|
-
**2. Create a new project
|
|
61
|
-
|
|
62
|
-
`
|
|
63
|
+
**2. Create a new project — once per project.** The two paths below are
|
|
64
|
+
**alternatives that reach the same result** — a project wired to this base
|
|
65
|
+
package. `dk-scaffold` is the one-command wrapper that *also* creates the GitHub
|
|
66
|
+
repo and pushes it; the hand-run steps are what it runs under the hood. It
|
|
67
|
+
scaffolds build config + a runnable demo — choose `lib` (published) or `app`
|
|
68
|
+
(private, the default); see [library vs app](#usage) and
|
|
63
69
|
[Packaging concepts](docs/packaging-concepts.md):
|
|
64
70
|
|
|
65
71
|
```bash
|
|
@@ -76,6 +82,45 @@ npx @doikayt/typescript-build-config init # scripts, deps, publi
|
|
|
76
82
|
npm install # fetch declared devDependencies
|
|
77
83
|
```
|
|
78
84
|
|
|
85
|
+
### Trying it out
|
|
86
|
+
|
|
87
|
+
One wrapper, three levels — each adds one thing you bring and one thing you see.
|
|
88
|
+
Each scaffolds a throwaway **app** (nothing publishes) unless noted. Do the
|
|
89
|
+
one-time [Quick start step 1](#quick-start) first so `dk-scaffold` is on your
|
|
90
|
+
PATH.
|
|
91
|
+
|
|
92
|
+
**Level 0 — local, no accounts.** Scaffold and run the same gate CI runs — no
|
|
93
|
+
GitHub repo, no push:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
dk-scaffold my-demo --local
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Under the hood it runs `init` (demo=yes, app, no Playwright) then `npm run ci`.
|
|
100
|
+
You'll see the vitest demo tests pass, `npm run build` emit `dist/` + type
|
|
101
|
+
declarations, and `update-all-format` fill the README's TOC + UML markers
|
|
102
|
+
(mermaid **source** — rendered at Level 1). `npm publish --dry-run` **refuses** —
|
|
103
|
+
proof the app archetype never publishes.
|
|
104
|
+
|
|
105
|
+
**Level 1 — push to your own GitHub.** Add a GitHub account and `gh`
|
|
106
|
+
(`gh auth login`). Point the wrapper at your account and drop `--local`:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
export DOIKAYT_ORG=<your-github-username> # target owner for the repo
|
|
110
|
+
dk-scaffold my-demo # app (private) — no npm creds
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
It creates the repo and pushes. On GitHub you'll see the **mermaid diagrams
|
|
114
|
+
rendered** and the **CI job go green**. Push a follow-up **`feat:`** commit and
|
|
115
|
+
the **release job** version-bumps + tags — nothing published (app). (The initial
|
|
116
|
+
`chore: scaffold` push releases nothing; `feat:` / `fix:` triggers it.)
|
|
117
|
+
|
|
118
|
+
**Level 2 — publish to your own npm.** Scaffold a `lib` and bring your own npm
|
|
119
|
+
scope + `NPM` secret to watch `changeset publish` ship a real package. Full
|
|
120
|
+
procedure: [docs/verification-runbook.md](docs/verification-runbook.md);
|
|
121
|
+
non-`@doikayt`-scope setup:
|
|
122
|
+
[docs/verification-byo-prerequisites.md](docs/verification-byo-prerequisites.md).
|
|
123
|
+
|
|
79
124
|
## Design Goals
|
|
80
125
|
|
|
81
126
|
The package housed in this repo is designed to be 'upstream-most' -- i.e., all other
|
|
@@ -135,10 +180,12 @@ sets up the release pipeline (see below).
|
|
|
135
180
|
## Usage
|
|
136
181
|
|
|
137
182
|
After installing, run the `init` scaffolder to write the
|
|
138
|
-
[canonical npm-script set](#the-canonical-script-set)
|
|
139
|
-
dependencies those scripts need
|
|
140
|
-
|
|
141
|
-
|
|
183
|
+
[canonical npm-script set](#the-canonical-script-set), declare the dev
|
|
184
|
+
dependencies those scripts need — `vitest`, `@doikayt/autogen-markdown-doc`,
|
|
185
|
+
`typescript`, and `@changesets/cli` (the release pipeline needs it) — and seed a
|
|
186
|
+
commented `vitest.config.ts`. `init` is interactive and **idempotent** — it only
|
|
187
|
+
adds what is missing and never overwrites a script or config you already have, so
|
|
188
|
+
it is safe to re-run.
|
|
142
189
|
|
|
143
190
|
### The canonical script set
|
|
144
191
|
|
|
@@ -158,8 +205,10 @@ small single-purpose scripts, and the check side mirrors the write side:
|
|
|
158
205
|
| `update-code-formatting` / `check-code-formatting` | Prettier write / check. |
|
|
159
206
|
| `update-markdown-docs` / `check-markdown-docs` | Regenerate / verify generated markdown (TOC, UML, …). |
|
|
160
207
|
|
|
161
|
-
`init` also asks whether the project is a **publishable library
|
|
162
|
-
|
|
208
|
+
`init` also asks whether the project is a **publishable library**. That answer
|
|
209
|
+
sets the `package.json` fields that control publishing — `main`, `types`,
|
|
210
|
+
`exports`, `files`, `prepack`, `private` — non-destructively (it merges, it
|
|
211
|
+
doesn't overwrite your other keys):
|
|
163
212
|
|
|
164
213
|
- **Library** — `main` / `types` / `exports` → `dist/index.js`, `files: ["dist"]`,
|
|
165
214
|
and `prepack`, so it publishes a compiled, typed ESM package on push. `init`
|
|
@@ -172,7 +221,15 @@ publish config accordingly (non-destructively):
|
|
|
172
221
|
`dist/`, publish fields, library vs app)? See
|
|
173
222
|
[Packaging concepts](docs/packaging-concepts.md) for the background.
|
|
174
223
|
|
|
175
|
-
###
|
|
224
|
+
### Optional Playwright config for Web / UI testing
|
|
225
|
+
|
|
226
|
+
The above section covers _what_ `init` decides; the two recipes below are _how_
|
|
227
|
+
you run it. They differ only in the **Playwright?** answer — `n` for a
|
|
228
|
+
console/CLI or plain library, `y` for a UI / web project that needs end-to-end
|
|
229
|
+
tests. Library-vs-app is an orthogonal choice, so either shape can still be
|
|
230
|
+
published or kept private.
|
|
231
|
+
|
|
232
|
+
**Console / CLI or plain library — answer `n`:**
|
|
176
233
|
|
|
177
234
|
```bash
|
|
178
235
|
npx @doikayt/typescript-build-config new # npm init -y + @doikayt scope
|
|
@@ -181,15 +238,9 @@ npx @doikayt/typescript-build-config init # answer "n" to Playwright
|
|
|
181
238
|
npm install # fetch the declared devDependencies
|
|
182
239
|
```
|
|
183
240
|
|
|
184
|
-
`
|
|
185
|
-
|
|
186
|
-
`@
|
|
187
|
-
pipeline needs it), and seeds a commented `vitest.config.ts`. Answering the
|
|
188
|
-
"publishable library?" prompt sets the publish
|
|
189
|
-
config — `private` for an app, or `prepack` + the `dist/`-based fields for a
|
|
190
|
-
library (see [The canonical script set](#the-canonical-script-set)).
|
|
191
|
-
|
|
192
|
-
### UI / web project (with Playwright e2e)
|
|
241
|
+
**UI / web — answer `y`:** injects the end-to-end setup — adds a `test:e2e`
|
|
242
|
+
script and folds it into `ci` (so the release gate runs e2e), declares
|
|
243
|
+
`@playwright/test`, and seeds a `playwright.config.ts` template.
|
|
193
244
|
|
|
194
245
|
```bash
|
|
195
246
|
npx @doikayt/typescript-build-config new # npm init -y + @doikayt scope
|
|
@@ -199,11 +250,9 @@ npm install
|
|
|
199
250
|
# then fill in the TODOs in the generated playwright.config.ts (webServer, baseURL)
|
|
200
251
|
```
|
|
201
252
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
installed on demand by the bundled `doikayt-playwright-install` wrapper the
|
|
206
|
-
`test:e2e` script calls — no manual `playwright install` step, locally or in CI.
|
|
253
|
+
Browsers are installed on demand by the bundled `doikayt-playwright-install`
|
|
254
|
+
wrapper the `test:e2e` script calls — no manual `playwright install` step,
|
|
255
|
+
locally or in CI.
|
|
207
256
|
|
|
208
257
|
### Existing project
|
|
209
258
|
|
|
@@ -212,22 +261,6 @@ required targets (`ci`, `update-all-format`) until you add them — either by
|
|
|
212
261
|
running `init` to adopt the full canonical set, or by defining the two scripts
|
|
213
262
|
by hand (see [Conventions](#conventions-every-project-must-adhere-to)).
|
|
214
263
|
|
|
215
|
-
### Trying it out (demo + scratch repo)
|
|
216
|
-
|
|
217
|
-
Answer **yes** to the demo prompt and `init` seeds a minimal starter — a `src/`
|
|
218
|
-
module, a `README` with doc-generator markers, and a `project.json` — so a
|
|
219
|
-
brand-new project builds, tests, and (for a library) publishes on push.
|
|
220
|
-
|
|
221
|
-
To exercise a scaffold end-to-end without standing up a repo, push it to the
|
|
222
|
-
shared throwaway repo
|
|
223
|
-
**[`doikayt/scratch-pad`](https://github.com/doikayt/scratch-pad)** (force-overwrite
|
|
224
|
-
each run). The full procedure — for both a library and an app, with what to look
|
|
225
|
-
for at each step — is in [docs/verification-runbook.md](docs/verification-runbook.md):
|
|
226
|
-
|
|
227
|
-
- [Pushing to the scratch repo](docs/verification-runbook.md#pushing-to-a-reusable-scratch-repo)
|
|
228
|
-
- [Testing publish without cluttering npm](docs/verification-runbook.md#testing-publish-without-cluttering-npm)
|
|
229
|
-
— dry-run / verdaccio, and deleting a real test publish afterward.
|
|
230
|
-
|
|
231
264
|
## Dependency Strategy
|
|
232
265
|
|
|
233
266
|
`eslint` and `prettier` are listed as `dependencies` and are pulled in
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doikayt/typescript-build-config",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.27",
|
|
4
4
|
"description": "Shared build configuration for TypeScript projects — ESLint, Prettier, tsconfig, and Playwright presets",
|
|
5
5
|
"_comments": {
|
|
6
6
|
"exports": "This block lists the config files that will be extended by files in in src/toplevel - which are copied to consuming project root folder. An example: eslint.config.js imports from '@doikayt/typescript-build-config/eslint'.",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"scripts": {
|
|
27
27
|
"prepack": "echo no build step required",
|
|
28
28
|
"postinstall": "node src/postinstall.js",
|
|
29
|
-
"update-all-format": "prettier --write src/ && update-markdown-toc README.md",
|
|
30
|
-
"check-format": "prettier --check src/ && update-markdown-toc --check README.md",
|
|
29
|
+
"update-all-format": "prettier --write src/ && update-markdown-toc README.md && update-markdown-toc docs/verification-runbook.md",
|
|
30
|
+
"check-format": "prettier --check src/ && update-markdown-toc --check README.md && update-markdown-toc --check docs/verification-runbook.md",
|
|
31
31
|
"ci": "npm run check-format && node --test tests/*.test.js",
|
|
32
32
|
"test": "node --test tests/*.test.js"
|
|
33
33
|
},
|