dntx v1.0.1
dntx
A simple CLI tool to temporarily install and run .NET tools via npx. No global installation required!
Quick Start
Run any .NET tool directly without installation:
npx dntx@latest <package-id> [arguments]
For example:
# Run the HTTP REPL tool
npx dntx@latest microsoft.dotnet-httprepl
# Run a specific version of a tool
npx dntx@latest microsoft.dotnet-httprepl@6.0.0
# Run with arguments
npx dntx@latest microsoft.dotnet-httprepl https://api.example.com
Prerequisites
- Node.js (>= 14.0.0)
- .NET SDK (any version)
Usage
You can run any .NET tool directly using npx without installing it globally:
npx dntx <package-id> [arguments]
Examples
- Run a tool without version specification:
npx dntx microsoft.dotnet-httprepl
- Run a tool with a specific version:
npx dntx microsoft.dotnet-httprepl@6.0.0
- Run a tool with arguments:
npx dntx microsoft.dotnet-httprepl https://api.example.com
How It Works
- Checks if .NET SDK is installed
- Creates a temporary directory
- Installs the specified .NET tool (with version if specified)
- Runs the tool with any provided arguments
- Automatically cleans up after execution
Features
- โจ No global installation required
- ๐ฏ Version pinning support (
package-id@version
) - ๐งน Automatic cleanup
- ๐ Works cross-platform
- ๐ Simple and intuitive interface
Common .NET Tools
Here are some popular .NET tools you can try:
microsoft.dotnet-httprepl
- HTTP REPL command-line tooldotnet-ef
- Entity Framework Core toolsdotnet-outdated-tool
- Check for outdated NuGet packagesdotnet-format
- Code formatterdotnet-trace
- Performance analysis tool
Development
Setup
- Clone the repository:
git clone https://github.com/redth/npx-dntx.git
cd npx-dntx
- Install dependencies:
npm install
Available Scripts
npm test
- Run testsnpm run test:watch
- Run tests in watch modenpm run build
- Run build process (currently runs tests)npm run prepare-publish
- Prepare for publishing (runs build and shows included files)
Running Tests
The project uses Jest for testing. Tests run across multiple Node.js versions and operating systems in CI.
npm test
Continuous Integration
GitHub Actions workflows automatically run tests on:
- Multiple operating systems (Windows, macOS, Linux)
- Multiple Node.js versions (14.x, 16.x, 18.x, 20.x)
- Multiple .NET SDK versions (6.0.x, 7.0.x, 8.0.x)
Publishing
Preparing for Release
- Update version and create git tag:
npm version patch # or minor/major
- Preview what will be published:
npm run prepare-publish
Publishing to npm
Manual Publishing
npm login
npm publish
Automated Publishing via GitHub
- Create an npm access token:
npm token create
Add the token to GitHub:
- Go to your repository's Settings
- Navigate to Secrets and variables > Actions
- Create a new secret named
NPM_TOKEN
- Paste your npm token as the value
Create a new release on GitHub:
- Go to Releases > Draft a new release
- Choose the tag created by npm version
- Add release notes
- Publish the release
The GitHub Actions workflow will automatically publish to npm when the release is created.
Error Handling
The tool provides clear error messages for common issues:
- Missing .NET SDK installation
- Invalid package IDs
- Non-existent versions
- Tool execution failures
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see the LICENSE file for details.
Author
Jon Dick (redth)
4 months ago