Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e83b95c6ee |
12
.github/workflows/lint.yml
vendored
12
.github/workflows/lint.yml
vendored
@@ -42,7 +42,11 @@ jobs:
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'npm'
|
||||
- run: npm ci
|
||||
- run: npm run build --if-present
|
||||
- run: npm run lint
|
||||
# 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.
|
||||
- run: corepack enable
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- run: pnpm run build
|
||||
- run: pnpm run lint
|
||||
- run: pnpm test
|
||||
|
||||
11
.github/workflows/release.yml
vendored
11
.github/workflows/release.yml
vendored
@@ -40,12 +40,17 @@ jobs:
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
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
|
||||
run: |
|
||||
npm ci
|
||||
npm run build
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm run build
|
||||
|
||||
- name: Check for optional styles
|
||||
id: styles
|
||||
|
||||
43
README.md
43
README.md
@@ -67,7 +67,7 @@ change the setting.
|
||||
### Retrofitting existing notes
|
||||
|
||||
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.
|
||||
|
||||
## Pretty sidebar (optional)
|
||||
@@ -89,14 +89,43 @@ are fixed.
|
||||
|
||||
## Development
|
||||
|
||||
- `npm install` (or `pnpm install`).
|
||||
- `npm run dev` - compile in watch mode.
|
||||
- `npm run build` - typecheck and produce `main.js`.
|
||||
- `npm test` - run the slug unit tests on Node's built-in test runner.
|
||||
- `npm run lint` - eslint with the Obsidian ruleset.
|
||||
Dependencies are managed with **pnpm** (see "Why pnpm, not npm" below). Node 22+ ships
|
||||
`corepack`, so you do not need to install pnpm globally, and the `packageManager` field in
|
||||
`package.json` pins the exact version.
|
||||
|
||||
```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
|
||||
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
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "zettelclean",
|
||||
"name": "Zettelclean",
|
||||
"version": "0.3.0",
|
||||
"version": "0.4.0",
|
||||
"minAppVersion": "1.0.0",
|
||||
"description": "Keep a Zettelkasten filename's slug in sync with the note's H1 heading.",
|
||||
"author": "Ruben Carlo Benante",
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
{
|
||||
"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.",
|
||||
"author": "Ruben Carlo Benante <rcb@beco.cc>",
|
||||
"main": "main.js",
|
||||
"type": "module",
|
||||
"packageManager": "pnpm@9.15.9",
|
||||
"scripts": {
|
||||
"dev": "node esbuild.config.mjs",
|
||||
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
|
||||
|
||||
840
pnpm-lock.yaml
generated
840
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -106,7 +106,7 @@ export default class ZettelcleanPlugin extends Plugin {
|
||||
if (extractTimeId(file.basename) !== null) return; // already a zettel
|
||||
menu.addItem((item) =>
|
||||
item
|
||||
.setTitle('Add zettel TIMEID to filename')
|
||||
.setTitle('Prefix timestamp to filename')
|
||||
.setIcon('clock')
|
||||
.onClick(() => void this.addTimeId(file)),
|
||||
);
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"0.3.0": "1.0.0"
|
||||
"0.4.0": "1.0.0"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user