Skip to content

Commit b6caf5c

Browse files
Dermot SmythDermot Smyth
authored andcommitted
added jsdoc example project
1 parent d616e3f commit b6caf5c

File tree

5 files changed

+79
-0
lines changed

5 files changed

+79
-0
lines changed

examples/jsdoc-project/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.gradle
2+
.idea
3+
build
4+
node_modules

examples/jsdoc-project/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## Overview
2+
3+
Example of how to use [jsdoc](http://usejsdoc.org/) in MarkLogic project
4+
5+
This project uses the [JSDoc Gradle Plugin](https://github.com/liferay/liferay-portal/tree/master/modules/sdk/gradle-plugins-jsdoc) to run the jsdoc task
6+
7+
8+
## Usage
9+
10+
The command below will generate jsdoc for the code in __src/main/ml-modules/lib__
11+
12+
```
13+
gradle mlJsdoc
14+
```
15+
16+
The html documentation will be generated in __build/docs/jsdoc__
17+
18+
## Customize
19+
20+
To customise the jsdoc output, you can modify the __jsdoc.json__ file. Refer to the http://usejsdoc.org/about-configuring-jsdoc.html site for details on how to configure this.
21+
22+
To customise the jsdoc task generator, please customize the __mlJsDoc__ task in the __build.gradle__ file. Refer to the [JSDoc Gradle Plugin](https://github.com/liferay/liferay-portal/tree/master/modules/sdk/gradle-plugins-jsdoc) site for details on how to configure this.
23+
24+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
buildscript {
2+
repositories {
3+
mavenCentral()
4+
}
5+
6+
dependencies {
7+
classpath 'commons-io:commons-io:2.6'
8+
}
9+
}
10+
11+
plugins {
12+
id "com.marklogic.ml-gradle" version "3.11.0"
13+
id "com.liferay.app.jsdoc" version "2.0.19"
14+
}
15+
16+
17+
task mlJsDoc(type:com.liferay.gradle.plugins.jsdoc.JSDocTask) {
18+
configuration = project.resources.text.fromFile(file("jsdoc.json"))
19+
destinationDir = "build/docs/jsdoc"
20+
sourceDirs = file("src/main/ml-modules/lib")
21+
}

examples/jsdoc-project/jsdoc.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"plugins": [],
3+
"recurseDepth": 10,
4+
"source": {
5+
"includePattern": ".+\\.s?js(doc|x)?$",
6+
"excludePattern": "(^|\\/|\\\\)_"
7+
},
8+
"sourceType": "module",
9+
"tags": {
10+
"allowUnknownTags": true,
11+
"dictionaries": ["jsdoc","closure"]
12+
},
13+
"templates": {
14+
"cleverLinks": false,
15+
"monospaceLinks": false
16+
}
17+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
/**
3+
* Returns "Hello " plus the str parameter
4+
*
5+
* @example
6+
* // returns "Hello World"
7+
* hello("World")
8+
*
9+
* @param {string} str the string to say hello to
10+
*/
11+
function hello(str) {
12+
return `Hello ${str}`
13+
}

0 commit comments

Comments
 (0)