Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7ce20f8
Run tests also on node 20 :scientist:
AdrieanKhisbe Jan 2, 2024
c08cd6e
Node 16 gallium LTS is the new minimal version :mechanical_arm:
AdrieanKhisbe Jan 2, 2024
987d25a
Perform npm update and audit fix :lock_with_ink_pen:
AdrieanKhisbe Jan 2, 2024
1a8d9ad
Replace travis by github actions :wave:
AdrieanKhisbe Jan 2, 2024
f992f4a
Perform minor dependancy bump :outbox_tray:
AdrieanKhisbe Jan 2, 2024
6e03eca
Ignore @types packages :see_no_evil:
AdrieanKhisbe Jan 2, 2024
26f7a6c
Add integration messafe expected for node 20 :incoming_envelope:
AdrieanKhisbe Jan 2, 2024
1cdb3b1
Do not stop on error :shield:
AdrieanKhisbe Jan 2, 2024
638abb5
Optional fail fast, and concurrent by default :checkered_flag:
AdrieanKhisbe Jan 2, 2024
5b18779
Bump license years :balance_scale:
AdrieanKhisbe Jan 2, 2024
d07b5c2
Integration test for --fail-fast and --serial :shield:
AdrieanKhisbe Jan 2, 2024
e66a622
Unified entrypoint :handshake:
AdrieanKhisbe Apr 4, 2024
343437d
Tweak for e2e tests :wrench:
AdrieanKhisbe Apr 4, 2024
b2a8f04
Two targeted bump to adress the high vulns :adhesive_bandage:
AdrieanKhisbe Apr 4, 2024
1fc509b
Run the CI on node 22&24 :scientist:
AdrieanKhisbe Oct 27, 2025
2512b32
Perform npm update :outbox_tray:
AdrieanKhisbe Oct 27, 2025
7a1762f
Bump license years :calendar:
AdrieanKhisbe Oct 27, 2025
e0c0db7
Make tests oblivious to weigth changes :weight_lifting:
AdrieanKhisbe Oct 27, 2025
a811841
Fix CLI links&badge :vertical_traffic_light:
AdrieanKhisbe Oct 27, 2025
2262144
Update coverage upload methods :umbrella:
AdrieanKhisbe Oct 27, 2025
38d9ff9
Add expected audit messages for node 22&24 :wrench:
AdrieanKhisbe Oct 27, 2025
edc8cd8
Tweak yargs options, removing newly introduced alias :pirate_flag:
AdrieanKhisbe Oct 27, 2025
eb4e8f2
Adapt tests to tweaked yargs params (_ -> packages) :package:
AdrieanKhisbe Oct 28, 2025
52403c4
Add some tests to improve coverage :shield:
AdrieanKhisbe Oct 28, 2025
408207c
Cover and fix readCurrentPackage :lady_beetle:
AdrieanKhisbe Oct 28, 2025
bdfd15e
Tweak so that arg less command can be invoked :crossed_flags:
AdrieanKhisbe Oct 28, 2025
8738e28
Cover the -p feature :stuck_out_tongue_winking_eye:
AdrieanKhisbe Oct 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
{
"files": "test/**/*.test.js",
"rules": {
"import/no-extraneous-dependencies": "off"
"import/no-extraneous-dependencies": "off",
"import/no-unresolved": "off"
}
}
]
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

name: Bundle Phobia CLI CI

on:
- push
- pull_request

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 16.x
- 18.x
- 20.x
- 22.x
- 24.x

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm test
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v12.22.12
v16.20.2
29 changes: 14 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# 🪦 Deprecation in progress, see .github/workflows/ci.yml
language: node_js
dist: focal

Expand All @@ -13,27 +14,25 @@ jobs:

- &test
stage: test
name: test-node8
node_js: '8'
name: test-node16
node_js: '16'
script:
- npm run test:unit
- npm run test:e2e
after_script: npm run publish-coverage

after_script:
- pip install codecov-cli
- codecov
- <<: *test
name: test-node10
node_js: '10'
- <<: *test
name: test-node12
node_js: '12'
name: test-node18
node_js: '18'
- <<: *test
name: test-node14
node_js: '14'
name: test-node20
node_js: '20'
- <<: *test
name: test-node16
node_js: '16'
name: test-node22
node_js: '22'
- <<: *test
name: test-node18
node_js: '18'
name: test-node24
node_js: '24'

