From 3dc5777b66dc1e3ff58029fc77158651308684d6 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Mon, 27 Feb 2017 01:35:34 +0800 Subject: [PATCH 1/3] Add doctoc devDependency and npm script Will use it to generate "Table of Contents" --- package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 725d9d3..c004ddd 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "test/installation": "npm run --silent test/installation/node && npm run --silent test/installation/iojs", "test/installation/node": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=installation_node test-$shell", "test/installation/iojs": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=installation_iojs test-$shell", - "test/sourcing": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=sourcing test-$shell" + "test/sourcing": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=sourcing test-$shell", + "doctoc": "doctoc README.markdown" }, "repository": { "type": "git", @@ -35,6 +36,7 @@ "devDependencies": { "replace": "^0.3.0", "semver": "^5.0.1", - "urchin": "^0.0.5" + "urchin": "^0.0.5", + "doctoc": "^1.2.0" } } From f8aaa32d179026b920e75864691a1587904be594 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Mon, 27 Feb 2017 01:36:57 +0800 Subject: [PATCH 2/3] README minor adjustment, generate "Table of Content" via doctoc --- README.markdown | 48 +++++++++++++++++++++++++++--------------------- package.json | 2 +- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/README.markdown b/README.markdown index 9cd618d..f9ee769 100644 --- a/README.markdown +++ b/README.markdown @@ -1,27 +1,33 @@ # Node Version Manager [![Build Status](https://travis-ci.org/creationix/nvm.svg?branch=master)][3] [![nvm version](https://img.shields.io/badge/version-v0.33.1-yellow.svg)][4] [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/684/badge)](https://bestpractices.coreinfrastructure.org/projects/684) + + ## Table of Contents - - [Installation](#installation) - - [Install script](#install-script) - - [Verify installation](#verify-installation) - - [Manual install](#manual-install) - - [Manual upgrade](#manual-upgrade) - - [Usage](#usage) - - [Long-term support](#long-term-support) - - [Migrating global packages while installing](#migrating-global-packages-while-installing) - - [io.js](#iojs) - - [System version of node](#system-version-of-node) - - [Listing versions](#listing-versions) - - [.nvmrc](#nvmrc) - - [Deeper Shell Integration](#deeper-shell-integration) - - [License](#license) - - [Running tests](#running-tests) - - [Bash completion](#bash-completion) - - [Usage](#usage-1) - - [Compatibility Issues](#compatibility-issues) - - [Installing nvm on Alpine Linux](#installing-nvm-on-alpine-linux) - - [Problems](#problems) +- [Installation](#installation) + - [Install script](#install-script) + - [Verify installation](#verify-installation) + - [Manual install](#manual-install) + - [Manual upgrade](#manual-upgrade) +- [Usage](#usage) + - [Long-term support](#long-term-support) + - [Migrating global packages while installing](#migrating-global-packages-while-installing) + - [io.js](#iojs) + - [System version of node](#system-version-of-node) + - [Listing versions](#listing-versions) + - [.nvmrc](#nvmrc) + - [Deeper Shell Integration](#deeper-shell-integration) + - [zsh](#zsh) + - [Calling `nvm use` automatically in a directory with a `.nvmrc` file](#calling-nvm-use-automatically-in-a-directory-with-a-nvmrc-file) +- [License](#license) +- [Running tests](#running-tests) +- [Bash completion](#bash-completion) + - [Usage](#usage-1) +- [Compatibility Issues](#compatibility-issues) +- [Installing nvm on Alpine Linux](#installing-nvm-on-alpine-linux) +- [Problems](#problems) + + ## Installation @@ -305,7 +311,7 @@ You can use [`avn`](https://github.com/wbyoung/avn) to deeply integrate into you If you prefer a lighter-weight solution, the recipes below have been contributed by `nvm` users. They are **not** supported by the `nvm` development team. We are, however, accepting pull requests for more examples. -#### Zsh +#### zsh ##### Calling `nvm use` automatically in a directory with a `.nvmrc` file diff --git a/package.json b/package.json index c004ddd..b81c8e9 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "test/installation/node": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=installation_node test-$shell", "test/installation/iojs": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=installation_iojs test-$shell", "test/sourcing": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=sourcing test-$shell", - "doctoc": "doctoc README.markdown" + "doctoc": "doctoc --title='## Table of Contents' --github README.markdown" }, "repository": { "type": "git", From 1689b174b376afa320c702a4eb45ca59a6f302ed Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Tue, 28 Feb 2017 04:17:29 +0800 Subject: [PATCH 3/3] [Test] Add doctoc up-to-date test in TravisCI --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 36ed102..24fb012 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ addons: - ksh cache: directories: + - $HOME/.npm - $HOME/.ghc - $HOME/.cabal - $TRAVIS_BUILD_DIR/.cache @@ -21,14 +22,16 @@ before_install: - curl --version - wget --version - if [ -n "${SHELLCHECK-}" ]; then cabal update && cabal install transformers-0.4.3.0 ShellCheck && shellcheck --version ; fi + - if [ -n "${DOCTOCCHECK-}" ]; then nvm install node && npm install -g doctoc && type doctoc ; fi install: - (mkdir /tmp/urchin && cd /tmp/urchin && curl -s "$(curl -s https://registry.npmjs.com/urchin | grep -Eo '"tarball":\s*"[^"]+"' | tail -n 1 | awk -F\" '{ print $4 }')" -O && tar -x -f urchin*) - chmod +x /tmp/urchin/package/urchin - '[ -z "$WITHOUT_CURL" ] || sudo apt-get remove curl -y' script: + - if [ -n "${DOCTOCCHECK-}" ]; then cp README.markdown README.markdown.orig && npm run doctoc && diff -q README.markdown README.markdown.orig ; fi - if [ -n "${SHELLCHECK-}" ]; then shellcheck -s bash nvm.sh && shellcheck -s sh nvm.sh && shellcheck -s dash nvm.sh && shellcheck -s ksh nvm.sh ; fi - if [ -n "${SHELLCHECK-}" ]; then shellcheck -s bash install.sh bash_completion nvm-exec ; fi - - if [ -z "${SHELLCHECK-}" ]; then make TEST_SUITE=$TEST_SUITE URCHIN=/tmp/urchin/package/urchin test-$SHELL ; fi + - if [ -n "${SHELL-}" ] && [ -n "${TEST_SUITE}" ]; then make TEST_SUITE=$TEST_SUITE URCHIN=/tmp/urchin/package/urchin test-$SHELL ; fi env: global: - CXX=g++-4.8 @@ -36,6 +39,7 @@ env: - PATH="~/.cabal/bin/:$(echo $PATH | sed 's/::/:/')" - NVM_DIR="${TRAVIS_BUILD_DIR}" matrix: + - DOCTOCCHECK=true - SHELLCHECK=true - SHELL=bash TEST_SUITE=install_script - SHELL=sh TEST_SUITE=fast