diff --git a/package.json b/package.json index 7fd9daf..1ff58d0 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,11 @@ "shx": "^0.2.2", "tmp": "^0.0.33", "tweak-sourcemap-paths": "0.0.3", + "typedoc": "0.8.0", + "typedoc-plugin-external-module-name": "1.1.1", + "typedoc-plugin-internal-external": "1.0.10", + "typedoc-plugin-ui-router": "1.0.6", + "ui-router-typedoc-themes": "1.0.2", "yargs": "^9.0.1" } } diff --git a/publish_docs.js b/publish_docs.js new file mode 100755 index 0000000..e320d26 --- /dev/null +++ b/publish_docs.js @@ -0,0 +1,44 @@ +#!/usr/bin/env node + +const publishYalcPackage = require('./publish_yalc_package'); +const util = require('./util'); +util.packageDir(); + +const fs = require('fs'); +const path = require('path'); +const _exec = util._exec; +const sh = require('shelljs'); +const readlineSync = require('readline-sync'); + +const CONFIG = JSON.parse(fs.readFileSync('./typedoc.json')); +const pkg = JSON.parse(fs.readFileSync('./package.json')); +const version = pkg.version; + +const GIT_URL = "git@github.com:ui-router/ui-router.github.io.git"; +const installTargetDir = path.join(".downstream_cache", "ui-router.gihub.io"); +const PAGES_DIR = path.join(installTargetDir, CONFIG.typedoc.publishDir); + +publishYalcPackage(installTargetDir, GIT_URL, { noInstall: true, noBuild: true, noPublish: true }); + +util.packageDir(); + +sh.rm('-rf', path.join(PAGES_DIR, 'latest')); +sh.cp('-r', CONFIG.typedoc.generateOptions.out, path.join(PAGES_DIR, 'latest')); + +sh.rm('-rf', path.join(PAGES_DIR, version)); +sh.cp('-r', CONFIG.typedoc.generateOptions.out, path.join(PAGES_DIR, version)); + +sh.cd(PAGES_DIR); +_exec("./process_docs.sh"); +_exec("git add ."); + +sh.echo("\n\nSpot check the docs, then run these commands to publish:\n\n"); +sh.echo("cd " + PAGES_DIR); +sh.echo(`git commit -m 'publish docs for ${version}'`); +sh.echo(`git push`); + +if (readlineSync.keyInYN('Publish docs?')) { + sh.cd(PAGES_DIR); + _exec(`git commit -m 'publish docs for ${version}'`); + _exec(`git push`); +} diff --git a/release.js b/release.js index d93a862..3d06d47 100755 --- a/release.js +++ b/release.js @@ -143,3 +143,9 @@ if (githuburl) { console.log("Could not determine github URL from package.json") } +// Generate docs +util.packageDir(); +if (fs.existsSync('typedoc.json') && readlineSync.keyInYN('Generate docs?')) { + _exec('generate_docs'); + _exec('publish_docs'); +} diff --git a/yarn.lock b/yarn.lock index e107d8d..574e83a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,59 @@ # yarn lockfile v1 +"@types/events@*": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@types/events/-/events-1.1.0.tgz#93b1be91f63c184450385272c47b6496fd028e02" + +"@types/fs-extra@^4.0.0": + version "4.0.7" + resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-4.0.7.tgz#02533262386b5a6b9a49797dc82feffdf269140a" + dependencies: + "@types/node" "*" + +"@types/glob@*": + version "5.0.35" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-5.0.35.tgz#1ae151c802cece940443b5ac246925c85189f32a" + dependencies: + "@types/events" "*" + "@types/minimatch" "*" + "@types/node" "*" + +"@types/handlebars@^4.0.31": + version "4.0.36" + resolved "https://registry.yarnpkg.com/@types/handlebars/-/handlebars-4.0.36.tgz#ff57c77fa1ab6713bb446534ddc4d979707a3a79" + +"@types/highlight.js@^9.1.8": + version "9.12.2" + resolved "https://registry.yarnpkg.com/@types/highlight.js/-/highlight.js-9.12.2.tgz#6ee7cd395effe5ec80b515d3ff1699068cd0cd1d" + +"@types/lodash@^4.14.37": + version "4.14.101" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.101.tgz#512f6c9e1749890f4d024e98cb995a63f562d458" + +"@types/marked@0.0.28": + version "0.0.28" + resolved "https://registry.yarnpkg.com/@types/marked/-/marked-0.0.28.tgz#44ba754e9fa51432583e8eb30a7c4dd249b52faa" + +"@types/minimatch@*": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" + +"@types/minimatch@^2.0.29": + version "2.0.29" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-2.0.29.tgz#5002e14f75e2d71e564281df0431c8c1b4a2a36a" + +"@types/node@*": + version "9.4.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-9.4.1.tgz#0f636f7837e15d2d73a7f6f3ea0e322eb2a5ab65" + +"@types/shelljs@^0.7.0": + version "0.7.8" + resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.8.tgz#4b4d6ee7926e58d7bca448a50ba442fd9f6715bd" + dependencies: + "@types/glob" "*" + "@types/node" "*" + JSONStream@^1.0.4: version "1.3.1" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.1.tgz#707f761e01dae9e16f1bcf93703b78c70966579a" @@ -415,6 +468,14 @@ from@~0: version "0.1.7" resolved "https://registry.yarnpkg.com/from/-/from-0.1.7.tgz#83c60afc58b9c56997007ed1a768b3ab303a44fe" +fs-extra@^4.0.0: + version "4.0.3" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94" + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -490,7 +551,7 @@ glob@^7.0.0, glob@^7.1.2: once "^1.3.0" path-is-absolute "^1.0.0" -graceful-fs@^4.1.2: +graceful-fs@^4.1.2, graceful-fs@^4.1.6: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" @@ -504,6 +565,16 @@ handlebars@^4.0.2: optionalDependencies: uglify-js "^2.6" +handlebars@^4.0.6: + version "4.0.11" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.11.tgz#630a35dfe0294bc281edae6ffc5d329fc7982dcc" + dependencies: + async "^1.4.0" + optimist "^0.6.1" + source-map "^0.4.4" + optionalDependencies: + uglify-js "^2.6" + has-flag@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" @@ -514,6 +585,10 @@ has@^1.0.1: dependencies: function-bind "^1.0.2" +highlight.js@^9.0.0: + version "9.12.0" + resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.12.0.tgz#e6d9dbe57cbefe60751f02af336195870c90c01e" + hosted-git-info@^2.1.4: version "2.5.0" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.5.0.tgz#6d60e34b3abbc8313062c3b798ef8d901a07af3c" @@ -633,6 +708,12 @@ json-stringify-safe@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" +jsonfile@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + optionalDependencies: + graceful-fs "^4.1.6" + jsonify@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" @@ -704,7 +785,7 @@ lodash@^4.0.0, lodash@^4.2.1: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" -lodash@^4.17.5: +lodash@^4.13.1, lodash@^4.17.5: version "4.17.5" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" @@ -734,6 +815,10 @@ map-stream@~0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.1.0.tgz#e56aa94c4c8055a16404a0674b78f215f7c8e194" +marked@^0.3.5: + version "0.3.12" + resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.12.tgz#7cf25ff2252632f3fe2406bde258e94eee927519" + mem@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" @@ -765,7 +850,7 @@ mimic-fn@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18" -minimatch@^3.0.4: +minimatch@^3.0.0, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" dependencies: @@ -937,6 +1022,10 @@ process-nextick-args@~1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" +progress@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" + ps-tree@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/ps-tree/-/ps-tree-1.1.0.tgz#b421b24140d6203f1ed3c76996b4427b08e8c014" @@ -1080,7 +1169,7 @@ shell-quote@^1.6.1: array-reduce "~0.0.0" jsonify "~0.0.0" -shelljs@^0.7.3, shelljs@^0.7.8: +shelljs@^0.7.0, shelljs@^0.7.3, shelljs@^0.7.8: version "0.7.8" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3" dependencies: @@ -1255,6 +1344,48 @@ tweak-sourcemap-paths@0.0.3: glob "^7.1.2" yargs "^9.0.1" +typedoc-default-themes@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/typedoc-default-themes/-/typedoc-default-themes-0.5.0.tgz#6dc2433e78ed8bea8e887a3acde2f31785bd6227" + +typedoc-plugin-external-module-name@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/typedoc-plugin-external-module-name/-/typedoc-plugin-external-module-name-1.1.1.tgz#0ef2d6a760b42c703519c474258b6f062983aa83" + +typedoc-plugin-internal-external@^1.0.10: + version "1.0.10" + resolved "https://registry.yarnpkg.com/typedoc-plugin-internal-external/-/typedoc-plugin-internal-external-1.0.10.tgz#df9fd6ee1743f009c39b8746a3c26edc36ce8bcd" + +typedoc-plugin-ui-router@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/typedoc-plugin-ui-router/-/typedoc-plugin-ui-router-1.0.6.tgz#6d452d499d1bd35701ebfdeb2beee670d8530e8b" + +typedoc@0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.8.0.tgz#d7172bc6a29964f451b7609c005beadadefe2361" + dependencies: + "@types/fs-extra" "^4.0.0" + "@types/handlebars" "^4.0.31" + "@types/highlight.js" "^9.1.8" + "@types/lodash" "^4.14.37" + "@types/marked" "0.0.28" + "@types/minimatch" "^2.0.29" + "@types/shelljs" "^0.7.0" + fs-extra "^4.0.0" + handlebars "^4.0.6" + highlight.js "^9.0.0" + lodash "^4.13.1" + marked "^0.3.5" + minimatch "^3.0.0" + progress "^2.0.0" + shelljs "^0.7.0" + typedoc-default-themes "^0.5.0" + typescript "2.4.1" + +typescript@2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.4.1.tgz#c3ccb16ddaa0b2314de031e7e6fee89e5ba346bc" + uglify-js@^2.6: version "2.8.29" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" @@ -1268,6 +1399,14 @@ uglify-to-browserify@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" +ui-router-typedoc-themes@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/ui-router-typedoc-themes/-/ui-router-typedoc-themes-1.0.2.tgz#3274960b8ee61e026b405ce3afcd9a2925992861" + +universalify@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.1.tgz#fa71badd4437af4c148841e3b3b165f9e9e590b7" + util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"