Summary
Extract duplicated pure functions from sync-pull.js and sprint-init.js into scripts/lib.js.
Motivation
slugify() is identical in both files (and tested identically in both test files)
escapeYaml() is a general-purpose utility only in sync-pull.js but useful elsewhere
- DRY violation: any change must be made in two places
Scope
- Create
scripts/lib.js with shared functions: slugify, escapeYaml
- Update
sync-pull.js and sprint-init.js to require('./lib')
- Create
scripts/lib.test.js with consolidated tests
- Remove duplicate tests from individual test files
From engineering review
Covers review finding #5 (slugify duplication).
Summary
Extract duplicated pure functions from
sync-pull.jsandsprint-init.jsintoscripts/lib.js.Motivation
slugify()is identical in both files (and tested identically in both test files)escapeYaml()is a general-purpose utility only in sync-pull.js but useful elsewhereScope
scripts/lib.jswith shared functions:slugify,escapeYamlsync-pull.jsandsprint-init.jstorequire('./lib')scripts/lib.test.jswith consolidated testsFrom engineering review
Covers review finding #5 (slugify duplication).