You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prepare Angular JSON is a lightweight CLI tool that generates a clean angular.json file from a commented angular.jsonc.
It allows you to keep your Angular configuration files readable and well-documented, while staying fully compatible with the Angular CLI.
✨ Features
✅ Converts angular.jsonc (with comments) into valid angular.json
✅ Automatically adds prepare-json and start scripts to your package.json
✅ Validates JSON output before writing
✅ Ready for integration into CI/CD pipelines
✅ No runtime dependencies in your Angular app
🚀 Quick Start
Install globally
npm install -g prepare-angular-json
Run the tool
prepare-angular-json
This will:
Create or update angular.json from angular.jsonc
Add useful scripts to your package.json if needed
Use it
pnpm start
#or
npm run start
🛠 What it does
The tool adds or updates these entries in your package.json:
"scripts": {
"prepare-json": "node prepare-angular-json.js",
"start": "pnpm run prepare-json && ng serve"
}
And generates this file if not present:
// prepare-angular-json.jsimport{readFileSync,writeFileSync,existsSync}from'fs';importstripJsonCommentsfrom'strip-json-comments';constinputPath='./angular.jsonc';constoutputPath='./angular.json';if(!existsSync(inputPath)){console.error(`❌ File "${inputPath}" not found.`);process.exit(1);}try{constjsonWithComments=readFileSync(inputPath,'utf8');constcleanedJson=stripJsonComments(jsonWithComments);JSON.parse(cleanedJson);writeFileSync(outputPath,cleanedJson);console.log(`✅ "${outputPath}" successfully created from "${inputPath}".`);}catch(error){console.error('❌ Error:',error.message);process.exit(1);}
About
Generate a valid angular.json from a commented angular.jsonc. CLI-ready, CI-friendly, and perfect for clean Angular configs.