Skip to content
This repository has been archived by the owner on Nov 20, 2019. It is now read-only.

Commit

Permalink
chore: 增加doc生成脚本等
Browse files Browse the repository at this point in the history
  • Loading branch information
binsee committed Apr 11, 2018
1 parent 2780687 commit 95912da
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
24 changes: 22 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "index.js",
"scripts": {
"start": "node demo",
"test": "echo \"Error: no test specified\" && exit 1"
"doc": "node scripts/docVer.js >nul && jsdoc2md index.js >> docs/index.md",
"eslint": "eslint {define,helper,index,demo}.js"
},
"author": "binsee",
"license": "ISC",
Expand All @@ -14,10 +15,29 @@
"ws": "^5.1.1"
},
"devDependencies": {
"@types/eslint": "^4.16.0",
"@types/log4js": "^2.3.5",
"@types/uuid": "^3.4.3",
"@types/ws": "^4.0.2",
"eslint": "^4.19.1",
"eslint-config-egg": "^7.0.0",
"jsdoc-to-markdown": "^4.0.1",
"log4js": "^2.5.3",
"qrcode-terminal": "^0.12.0"
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/binsee/padchat-sdk.git"
},
"bugs": {
"url": "https://github.com/binsee/padchat-sdk/issues"
},
"homepage": "https://github.com/binsee/padchat-sdk#readme",
"files": [
"README.md",
"package.json",
"define.js",
"helper.js",
"index.js"
]
}
22 changes: 22 additions & 0 deletions scripts/docVer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict'

const fs = require('fs')

const tpl = `# Padchat Sdk $ver$ Documentation
`

console.log(`args: ${process.argv}`)

try {
const tmpBuf = fs.readFileSync('./package.json')
const data = JSON.parse(String(tmpBuf))
const ver = String(data.version || '')
const str = tpl.replace('$ver$', `v${ver}` || 'Unknown version')

fs.writeFileSync('docs/index.md', str)
} catch (e) {
console.error(e)
process.exit(-1)
}

0 comments on commit 95912da

Please sign in to comment.