metalsmith / metalsmith/default-values

metalsmith.match() issue with metalsmith-branch

Open
#24 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
10
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Something I've noticed in my own plugins @webketje is how `metalsmith-branch` will only pass a subset of files to a child plugin, but if you use `metalsmith.match()` it will match against the "global" list of files, and you will end up with some filenames that might not be in your "working" file list.

The fix is using `metalsmith.match(pattern, Object.keys(files))` in every plugin, like this: https://github.com/emmercm/metalsmith-reading-time/pull/88/files#diff-92bbac9a308cd5fcf9db165841f2d90ce981baddcb2b1e26cfff170929af3bd1R16

Contributor guide

No contributing guide indexed for this repository

Research direction

Review the plugin implementation for every use of metalsmith.match(), starting with the behavior described for metalsmith-branch. Use the linked metalsmith-reading-time pull request as a reference. Done means matching is restricted to Object.keys(files), so a child plugin receives only filenames in its working file list.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.