Last active
August 21, 2018 05:42
-
-
Save jackson-dean/545b8f027fc64d28a2b26c01fbce068c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
'use strict'; | |
const fs = require('fs'); | |
// TODO: update current jsconfig if it exists | |
const config = { | |
compilerOptions: { | |
baseUrl: ".", | |
paths: {}, | |
}, | |
exclude: [ | |
"node_modules", | |
"dist", | |
".git", | |
"build", | |
"dist", | |
"tmp", | |
"i18n", | |
"config", | |
".gradle", | |
".eyeglass_cache", | |
"logs", | |
".vscode", | |
".bowerrc" | |
] | |
}; | |
const addonSources = [ | |
"./core/engines", | |
"./core/lib", | |
"./engine-lib", | |
"./extended/engines", | |
"./extended/lib", | |
"./lib" | |
]; | |
addonSources.forEach(addonSource => { | |
const addonNames = fs.readdirSync(addonSource); | |
addonNames.forEach(directoryName => { | |
if (/^\./.test(directoryName) || directoryName === 'README.md') { | |
return; | |
} | |
const pathKey = directoryName === 's-base' ? 'shared/*' : `${directoryName}/*`; | |
const sources = [`${addonSource}/${directoryName}/addon/*`, `${addonSource}/${directoryName}/addon-test-support/*`]; | |
const sourcesForKey = config.compilerOptions.paths[pathKey]; | |
config.compilerOptions.paths[pathKey] = sourcesForKey ? sourcesForKey.concat(sources) : sources; | |
}); | |
}); | |
fs.writeFile('jsconfig.json', JSON.stringify(config, null, 2), 'utf8'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment