瀏覽代碼

Fix documentation building

Kevin van Zonneveld 9 年之前
父節點
當前提交
44c28178a7

+ 11 - 11
src/core/Core.js

@@ -4,10 +4,10 @@ import Translator from '../core/Translator'
 import ejs from 'ejs'
 
 /**
-* Main Uppy core
-*
-* @param {object} opts general options, like locale, to show modal or not to show
-*/
+ * Main Uppy core
+ *
+ * @param {object} opts general options, like locale, to show modal or not to show
+ */
 export default class Core {
   constructor (opts) {
     // set default options
@@ -31,7 +31,7 @@ export default class Core {
     console.log(this.translator.t('filesChosen', {smart_count: 3}))
   }
 
-  /**
+/**
  * Registers a plugin with Core
  *
  * @param {Class} Plugin object
@@ -47,7 +47,7 @@ export default class Core {
     return this
   }
 
-  /**
+/**
  * Sets plugin’s progress, like for uploads
  *
  * @param {object} plugin that wants to set progress
@@ -60,7 +60,7 @@ export default class Core {
     return this
   }
 
-  /**
+/**
  * Runs all plugins of the same type in parallel
  *
  * @param {string} type that wants to set progress
@@ -80,10 +80,10 @@ export default class Core {
     return ejs.render(template, options)
   }
 
-  /**
-  * Runs a waterfall of runType plugin packs, like so:
-  * All preseters(data) --> All selecters(data) --> All uploaders(data) --> done
-  */
+/**
+ * Runs a waterfall of runType plugin packs, like so:
+ * All preseters(data) --> All selecters(data) --> All uploaders(data) --> done
+ */
   run () {
     console.log({
       class: 'Core',

+ 30 - 30
src/core/Translator.js

@@ -1,33 +1,33 @@
 /**
-* Translates strings with interpolation & pluralization support.Extensible with custom dictionaries
-* and pluralization functions.
-*
-* Borrows heavily from and inspired by Polyglot https://github.com/airbnb/polyglot.js,
-* basically a stripped-down version of it. Differences: pluralization functions are not hardcoded
-* and can be easily added among with dictionaries, nested objects are used for pluralization
-* as opposed to `||||` delimeter
-*
-* Usage example: `translator.t('files_chosen', {smart_count: 3})`
-*
-* @param {object} opts
-*/
+ * Translates strings with interpolation & pluralization support.Extensible with custom dictionaries
+ * and pluralization functions.
+ *
+ * Borrows heavily from and inspired by Polyglot https://github.com/airbnb/polyglot.js,
+ * basically a stripped-down version of it. Differences: pluralization functions are not hardcoded
+ * and can be easily added among with dictionaries, nested objects are used for pluralization
+ * as opposed to `||||` delimeter
+ *
+ * Usage example: `translator.t('files_chosen', {smart_count: 3})`
+ *
+ * @param {object} opts
+ */
 export default class Translator {
   constructor (opts) {
     const defaultOptions = {}
     this.opts = Object.assign({}, defaultOptions, opts)
   }
 
-  /**
-  * Takes a string with placeholder variables like `%{smart_count} file selected`
-  * and replaces it with values from options `{smart_count: 5}`
-  *
-  * @license https://github.com/airbnb/polyglot.js/blob/master/LICENSE
-  * taken from https://github.com/airbnb/polyglot.js/blob/master/lib/polyglot.js#L299
-  *
-  * @param {string} phrase that needs interpolation, with placeholders
-  * @param {object} options with values that will be used to replace placeholders
-  * @return {string} interpolated
-  */
+/**
+ * Takes a string with placeholder variables like `%{smart_count} file selected`
+ * and replaces it with values from options `{smart_count: 5}`
+ *
+ * @license https://github.com/airbnb/polyglot.js/blob/master/LICENSE
+ * taken from https://github.com/airbnb/polyglot.js/blob/master/lib/polyglot.js#L299
+ *
+ * @param {string} phrase that needs interpolation, with placeholders
+ * @param {object} options with values that will be used to replace placeholders
+ * @return {string} interpolated
+ */
   interpolate (phrase, options) {
     const replace = String.prototype.replace
     const dollarRegex = /\$/g
@@ -51,13 +51,13 @@ export default class Translator {
     return phrase
   }
 
-  /**
-  * Public translate method
-  *
-  * @param {string} key
-  * @param {object} options with values that will be used later to replace placeholders in string
-  * @return {string} translated (and interpolated)
-  */
+/**
+ * Public translate method
+ *
+ * @param {string} key
+ * @param {object} options with values that will be used later to replace placeholders in string
+ * @return {string} translated (and interpolated)
+ */
   t (key, options) {
     if (options && options.smart_count) {
       var plural = this.opts.locale.pluralize(options.smart_count)

+ 7 - 7
src/plugins/DragDrop.js

@@ -3,9 +3,9 @@ import Plugin from './Plugin'
 import templateDragDrop from '../templates/dragdrop.hbs'
 
 /**
-* Drag & Drop plugin
-*
-*/
+ * Drag & Drop plugin
+ *
+ */
 export default class DragDrop extends Plugin {
   constructor (core, opts) {
     super(core, opts)
@@ -42,10 +42,10 @@ export default class DragDrop extends Plugin {
     }))
   }
 
-   /**
-  * Checks if the browser supports Drag & Drop
-  * @return {Boolean} true if supported, false otherwise
-  */
+/**
+ * Checks if the browser supports Drag & Drop
+ * @return {Boolean} true if supported, false otherwise
+ */
   checkDragDropSupport () {
     const div = document.createElement('div')
 

+ 8 - 8
src/plugins/Plugin.js

@@ -1,12 +1,12 @@
 /**
-* Boilerplate that all Plugins share - and should not be used
-* directly. It also shows which methods final plugins should implement/override,
-* this deciding on structure.
-*
-* @param {object} main Uppy core object
-* @param {object} object with plugin options
-* @return {array | string} files or success/fail message
-*/
+ * Boilerplate that all Plugins share - and should not be used
+ * directly. It also shows which methods final plugins should implement/override,
+ * this deciding on structure.
+ *
+ * @param {object} main Uppy core object
+ * @param {object} object with plugin options
+ * @return {array | string} files or success/fail message
+ */
 export default class Plugin {
 
   constructor (core, opts) {

+ 5 - 5
src/plugins/Tus10.js

@@ -2,16 +2,16 @@ import Plugin from './Plugin'
 import tus from 'tus-js-client'
 
 /**
-* Tus resumable file uploader
-*
-*/
+ * Tus resumable file uploader
+ *
+ */
 export default class Tus10 extends Plugin {
   constructor (core, opts) {
     super(core, opts)
     this.type = 'uploader'
   }
 
-  /**
+/**
  * Add files to an array of `upload()` calles, passing the current and total file count numbers
  *
  * @param {array | object} results
@@ -41,7 +41,7 @@ export default class Tus10 extends Plugin {
     return Promise.all(uploaders)
   }
 
-  /**
+/**
  * Create a new Tus upload
  *
  * @param {object} file for use with upload

+ 1 - 1
src/templates/dragdrop.ejs

@@ -2,7 +2,7 @@
       method="post"
       action="/"
       enctype="multipart/form-data">
-    <img class="UppyDragDrop-puppy" src="/images/uppy.svg">
+    <img class="UppyDragDrop-puppy" src="/images/uppy.svg" />
     <input class="UppyDragDrop-input"
            type="file"
            name="files[]"

+ 1 - 1
src/templates/dragdrop.hbs

@@ -2,7 +2,7 @@
       method="post"
       action="/"
       enctype="multipart/form-data">
-    <img class="UppyDragDrop-puppy" src="/images/uppy.svg">
+    <img class="UppyDragDrop-puppy" src="/images/uppy.svg" />
     <input class="UppyDragDrop-input"
            type="file"
            name="files[]"

+ 1 - 1
src/templates/dragdrop.js

@@ -3,7 +3,7 @@ export default function (strings) {
         method="post"
         action="/"
         enctype="multipart/form-data">
-      <img class="UppyDragDrop-puppy" src="/images/uppy.svg">
+      <img class="UppyDragDrop-puppy" src="/images/uppy.svg" />
       <input class="UppyDragDrop-input"
              type="file"
              name="files[]"

+ 6 - 2
website/build-documentation.js

@@ -8,10 +8,14 @@ var fs = require('fs')
 var docOrder = ['Core', 'Utils', 'Translator', 'Plugin']
 
 documentation('../src/index.js', {order: docOrder}, function (err, comments) {
-  if (err) console.log(err)
+  if (err) {
+    throw new Error(err)
+  }
 
   documentationFormatter(comments, {}, function (err, output) {
-    if (err) console.log(err)
+    if (err) {
+      throw new Error(err)
+    }
 
     var inputMarkdownContent = remark.parse(fs.readFileSync('src/api/docs.md', 'utf-8'))
     var newStuff = remark.parse(output)

+ 1 - 1
website/src/api/docs.md

@@ -187,7 +187,7 @@ Drag & Drop plugin
 
 Checks if the browser supports Drag & Drop
 
-Returns **object** true if supported, false otherwise
+Returns **Boolean** true if supported, false otherwise
 
 ## Tus10