pnpm corepack, CI bugfix and no warnings for TIMEID
Some checks failed
Zettelclean CI / build (20.x) (push) Has been cancelled
Zettelclean CI / build (22.x) (push) Has been cancelled
Zettelclean CI / build (24.x) (push) Has been cancelled
Release Zettelclean / build (push) Has been cancelled

This commit is contained in:
2026-07-28 21:27:47 -03:00
parent 4ba2717902
commit e83b95c6ee
9 changed files with 58 additions and 859 deletions

View File

@@ -42,7 +42,11 @@ jobs:
uses: actions/setup-node@v6 uses: actions/setup-node@v6
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
cache: 'npm' # Node ships corepack, which selects the pnpm version pinned in
- run: npm ci # package.json ("packageManager"). If this self-hosted runner has no
- run: npm run build --if-present # Node, drop the setup-node step above and rely on a preinstalled Node.
- run: npm run lint - run: corepack enable
- run: pnpm install --frozen-lockfile
- run: pnpm run build
- run: pnpm run lint
- run: pnpm test

View File

@@ -40,12 +40,17 @@ jobs:
uses: actions/setup-node@v6 uses: actions/setup-node@v6
with: with:
node-version: 24 node-version: 24
cache: 'npm'
# Node ships corepack, which selects the pnpm version pinned in
# package.json ("packageManager"). If this self-hosted runner has no
# Node, drop the setup-node step above and rely on a preinstalled Node.
- name: Enable pnpm
run: corepack enable
- name: Build plugin - name: Build plugin
run: | run: |
npm ci pnpm install --frozen-lockfile
npm run build pnpm run build
- name: Check for optional styles - name: Check for optional styles
id: styles id: styles

View File

@@ -67,7 +67,7 @@ change the setting.
### Retrofitting existing notes ### Retrofitting existing notes
Notes created before you adopted this workflow have no TIMEID. Right-click such a note in the Notes created before you adopted this workflow have no TIMEID. Right-click such a note in the
file explorer and choose **"Add zettel TIMEID to filename"**. It mints a fresh timestamp, file explorer and choose **"Prefix timestamp to filename"**. It mints a fresh timestamp,
prepends it, and the note is now a zettel that syncs on future H1 edits. prepends it, and the note is now a zettel that syncs on future H1 edits.
## Pretty sidebar (optional) ## Pretty sidebar (optional)
@@ -89,14 +89,43 @@ are fixed.
## Development ## Development
- `npm install` (or `pnpm install`). Dependencies are managed with **pnpm** (see "Why pnpm, not npm" below). Node 22+ ships
- `npm run dev` - compile in watch mode. `corepack`, so you do not need to install pnpm globally, and the `packageManager` field in
- `npm run build` - typecheck and produce `main.js`. `package.json` pins the exact version.
- `npm test` - run the slug unit tests on Node's built-in test runner.
- `npm run lint` - eslint with the Obsidian ruleset. ```bash
corepack pnpm install # first time, or after a dependency change
corepack pnpm run dev # compile in watch mode
corepack pnpm run build # typecheck and produce main.js
corepack pnpm test # run the slug unit tests (Node's built-in runner)
corepack pnpm run lint # eslint with the Obsidian ruleset
```
The pure string logic lives in `src/slug.ts` and is unit-tested in isolation; the Obsidian The pure string logic lives in `src/slug.ts` and is unit-tested in isolation; the Obsidian
wiring lives in `src/main.ts`. wiring lives in `src/main.ts`. Tests run on Node's built-in test runner (`node --test`) - there
is no vitest or jest dependency.
### Why pnpm, not npm
**Do not run `npm install` or `npm ci` in this repo.** This project is developed on a **ZFS**
filesystem, and npm's installer renames many directories in parallel (to hoist and dedupe
packages). That races ZFS's directory-metadata handling and aborts with:
```
npm error code ENOTEMPTY
npm error syscall rename
```
pnpm avoids the problem entirely: it hard-links packages from a global content-addressable
store instead of renaming directories into place, so it installs cleanly on the same disk.
Notes for contributors:
- Only `npm install` / `npm ci` are affected. Running *scripts* through npm (`npm run build`)
still works, because that just spawns tsc/esbuild and installs nothing. Still, prefer `pnpm`
everywhere for consistency.
- The lockfile is `pnpm-lock.yaml` (committed). There is no `package-lock.json`; do not create
one.
## License ## License

View File

@@ -1 +1 @@
zettelclean v0.3 zettelclean v0.4

View File

@@ -1,7 +1,7 @@
{ {
"id": "zettelclean", "id": "zettelclean",
"name": "Zettelclean", "name": "Zettelclean",
"version": "0.3.0", "version": "0.4.0",
"minAppVersion": "1.0.0", "minAppVersion": "1.0.0",
"description": "Keep a Zettelkasten filename's slug in sync with the note's H1 heading.", "description": "Keep a Zettelkasten filename's slug in sync with the note's H1 heading.",
"author": "Ruben Carlo Benante", "author": "Ruben Carlo Benante",

View File

@@ -1,10 +1,11 @@
{ {
"name": "zettelclean", "name": "zettelclean",
"version": "0.3.0", "version": "0.4.0",
"description": "Keep a Zettelkasten filename's slug in sync with the note's H1 heading.", "description": "Keep a Zettelkasten filename's slug in sync with the note's H1 heading.",
"author": "Ruben Carlo Benante <rcb@beco.cc>", "author": "Ruben Carlo Benante <rcb@beco.cc>",
"main": "main.js", "main": "main.js",
"type": "module", "type": "module",
"packageManager": "pnpm@9.15.9",
"scripts": { "scripts": {
"dev": "node esbuild.config.mjs", "dev": "node esbuild.config.mjs",
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production", "build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",

840
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -106,7 +106,7 @@ export default class ZettelcleanPlugin extends Plugin {
if (extractTimeId(file.basename) !== null) return; // already a zettel if (extractTimeId(file.basename) !== null) return; // already a zettel
menu.addItem((item) => menu.addItem((item) =>
item item
.setTitle('Add zettel TIMEID to filename') .setTitle('Prefix timestamp to filename')
.setIcon('clock') .setIcon('clock')
.onClick(() => void this.addTimeId(file)), .onClick(() => void this.addTimeId(file)),
); );

View File

@@ -1,3 +1,3 @@
{ {
"0.3.0": "1.0.0" "0.4.0": "1.0.0"
} }