Last active
August 16, 2019 14:07
-
-
Save MhdAljuboori/f917915fd586ab40cc44 to your computer and use it in GitHub Desktop.
NG-Annotate for folder
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
var sh = require('shelljs'); | |
function annotateFile (filePath) { | |
console.log('annotate ' + filePath); | |
sh.exec('ng-annotate -a ' + filePath + ' -o ' + filePath); | |
} | |
function annotateFolder (folderPath) { | |
console.log("annotate Folder " + folderPath); | |
sh.cd(folderPath); | |
var files = sh.ls() || []; | |
for (var i=0; i<files.length; i++) { | |
var file = files[i]; | |
if (file.match(/.*\.js$/)) | |
annotateFile(file); | |
else if (!file.match(/.*\..*/)) { | |
annotateFolder(file); | |
sh.cd('../'); | |
} | |
} | |
} | |
if (process.argv.slice(2)[0]) | |
annotateFolder(process.argv.slice(2)[0]); | |
else { | |
console.log('There is no folder'); | |
console.log('--- node FILENAME.js FOLDER_PATH'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, just needed to annotate my legacy angularjs app only once so I could integrate it into my Angular stack.