Generates a jsconfig.json file from an alias hash
TODOs
- Automate publish through CI
Setup
npm install
Test
npm test
To Publish
- Run
npm run release
- Commit changes
- Run
npm publish
Examples
const { writeJsconfig } = require("@revved/generate-jsconfig");
const aliases = {
"~root": "./",
"~lib": "./lib",
"~config": "./config",
}
const merge = config => {
config.compilerOptions.target = "es6";
return config;
};
// __dirname may not be the root if running from a bin folder. Adjust as needed i.e. path.join(__dirname, "../");
writeJsconfig(__dirname, getWebpackAliases(), merge);
Result written to jsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"~root/*": [
"api-boomnation/*"
],
"~lib/*": [
"api-boomnation/lib/*"
],
"~config/*": [
"api-boomnation/config/*"
],
},
"target": "es6"
},
"exclude": [
"node_modules",
"**/node_modules/*"
]
}