@doikayt/typescript-build-config 0.1.26 → 0.1.28
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 +105 -50
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -6,15 +6,18 @@ 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
|
+
- [1. One-time machine setup (once per machine)](#1-one-time-machine-setup-once-per-machine)
|
|
10
|
+
- [2. Create a new project (repeatable)](#2-create-a-new-project-repeatable)
|
|
11
|
+
- [dk-scaffold](#dk-scaffold)
|
|
12
|
+
- [Run dk-scaffold's steps individually](#run-dk-scaffolds-steps-individually)
|
|
13
|
+
- [Trying it out](#trying-it-out)
|
|
9
14
|
- [Design Goals](#design-goals)
|
|
10
15
|
- [What each component is for](#what-each-component-is-for)
|
|
11
16
|
- [Installation](#installation)
|
|
12
17
|
- [Usage](#usage)
|
|
13
18
|
- [The canonical script set](#the-canonical-script-set)
|
|
14
|
-
- [
|
|
15
|
-
- [UI / web project (with Playwright e2e)](#ui--web-project-with-playwright-e2e)
|
|
19
|
+
- [Optional Playwright config for Web / UI testing](#optional-playwright-config-for-web--ui-testing)
|
|
16
20
|
- [Existing project](#existing-project)
|
|
17
|
-
- [Trying it out (demo + scratch repo)](#trying-it-out-demo--scratch-repo)
|
|
18
21
|
- [Dependency Strategy](#dependency-strategy)
|
|
19
22
|
- [Current Contents](#current-contents)
|
|
20
23
|
- [Delivery Model](#delivery-model)
|
|
@@ -44,30 +47,47 @@ via the pipeline files it installs into each consumer repo and the canonical rel
|
|
|
44
47
|
|
|
45
48
|
## Quick start
|
|
46
49
|
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
These steps set up — in a fresh "new-developer" environment — a local git repo
|
|
51
|
+
with a skeleton demo app plus all the standard Doikayt build configuration:
|
|
52
|
+
tooling that auto-documents the code in the repo and lets it be pushed to
|
|
53
|
+
GitHub, built on GitHub's CI servers, and (for a library) published to npm. Steps
|
|
54
|
+
are minimal here — each links to the section that explains _what_ and _why_.
|
|
49
55
|
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
### 1. One-time machine setup (once per machine)
|
|
57
|
+
|
|
58
|
+
Clone this base repo and install the shared team
|
|
59
|
+
[shell aliases](#team-shell-aliases). This only sets up the aliases
|
|
60
|
+
(`dk-scaffold`, `mkrepo`); it does **not** configure any project:
|
|
52
61
|
|
|
53
62
|
```bash
|
|
54
|
-
git clone
|
|
63
|
+
git clone https://github.com/doikayt/typescript-build-config.git # HTTPS: no SSH key needed
|
|
55
64
|
cd typescript-build-config
|
|
56
65
|
./assets/shell/install.sh # adds `source assets/shell/aliases.sh` to your rc (idempotent)
|
|
57
66
|
exec $SHELL # reload
|
|
58
67
|
```
|
|
59
68
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
69
|
+
### 2. Create a new project (repeatable)
|
|
70
|
+
|
|
71
|
+
The two paths below are **alternatives that reach the same result** — a project
|
|
72
|
+
wired to this base package.
|
|
73
|
+
|
|
74
|
+
#### dk-scaffold
|
|
75
|
+
|
|
76
|
+
`dk-scaffold` is the one-command wrapper that also (optionally) creates the
|
|
77
|
+
GitHub repo and pushes it. Just run it with a first argument naming your project
|
|
78
|
+
and a second indicating `lib` (a published library) or `app` (a standalone
|
|
79
|
+
app/utility, the default) — see [library vs app](#usage) and
|
|
63
80
|
[Packaging concepts](docs/packaging-concepts.md):
|
|
64
81
|
|
|
65
82
|
```bash
|
|
66
83
|
dk-scaffold my-project lib
|
|
67
84
|
```
|
|
68
85
|
|
|
69
|
-
|
|
70
|
-
|
|
86
|
+
#### Run dk-scaffold's steps individually
|
|
87
|
+
|
|
88
|
+
The steps below mirror the work `dk-scaffold` does under the hood — either for a
|
|
89
|
+
brand-new project or to adopt Doikayt standard build config into an existing one.
|
|
90
|
+
([Installation](#installation) and [Usage](#usage) explain each in detail.)
|
|
71
91
|
|
|
72
92
|
```bash
|
|
73
93
|
npx @doikayt/typescript-build-config new # npm init -y + @doikayt scope
|
|
@@ -76,6 +96,53 @@ npx @doikayt/typescript-build-config init # scripts, deps, publi
|
|
|
76
96
|
npm install # fetch declared devDependencies
|
|
77
97
|
```
|
|
78
98
|
|
|
99
|
+
### Trying it out
|
|
100
|
+
|
|
101
|
+
`dk-scaffold` does a lot under the hood, so the best way to get familiar with it
|
|
102
|
+
is to run it at the three levels it supports — each requiring a little more setup
|
|
103
|
+
than the last, and revealing a little more of the process. Each level scaffolds a
|
|
104
|
+
throwaway **app** (nothing publishes) unless noted. Do the one-time
|
|
105
|
+
[machine setup](#1-one-time-machine-setup-once-per-machine) first so `dk-scaffold`
|
|
106
|
+
is on your PATH.
|
|
107
|
+
|
|
108
|
+
**Level 0 — local (no external GitHub/npm accounts needed).** Scaffold and run
|
|
109
|
+
the same gate CI runs — no GitHub repo, no push:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
dk-scaffold my-demo --local
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
That single command runs `init` (demo=yes, app, no Playwright) then `npm run ci`.
|
|
116
|
+
You'll see the vitest demo tests pass, `npm run build` emit `dist/` + type
|
|
117
|
+
declarations, and `update-all-format` fill the README's TOC + UML markers
|
|
118
|
+
(mermaid **source** — rendered at Level 1). `npm publish --dry-run` **refuses** —
|
|
119
|
+
proof the app archetype never publishes.
|
|
120
|
+
|
|
121
|
+
**Level 1 — push to your own GitHub.** Bring a GitHub account and the `gh` CLI.
|
|
122
|
+
Sign in, point the wrapper at your account, and drop `--local`:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
gh auth login # one-time: sign in to GitHub
|
|
126
|
+
export DOIKAYT_ORG=<your-github-username> # target owner for the repo
|
|
127
|
+
dk-scaffold my-demo # app (private) — no npm creds
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Now it creates the repo and pushes — and you see what Level 0 couldn't: the
|
|
131
|
+
**mermaid diagrams rendered** (example
|
|
132
|
+
[here](https://github.com/doikayt/build-tools/blob/main/javascript/tooling-core/README.md#package-structure))
|
|
133
|
+
and the **CI job go green** in Actions (example:
|
|
134
|
+
[this project's runs](https://github.com/doikayt/typescript-build-config/actions)).
|
|
135
|
+
Push a follow-up **`feat:`** commit and the **release job** version-bumps + tags —
|
|
136
|
+
nothing published (app). (The initial `chore: scaffold` push releases nothing;
|
|
137
|
+
`feat:` / `fix:` triggers it.)
|
|
138
|
+
|
|
139
|
+
**Level 2 — publish to your own npm.** The last rung swaps the app for a `lib`
|
|
140
|
+
and adds your own npm scope + `NPM` secret — then you see the one thing the other
|
|
141
|
+
levels can't: `changeset publish` shipping a real, dist-only package. Full
|
|
142
|
+
procedure: [docs/verification-runbook.md](docs/verification-runbook.md);
|
|
143
|
+
non-`@doikayt`-scope setup:
|
|
144
|
+
[docs/verification-byo-prerequisites.md](docs/verification-byo-prerequisites.md).
|
|
145
|
+
|
|
79
146
|
## Design Goals
|
|
80
147
|
|
|
81
148
|
The package housed in this repo is designed to be 'upstream-most' -- i.e., all other
|
|
@@ -135,10 +202,12 @@ sets up the release pipeline (see below).
|
|
|
135
202
|
## Usage
|
|
136
203
|
|
|
137
204
|
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
|
-
|
|
205
|
+
[canonical npm-script set](#the-canonical-script-set), declare the dev
|
|
206
|
+
dependencies those scripts need — `vitest`, `@doikayt/autogen-markdown-doc`,
|
|
207
|
+
`typescript`, and `@changesets/cli` (the release pipeline needs it) — and seed a
|
|
208
|
+
commented `vitest.config.ts`. `init` is interactive and **idempotent** — it only
|
|
209
|
+
adds what is missing and never overwrites a script or config you already have, so
|
|
210
|
+
it is safe to re-run.
|
|
142
211
|
|
|
143
212
|
### The canonical script set
|
|
144
213
|
|
|
@@ -158,8 +227,10 @@ small single-purpose scripts, and the check side mirrors the write side:
|
|
|
158
227
|
| `update-code-formatting` / `check-code-formatting` | Prettier write / check. |
|
|
159
228
|
| `update-markdown-docs` / `check-markdown-docs` | Regenerate / verify generated markdown (TOC, UML, …). |
|
|
160
229
|
|
|
161
|
-
`init` also asks whether the project is a **publishable library
|
|
162
|
-
|
|
230
|
+
`init` also asks whether the project is a **publishable library**. That answer
|
|
231
|
+
sets the `package.json` fields that control publishing — `main`, `types`,
|
|
232
|
+
`exports`, `files`, `prepack`, `private` — non-destructively (it merges, it
|
|
233
|
+
doesn't overwrite your other keys):
|
|
163
234
|
|
|
164
235
|
- **Library** — `main` / `types` / `exports` → `dist/index.js`, `files: ["dist"]`,
|
|
165
236
|
and `prepack`, so it publishes a compiled, typed ESM package on push. `init`
|
|
@@ -172,7 +243,15 @@ publish config accordingly (non-destructively):
|
|
|
172
243
|
`dist/`, publish fields, library vs app)? See
|
|
173
244
|
[Packaging concepts](docs/packaging-concepts.md) for the background.
|
|
174
245
|
|
|
175
|
-
###
|
|
246
|
+
### Optional Playwright config for Web / UI testing
|
|
247
|
+
|
|
248
|
+
The above section covers _what_ `init` decides; the two recipes below are _how_
|
|
249
|
+
you run it. They differ only in the **Playwright?** answer — `n` for a
|
|
250
|
+
console/CLI or plain library, `y` for a UI / web project that needs end-to-end
|
|
251
|
+
tests. Library-vs-app is an orthogonal choice, so either shape can still be
|
|
252
|
+
published or kept private.
|
|
253
|
+
|
|
254
|
+
**Console / CLI or plain library — answer `n`:**
|
|
176
255
|
|
|
177
256
|
```bash
|
|
178
257
|
npx @doikayt/typescript-build-config new # npm init -y + @doikayt scope
|
|
@@ -181,15 +260,9 @@ npx @doikayt/typescript-build-config init # answer "n" to Playwright
|
|
|
181
260
|
npm install # fetch the declared devDependencies
|
|
182
261
|
```
|
|
183
262
|
|
|
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)
|
|
263
|
+
**UI / web — answer `y`:** injects the end-to-end setup — adds a `test:e2e`
|
|
264
|
+
script and folds it into `ci` (so the release gate runs e2e), declares
|
|
265
|
+
`@playwright/test`, and seeds a `playwright.config.ts` template.
|
|
193
266
|
|
|
194
267
|
```bash
|
|
195
268
|
npx @doikayt/typescript-build-config new # npm init -y + @doikayt scope
|
|
@@ -199,11 +272,9 @@ npm install
|
|
|
199
272
|
# then fill in the TODOs in the generated playwright.config.ts (webServer, baseURL)
|
|
200
273
|
```
|
|
201
274
|
|
|
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.
|
|
275
|
+
Browsers are installed on demand by the bundled `doikayt-playwright-install`
|
|
276
|
+
wrapper the `test:e2e` script calls — no manual `playwright install` step,
|
|
277
|
+
locally or in CI.
|
|
207
278
|
|
|
208
279
|
### Existing project
|
|
209
280
|
|
|
@@ -212,22 +283,6 @@ required targets (`ci`, `update-all-format`) until you add them — either by
|
|
|
212
283
|
running `init` to adopt the full canonical set, or by defining the two scripts
|
|
213
284
|
by hand (see [Conventions](#conventions-every-project-must-adhere-to)).
|
|
214
285
|
|
|
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
286
|
## Dependency Strategy
|
|
232
287
|
|
|
233
288
|
`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.28",
|
|
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
|
},
|