Page tree
Skip to end of metadata
Go to start of metadata

This is a technical notes for setting up automatically code documentation for typescript in AuScope-Portal project. It also includes how to integrate the typedoc with Jenkins build.

we are using 

http://typedoc.org/guides/doccomments/

Pre-requirement:

Assume you already git clone the AuScope-Portal source code from GitHub and install the node8 with npm.


Add Pre Steps shell commend in AuScopePortalTrunk jenkins.

Browser to https://cgsrv8.arrc.csiro.au/jenkins/job/AuScopePortalTrunk/configure , then put following script into a pre step section

 

Linux Terminal

#angular4 deployment

#pushd the source code root directory
pushd ./
cd src/main/webapp/angular4/project/

#build angular4 portal first

npm install

ng build

#install typdedoc
npm install typedoc --save-dev

#generate the code document into src/main/webapp/doc/angular4 directory
./node_modules/.bin/typedoc --out ../../doc/angular4 --mode modules --module commonjs .
rm -rf node_modules
popd
# Create and commit the typescript documentation for the angular4 website
# If we're in the wrong dir then exit
[ ! -d src/main/webapp/doc/angular4 ] && exit 1
# Change the view to the local master branch
git checkout master
# Any recent changes must be pulled into local master
git pull origin master
# Add new & modified files, but only documentation files
git status --porcelain | egrep '^.+ src/main/webapp/doc/angular4' | awk '{print $2}' | xargs -iX git add X
# This prevents commit making the shell exit early with a failure if there are no files to commit
set +e
# Commit files. The 'Git Publisher' step below will push the files to github repository
# NB: Must name the author because the default 'cg-jenkins' is not recognised by github
git commit -m "Automatic typescript documentation update" --author "Lingbo Jiang <Lingbo.Jiang@csiro.au>"
exit 0