microsoft / microsoft/beachball

feat: ignore parts of json file when running `change`

Open
#626 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
TypeScript
Stars
815
Forks
93
Avg merge
2d 13h
Merged PRs (30d)
12

Description

Current behaviour

We use fine grained glob list of ignorePatterns to provide less distracted experience to contributors - only to require change files when they are really needed.

Example:

ignorePatterns: [
    '**/*.{shot,snap}',
    '**/*.{test,spec}.{ts,tsx}',
    '**/*.stories.tsx',
    '**/__fixtures__/**',
    '**/__mocks__/**',
    '**/common/isConformant.ts',
    '**/jest.config.js',
    '**/SPEC*.md',
    '**/tests/**',
  ],

While this is great, it this falls short is when we update part of json files like scripts or devDependencies which have nothing to do with triggering a change.

New behaviour/Feature request:
  • it would be great to add functionality where one can define which part of json files should/should not trigger a change as sell

Propsoed API

- type IgnorePatterns = Array<string>
+ type IgnorePatterns = Array<string | { jsonGlob: string, keys: Array<string> }>

Example:

ignorePatterns: [
    '**/*.{shot,snap}',
    '**/*.{test,spec}.{ts,tsx}',
    '**/*.stories.tsx',
    '**/__fixtures__/**',
    '**/__mocks__/**',
    '**/common/isConformant.ts',
    '**/jest.config.js',
    '**/SPEC*.md',
    '**/tests/**'

    // 🛠 New API usage
    {
         jsonGlob: '**/package.json', 
         keys: [ 'scripts', 'devDependencies' ] 
    }
  ],

Open to any suggestions ofc

Validation:

  • if user would use this new api for file/glob that doesn't have json extension, CLI will throw error
    • {jsonGlob: '**/SPEC*.md'} - throw Error 🚨
    • {jsonGlob: '**/SPEC*.md',keys: ['foo'] } - throw Error 🚨

thx!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no source files or tests; start by locating the change command's ignorePatterns handling in the TypeScript CLI. Exercise the proposed JSON-object configuration with package.json and a non-JSON glob, and consider the behavior complete when selected JSON keys are ignored while non-JSON patterns are rejected.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, release
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.