@accessiblewebmedia/ionic-angular-init
v1.0.9
Published
CLI tool to initialize Ionic Angular projects with Firebase configuration
Maintainers
Readme
@accessiblewebmedia/ionic-angular-init
A CLI tool to initialize Ionic Angular projects with Firebase configuration, environment management, and CI/CD setup.
Features
- 🚀 Environment Management: Creates multiple environment configurations for dev, staging, and production
- 🔥 Firebase Integration: Optional Firebase hosting setup with GitHub Actions CI/CD
- 📦 Package.json Updates: Adds useful scripts and metadata without overwriting existing content
- ⚙️ Angular Configuration: Updates
angular.jsonwith build and serve configurations - 📚 Documentation: Generates comprehensive docs and README files
- 🛡️ Idempotent: Safe to run multiple times, won't duplicate configurations
- 🔍 Dry Run Mode: Preview changes before applying them
Installation
# Global installation
npm install -g @accessiblewebmedia/ionic-angular-init
# Or use npx (recommended)
npx @accessiblewebmedia/ionic-angular-initUsage
Basic Usage
# Interactive mode
npx @accessiblewebmedia/ionic-angular-init
# Non-interactive with defaults
npx @accessiblewebmedia/ionic-angular-init --yes
# Preview changes without applying
npx @accessiblewebmedia/ionic-angular-init --dry-runAdvanced Usage
npx @accessiblewebmedia/ionic-angular-init \
--yes \
--author "Your Name" \
--title "My Awesome App" \
--website "https://myapp.com" \
--firebase \
--ci=github \
--hosting-sites="prod:myapp-prod,staging:myapp-staging" \
--branch-prod=main \
--branch-staging=developOptions
| Option | Description | Default |
|--------|-------------|---------|
| -y, --yes | Skip prompts and use defaults | false |
| --dry-run | Show planned changes without writing files | false |
| --author <string> | Author name for package.json | Prompted |
| --title <string> | Project title (used for package.json name) | Prompted |
| --website <url> | Website URL for package.json homepage | Prompted |
| --firebase | Ensure @angular/fire and firebase are installed | false |
| --ci <github\|none> | CI/CD setup | github |
| --hosting-sites <sites> | Firebase hosting sites mapping | Prompted |
| --branch-prod <branch> | Production branch name | main |
| --branch-staging <branch> | Staging branch name | staging |
What It Does
1. Environment Files
Creates/updates environment files in src/environments/:
environment.ts- Developmentenvironment.prod.ts- Productionenvironment.staging.ts- Stagingenvironment.prod.staging.ts- Staging with production buildenvironment.example.ts- Example configurationenvironment.prod.example.ts- Example production configuration
2. Package.json Updates
- Adds useful npm scripts for different environments
- Sets author, homepage, and project name
- Ensures Node.js 18+ requirement
- Installs Firebase dependencies if requested
- Version bump and deploy scripts:
vd- Patch bump, build, deploy to productionfvd- Feature bump, build, deploy to productionmvd- Major bump, build, deploy to productiontd- Build and deploy to staging (no version bump)
3. Angular Configuration
Updates angular.json with:
- Build configurations for staging and production
- Serve configurations for different environments
- File replacements for environment switching
4. Firebase Setup (Optional)
If --firebase is passed:
- Generates
firebase.jsonand.firebaserc - Creates GitHub Actions workflow for CI/CD
- Sets up hosting targets for production and staging
5. Documentation
Generates:
- Project README with usage instructions
docs/folder with detailed guides- Environment configuration guide
- Deployment instructions
Project Requirements
The CLI validates that you're in a valid Ionic Angular workspace:
- Must have
package.jsonwith@ionic/angularand@angular/coredependencies - Must have
angular.jsonwith proper project structure
Examples
Quick Start
cd my-ionic-app
npx @accessiblewebmedia/ionic-angular-init --yes --firebaseCustom Configuration
npx @accessiblewebmedia/ionic-angular-init \
--title "Kahal" \
--author "Alicia Anne Taylor" \
--website "https://theoneassembly.org" \
--firebase \
--hosting-sites="prod:kahal-prod,staging:kahal-staging"Preview Changes
npx @accessiblewebmedia/ionic-angular-init --dry-run --firebaseDevelopment
Building
npm install
npm run buildDevelopment Mode
npm run devTesting
npm testLicense
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