cache: npm
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
The MIT License (MIT)
Copyright (c) 2017-2022 Adrien Becchis (@AdrieanKhisbe)
Copyright (c) 2017-2025 Adrien Becchis (@AdrieanKhisbe)


Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
49 changes: 30 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# bundle-phobia-cli

[![npm](https://img.shields.io/npm/v/bundle-phobia-cli.svg)](https://www.npmjs.com/package/bundle-phobia-cli)
[![Build Status](https://travis-ci.com/AdrieanKhisbe/bundle-phobia-cli.svg?branch=master)](https://travis-ci.com/AdrieanKhisbe/bundle-phobia-cli)
[![Build Status](https://github.com/AdrieanKhisbe/bundle-phobia-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/AdrieanKhisbe/bundle-phobia-cli/actions)
[![codecov](https://codecov.io/gh/AdrieanKhisbe/bundle-phobia-cli/branch/master/graph/badge.svg)](https://codecov.io/gh/AdrieanKhisbe/bundle-phobia-cli)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

Expand All @@ -18,10 +18,15 @@ Just use `npm install -g bundle-phobia-cli` and you're good to go!

## Usage

Once installed you will have access to different executables:
- `bundle-phobia`: to query package size.
Just invoke it with a list of package names and some options.
- `bundle-phobia-install`: to conditionally install package if weight constraint are respected. This is a wrapper on `npm install`
Once installed you will have access a single executable `bundle-phobia` (aliased to `bundle-phobia-cli` for `npx usage`), with two commands:
- `stats` to query package size. This is the default command, just invoke it with a list of package names and some options.
```
$ bundle-phobia lodash react
```
- `install`: to conditionally install package if weight constraint are respected. This is a wrapper on `npm install`
```
$ bundle-phobia install lodash react
```

Note that you can specify a version along with the package range such as an
instance exact version `lodash@4.12.0` or range version `ora@^3.0.0`.
Expand Down Expand Up @@ -63,18 +68,20 @@ Usage: bundle-phobia <package-name> [other-package-names...]

Options:
--version Show version number [boolean]
--package, -p Provide a package.json to read dependencies [string]
--range, -r Get a range of version (0 for all, 8 by default) [number]
--json, -j Output json rather than a formater string [boolean]
--size, -s Output just the module size [boolean]
--gzip-size, -g Output just the module gzip size [boolean]
--dependencies, -d Output just the number of dependencies [boolean]
--self Output bundle-phobia stats [boolean]
-p, --package Provide a package.json to read dependencies [string]
-r, --range Get a range of version (0 for all, 8 by default) [number]
-j, --json Output json rather than a formater string [boolean]
-s, --size Output just the module size [boolean]
-g, --gzip-size Output just the module gzip size [boolean]
-d, --dependencies Output just the number of dependencies [boolean]
-x, --fail-fast Stop on first error [boolean]
-1, --serial Run requests serially [boolean]
--self Output bundle-phobia stats [boolean]
-h, --help Show help [boolean]
```
#### `bundle-phobia-install`
#### `bundle-phobia install`

`bundle-phobia-install` offer three kind of flags:
`bundle-phobia install` offer three kind of flags:
- flags to specify the size constraints
- flags to specify behavior when constraints are not respected
- npm install flags to control it's behavior
Expand Down Expand Up @@ -104,15 +111,19 @@ Limits can also be configured in the `package.json` by adding a `bundle-phobia`
##### Options Summary

```
Usage: bundle-phobia-install <package-name> [other-package-names...]
Usage: bundle-phobia install <package-name> [other-package-names...]

Options:
--version Show version number [boolean]
--warn, -w Install despite of negative check but warn about
-w, --warn Install despite of negative check but warn about
predicate violation [boolean]
--interactive, -i Ask for override in case of predicate violation [boolean]
--max-size, -m Size threeshold of individual library to install [string]
--max-gzip-size, -M Gzip Size threeshold of individual library to install
-i, --interactive Ask for override in case of predicate violation [boolean]
-m, --max-size Size threeshold of individual library to install [string]
-M, --max-gzip-size Gzip Size threeshold of individual library to install
[string]
-o, --max-overall-size Overall size threeshold of dependencies [string]
-O, --max-overall-gzip-size Overall Gzip size threeshold of dependencies
[string]
-x, --fail-fast Stop on first error [boolean]
-h, --help Show help [boolean]
```
64 changes: 0 additions & 64 deletions index-install.js

This file was deleted.

48 changes: 0 additions & 48 deletions index.js

This file was deleted.

Loading