From 45dd0c8450031a854fc5a8cc698c2c3dc55bc2da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20B=C3=B6hm?= Date: Mon, 14 Nov 2022 18:56:09 +0100 Subject: [PATCH] perf: reduce the package size --- .gitignore | 1 + README.md | 53 ++++++++++++------------------------------- cmd/use_correct_pm.go | 2 +- package.json | 9 +++++--- 4 files changed, 22 insertions(+), 43 deletions(-) diff --git a/.gitignore b/.gitignore index bbb4111..921e381 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ *.dll *.so *.dylib +/bin # Test binary, built with `go test -c` *.test diff --git a/README.md b/README.md index 9d76112..be0e76f 100644 --- a/README.md +++ b/README.md @@ -2,43 +2,20 @@ A simple check of the usage of the correct package manager. -## Install - -The local installation is optional. It is only needed if you want to have the package inside your project. This could improve performance, for example. - -### With NPM - -```sh -npm install -D use-correct-pm -``` - -### With YARN - -```sh -yarn add -D use-correct-pm -``` - -### With PNPM - -```sh -pnpm add -D use-correct-pm -``` - ## Usage +No installation is needed. Just run with `npx`. + ### As script in `package.json` Use one of the examples. ```jsonc "scripts": { - "use-correct-pm": "npx use-correct-pm npm", // NPM - "use-correct-pm": "yarn dlx use-correct-pm yarn", // YARN - "use-correct-pm": "yarn exec use-correct-pm yarn", // YARN - locally installed - "use-correct-pm": "pnpm dlx use-correct-pm", // PNPM - "use-correct-pm": "pnpm dlx use-correct-pm pnpm", // PNPM - alternative - "use-correct-pm": "pnpm exec use-correct-pm", // PNPM - locally installed - "use-correct-pm": "pnpm exec use-correct-pm pnpm", // PNPM - alternative locally installed + "use-correct-pm": "npx use-correct-pm", // PNPM + "use-correct-pm": "npx use-correct-pm pnpm", // PNPM + "use-correct-pm": "npx use-correct-pm npm", // NPM + "use-correct-pm": "npx use-correct-pm yarn", // YARN }, ``` @@ -49,26 +26,24 @@ Use one of the examples. Use `npx` if you use `NPM` as package manager.\ Otherwise use `exec` if you have installed the package in your project, otherwise use `dlx`. +#### Check for `PNPM` + ```sh npx use-correct-pm +# or +npx use-correct-pm pnpm ``` -#### `NPM` +#### Check for `NPM` ```sh npx use-correct-pm npm ``` -#### `YARN` +#### Check for `YARN` ```sh -yarn dlx use-correct-pm yarn -``` - -#### `PNPM` - -```sh -pnpm dlx use-correct-pm pnpm +npx use-correct-pm yarn ``` ### As git hook @@ -81,5 +56,5 @@ For example used in combination with [husky](https://typicode.github.io/husky/). [ -n "$CI" ] && exit 0 -pnpm dlx use-correct-pm +npx use-correct-pm ``` diff --git a/cmd/use_correct_pm.go b/cmd/use_correct_pm.go index 88b0235..9db3848 100644 --- a/cmd/use_correct_pm.go +++ b/cmd/use_correct_pm.go @@ -13,7 +13,7 @@ import ( var rootCmd = &cobra.Command{ Use: "use-correct-pm", - Version: "1.0.3", + Version: "1.0.4", Short: "A simple check of the usage of the correct package manager", Long: `Check if the correct package manager is used. Available are 'NPM', 'Yarn' and 'PNPM'.`, diff --git a/package.json b/package.json index b031ae5..4df2f4a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "use-correct-pm", - "version": "1.0.3", + "version": "1.0.4", "description": "A simple check of the usage of the correct package manager.", "keywords": [ "package-manager", @@ -15,9 +15,12 @@ }, "license": "MIT", "author": "Alexander Böhm ", + "files": [ + "LICENSE", + "README.md" + ], "scripts": { - "postinstall": "is-ci || go-npm install", - "prepare": "is-ci || husky install", + "prepare": "is-ci || husky install && go-npm install", "sort-package-json": "npx sort-package-json", "preuninstall": "go-npm uninstall" },