Skip to content

Feature(monosize): make packageName configurale within compare-reports command #62

@Hotell

Description

@Hotell

ATM packageName for local report is being inferred from package folder basename https://github.com/microsoft/monosize/blob/main/packages/monosize/src/utils/collectLocalReport.mts#L23

While this might work for simple use-cases once it should be configurable by the user.

Example

when directory structure is (see within PR)

|-react-alert/
  |- library/
    |- /bundle-size 
  |- stories/
  |- e2e/

Current:

image

Expected:

image

Proposed Implementations:

  1. change the behaviours to obtain the name from package.json#name and fallback to folder basename if not present

This would be a BREAKING CHANGE

  1. enable set this behaviour via configuration
  • via cli
monosize compare-reports --packageName='folder'|'package.json'
  • via config
export type MonoSizeConfig = {
    repository: string;
    storage: StorageAdapter;
    bundler: BundlerAdapter;
+   commands: {
+     'compare-report': {
+        packageName: 'directory' | 'packageJSON' | ( packageRoot:string ) => string
+      }
  }
};

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions