Package Exports
- resolve-stack-cli
- resolve-stack-cli/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (resolve-stack-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Resolve Stack CLI
🤖 AI-Powered Development Project
This project was created through Vibe Coding using Gemini CLI + Claude 4 collaboration. The primary goal is to solve real-world problems while exploring the feasibility and capability boundaries of AI-assisted development workflows.
A lightweight, fast command-line tool for resolving JavaScript stack traces using source maps.
Features
- 🚀 Fast: Built with Bun runtime for optimal performance
- 📁 TOML Configuration: Support for TOML-based configuration files
- 🛠️ CLI Interface: Easy-to-use command-line interface
- 📊 Stack Trace Resolution: Resolve minified stack traces to original source code locations
- ⚡ TypeScript: Written in TypeScript with full type safety
Installation
From npm (Recommended)
# Install globally to use as a CLI tool
npm install -g resolve-stack-cliPrerequisites
- Node.js >=16.0.0
- npm
Alternative Installation Methods
For developers and contributors
From Source
# Clone the repository
git clone https://github.com/luxi78/resolve-stack-cli.git
cd resolve-stack-cli
bun install
bun install -g .Development Installation
# For development purposes
git clone https://github.com/luxi78/resolve-stack-cli.git
cd resolve-stack-cli
bun installDevelopment Prerequisites:
- Bun runtime (latest version recommended)
- TypeScript ^5.0.0
Usage
Basic Usage
After installing via npm, use the tool directly:
resolve-stack [options]Getting Help
resolve-stack --helpCommand Line Options
The tool uses yargs for command-line argument parsing with the following options:
-c, --config: Path to a TOML config file--app-url-base: The base URL of your deployed application--source-map-root: The local root directory of your source maps-h, --help: Show help--version: Show version number
Development Usage
# If running from source:
bun run index.ts [options]
bun run index.ts --helpConfiguration
Resolve Stack CLI supports TOML configuration files for advanced usage scenarios. Create a configuration file in your project directory:
# example.toml
[sourcemap]
appUrlBase = "https://cdn.xuante.top:44300/cdns1.bangnimang.net/fapiao-ng"
sourceMapRoot = "out"Dependencies
- @iarna/toml: TOML parser for configuration files
- source-map: Core source map processing library for stack trace resolution
- yargs: Command-line argument parsing
License
MIT License
For Developers and Contributors
Development Setup and Guidelines
Development
Running the Development Version
bun run startBuilding
This project uses ES modules and is designed to run directly with Bun:
bun run index.tsRequirements
- Node.js-compatible runtime (Bun recommended)
- TypeScript ^5.0.0
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📦 NPM Publishing Guide
Core Concepts
This is a TypeScript CLI project that compiles TS code to Node.js-compatible JavaScript through a build process, then publishes to npm. Users don't need to install bun or TypeScript to use the package.
Project Configuration Essentials
Key package.json Fields
{
"name": "resolve-stack-cli",
"version": "1.0.0",
"description": "A lightweight, fast command-line tool for resolving JavaScript stack traces using source maps",
"main": "dist/index.js", // Points to compiled JS file
"module": "dist/index.js",
"type": "module",
"bin": {
"resolve-stack": "dist/index.js" // CLI command entry point
},
"files": [ // Files included in publication
"dist/**/*",
"README.md",
"package.json"
],
"engines": {
"node": ">=16.0.0" // Node.js version requirement
}
}Build Script Configuration
{
"scripts": {
"build": "bun build index.ts --outdir dist --target node --format esm",
"prepublishOnly": "npm run build", // Auto-build before publishing
"test": "echo \"No tests specified\" && exit 0"
}
}Pre-Publishing Checklist
1. Complete Project Information
Update in package.json:
{
"author": "Your Name <your.email@example.com>",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/yourusername/resolve-stack-cli.git"
},
"bugs": {
"url": "https://github.com/yourusername/resolve-stack-cli/issues"
},
"homepage": "https://github.com/yourusername/resolve-stack-cli#readme",
"keywords": [
"stack-trace",
"source-map",
"cli",
"debugging",
"typescript",
"javascript"
]
}2. Fix Entry Point
Ensure index.ts uses Node.js shebang:
#!/usr/bin/env node
import { main } from './resolve-stack.js';
main().catch(console.error);Complete Publishing Process
1. Register npm Account
# First-time registration
npm adduser
# Login with existing account
npm login
# Verify login status
npm whoami2. Check Package Name Availability
npm view resolve-stack-cli
# If shows 404 Not Found, the package name is available3. Pre-Build Verification
# Build project
npm run build
# Test build result
node dist/index.js --help
# Preview publication content
npm pack --dry-run4. Publish to npm
# Publish
npm publish
# Verify successful publication
npm view resolve-stack-cliVersion Management
Manual Version Updates
# Modify version field in package.json
# Then republish
npm publishUsing npm Version Commands
# Patch version (1.0.0 → 1.0.1)
npm version patch && npm publish
# Minor version (1.0.0 → 1.1.0)
npm version minor && npm publish
# Major version (1.0.0 → 2.0.0)
npm version major && npm publishTechnical Details
TypeScript to JavaScript Conversion
- Development Stage: Use
bunto run TypeScript directly - Build Stage:
bun buildcompiles TS to Node.js-compatible JS - Publishing Stage: Only publish compiled JavaScript
- User Usage: Run through Node.js, no bun required
Build Output Characteristics
- Uses
#!/usr/bin/env nodeshebang - ES Module format
- All dependencies bundled in single file
- Node.js >=16.0.0 compatible
User Installation Experience
# Global installation
npm install -g resolve-stack-cli
# Direct usage
resolve-stack --helpUser system requirements:
- ✅ Node.js >=16.0.0
- ✅ npm
- ❌ No bun required
- ❌ No TypeScript required
Troubleshooting
Common Issues
- Shebang errors: Ensure built file uses
#!/usr/bin/env node - File permissions: Built file should have execute permissions
- Import paths: Ensure import statements use
.jsextensions - Published files: Check
filesfield includesdist/**/*
Verification Steps
# Check build file type
file dist/index.js
# Should display: Node.js script executable
# Check shebang
head -1 dist/index.js
# Should display: #!/usr/bin/env node
# Test CLI functionality
node dist/index.js --helpBest Practices
- Pre-publish testing: Always test built files locally
- Semantic versioning: Follow Semantic Versioning
- Documentation integrity: Keep README.md synchronized with features
- License clarity: Choose appropriate open source license
- Keyword optimization: Add relevant keywords for discoverability
Built with ❤️ using Bun runtime.