diff options
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/npm.eclass | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/eclass/npm.eclass b/eclass/npm.eclass index 65b7447..b6a2cde 100644 --- a/eclass/npm.eclass +++ b/eclass/npm.eclass @@ -7,8 +7,8 @@ # Jesus Rivero <neurogeek@gentoo.org> # @BLURB: Eclass for NodeJS packages available through the npm registry. # @DESCRIPTION: -# This eclass contains various functions that may be useful when -# dealing with packages from the npm registry, for NodeJS. +# This eclass contains various functions that may be useful when dealing with +# packages from the npm registry, for NodeJS. # Requires EAPI=2 or later. case ${EAPI} in @@ -29,37 +29,30 @@ NPM_MODULE="${PN}" # @ECLASS-VARIABLE: NPM_FILES # @INTERNAL # @DESCRIPTION: -# Files and directories that usually come in a standard -# NodeJS/npm module. -NPM_FILES="lib package.json index.js" +# Files and directories that usually come in a standard NodeJS/npm module. +NPM_FILES="index.js lib package.json ${PN}.js" # @ECLASS-VARIABLE: NPM_DOCS -# @INTERNAL # @DESCRIPTION: -# Document files that usually come in a standard -# NodeJS/npm module. -NPM_DOCS="README* LICENSE HISTORY*" +# Document files that come in a NodeJS/npm module, outside of the usual docs +# list of README*, ChangeLog AUTHORS* etc. These are only installed if 'doc' is +# in ${USE} +# NPM_DOCS="README* LICENSE HISTORY*" # @ECLASS-VARIABLE: NPM_EXTRA_FILES # @DESCRIPTION: -# If additional dist files are present in the NodeJS/npm module -# that are not listed in NPM_FILES, then this is the place to put them in. +# If additional dist files are present in the NodeJS/npm module that are not +# listed in NPM_FILES, then this is the place to put them in. # Can be either files, or directories. # Example: NPM_EXTRA_FILES="rigger.js modules" -# @ECLASS-VARIABLE: NPM_EXTRA_DOCS -# @DESCRIPTION: -# Variable for additional document files that are not listed -# in NPM_DOCS -# Example: NPM_EXTRA_DOCS="docs index.html" - HOMEPAGE="https://www.npmjs.org/package/${PN}" SRC_URI="http://registry.npmjs.org/${PN}/-/${P}.tgz" # @FUNCTION: npm-src_unpack # @DESCRIPTION: -# Default src_unpack function for NodeJS/npm packages. This funtions -# unpacks the source code, then renames the 'package' dir to $S +# Default src_unpack function for NodeJS/npm packages. This funtions unpacks +# the source code, then renames the 'package' dir to ${S}. npm_src_unpack() { unpack "${A}" @@ -69,15 +62,14 @@ npm_src_unpack() { # @FUNCTION: npm-src_compile # @DESCRIPTION: # This function does nothing. - npm_src_compile() { true } # @FUNCTION: npm-src_install # @DESCRIPTION: -# This function installs the NodeJS/npm module to an appropriate location, -# also taking care of NPM_FILES, NPM_EXTRA_FILES, NPM_DOCS and NPM_EXTRA_DOCS +# This function installs the NodeJS/npm module to an appropriate location, also +# taking care of NPM_FILES, NPM_EXTRA_FILES, NPM_DOCS npm_src_install() { local npm_files="${NPM_FILES} ${NPM_EXTRA_FILES}" @@ -91,9 +83,18 @@ npm_src_install() { cp -r "${S}/$f" ${node_modules} fi done + + # Install docs usually found in NodeJS/NPM packages. + local f + for f in README* HISTORY* ChangeLog AUTHORS NEWS TODO CHANGES \ + THANKS BUGS FAQ CREDITS CHANGELOG*; do + if [[ -s ${f} ]]; then + dodoc "${f}" + fi + done if has doc ${USE}; then - local npm_docs="${NPM_DOCS} ${NPM_EXTRA_DOCS}" + local npm_docs="${NPM_DOCS}" for f in $npm_docs do |