Skip to content

Commit a06086c

Browse files
committed
updates
1 parent e0e5e18 commit a06086c

File tree

8 files changed

+4275
-35
lines changed

8 files changed

+4275
-35
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Martin Page
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 63 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,92 @@
11
# Auto-PM
22

3-
Auto-PM is a CLI tool to detect the package manager in a project and run commands accordingly.
3+
Auto-PM is a CLI tool that automatically detects the package manager (npm, yarn, pnpm, bun, deno) in your project and runs commands accordingly. This allows you to use a consistent command (`auto`) across different projects without worrying about which package manager is in use.
4+
5+
## Features
6+
7+
- Automatically detects npm, yarn, pnpm, bun, and deno.
8+
- Seamlessly runs package manager commands.
9+
- Supports executing packages with `auto x <package>` (equivalent to `npx`, `yarn dlx`, `pnpm dlx`, `bun x`, `deno run -A`).
410

511
## Installation
612

13+
### Global Installation (Recommended)
14+
15+
Install `auto-pm` globally to use the `auto` command in any project:
16+
717
```bash
818
npm install -g auto-pm
919
```
1020

11-
## Usage
21+
### Local Installation
22+
23+
You can also install `auto-pm` as a dev dependency in a specific project:
1224

1325
```bash
14-
auto <command> [args...]
26+
npm install --save-dev auto-pm
1527
```
1628

17-
- `x`: Runs a command using the appropriate package manager (e.g., `npx`, `yarn dlx`, etc.).
18-
- Other commands are passed directly to the detected package manager.
29+
Then you can run it via `npx auto ...` or by adding it to your `package.json` scripts.
1930

20-
## Development
31+
## Usage
2132

22-
### Build
33+
Once installed globally, you can use the `auto` command in any project directory that uses a supported package manager.
2334

24-
```bash
25-
npm run build
26-
```
35+
### Basic Commands
2736

28-
### Test
37+
- `auto install`: Installs project dependencies (e.g., runs `npm install`, `yarn install`, etc.).
38+
- `auto add <package>`: Adds a new package (e.g., runs `npm install <package>`, `yarn add <package>`, etc.).
39+
- `auto remove <package>`: Removes a package (e.g., runs `npm uninstall <package>`, `yarn remove <package>`, etc.).
40+
- `auto run <script>`: Runs a script defined in your `package.json` (e.g., runs `npm run <script>`, `yarn <script>`, etc.).
2941

30-
```bash
31-
npm test
32-
```
42+
### Executing Packages (like npx)
3343

34-
### Lint
44+
The `auto x` command allows you to execute packages without installing them globally, similar to `npx`, `yarn dlx`, `pnpm dlx`, `bun x`, or `deno run -A`.
3545

3646
```bash
37-
npm run lint
47+
auto x create-react-app my-app
48+
auto x cowsay "Hello World"
3849
```
3950

40-
### Format
51+
### Passing Arguments
52+
53+
Arguments are passed through to the underlying package manager command:
4154

4255
```bash
43-
npm run format
56+
auto add typescript --dev
57+
auto run build --watch
4458
```
4559

60+
## How it Works
61+
62+
`auto-pm` detects the package manager by looking for specific lock files or configuration files in the current directory and its parent directories:
63+
64+
- `yarn.lock` for Yarn
65+
- `package-lock.json` for npm
66+
- `pnpm-lock.yaml` for pnpm
67+
- `bun.lockb` or `bun.lock` for Bun
68+
- `deno.json` or `deno.jsonc` for Deno
69+
70+
If no lock file is found, it will throw an error.
71+
72+
## Supported Package Managers
73+
74+
- npm
75+
- Yarn
76+
- pnpm
77+
- Bun
78+
- Deno
79+
80+
## Contributing
81+
82+
Contributions are welcome! Please feel free to submit a pull request or open an issue if you have suggestions or find a bug.
83+
84+
1. Fork the repository.
85+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`).
86+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`).
87+
4. Push to the branch (`git push origin feature/AmazingFeature`).
88+
5. Open a Pull Request.
89+
4690
## License
4791

48-
This project is licensed under the MIT License.
92+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

bin/auto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env node
22

3-
require('../dist/index.cjs');
3+
require("../dist/index.js");

jest.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
preset: "ts-jest",
3+
testEnvironment: "node",
4+
roots: ["<rootDir>/src"],
5+
};

0 commit comments

Comments
 (0)