Skip to content

Extract shared Node library (lib.js) #8

@sungjunlee

Description

@sungjunlee

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

  1. Create scripts/lib.js with shared functions: slugify, escapeYaml
  2. Update sync-pull.js and sprint-init.js to require('./lib')
  3. Create scripts/lib.test.js with consolidated tests
  4. Remove duplicate tests from individual test files

From engineering review

Covers review finding #5 (slugify duplication).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions