Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*.dll
*.so
*.dylib
/bin

# Test binary, built with `go test -c`
*.test
Expand Down
53 changes: 14 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
```

Expand All @@ -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
Expand All @@ -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
```
2 changes: 1 addition & 1 deletion cmd/use_correct_pm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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'.`,
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -15,9 +15,12 @@
},
"license": "MIT",
"author": "Alexander Böhm <[email protected]>",
"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"
},
Expand Down