easter-egg-generator
v1.0.2
Published
A CLI tool to generate JavaScript easter eggs for websites
Maintainers
Readme
🥚 Easter Egg Generator
A fun CLI tool built with TypeScript that generates JavaScript easter eggs for your website! Create engaging hidden features that delight your users and showcase your creativity.
Features
- TypeScript Built - Fully typed codebase for better development experience
- Interactive CLI - Easy-to-use command-line interface with prompts
- Multiple Easter Egg Types - Console messages, Konami code, click counters, key sequences, and more
- Optimized Output - Webpack-bundled and minified JavaScript for production
- Zero Dependencies - Generated files work standalone without external libraries
- Cross-Browser Compatible - Works in all modern browsers
- Non-Intrusive - Won't interfere with your existing website functionality
- Turbo-Ready - Built with Turbo for fast builds and future monorepo support
Installation
Global Installation (Recommended)
npm install -g easter-egg-generatorLocal Installation
npm install easter-egg-generatorUsage
Interactive Mode (Default)
easter-egg-generator
# or
egg-genCommand Line Options
The CLI supports the following options via yargs:
# Run in interactive mode (default)
easter-egg-generator --interactive
easter-egg-generator -i
# Specify custom output directory
easter-egg-generator --output ./custom-output
easter-egg-generator -o ./custom-output
# Show help
easter-egg-generator --help
easter-egg-generator -h
# Show version
easter-egg-generator --version
easter-egg-generator -v
# Example with multiple options
easter-egg-generator --interactive --output ./my-easter-eggsArguments Reference
| Option | Alias | Type | Default | Description |
|--------|-------|------|---------|-------------|
| --interactive | -i | boolean | true | Run in interactive mode with prompts |
| --output | -o | string | ./output | Output directory for generated files |
| --help | -h | - | - | Show help information |
| --version | -v | - | - | Show version number |
Easter Egg Types
🖥️ Console Message
Displays welcome messages and fun text in the browser's developer console.
- Perfect for recruiting developers
- Customizable messages
- Styled console output
🎮 Konami Code
Classic gaming easter egg activated with the famous cheat code sequence:
↑ ↑ ↓ ↓ ← → ← → B A
👆 Click Counter
Hidden functionality triggered by clicking an element multiple times.
- Configurable target element (CSS selector)
- Customizable click count threshold
- Visual feedback and celebration effects
⌨️ Key Sequence
Secret codes activated by typing specific letter sequences.
- Custom word/phrase triggers
- Sparkle animations
- Timeout reset for natural typing
🐭 Mouse Shake
Detects rapid mouse movement to trigger surprises.
- Automatic sensitivity adjustment
- Screen shake effects
- Fun notifications
Generated Files
The tool creates:
easter-eggs.js- Production-ready minified JavaScriptREADME.md- Documentation specific to your generated easter eggs
Example Output Structure
output/
├── easter-eggs.js # Main JavaScript file to include in your website
└── README.md # Documentation for your easter eggsIntegration
Add the generated file to your website:
<script src="path/to/easter-eggs.js"></script>Or load asynchronously:
<script>
const script = document.createElement('script');
script.src = 'path/to/easter-eggs.js';
script.async = true;
document.head.appendChild(script);
</script>Troubleshooting
"Cannot find module 'webpack'" Error
If you encounter a webpack module error after installation:
# Uninstall and reinstall globally
npm uninstall -g easter-egg-generator
npm install -g easter-egg-generator
# Or for local installation
npm uninstall easter-egg-generator
npm install easter-egg-generatorThis ensures all required dependencies (including webpack) are properly installed.
Permission Issues on macOS/Linux
If you get permission errors during global installation:
# Use sudo (not recommended)
sudo npm install -g easter-egg-generator
# Or configure npm to use a different directory (recommended)
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.profile
source ~/.profile
npm install -g easter-egg-generatorNode.js Version Issues
Make sure you're using Node.js 18.0.0 or higher:
node --version # Should show v18.0.0 or higherDevelopment
Setup
git clone <repository-url>
cd easter-egg-generator
npm installDevelopment Mode
npm run dev # Run in development mode
npm run dev:interactive # Run with interactive flag
npm run dev:test # Run test development scriptBuild
npm run buildTest
npm test # Run tests (currently placeholder)
npm run dev:test # Run development test scriptDevelopment Tools
npm run start # Start production build
npm run lint # Run linting (placeholder)Clean Build
npm run clean
npm run buildPackage for Publishing
npm run prepublishOnly # Automatic build before publishing
npm run prepack # Build before packaging
npm pack # Create package tarballType Check
npm run type-check # Check TypeScript types without emittingBuild Process
The generator uses a sophisticated build pipeline powered by TypeScript and Turbo:
- TypeScript Compilation - Source code is compiled from TypeScript to JavaScript
- Type Checking - Ensures type safety and catches errors at build time
- Template Generation - Creates JavaScript from user inputs and templates
- Webpack Bundling - Bundles code with optimal settings
- Babel Transpilation - Ensures compatibility with older browsers
- Minification - Reduces file size for production
- Documentation - Generates usage instructions
Technology Stack
- TypeScript - Type-safe development with full type declarations
- Turbo - Fast build system and monorepo support
- Webpack - Module bundling and minification
- Babel - JavaScript transpilation for browser compatibility
- Yargs - Command-line argument parsing with built-in help
- Inquirer - Interactive command-line prompts
- Chalk - Colored terminal output for better UX
- fs-extra - Enhanced file system operations
- tsx - TypeScript execution for development
Browser Support
- Chrome (latest 2 versions)
- Firefox (latest 2 versions)
- Safari (latest 2 versions)
- Edge (latest 2 versions)
- Internet Explorer 11+
Requirements
- Node.js 18.0.0 or higher
- npm 8.0.0 or higher
Publishing
This package is ready for npm publishing with:
- TypeScript declarations included
- Proper package.json configuration
- GitHub Actions CI/CD pipeline
- Automated testing and building
- Source maps for debugging
# For maintainers
npm version patch|minor|major
git push --tags
# CI will automatically publish to npm on releaseContributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
MIT License - feel free to use this in your projects!
Changelog
v1.0.0
- Initial release
- Interactive CLI interface
- 5 easter egg types
- Webpack build pipeline
- Cross-browser compatibility
Made with ❤️ for developers who love hidden surprises!
