andresz1 / size-limit-action

Compare the real cost to run your JS app or lib to keep good performance in every pull request

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Directory support for monorepo

azu opened this issue · comments

commented

I want to use size-limit-action in monorepo.
The monorepo has multiple packages in a repository.

.
└── packages/
    ├── foo/
    │   └── package.json
    └── bar/
        ├── package.json/
        └── index.ts  <- Want to analyze the size

However, current size-limit-action can not specify the directory like packages/bar.

📝 Unfortunately, GitHub Actions does not support the combination of working-directory and uses & with.
Unable to use working-directory with docker based actions - GitHub Actions - GitHub Support Community

Is there any chance size-limit-action provide current working directory option like cwd?

Hi @azu! thank you so much for opening this issue. Currently there is no way to provide the working directory but there is another way, for example using lerna:

  • Install size-limit in your main package (root).
  • Install all packages dependencies after main install and build all packages during build step.
"scripts": {
  "postinstall": "lerna bootstrap",
  "build": "lerna run build"
},
  • Configure size-limit specifying each file you want to track.
"size-limit": [
  {
    "path": "packages/foo/dist/index.js",
    "limit": "4500 ms"
  },
 {
    "path": "packages/bar/dist/index.js",
    "limit": "3200 ms"
  }
]

Let me know your thoughts!

commented

Thanks.

I also want to use this action in large monorepo.
It includes multiple architectures like go lang and Node.js.
So, the root directory does not depend on npm or yarn.

Example

.github
└── workflows
golangbased-system
└── go-structure
nodebased-system
└── packages/
    ├── foo/
    │   └── package.json
    └── bar/
        ├── package.json/
        └── index.ts  <- Want to analyze the size

Probably, create package.json in root dir and this action can check it, but it inconveniences.