From acbd7d21b1550318001c2dd86bb952c63dbfc8a4 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sun, 30 Dec 2018 05:17:00 -0600 Subject: [PATCH 001/106] Converting to TypeScript --- .eslintrc.yml | 11 --- .travis.yml | 7 +- package-lock.json | 147 ++++++++++++++++++++++++++++++ package.json | 26 ++++-- bin/bump.js => src/bin/bump.ts | 152 +++++++++++++++++++------------ lib/index.js => src/lib/index.ts | 0 test/.eslintrc.yml | 10 ++ tsconfig.json | 31 +++++++ tslint.yaml | 8 ++ 9 files changed, 316 insertions(+), 76 deletions(-) delete mode 100644 .eslintrc.yml rename bin/bump.js => src/bin/bump.ts (57%) rename lib/index.js => src/lib/index.ts (100%) create mode 100644 tsconfig.json create mode 100644 tslint.yaml diff --git a/.eslintrc.yml b/.eslintrc.yml deleted file mode 100644 index 919c5af..0000000 --- a/.eslintrc.yml +++ /dev/null @@ -1,11 +0,0 @@ -# ESLint config -# http://eslint.org/docs/user-guide/configuring -# https://github.com/JS-DevTools/eslint-config-modular - -root: true - -extends: - - modular/best-practices - - modular/style - - modular/es6 - - modular/node diff --git a/.travis.yml b/.travis.yml index 3185131..b61a17f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,12 @@ os: - osx - windows -script: npm run lint && npm run coverage +before_script: + - npm run lint + - npm run build + +script: + - npm run coverage after_success: # send code-coverage data to Coveralls diff --git a/package-lock.json b/package-lock.json index f68715e..9f9a729 100644 --- a/package-lock.json +++ b/package-lock.json @@ -119,6 +119,24 @@ } } }, + "@types/chai": { + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.1.7.tgz", + "integrity": "sha512-2Y8uPt0/jwjhQ6EiluT0XCri1Dbplr0ZxfFXUz+ye13gaqE8u5gL5ppao1JrUYr9cIip5S6MvQzBS7Kke7U9VA==", + "dev": true + }, + "@types/mocha": { + "version": "5.2.5", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.5.tgz", + "integrity": "sha512-lAVp+Kj54ui/vLUFxsJTMtWvZraZxum3w3Nwkble2dNuV5VnPA+Mi2oGX9XYJAaIvZi3tn3cbjS/qcJXRb6Bww==", + "dev": true + }, + "@types/node": { + "version": "10.12.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.18.tgz", + "integrity": "sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ==", + "dev": true + }, "acorn": { "version": "6.0.4", "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.0.4.tgz", @@ -2242,6 +2260,16 @@ } } }, + "mock-require": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mock-require/-/mock-require-3.0.2.tgz", + "integrity": "sha512-aD/Y1ZFHqw5pHg3HVQ50dLbfaAAcytS6sqLuhP51Dk3TSPdFb2VkSAa3mjrHifLIlGAtwQHJHINafAyqAne7vA==", + "dev": true, + "requires": { + "get-caller-file": "^1.0.2", + "normalize-path": "^2.1.1" + } + }, "ms": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", @@ -2285,6 +2313,15 @@ "validate-npm-package-license": "^3.0.1" } }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + }, "npm-check": { "version": "5.9.0", "resolved": "https://registry.npmjs.org/npm-check/-/npm-check-5.9.0.tgz", @@ -3892,6 +3929,12 @@ "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, "path-type": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", @@ -4131,6 +4174,12 @@ "rc": "^1.0.1" } }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, "repeating": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", @@ -4196,6 +4245,15 @@ "resolve-from": "^1.0.0" } }, + "resolve": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.9.0.tgz", + "integrity": "sha512-TZNye00tI67lwYvzxCxHGjwTNlUV70io54/Ed4j6PscB8xVfuBJpRenI/o6dVk0cY0PYTY27AgCoGGxRnYuItQ==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + }, "resolve-dir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", @@ -4599,6 +4657,40 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==" }, + "tslint": { + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.12.0.tgz", + "integrity": "sha512-CKEcH1MHUBhoV43SA/Jmy1l24HJJgI0eyLbBNSRyFlsQvb9v6Zdq+Nz2vEOH00nC5SUx4SneJ59PZUS/ARcokQ==", + "dev": true, + "requires": { + "babel-code-frame": "^6.22.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^3.2.0", + "glob": "^7.1.1", + "js-yaml": "^3.7.0", + "minimatch": "^3.0.4", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.27.2" + } + }, + "tslint-modular": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/tslint-modular/-/tslint-modular-1.0.0.tgz", + "integrity": "sha512-WLtNdd7GrwzqNQY6xcpDXKq00YbtxwNWhPSegRgqwu90waWUD8mIKk6baYDjvqSfjnGT7ZZ9AjdhsaORzYfyIw==" + }, + "tsutils": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, "tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -4629,6 +4721,23 @@ "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==" }, + "typescript": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.2.2.tgz", + "integrity": "sha512-VCj5UiSyHBjwfYacmDuc/NOk4QQixbE+Wn7MFJuS0nRuPQbof132Pw4u53dm264O8LPc2MVsc7RJNml5szurkg==", + "dev": true + }, + "typescript-tslint-plugin": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/typescript-tslint-plugin/-/typescript-tslint-plugin-0.2.1.tgz", + "integrity": "sha512-j0Tn/2GlAwnaklSNMOZRNpv96j6IWkQF6RuTJ5WowfNlgdYqnJpSaVFwT22INwJiPDDGKNe/aATT0qkU0pWM4w==", + "dev": true, + "requires": { + "minimatch": "^3.0.4", + "mock-require": "^3.0.2", + "vscode-languageserver": "^5.1.0" + } + }, "unique-string": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz", @@ -4715,6 +4824,44 @@ "extsprintf": "^1.2.0" } }, + "vscode-jsonrpc": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-4.0.0.tgz", + "integrity": "sha512-perEnXQdQOJMTDFNv+UF3h1Y0z4iSiaN9jIlb0OqIYgosPCZGYh/MCUlkFtV2668PL69lRDO32hmvL2yiidUYg==", + "dev": true + }, + "vscode-languageserver": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-5.2.1.tgz", + "integrity": "sha512-GuayqdKZqAwwaCUjDvMTAVRPJOp/SLON3mJ07eGsx/Iq9HjRymhKWztX41rISqDKhHVVyFM+IywICyZDla6U3A==", + "dev": true, + "requires": { + "vscode-languageserver-protocol": "3.14.1", + "vscode-uri": "^1.0.6" + } + }, + "vscode-languageserver-protocol": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.14.1.tgz", + "integrity": "sha512-IL66BLb2g20uIKog5Y2dQ0IiigW0XKrvmWiOvc0yXw80z3tMEzEnHjaGAb3ENuU7MnQqgnYJ1Cl2l9RvNgDi4g==", + "dev": true, + "requires": { + "vscode-jsonrpc": "^4.0.0", + "vscode-languageserver-types": "3.14.0" + } + }, + "vscode-languageserver-types": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.14.0.tgz", + "integrity": "sha512-lTmS6AlAlMHOvPQemVwo3CezxBp0sNB95KNPkqp3Nxd5VFEnuG1ByM0zlRWos0zjO3ZWtkvhal0COgiV1xIA4A==", + "dev": true + }, + "vscode-uri": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-1.0.6.tgz", + "integrity": "sha512-sLI2L0uGov3wKVb9EB+vIQBl9tVP90nqRvxSoJ35vI3NjxE8jfsE5DSOhWgSunHSZmKS4OCi2jrtfxK7uyp2ww==", + "dev": true + }, "walkdir": { "version": "0.0.11", "resolved": "https://registry.npmjs.org/walkdir/-/walkdir-0.0.11.tgz", diff --git a/package.json b/package.json index a872fbd..6116e89 100644 --- a/package.json +++ b/package.json @@ -29,20 +29,29 @@ "url": "https://github.com/JS-DevTools/version-bump-prompt.git" }, "main": "lib/index.js", + "bin": { + "bump": "bin/bump.js" + }, "files": [ "bin", "lib" ], "scripts": { - "lint": "eslint bin lib test", + "build": "tsc", + "watch": "tsc --watch", + "lint": "npm run lint:typescript && npm run lint:javascript", + "lint:typescript": "tslint -p tsconfig.json", + "lint:javascript": "eslint test", "test": "mocha && npm run lint", "coverage": "nyc --reporter=text --reporter=lcov mocha", "upgrade": "npm-check -u", - "bump": "node bin/bump.js --prompt --tag --push --all", - "release": "npm run upgrade && npm test && npm run bump", - "semver": "semver" + "bump": "node bin/bump.js --tag --push --all", + "release": "npm run upgrade && npm run build && npm test && npm run bump" }, "devDependencies": { + "@types/chai": "^4.1.7", + "@types/mocha": "^5.2.5", + "@types/node": "^10.12.18", "chai": "^4.2.0", "chai-exec": "^1.1.1", "coveralls": "^3.0.2", @@ -52,7 +61,11 @@ "mocha": "^5.2.0", "npm-check": "^5.9.0", "nyc": "^13.1.0", - "strip-ansi": "^5.0.0" + "strip-ansi": "^5.0.0", + "tslint": "^5.12.0", + "tslint-modular": "^1.0.0", + "typescript": "^3.2.2", + "typescript-tslint-plugin": "^0.2.1" }, "dependencies": { "chalk": "^2.4.1", @@ -64,9 +77,6 @@ "log-symbols": "^2.2.0", "semver": "^5.6.0" }, - "bin": { - "bump": "bin/bump.js" - }, "engines": { "node": ">=6" } diff --git a/bin/bump.js b/src/bin/bump.ts similarity index 57% rename from bin/bump.js rename to src/bin/bump.ts index 493a14c..b05a0cb 100644 --- a/bin/bump.js +++ b/src/bin/bump.ts @@ -1,81 +1,121 @@ #!/usr/bin/env node "use strict"; -const program = require("commander"); -const SemVer = require("semver"); +const cli = require("commander"); +const semver = require("semver"); const inquirer = require("inquirer"); const chalk = require("chalk"); const api = require("../"); -program - .version(require("../package").version) - .option("--major", "Increase major version") - .option("--minor", "Increase minor version") - .option("--patch", "Increase patch version") - .option("--premajor", "Increase major version, pre-release") - .option("--preminor", "Increase preminor version, pre-release") - .option("--prepatch", "Increase prepatch version, pre-release") - .option("--prerelease", "Increase prerelease version") - .option("--prompt", "Prompt for type of bump (patch, minor, major, premajor, prerelase, etc.)") +cli + .arguments("[version] [files...]") .option("--preid ", 'The identifier for prerelease versions (default is "beta")') .option("--commit [message]", 'Commit changed files to Git (default message is "release vX.X.X")') .option("--tag", "Tag the commit in Git") .option("--push", "Push the Git commit") .option("--all", "Commit/tag/push ALL pending files, not just the ones changed by bump") - .option("--grep ", "Files and/or globs to do a text-replace of the old version number with the new one") - .option("--lock", "Also update the package-lock.json") + .version(require("../package").version) .on("--help", () => { - console.log( - "\n Examples:\n" + - "\n" + - " $ bump --patch\n" + - " $ bump --major --tag\n" + - " $ bump --patch --tag --all --grep README.md\n" + - " $ bump --prompt --tag --push --all\n" + console.log(` + +Version + One of the following: + - A semver version number (ex: 1.23.456) + - prompt: Prompt for the version number (this is the default) + - major: Increase major version + - minor: Increase minor version + - patch: Increase patch version + - premajor: Increase major version, pre-release + - preminor: Increase preminor version, pre-release + - prepatch: Increase prepatch version, pre-release + - prerelease: Increase prerelease version + +Files... + One or more files and/or globs to bump (ex: README.md *.txt). + package.json and package-lock.json are always updated. + +Examples: + + bump patch + + Bumps the patch version number in package.json and package-lock.json. + Nothing is committed to git. + + bump --commit major + + Bumps the major version number in package.json and package-lock.json. + Commits the package.json and package-lock.json to git, but does not tag the commit. + + bump --tag --push --all README.md + + Prompts for the new version number and updates package.json, package-lock.json, and README.md. + Commits ALL modified files to git, tags the commit, and pushes the commit. + + bump --tag --push 4.27.9934 bower.json docs/**/*.md + + Sets the version number to 4.27.9934 in package.json, package-lock.json, bower.json, + and all markdown files in the "docs" directory. Commits the updated files to git, + tags the commit, and pushes the commit. +` ); }) .parse(process.argv); -// Show help if no options were given -if (program.rawArgs.length < 3) { - program.help(); +// Convert CLI args to an Options object +let options = { + version: "prompt", + preid: cli.preid || "beta", + commit: !!cli.commit, + commitMessage: "", + tag: !!cli.tag, + push: !!cli.push, + all: !!cli.all, + files: ["package.json", "package-lock.json"], +}; + +if (typeof cli.commit === "string") { + options.commitMessage = cli.commit; } -else { - let options = program; - if (options.grep && program.args) { - // If multiple --grep files are specified, then they are parsed as separate args - options.grep = program.args.concat(options.grep); - } +if (cli.args.length > 0) { + let firstArg = cli.args[0]; + let bumps = ["prompt", "major", "minor", "patch", "premajor", "preminor", "prepatch", "prerelease"]; - if (typeof options.commit === "string") { - options.commitMessage = options.commit; - options.commit = true; + if (semver.valid(firstArg) || bumps.includes(firstArg)) { + options.version = firstArg; + cli.args.shift(); } - let manifests = api.manifests(options.lock); - bumpManifests(manifests, options) - .then(() => { - api.grep(manifests, options); + options.files.push(...cli.args); +} + +console.log(options); +process.exit(0); + + +let manifests = api.manifests(options.lock); +bumpManifests(manifests, options) + .then(() => { + api.grep(manifests, options); + manifests.forEach((manifest) => { + api.runNpmScriptIfExists(manifest, "version"); + }); + }) + .then(() => { + if (options.commit || options.tag || options.push) { + api.git(manifests, options); + } + else { manifests.forEach((manifest) => { - api.runNpmScriptIfExists(manifest, "version"); + api.runNpmScriptIfExists(manifest, "postversion"); }); - }) - .then(() => { - if (options.commit || options.tag || options.push) { - api.git(manifests, options); - } - else { - manifests.forEach((manifest) => { - api.runNpmScriptIfExists(manifest, "postversion"); - }); - } - }) - .catch((err) => { - console.error(chalk.red(err.message)); - process.exit(err.status || 1); - }); -} + } + }) + .catch((err) => { + console.error(chalk.red(err.message)); + process.exit(err.status || 1); + }); + /** * Bumps each manifest sequentially @@ -142,9 +182,9 @@ function bumpManifest (manifest, defaultBumpType, options) { message: "Enter the new version number:", default: version.current, when: answers => answers.bumpType === "custom", - filter: SemVer.clean, + filter: semver.clean, validate: answer => { - return SemVer.valid(answer) ? true : "That's not a valid version number"; + return semver.valid(answer) ? true : "That's not a valid version number"; }, } ]) diff --git a/lib/index.js b/src/lib/index.ts similarity index 100% rename from lib/index.js rename to src/lib/index.ts diff --git a/test/.eslintrc.yml b/test/.eslintrc.yml index 045d4a4..928e579 100644 --- a/test/.eslintrc.yml +++ b/test/.eslintrc.yml @@ -1,2 +1,12 @@ +# ESLint config +# http://eslint.org/docs/user-guide/configuring +# https://github.com/JS-DevTools/eslint-config-modular + +root: true + extends: + - modular/best-practices + - modular/style + - modular/es6 + - modular/node - modular/test diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..e5405ff --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,31 @@ +{ + "compilerOptions": { + "target": "esnext", + "module": "commonjs", + "moduleResolution": "node", + + "outDir": "lib", + "sourceMap": true, + "declaration": true, + + "newLine": "LF", + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictBindCallApply": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": true, + + "plugins": [ + { "name": "typescript-tslint-plugin" } + ] + }, + "include": [ + "src/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} diff --git a/tslint.yaml b/tslint.yaml new file mode 100644 index 0000000..84827da --- /dev/null +++ b/tslint.yaml @@ -0,0 +1,8 @@ +# TSLint config +# https://palantir.github.io/tslint/usage/configuration/ +# https://github.com/JS-DevTools/tslint-modular + +extends: + - tslint-modular/best-practices + - tslint-modular/style + - tslint-modular/node From 025516be0a9b7c43fb7bf40fc4e788d724881a02 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sun, 30 Dec 2018 12:30:17 -0600 Subject: [PATCH 002/106] Exclude TypeScript build output from source control --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index b529cd2..4893dd2 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,10 @@ pids # Dependencies node_modules +# Build output +/bin +/lib + # Test output /.nyc_output /coverage From 3283eb2e7be3cc06bec188fa0cfd18a9846eb904 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sun, 30 Dec 2018 12:31:04 -0600 Subject: [PATCH 003/106] Started rewriting in TypeScript --- src/bin/bump.ts | 240 ++++++++------------------------ src/lib/index.ts | 227 ++---------------------------- src/lib/options.ts | 48 +++++++ src/lib/version-bump-options.ts | 61 ++++++++ src/lib/version-bump-results.ts | 31 +++++ src/lib/version-bump-type.ts | 64 +++++++++ src/lib/version-bump.ts | 42 ++++++ tsconfig.json | 2 +- 8 files changed, 319 insertions(+), 396 deletions(-) create mode 100644 src/lib/options.ts create mode 100644 src/lib/version-bump-options.ts create mode 100644 src/lib/version-bump-results.ts create mode 100644 src/lib/version-bump-type.ts create mode 100644 src/lib/version-bump.ts diff --git a/src/bin/bump.ts b/src/bin/bump.ts index b05a0cb..a57cbc7 100644 --- a/src/bin/bump.ts +++ b/src/bin/bump.ts @@ -1,22 +1,64 @@ #!/usr/bin/env node -"use strict"; - -const cli = require("commander"); -const semver = require("semver"); -const inquirer = require("inquirer"); -const chalk = require("chalk"); -const api = require("../"); - -cli - .arguments("[version] [files...]") - .option("--preid ", 'The identifier for prerelease versions (default is "beta")') - .option("--commit [message]", 'Commit changed files to Git (default message is "release vX.X.X")') - .option("--tag", "Tag the commit in Git") - .option("--push", "Push the Git commit") - .option("--all", "Commit/tag/push ALL pending files, not just the ones changed by bump") - .version(require("../package").version) - .on("--help", () => { - console.log(` + +import * as cli from "commander"; +import * as semver from "semver"; +import { isVersionBumpType, versionBump, VersionBumpOptions } from "../lib"; + +// tslint:disable-next-line: no-floating-promises +main(process.argv.slice(2)); + +/** + * The main entry point + */ +async function main(args: string[]): Promise { + let options = parseArgs(args); + await versionBump(options); +} + +/** + * Parses the command-line arguments + */ +function parseArgs(args: string[]): VersionBumpOptions { + cli + .arguments("[version] [files...]") + .option("--preid ", 'The identifier for prerelease versions (default is "beta")') + .option("--commit [message]", 'Commit changed files to Git (default message is "release vX.X.X")') + .option("--tag [tag]", 'Tag the commit in Git (default tag is "vX.X.X")') + .option("--push", "Push the Git commit") + .option("--all", "Commit/tag/push ALL pending files, not just the ones changed by bump") + .version(require("../package").version) + .on("--help", showHelp) + .parse(process.argv); + + // Convert CLI args to an Options object + let options: VersionBumpOptions = { + preid: cli.preid as string, + commit: cli.commit as boolean, + tag: cli.tag as boolean, + push: cli.push as boolean, + all: cli.all as boolean, + }; + + if (cli.args.length > 0) { + let firstArg = cli.args[0]; + + if (isVersionBumpType(firstArg) && semver.valid(firstArg)) { + options.version = firstArg; + cli.args.shift(); + } + + options.files = cli.args; + } + + return options; +} + +/** + * Appends additional help text to the default text that Commander prints + */ +function showHelp(): void { + // tslint:disable-next-line: no-console + console.log(` Version One of the following: @@ -56,165 +98,5 @@ Examples: Sets the version number to 4.27.9934 in package.json, package-lock.json, bower.json, and all markdown files in the "docs" directory. Commits the updated files to git, tags the commit, and pushes the commit. -` - ); - }) - .parse(process.argv); - -// Convert CLI args to an Options object -let options = { - version: "prompt", - preid: cli.preid || "beta", - commit: !!cli.commit, - commitMessage: "", - tag: !!cli.tag, - push: !!cli.push, - all: !!cli.all, - files: ["package.json", "package-lock.json"], -}; - -if (typeof cli.commit === "string") { - options.commitMessage = cli.commit; -} - -if (cli.args.length > 0) { - let firstArg = cli.args[0]; - let bumps = ["prompt", "major", "minor", "patch", "premajor", "preminor", "prepatch", "prerelease"]; - - if (semver.valid(firstArg) || bumps.includes(firstArg)) { - options.version = firstArg; - cli.args.shift(); - } - - options.files.push(...cli.args); -} - -console.log(options); -process.exit(0); - - -let manifests = api.manifests(options.lock); -bumpManifests(manifests, options) - .then(() => { - api.grep(manifests, options); - manifests.forEach((manifest) => { - api.runNpmScriptIfExists(manifest, "version"); - }); - }) - .then(() => { - if (options.commit || options.tag || options.push) { - api.git(manifests, options); - } - else { - manifests.forEach((manifest) => { - api.runNpmScriptIfExists(manifest, "postversion"); - }); - } - }) - .catch((err) => { - console.error(chalk.red(err.message)); - process.exit(err.status || 1); - }); - - -/** - * Bumps each manifest sequentially - * - * @param {string[]} manifests - An array of manifest files to bump - * @param {object} options - CLI options - * @returns {Promise} - */ -function bumpManifests (manifests, options) { - let i = 0; - - return bumpNext("patch"); - - function bumpNext (defaultBumpType) { - let manifest = manifests[i++]; - if (manifest) { - return bumpManifest(manifest, defaultBumpType, options).then(bumpNext); - } - else { - return Promise.resolve(defaultBumpType); - } - } -} - -/** - * Bumps the given manifest - * - * @param {string} manifest - The manifest name (e.g. "package.json", "bower.json", etc.) - * @param {string} defaultBumpType - The default type of bump to perform - * @param {object} options - CLI options - * @returns {Promise} - */ -function bumpManifest (manifest, defaultBumpType, options) { - return new Promise((resolve, reject) => { - api.runNpmScriptIfExists(manifest, "preversion"); - - if (options.prompt) { - // Prompt the user for the type of bump to perform - let version = api.versionInfo(manifest, options); - console.log("\nCurrent version in %s is %s", manifest, version.current); - - inquirer.prompt([ - { - type: "list", - name: "bumpType", - message: "How would you like to bump it?", - default: defaultBumpType, - pageSize: 9, - choices: [ - { value: "major", name: "major (" + version.nextMajor + ")" }, - { value: "minor", name: "minor (" + version.nextMinor + ")" }, - { value: "patch", name: "patch (" + version.nextPatch + ")" }, - { value: "premajor", name: "pre-release major (" + version.nextPreMajor + ")" }, - { value: "preminor", name: "pre-release minor (" + version.nextPreMinor + ")" }, - { value: "prepatch", name: "pre-release patch (" + version.nextPrePatch + ")" }, - { value: "prerelease", name: "pre-release (" + version.nextPreRelease + ")" }, - new inquirer.Separator(), - { value: "custom", name: "custom..." }, - ] - }, - { - type: "input", - name: "newVersion", - message: "Enter the new version number:", - default: version.current, - when: answers => answers.bumpType === "custom", - filter: semver.clean, - validate: answer => { - return semver.valid(answer) ? true : "That's not a valid version number"; - }, - } - ]) - .then((answers) => { - bump(answers.bumpType, answers.newVersion); - }); - } - else { - let bumpType = - options.major ? "major" - : options.minor ? "minor" - : options.patch ? "patch" - : options.premajor ? "premajor" - : options.preminor ? "preminor" - : options.prepatch ? "prepatch" - : options.prerelease ? "prerelease" - : defaultBumpType; - - bump(bumpType); - } - - function bump (bumpType, newVersion) { - try { - options.newVersion = newVersion; - api.bump(manifest, bumpType, options); - } - catch (ex) { - reject(ex); - } - resolve(bumpType); - } - }); +`); } diff --git a/src/lib/index.ts b/src/lib/index.ts index 47ce73e..cc4aa06 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -1,220 +1,15 @@ -"use strict"; +import { versionBump } from "./version-bump"; -const SemVer = require("semver"); -const ezSpawn = require("ez-spawn"); -const fs = require("fs"); -const path = require("path"); -const glob = require("glob"); -const indent = require("detect-indent"); -const logSymbols = require("log-symbols"); -const cwd = process.cwd(); +export { versionBump } from "./version-bump"; +export { VersionBumpOptions } from "./version-bump-options"; +export { VersionBumpResults } from "./version-bump-results"; +export { isVersionBumpType, VersionBumpType } from "./version-bump-type"; -let oldVersion, newVersion; +// tslint:disable-next-line: no-default-export +export default versionBump; -module.exports = { - manifests: getManifests, - versionInfo, - bump, - runNpmScriptIfExists, - grep, - git -}; - -/** - * These are the files that will be updated automatically by version-bump-prompt. - * Only the files that exist and have a "version" property are returned, so the result might be an empty array. - * - * @returns {string[]} - */ -function getManifests (withLockfile) { - let candidates = ["package.json", "bower.json", "component.json"]; - if (withLockfile) { - candidates.push("package-lock.json"); - } - return candidates.filter((manifest) => { - let pkgPath = path.join(cwd, manifest); - try { - const pkg = require(pkgPath); - return pkg.hasOwnProperty("version"); - } - catch (err) { - return false; - } - }); -} - -/** - * Returns information about the current next versions of the given manifest file. - * - * @param {string} manifest - The name of the manifest file (e.g. "package.json") - * @param {object} options - CLI options - * @returns {VersionInfo} - */ -function versionInfo (manifest, options) { - let pkgPath = path.join(cwd, manifest); - const pkg = require(pkgPath); - - let current = new SemVer(pkg.version || "0.0.0"); - let identifier = options.preid || current.prerelease[0] || "beta"; - - /** @name VersionInfo **/ - return { - current: current.version, - nextMajor: SemVer.inc(current.version, "major"), - nextMinor: SemVer.inc(current.version, "minor"), - nextPatch: SemVer.inc(current.version, "patch"), - nextPreMajor: SemVer.inc(current.version, "premajor", identifier), - nextPreMinor: SemVer.inc(current.version, "preminor", identifier), - nextPrePatch: SemVer.inc(current.version, "prepatch", identifier), - nextPreRelease: SemVer.inc(current.version, "prerelease", identifier) - }; -} - -/** - * Updates the version number of the given manifest file. - * - * @param {string} manifest - The name of the manifest file (e.g. "package.json") - * @param {string} type - The type of bump to do ("major", "minor", "patch", "premajor", etc.) - * @param {object} options - CLI options - */ -function bump (manifest, type, options) { - let pkgPath = path.join(cwd, manifest); - const pkg = require(pkgPath); - - oldVersion = pkg.version || "0.0.0"; - - if (type === "custom") { - newVersion = options.newVersion; - } - else { - // Increment the version number - let current = new SemVer(oldVersion); - current.inc(type, options.preid || current.prerelease[0] || "beta"); - newVersion = current.version; - } - - if (newVersion !== oldVersion) { - // Save the file - let usedIndent = indent(fs.readFileSync(pkgPath, "utf8")).indent || " "; - - pkg.version = newVersion; - fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, usedIndent)); - - console.log("%s Updated %s to %s", logSymbols.success, manifest, newVersion); - } -} - -/** - * Takes npm scripts object and if a script exists, runs the script. - * - * @param {string} manifest - The name of the manifest file (e.g. "package.json") - * @param {string} script - Name of the script ("preversion", "postversion", etc.) - */ -function runNpmScriptIfExists (manifest, script) { - if (manifest !== "package.json") { - return; - } - let pkgPath = path.join(cwd, manifest); - const pkg = require(pkgPath); - let pkgScripts = pkg.scripts; - - if (pkgScripts && pkgScripts[script]) { - ezSpawn.sync("npm", ["run", script], { stdio: "inherit" }); - } -} - -/** - * Performs text replacements of the old version string with the new version string - * in the {@link options.grep} file list. - * - * @param {string[]} manifests - * - The manifest files. Any files affected by {@link grep} will be added to this array. - * - * @param {object} options - CLI options - */ -function grep (manifests, options) { - if (newVersion === oldVersion) { - return; - } - - if (!options.grep) { - return; - } - - // Separate the glob patterns into two lists: included and excluded - let included = [], excluded = []; - options.grep.forEach((pattern) => { - if (pattern[0] === "!") { - excluded.push(pattern); - } - else { - included.push(pattern); - } - }); - - // Process each glob pattern - included.forEach((pattern) => { - let files = glob.sync(pattern, { nodir: true, ignore: excluded }); - - // Process each matched file - files.forEach((file) => { - // Read the file - let fileContents = fs.readFileSync(file, { encoding: "utf8" }); - - // Replace the old version number with the new version number - let oldVersionPattern = new RegExp(oldVersion.replace(/\./g, "\\."), "g"); - let newFileContents = fileContents.replace(oldVersionPattern, newVersion); - - // Only save the file if there were changes - if (newFileContents !== fileContents) { - fs.writeFileSync(file, newFileContents); - manifests.push(file); - console.log("%s Updated %s to %s", logSymbols.success, file, newVersion); - } - }); - }); -} - -/** - * Commits to Git, optionally tagging and pushing the commit. - * - * @param {string[]} manifests - An array of manifest files to bump - * @param {object} options - CLI options - */ -function git (manifests, options) { - if (newVersion === oldVersion) { - return; - } - - if (!(options.commit || options.tag || options.push)) { - return; - } - - // Git Commit - let commitArgs = ["commit"]; - commitArgs = commitArgs.concat(options.all ? "-a" : manifests); - let commitMessage = "release v" + newVersion; - if (options.commitMessage) { - commitMessage = "v" + newVersion + " " + options.commitMessage; - } - commitArgs = commitArgs.concat(["-m", commitMessage]); - ezSpawn.sync("git", commitArgs); - console.log(logSymbols.success, "Git commit"); - - // Git Tag - if (options.tag) { - ezSpawn.sync("git", ["tag", "-a", "v" + newVersion, "-m", newVersion]); - console.log(logSymbols.success, "Git tag"); - } - - manifests.forEach((manifest) => { - runNpmScriptIfExists(manifest, "postversion"); - }); - - // Git Push - if (options.push) { - ezSpawn.sync("git", ["push"]); - options.tag && ezSpawn.sync("git", ["push", "--tags"]); - console.log(logSymbols.success, "Git push"); - } +// CommonJS default export hack +if (typeof module === "object" && typeof exports === "object") { + module.exports = versionBump; + Object.assign(versionBump, exports); } diff --git a/src/lib/options.ts b/src/lib/options.ts new file mode 100644 index 0000000..3ba5fdf --- /dev/null +++ b/src/lib/options.ts @@ -0,0 +1,48 @@ +import { VersionBumpOptions } from "./version-bump-options"; + +/** + * Normalized and sanitized options + */ +export class Options { + public version: string; + public preid: string; + public commit: boolean; + public commitMessage?: string; + public tag: boolean; + public tagName?: string; + public push: boolean; + public all: boolean; + public files: string[]; + + public constructor(props: VersionBumpOptions) { + this.version = props.version || "prompt"; + this.preid = props.preid || "beta"; + this.push = Boolean(props.push); + this.all = Boolean(props.all); + this.files = Array.isArray(props.files) ? props.files : ["package.json", "package-lock.json"]; + + if (typeof props.tag === "string") { + this.tag = true; + this.tagName = props.tag; + } + else if (props.tag) { + this.tag = true; + this.tagName = "v"; + } + else { + this.tag = false; + } + + if (typeof props.commit === "string") { + this.commit = true; + this.commitMessage = props.commit; + } + else if (props.commit || this.tag || this.push) { + this.commit = true; + this.commitMessage = "release v"; + } + else { + this.commit = false; + } + } +} diff --git a/src/lib/version-bump-options.ts b/src/lib/version-bump-options.ts new file mode 100644 index 0000000..98a0ede --- /dev/null +++ b/src/lib/version-bump-options.ts @@ -0,0 +1,61 @@ +/** + * Options for the `versionBump()` function. + */ +export interface VersionBumpOptions { + /** + * The new version number (e.g. "1.23.456") or the type of version bump to perform + * (e.g. "major", "minor", "patch", "prerelease", etc.). Use "prompt" to prompt the + * user for the version number. + * + * Defaults to "prompt". + */ + version?: string; + + /** + * The prerelease type (e.g. "alpha", "beta", "next"). + * + * Defaults to "beta". + */ + preid?: string; + + /** + * Indicates whether to create a git commit. Can be set to a custom commit message string + * or `true` to use "release v" (the version number will be appended). + * + * Defaults to `false`. + */ + commit?: boolean | string; + + /** + * Indicates whether to tag the git commit. Can be set to a custom tag string + * or `true` to use "v" (the version number will be appended). + * + * Defaults to `false`. + */ + tag?: boolean | string; + + /** + * Indicates whether to push the git commit and tag. + * + * Defaults to `false`. + */ + push?: boolean; + + /** + * Indicates whether the git commit should include ALL files (`git commit -a`) + * rather than just the files that were modified by `versionBump()`. + * + * Defaults to `false`. + */ + all?: boolean; + + /** + * The files to be updated. For certain known files ("package.json", "bower.json", etc.) + * `versionBump()` will explicitly update the file's version number. For other files + * (ReadMe files, config files, source code, etc.) it will simply do a global replacement + * of the old version number with the new version number. + * + * Defaults to ["package.json", "package-lock.json"] + */ + files?: string[]; +} diff --git a/src/lib/version-bump-results.ts b/src/lib/version-bump-results.ts new file mode 100644 index 0000000..59d74f9 --- /dev/null +++ b/src/lib/version-bump-results.ts @@ -0,0 +1,31 @@ +/** + * Information about the work that was performed by the `versionBump()` function. + */ +export interface VersionBumpResults { + /** + * The previous version number in package.json. + */ + oldVersion: string; + + /** + * The new version number. + */ + newVersion: string; + + /** + * The commit message that was used for the git commit. + * If no git commit was created, then this is `undefined`. + */ + commitMessage?: string; + + /** + * The tag name that was used for the git tag. + * If no tag was created, then this is `undefined`. + */ + tagName?: string; + + /** + * The files that were updated. + */ + files: string[]; +} diff --git a/src/lib/version-bump-type.ts b/src/lib/version-bump-type.ts new file mode 100644 index 0000000..edbe1ef --- /dev/null +++ b/src/lib/version-bump-type.ts @@ -0,0 +1,64 @@ +/** + * Types of version bumps that can be performed. + */ +export enum VersionBumpType { + /** + * Prompts the user for the version number. + */ + Prompt = "prompt", + + /** + * Bumps the major version number (e.g. 1.23.456 => 2.0.0) + */ + Major = "major", + + /** + * Bumps the minor version number (e.g. 1.23.456 => 1.3.0) + */ + Minor = "minor", + + /** + * Bumps the patch version number (e.g. 1.23.456 => 1.23.457) + */ + Patch = "patch", + + /** + * Bumps the premajor version number (e.g. 1.23.456 => 2.0.0-beta.1) + */ + Premajor = "premajor", + + /** + * Bumps the preminor version number (e.g. 1.23.456 => 1.3.0-beta.1) + */ + Preminor = "preminor", + + /** + * Bumps the prepatch version number (e.g. 1.23.456 => 1.23.457-beta.1) + */ + Prepatch = "prepatch", + + /** + * Bumps the prerelease version number (e.g. 1.23.456-beta.7 => 1.23.456-beta.8) + */ + Prerelease = "prerelease", +} + +/** + * Determines whether the specified value is a valid VersionBumpType string. + */ +export function isVersionBumpType(value: string): value is VersionBumpType { + switch (value) { + case VersionBumpType.Prompt: + case VersionBumpType.Major: + case VersionBumpType.Minor: + case VersionBumpType.Patch: + case VersionBumpType.Premajor: + case VersionBumpType.Preminor: + case VersionBumpType.Prepatch: + case VersionBumpType.Prerelease: + return true; + + default: + return false; + } +} diff --git a/src/lib/version-bump.ts b/src/lib/version-bump.ts new file mode 100644 index 0000000..63f113c --- /dev/null +++ b/src/lib/version-bump.ts @@ -0,0 +1,42 @@ +import { Options } from "./options"; +import { VersionBumpOptions } from "./version-bump-options"; +import { VersionBumpResults } from "./version-bump-results"; + +/** + * Prompts the user for a version number and updates package.json and package-lock.json. + * + * @returns - The new version number + */ +export async function versionBump(): Promise; + +/** + * Bumps the version number in package.json, package-lock.json. + * + * @param version + * The new version number, or a bump type, such as "major", "minor", "patch", etc. + * Use "prompt" to prompt the user for the version number. + */ +export async function versionBump(version: string): Promise; + +/** + * Bumps the version number in one or more files, prompting the user if necessary. + * Optionally also commits, tags, and pushes to git. + */ +export async function versionBump(options: VersionBumpOptions): Promise; + +export async function versionBump(arg: VersionBumpOptions | string = {}): Promise { + if (typeof arg === "string") { + arg = { version: arg }; + } + + let options = new Options(arg); + + console.log(options); + process.exit(0); + + return { + oldVersion: "1.2.3", + newVersion: "1.2.3", + files: options.files, + }; +} diff --git a/tsconfig.json b/tsconfig.json index e5405ff..7796fc2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ "module": "commonjs", "moduleResolution": "node", - "outDir": "lib", + "outDir": ".", "sourceMap": true, "declaration": true, From 8b44c58710cda3a0f8ea55cc9b9b2ae13cfe0181 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Mon, 31 Dec 2018 11:27:35 -0600 Subject: [PATCH 004/106] Decided to leave the "bin" directory as plain JavaScript --- .gitignore | 1 - bin/bump.js | 4 ++++ tsconfig.json | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 bin/bump.js diff --git a/.gitignore b/.gitignore index 4893dd2..b7bc785 100644 --- a/.gitignore +++ b/.gitignore @@ -36,7 +36,6 @@ pids node_modules # Build output -/bin /lib # Test output diff --git a/bin/bump.js b/bin/bump.js new file mode 100644 index 0000000..cd0bf1f --- /dev/null +++ b/bin/bump.js @@ -0,0 +1,4 @@ +#!/usr/bin/env node +"use strict"; +const { main } = require("../lib/cli"); +main(process.argv.slice(2)); diff --git a/tsconfig.json b/tsconfig.json index 7796fc2..e5405ff 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ "module": "commonjs", "moduleResolution": "node", - "outDir": ".", + "outDir": "lib", "sourceMap": true, "declaration": true, From 215e6e6074d5e03f69f151a61e8c7c43c7be7cd3 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Mon, 31 Dec 2018 11:28:38 -0600 Subject: [PATCH 005/106] Switched from `commander` to `command-line-args` for command-line argument parsing --- package-lock.json | 612 +++++++++++++++++++++++++++++++--------------- package.json | 5 +- 2 files changed, 418 insertions(+), 199 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9f9a729..9a57b4d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -125,6 +125,22 @@ "integrity": "sha512-2Y8uPt0/jwjhQ6EiluT0XCri1Dbplr0ZxfFXUz+ye13gaqE8u5gL5ppao1JrUYr9cIip5S6MvQzBS7Kke7U9VA==", "dev": true }, + "@types/command-line-args": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/command-line-args/-/command-line-args-5.0.0.tgz", + "integrity": "sha512-4eOPXyn5DmP64MCMF8ePDvdlvlzt2a+F8ZaVjqmh2yFCpGjc1kI3kGnCFYX9SCsGTjQcWIyVZ86IHCEyjy/MNg==", + "dev": true + }, + "@types/inquirer": { + "version": "0.0.43", + "resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-0.0.43.tgz", + "integrity": "sha512-xgyfKZVMFqE8aIKy1xfFVsX2MxyXUNgjgmbF6dRbR3sL+ZM5K4ka/9L4mmTwX8eTeVYtduyXu0gUVwVJa1HbNw==", + "dev": true, + "requires": { + "@types/rx": "*", + "@types/through": "*" + } + }, "@types/mocha": { "version": "5.2.5", "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.5.tgz", @@ -137,6 +153,147 @@ "integrity": "sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ==", "dev": true }, + "@types/rx": { + "version": "4.1.1", + "resolved": "http://registry.npmjs.org/@types/rx/-/rx-4.1.1.tgz", + "integrity": "sha1-WY/JSla67ZdfGUV04PVy/Y5iekg=", + "dev": true, + "requires": { + "@types/rx-core": "*", + "@types/rx-core-binding": "*", + "@types/rx-lite": "*", + "@types/rx-lite-aggregates": "*", + "@types/rx-lite-async": "*", + "@types/rx-lite-backpressure": "*", + "@types/rx-lite-coincidence": "*", + "@types/rx-lite-experimental": "*", + "@types/rx-lite-joinpatterns": "*", + "@types/rx-lite-testing": "*", + "@types/rx-lite-time": "*", + "@types/rx-lite-virtualtime": "*" + } + }, + "@types/rx-core": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/rx-core/-/rx-core-4.0.3.tgz", + "integrity": "sha1-CzNUsSOM7b4rdPYybxOdvHpZHWA=", + "dev": true + }, + "@types/rx-core-binding": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/rx-core-binding/-/rx-core-binding-4.0.4.tgz", + "integrity": "sha512-5pkfxnC4w810LqBPUwP5bg7SFR/USwhMSaAeZQQbEHeBp57pjKXRlXmqpMrLJB4y1oglR/c2502853uN0I+DAQ==", + "dev": true, + "requires": { + "@types/rx-core": "*" + } + }, + "@types/rx-lite": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@types/rx-lite/-/rx-lite-4.0.6.tgz", + "integrity": "sha512-oYiDrFIcor9zDm0VDUca1UbROiMYBxMLMaM6qzz4ADAfOmA9r1dYEcAFH+2fsPI5BCCjPvV9pWC3X3flbrvs7w==", + "dev": true, + "requires": { + "@types/rx-core": "*", + "@types/rx-core-binding": "*" + } + }, + "@types/rx-lite-aggregates": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/rx-lite-aggregates/-/rx-lite-aggregates-4.0.3.tgz", + "integrity": "sha512-MAGDAHy8cRatm94FDduhJF+iNS5//jrZ/PIfm+QYw9OCeDgbymFHChM8YVIvN2zArwsRftKgE33QfRWvQk4DPg==", + "dev": true, + "requires": { + "@types/rx-lite": "*" + } + }, + "@types/rx-lite-async": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/rx-lite-async/-/rx-lite-async-4.0.2.tgz", + "integrity": "sha512-vTEv5o8l6702ZwfAM5aOeVDfUwBSDOs+ARoGmWAKQ6LOInQ8J4/zjM7ov12fuTpktUKdMQjkeCp07Vd73mPkxw==", + "dev": true, + "requires": { + "@types/rx-lite": "*" + } + }, + "@types/rx-lite-backpressure": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/rx-lite-backpressure/-/rx-lite-backpressure-4.0.3.tgz", + "integrity": "sha512-Y6aIeQCtNban5XSAF4B8dffhIKu6aAy/TXFlScHzSxh6ivfQBQw6UjxyEJxIOt3IT49YkS+siuayM2H/Q0cmgA==", + "dev": true, + "requires": { + "@types/rx-lite": "*" + } + }, + "@types/rx-lite-coincidence": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/rx-lite-coincidence/-/rx-lite-coincidence-4.0.3.tgz", + "integrity": "sha512-1VNJqzE9gALUyMGypDXZZXzR0Tt7LC9DdAZQ3Ou/Q0MubNU35agVUNXKGHKpNTba+fr8GdIdkC26bRDqtCQBeQ==", + "dev": true, + "requires": { + "@types/rx-lite": "*" + } + }, + "@types/rx-lite-experimental": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@types/rx-lite-experimental/-/rx-lite-experimental-4.0.1.tgz", + "integrity": "sha1-xTL1y98/LBXaFt7Ykw0bKYQCPL0=", + "dev": true, + "requires": { + "@types/rx-lite": "*" + } + }, + "@types/rx-lite-joinpatterns": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@types/rx-lite-joinpatterns/-/rx-lite-joinpatterns-4.0.1.tgz", + "integrity": "sha1-9w/jcFGKhDLykVjMkv+1a05K/D4=", + "dev": true, + "requires": { + "@types/rx-lite": "*" + } + }, + "@types/rx-lite-testing": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@types/rx-lite-testing/-/rx-lite-testing-4.0.1.tgz", + "integrity": "sha1-IbGdEfTf1v/vWp0WSOnIh5v+Iek=", + "dev": true, + "requires": { + "@types/rx-lite-virtualtime": "*" + } + }, + "@types/rx-lite-time": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/rx-lite-time/-/rx-lite-time-4.0.3.tgz", + "integrity": "sha512-ukO5sPKDRwCGWRZRqPlaAU0SKVxmWwSjiOrLhoQDoWxZWg6vyB9XLEZViKOzIO6LnTIQBlk4UylYV0rnhJLxQw==", + "dev": true, + "requires": { + "@types/rx-lite": "*" + } + }, + "@types/rx-lite-virtualtime": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/rx-lite-virtualtime/-/rx-lite-virtualtime-4.0.3.tgz", + "integrity": "sha512-3uC6sGmjpOKatZSVHI2xB1+dedgml669ZRvqxy+WqmGJDVusOdyxcKfyzjW0P3/GrCiN4nmRkLVMhPwHCc5QLg==", + "dev": true, + "requires": { + "@types/rx-lite": "*" + } + }, + "@types/semver": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ==", + "dev": true + }, + "@types/through": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/through/-/through-0.0.29.tgz", + "integrity": "sha512-9a7C5VHh+1BKblaYiq+7Tfc+EOmjMdZaD1MYtkQjSoxgB69tBjW98ry6SKsi4zEIWztLOMRuL87A3bdT/Fc/4w==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "acorn": { "version": "6.0.4", "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.0.4.tgz", @@ -197,6 +354,23 @@ "sprintf-js": "~1.0.2" } }, + "argv-tools": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/argv-tools/-/argv-tools-0.1.1.tgz", + "integrity": "sha512-Cc0dBvx4dvrjjKpyDA6w8RlNAw8Su30NvZbWl/Tv9ZALEVlLVkWQiHMi84Q0xNfpVuSaiQbYkdmWK8g1PLGhKw==", + "requires": { + "array-back": "^2.0.0", + "find-replace": "^2.0.1" + } + }, + "array-back": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-2.0.0.tgz", + "integrity": "sha512-eJv4pLLufP3g5kcZry0j6WXpIbzYw9GUB4mVJZno9wfwiBxbizTnHCw3VJb07cBihbFX48Y7oSrW9y+gt4glyw==", + "requires": { + "typical": "^2.6.1" + } + }, "array-find-index": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", @@ -655,54 +829,6 @@ "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.1.0.tgz", "integrity": "sha1-sjTKIJsp72b8UY2bmNWEewDt8Ao=" }, - "cliui": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", - "dev": true, - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wrap-ansi": "^2.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - } - } - }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -737,10 +863,23 @@ "delayed-stream": "~1.0.0" } }, + "command-line-args": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.0.2.tgz", + "integrity": "sha512-/qPcbL8zpqg53x4rAaqMFlRV4opN3pbla7I7k9x8kyOBMQoGT6WltjN6sXZuxOXw6DgdK7Ad+ijYS5gjcr7vlA==", + "requires": { + "argv-tools": "^0.1.1", + "array-back": "^2.0.0", + "find-replace": "^2.0.1", + "lodash.camelcase": "^4.3.0", + "typical": "^2.6.1" + } + }, "commander": { "version": "2.19.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", - "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==" + "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==", + "dev": true }, "concat-map": { "version": "0.0.1", @@ -915,6 +1054,153 @@ "require-package-name": "^2.0.1", "walkdir": "0.0.11", "yargs": "^8.0.2" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" + }, + "dependencies": { + "string-width": { + "version": "1.0.2", + "resolved": "http://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + } + } + }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, + "requires": { + "invert-kv": "^1.0.0" + } + }, + "mem": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", + "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "dev": true, + "requires": { + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "dev": true + }, + "yargs": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz", + "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", + "dev": true, + "requires": { + "camelcase": "^4.1.0", + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "os-locale": "^2.0.0", + "read-pkg-up": "^2.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^7.0.0" + } + }, + "yargs-parser": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", + "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + } + } } }, "deprecate": { @@ -1267,13 +1553,13 @@ "object-assign": "^4.0.1" } }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, + "find-replace": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-2.0.1.tgz", + "integrity": "sha512-LzDo3Fpa30FLIBsh6DCDnMN1KW2g4QKkqKmejlImgWY67dDFPX/x9Kh/op/GK522DchQXEvDi/wD48HKW49XOQ==", "requires": { - "locate-path": "^2.0.0" + "array-back": "^2.0.0", + "test-value": "^3.0.0" } }, "flat-cache": { @@ -1644,12 +1930,6 @@ "loose-envify": "^1.0.0" } }, - "invert-kv": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", - "dev": true - }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -1887,15 +2167,6 @@ "package-json": "^4.0.0" } }, - "lcid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", - "dev": true, - "requires": { - "invert-kv": "^1.0.0" - } - }, "lcov-parse": { "version": "0.0.10", "resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-0.0.10.tgz", @@ -1952,29 +2223,16 @@ } } }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", - "dev": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - }, - "dependencies": { - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - } - } - }, "lodash": { "version": "4.17.11", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" }, + "lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=" + }, "lodash.toarray": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.toarray/-/lodash.toarray-4.4.0.tgz", @@ -2045,15 +2303,6 @@ "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", "dev": true }, - "mem": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", - "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", - "dev": true, - "requires": { - "mimic-fn": "^1.0.0" - } - }, "meow": { "version": "3.7.0", "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", @@ -2174,7 +2423,7 @@ }, "minimist": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true }, @@ -3797,45 +4046,6 @@ } } }, - "os-locale": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", - "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", - "dev": true, - "requires": { - "execa": "^0.7.0", - "lcid": "^1.0.0", - "mem": "^1.1.0" - }, - "dependencies": { - "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", - "dev": true, - "requires": { - "lru-cache": "^4.0.1", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "execa": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", - "dev": true, - "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - } - } - }, "os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", @@ -3847,36 +4057,12 @@ "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", "dev": true }, - "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", - "dev": true, - "requires": { - "p-limit": "^1.1.0" - } - }, "p-map": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==", "dev": true }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", - "dev": true - }, "package-json": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/package-json/-/package-json-4.0.1.tgz", @@ -4103,6 +4289,57 @@ "requires": { "find-up": "^2.0.0", "read-pkg": "^2.0.0" + }, + "dependencies": { + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } } }, "readline2": { @@ -4593,6 +4830,15 @@ } } }, + "test-value": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/test-value/-/test-value-3.0.0.tgz", + "integrity": "sha512-sVACdAWcZkSU9x7AOmJo5TqE+GyNJknHaHsMrR6ZnhjVlVN9Yx6FjHrsKZ3BjIpPCT68zYesPWkakrNupwfOTQ==", + "requires": { + "array-back": "^2.0.0", + "typical": "^2.6.1" + } + }, "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -4680,7 +4926,8 @@ "tslint-modular": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/tslint-modular/-/tslint-modular-1.0.0.tgz", - "integrity": "sha512-WLtNdd7GrwzqNQY6xcpDXKq00YbtxwNWhPSegRgqwu90waWUD8mIKk6baYDjvqSfjnGT7ZZ9AjdhsaORzYfyIw==" + "integrity": "sha512-WLtNdd7GrwzqNQY6xcpDXKq00YbtxwNWhPSegRgqwu90waWUD8mIKk6baYDjvqSfjnGT7ZZ9AjdhsaORzYfyIw==", + "dev": true }, "tsutils": { "version": "2.29.0", @@ -4738,6 +4985,11 @@ "vscode-languageserver": "^5.1.0" } }, + "typical": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", + "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=" + }, "unique-string": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz", @@ -4999,47 +5251,11 @@ "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", "dev": true }, - "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", - "dev": true - }, "yallist": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "dev": true - }, - "yargs": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz", - "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", - "dev": true, - "requires": { - "camelcase": "^4.1.0", - "cliui": "^3.2.0", - "decamelize": "^1.1.1", - "get-caller-file": "^1.0.1", - "os-locale": "^2.0.0", - "read-pkg-up": "^2.0.0", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^2.0.0", - "which-module": "^2.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^7.0.0" - } - }, - "yargs-parser": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", - "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", - "dev": true, - "requires": { - "camelcase": "^4.1.0" - } } } } diff --git a/package.json b/package.json index 6116e89..5072e8f 100644 --- a/package.json +++ b/package.json @@ -50,8 +50,11 @@ }, "devDependencies": { "@types/chai": "^4.1.7", + "@types/command-line-args": "^5.0.0", + "@types/inquirer": "0.0.43", "@types/mocha": "^5.2.5", "@types/node": "^10.12.18", + "@types/semver": "^5.5.0", "chai": "^4.2.0", "chai-exec": "^1.1.1", "coveralls": "^3.0.2", @@ -69,7 +72,7 @@ }, "dependencies": { "chalk": "^2.4.1", - "commander": "^2.19.0", + "command-line-args": "^5.0.2", "detect-indent": "^5.0.0", "ez-spawn": "^2.1.1", "glob": "^7.1.3", From 8ba143f93f4c5d0755d9c191d783af01725660f3 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Mon, 31 Dec 2018 11:29:45 -0600 Subject: [PATCH 006/106] Moved everything in the "lib" directory up to "src" --- src/bin/bump.ts | 102 -------------------------- src/{lib => }/index.ts | 1 - src/{lib => }/options.ts | 0 src/{lib => }/version-bump-options.ts | 0 src/{lib => }/version-bump-results.ts | 0 src/{lib => }/version-bump-type.ts | 0 src/{lib => }/version-bump.ts | 2 +- 7 files changed, 1 insertion(+), 104 deletions(-) delete mode 100644 src/bin/bump.ts rename src/{lib => }/index.ts (86%) rename src/{lib => }/options.ts (100%) rename src/{lib => }/version-bump-options.ts (100%) rename src/{lib => }/version-bump-results.ts (100%) rename src/{lib => }/version-bump-type.ts (100%) rename src/{lib => }/version-bump.ts (97%) diff --git a/src/bin/bump.ts b/src/bin/bump.ts deleted file mode 100644 index a57cbc7..0000000 --- a/src/bin/bump.ts +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env node - -import * as cli from "commander"; -import * as semver from "semver"; -import { isVersionBumpType, versionBump, VersionBumpOptions } from "../lib"; - -// tslint:disable-next-line: no-floating-promises -main(process.argv.slice(2)); - -/** - * The main entry point - */ -async function main(args: string[]): Promise { - let options = parseArgs(args); - await versionBump(options); -} - -/** - * Parses the command-line arguments - */ -function parseArgs(args: string[]): VersionBumpOptions { - cli - .arguments("[version] [files...]") - .option("--preid ", 'The identifier for prerelease versions (default is "beta")') - .option("--commit [message]", 'Commit changed files to Git (default message is "release vX.X.X")') - .option("--tag [tag]", 'Tag the commit in Git (default tag is "vX.X.X")') - .option("--push", "Push the Git commit") - .option("--all", "Commit/tag/push ALL pending files, not just the ones changed by bump") - .version(require("../package").version) - .on("--help", showHelp) - .parse(process.argv); - - // Convert CLI args to an Options object - let options: VersionBumpOptions = { - preid: cli.preid as string, - commit: cli.commit as boolean, - tag: cli.tag as boolean, - push: cli.push as boolean, - all: cli.all as boolean, - }; - - if (cli.args.length > 0) { - let firstArg = cli.args[0]; - - if (isVersionBumpType(firstArg) && semver.valid(firstArg)) { - options.version = firstArg; - cli.args.shift(); - } - - options.files = cli.args; - } - - return options; -} - -/** - * Appends additional help text to the default text that Commander prints - */ -function showHelp(): void { - // tslint:disable-next-line: no-console - console.log(` - -Version - One of the following: - - A semver version number (ex: 1.23.456) - - prompt: Prompt for the version number (this is the default) - - major: Increase major version - - minor: Increase minor version - - patch: Increase patch version - - premajor: Increase major version, pre-release - - preminor: Increase preminor version, pre-release - - prepatch: Increase prepatch version, pre-release - - prerelease: Increase prerelease version - -Files... - One or more files and/or globs to bump (ex: README.md *.txt). - package.json and package-lock.json are always updated. - -Examples: - - bump patch - - Bumps the patch version number in package.json and package-lock.json. - Nothing is committed to git. - - bump --commit major - - Bumps the major version number in package.json and package-lock.json. - Commits the package.json and package-lock.json to git, but does not tag the commit. - - bump --tag --push --all README.md - - Prompts for the new version number and updates package.json, package-lock.json, and README.md. - Commits ALL modified files to git, tags the commit, and pushes the commit. - - bump --tag --push 4.27.9934 bower.json docs/**/*.md - - Sets the version number to 4.27.9934 in package.json, package-lock.json, bower.json, - and all markdown files in the "docs" directory. Commits the updated files to git, - tags the commit, and pushes the commit. -`); -} diff --git a/src/lib/index.ts b/src/index.ts similarity index 86% rename from src/lib/index.ts rename to src/index.ts index cc4aa06..518d0eb 100644 --- a/src/lib/index.ts +++ b/src/index.ts @@ -3,7 +3,6 @@ import { versionBump } from "./version-bump"; export { versionBump } from "./version-bump"; export { VersionBumpOptions } from "./version-bump-options"; export { VersionBumpResults } from "./version-bump-results"; -export { isVersionBumpType, VersionBumpType } from "./version-bump-type"; // tslint:disable-next-line: no-default-export export default versionBump; diff --git a/src/lib/options.ts b/src/options.ts similarity index 100% rename from src/lib/options.ts rename to src/options.ts diff --git a/src/lib/version-bump-options.ts b/src/version-bump-options.ts similarity index 100% rename from src/lib/version-bump-options.ts rename to src/version-bump-options.ts diff --git a/src/lib/version-bump-results.ts b/src/version-bump-results.ts similarity index 100% rename from src/lib/version-bump-results.ts rename to src/version-bump-results.ts diff --git a/src/lib/version-bump-type.ts b/src/version-bump-type.ts similarity index 100% rename from src/lib/version-bump-type.ts rename to src/version-bump-type.ts diff --git a/src/lib/version-bump.ts b/src/version-bump.ts similarity index 97% rename from src/lib/version-bump.ts rename to src/version-bump.ts index 63f113c..23aed3a 100644 --- a/src/lib/version-bump.ts +++ b/src/version-bump.ts @@ -31,7 +31,7 @@ export async function versionBump(arg: VersionBumpOptions | string = {}): Promis let options = new Options(arg); - console.log(options); + console.log("\n\n", options); process.exit(0); return { From c4a1f9cddac35fdd6d8bbe624ed2db66413117b2 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Mon, 31 Dec 2018 11:29:58 -0600 Subject: [PATCH 007/106] Rewrote the CLI in TypeScript --- src/cli/help.ts | 68 ++++++++++++++++++++++++++++++++++++++++ src/cli/index.ts | 54 ++++++++++++++++++++++++++++++++ src/cli/manifest.ts | 20 ++++++++++++ src/cli/parse-args.ts | 73 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 215 insertions(+) create mode 100644 src/cli/help.ts create mode 100644 src/cli/index.ts create mode 100644 src/cli/manifest.ts create mode 100644 src/cli/parse-args.ts diff --git a/src/cli/help.ts b/src/cli/help.ts new file mode 100644 index 0000000..37339c1 --- /dev/null +++ b/src/cli/help.ts @@ -0,0 +1,68 @@ +import { manifest } from "./manifest"; + +/** + * The CLI help text + */ +export const helpText = ` +Usage: ${manifest.name} [version] [options] [files...] + +${manifest.description} + +version + One of the following: + - A semver version number (ex: 1.23.456) + - prompt: Prompt for the version number (this is the default) + - major: Increase major version + - minor: Increase minor version + - patch: Increase patch version + - premajor: Increase major version, pre-release + - preminor: Increase preminor version, pre-release + - prepatch: Increase prepatch version, pre-release + - prerelease: Increase prerelease version + +options: + --preid The identifier for prerelease versions. + Defaults to "beta". + + -c, --commit [message] Commit changed files to Git. + Defaults to "release vX.X.X". + + -t, --tag [tag] Tag the commit in Git. + The Default tag is "vX.X.X" + + -p, --push Push the Git commit. + + -a, --all Commit/tag/push ALL pending files, + not just the ones changed by bump (git commit -a) + + -v, --version Show the version number + + -h, --help Show usage information + +files... + One or more files and/or globs to bump (ex: README.md *.txt). + Defaults to package.json and package-lock.json. + +Examples: + + bump patch + + Bumps the patch version number in package.json and package-lock.json. + Nothing is committed to git. + + bump major --commit + + Bumps the major version number in package.json and package-lock.json. + Commits package.json and package-lock.json to git, but does not tag the commit. + + bump -tpa README.md + + Prompts for the new version number and updates package.json, package-lock.json, and README.md. + Commits ALL modified files to git, tags the commit, and pushes the commit. + + bump 4.27.9934 --tag "Version " bower.json docs/**/*.md + + Sets the version number to 4.27.9934 in package.json, package-lock.json, bower.json, + and all markdown files in the "docs" directory. Commits the updated files to git, + and tags the commit as "Version 4.27.9934". +`; diff --git a/src/cli/index.ts b/src/cli/index.ts new file mode 100644 index 0000000..7cddec7 --- /dev/null +++ b/src/cli/index.ts @@ -0,0 +1,54 @@ +// tslint:disable: no-console +import { versionBump } from "../version-bump"; +import { VersionBumpOptions } from "../version-bump-options"; +import { helpText } from "./help"; +import { manifest } from "./manifest"; +import { parseArgs } from "./parse-args"; + +enum ExitCode { + Success = 0, + SytaxError = 1, + RuntimeError = 2, +} + +/** + * The main entry point of the CLI + * + * @param args - The command-line arguments (e.g. ["major", "--preid=alpha", "-ctpa"]) + */ +export async function main(args: string[]): Promise { + try { + let { help, version, options } = parseArgs(args); + + if (help) { + // Show the help text and exit + console.log(helpText); + process.exit(ExitCode.Success); + } + else if (version) { + // Show the version number and exit + console.log(manifest.version); + process.exit(ExitCode.Success); + } + else { + await bump(options); + } + } + catch (error) { + // There was an error parsing the command-line args + console.error((error as Error).message); + console.error(helpText); + process.exit(ExitCode.SytaxError); + } +} + +async function bump(options: VersionBumpOptions): Promise { + try { + let results = await versionBump(options); + console.log("\n\nRESULTS:", results, "\n\n"); + } + catch (error) { + console.error((error as Error).stack || (error as Error).message); + process.exit(ExitCode.RuntimeError); + } +} diff --git a/src/cli/manifest.ts b/src/cli/manifest.ts new file mode 100644 index 0000000..6d58f5e --- /dev/null +++ b/src/cli/manifest.ts @@ -0,0 +1,20 @@ +// NOTE: We can't `import` the package.json file because it's outside of the "src" directory. +// tslint:disable-next-line: no-var-requires no-require-imports +const manifest = require("../../package.json") as Manifest; + +// Don't use the npm package name ("version-bump-prompt"). +// Use the name of the binary ("bump") instead. +let name = Object.keys(manifest.bin)[0]; +const alteredManifest: Manifest = Object.assign({}, manifest, { name }); +export { alteredManifest as manifest }; + +/** + * The npm package manifest (package.json) + */ +export interface Manifest { + name: string; + version: string; + description: string; + bin: Record; + [key: string]: unknown; +} diff --git a/src/cli/parse-args.ts b/src/cli/parse-args.ts new file mode 100644 index 0000000..f1e328b --- /dev/null +++ b/src/cli/parse-args.ts @@ -0,0 +1,73 @@ +import * as commandLineArgs from "command-line-args"; +import * as semver from "semver"; +import { VersionBumpOptions } from "../version-bump-options"; +import { isVersionBumpType } from "../version-bump-type"; + +/** + * The parsed command-line arguments + */ +export interface ParsedArgs { + help?: boolean; + version?: boolean; + options: VersionBumpOptions; +} + +/** + * Parses the command-line arguments + */ +export function parseArgs(argv: string[]): ParsedArgs { + let args = commandLineArgs( + [ + { name: "preid", type: String }, + { name: "commit", alias: "c", type: String }, + { name: "tag", alias: "t", type: String }, + { name: "push", alias: "p", type: Boolean }, + { name: "all", alias: "a", type: Boolean }, + { name: "version", alias: "v", type: Boolean }, + { name: "help", alias: "h", type: Boolean }, + { name: "files", type: String, multiple: true, defaultOption: true }, + ], + { argv } + ); + + let parsedArgs: ParsedArgs = { + help: args.help as boolean, + version: args.version as boolean, + options: { + preid: args.preid as string, + commit: args.commit as string | boolean, + tag: args.tag as string | boolean, + push: args.push as boolean, + all: args.all as boolean, + files: args.files as string[], + } + }; + + // If --preid is used without an argument, then throw an error, since it's probably a mistake. + // If they want to use the default value ("beta"), then they should not pass the argument at all + if (args.preid === null) { + throw new Error(`The --preid option requires a value, such as "alpha", "beta", etc.`); + } + + // If --commit is used without an argument, then treat it as a boolean flag + if (args.commit === null) { + parsedArgs.options.commit = true; + } + + // If --tag is used without an argument, then treat it as a boolean flag + if (args.tag === null) { + parsedArgs.options.tag = true; + } + + // If a version number or bump type was specified, then it will mistakenly be added to the "files" array + if (parsedArgs.options.files && parsedArgs.options.files.length > 0) { + let firstArg = parsedArgs.options.files[0]; + + if (isVersionBumpType(firstArg) || semver.valid(firstArg)) { + parsedArgs.options.version = firstArg; + parsedArgs.options.files.shift(); + } + } + + return parsedArgs; +} From dd2afe31022c43ed23e10fa1f2f9927fc85e70df Mon Sep 17 00:00:00 2001 From: James Messinger Date: Tue, 1 Jan 2019 08:17:01 -0600 Subject: [PATCH 008/106] Improved the options parsing logic --- src/options.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/options.ts b/src/options.ts index 3ba5fdf..fee7ba5 100644 --- a/src/options.ts +++ b/src/options.ts @@ -1,4 +1,5 @@ import { VersionBumpOptions } from "./version-bump-options"; +import { VersionBumpType } from "./version-bump-type"; /** * Normalized and sanitized options @@ -15,11 +16,10 @@ export class Options { public files: string[]; public constructor(props: VersionBumpOptions) { - this.version = props.version || "prompt"; + this.version = props.version || VersionBumpType.Prompt; this.preid = props.preid || "beta"; this.push = Boolean(props.push); this.all = Boolean(props.all); - this.files = Array.isArray(props.files) ? props.files : ["package.json", "package-lock.json"]; if (typeof props.tag === "string") { this.tag = true; @@ -44,5 +44,12 @@ export class Options { else { this.commit = false; } + + if (Array.isArray(props.files) && props.files.length > 0) { + this.files = props.files.slice(); + } + else { + this.files = ["package.json", "package-lock.json"]; + } } } From 2e4476dec6d64f7e11b7962074a466761c81efd7 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Tue, 1 Jan 2019 08:18:39 -0600 Subject: [PATCH 009/106] Dropped support for Node 6, so we can use async/await synatax --- .travis.yml | 1 - package.json | 2 +- src/cli/manifest.ts | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index b61a17f..81bde33 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,6 @@ language: node_js node_js: - 10 - 8 - - 6 os: - linux diff --git a/package.json b/package.json index 5072e8f..46840fd 100644 --- a/package.json +++ b/package.json @@ -81,6 +81,6 @@ "semver": "^5.6.0" }, "engines": { - "node": ">=6" + "node": ">=7" } } diff --git a/src/cli/manifest.ts b/src/cli/manifest.ts index 6d58f5e..8958715 100644 --- a/src/cli/manifest.ts +++ b/src/cli/manifest.ts @@ -5,7 +5,7 @@ const manifest = require("../../package.json") as Manifest; // Don't use the npm package name ("version-bump-prompt"). // Use the name of the binary ("bump") instead. let name = Object.keys(manifest.bin)[0]; -const alteredManifest: Manifest = Object.assign({}, manifest, { name }); +const alteredManifest: Manifest = { ...manifest, name }; export { alteredManifest as manifest }; /** From cd16cba3ad9866b622c5c5c6fabf539b7a1aa015 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Tue, 1 Jan 2019 08:50:27 -0600 Subject: [PATCH 010/106] Made the `VersionBumpResults` object more consistent with the `VersionBumpOptions` object --- src/options.ts | 6 ++++-- src/version-bump-results.ts | 14 ++++++++------ src/version-bump.ts | 2 ++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/options.ts b/src/options.ts index fee7ba5..ee061fe 100644 --- a/src/options.ts +++ b/src/options.ts @@ -8,9 +8,9 @@ export class Options { public version: string; public preid: string; public commit: boolean; - public commitMessage?: string; + public commitMessage: string; public tag: boolean; - public tagName?: string; + public tagName: string; public push: boolean; public all: boolean; public files: string[]; @@ -31,6 +31,7 @@ export class Options { } else { this.tag = false; + this.tagName = ""; } if (typeof props.commit === "string") { @@ -43,6 +44,7 @@ export class Options { } else { this.commit = false; + this.commitMessage = ""; } if (Array.isArray(props.files) && props.files.length > 0) { diff --git a/src/version-bump-results.ts b/src/version-bump-results.ts index 59d74f9..01514e7 100644 --- a/src/version-bump-results.ts +++ b/src/version-bump-results.ts @@ -13,16 +13,18 @@ export interface VersionBumpResults { newVersion: string; /** - * The commit message that was used for the git commit. - * If no git commit was created, then this is `undefined`. + * The commit message that was used for the git commit, or `false` if no git commit was created. + * + * NOTE: This will never be an empty string. It will always contain at least the new version number. */ - commitMessage?: string; + commit: string | false; /** - * The tag name that was used for the git tag. - * If no tag was created, then this is `undefined`. + * The tag name that was used for the git tag, or `false` if no git tag was created. + * + * NOTE: This will never be an empty string. It will always contain at least the new version number. */ - tagName?: string; + tag: string | false; /** * The files that were updated. diff --git a/src/version-bump.ts b/src/version-bump.ts index 23aed3a..4d76ed1 100644 --- a/src/version-bump.ts +++ b/src/version-bump.ts @@ -37,6 +37,8 @@ export async function versionBump(arg: VersionBumpOptions | string = {}): Promis return { oldVersion: "1.2.3", newVersion: "1.2.3", + commit: options.commitMessage || false, + tag: options.tagName || false, files: options.files, }; } From bbc59bcecc6f8c2a950d25a66150c49448457745 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Tue, 1 Jan 2019 08:50:48 -0600 Subject: [PATCH 011/106] Implemented the logic for determining the current version number --- src/fs.ts | 28 ++++++++++++++++++++++ src/get-old-version.ts | 53 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 src/fs.ts create mode 100644 src/get-old-version.ts diff --git a/src/fs.ts b/src/fs.ts new file mode 100644 index 0000000..b612d51 --- /dev/null +++ b/src/fs.ts @@ -0,0 +1,28 @@ +import * as fs from "fs"; + +/** + * Reads a text file and returns its contents. + */ +export function readTextFile(file: string): Promise { // tslint:disable-line: promise-function-async + return new Promise((resolve, reject) => { + // tslint:disable-next-line ban + fs.readFile(file, "utf8", (err, text) => { + if (err) { + reject(err); + } + else { + resolve(text); + } + }); + }); +} + +/** + * Reads a JSON file and returns the parsed data. + */ +export async function readJsonFile(file: string): Promise { + let json = await readTextFile(file); + let pojo = JSON.parse(json) as unknown; + + return pojo; +} diff --git a/src/get-old-version.ts b/src/get-old-version.ts new file mode 100644 index 0000000..b95cd6e --- /dev/null +++ b/src/get-old-version.ts @@ -0,0 +1,53 @@ +import * as semver from "semver"; +import { Manifest } from "./cli/manifest"; +import { readJsonFile } from "./fs"; + +/** + * Returns the current version number from files such as package.json. + * An error is thrown if no version number can be found. + * + * @param files - The files to check for a version number + */ +export async function getOldVersion(files: string[]): Promise { + // Check all JSON files in the files list + let filesToCheck = files.filter((file) => file.endsWith(".json")); + + // Always check package.json + if (!filesToCheck.includes("package.json")) { + filesToCheck.push("package.json"); + } + + // Check each file, in order, and return the first valid version number we find + for (let file of filesToCheck) { + let version = await readVersion(file); + if (version) { + return version; + } + } + + // If we get here, then no version number was found + throw new Error( + `Unable to determine the current version number. Checked ${filesToCheck.join(", ")}.` + ); +} + +/** + * Tries to read the version number from the specified JSON file. + * + * @returns - The version number, or undefined if the file doesn't have a version number + */ +async function readVersion(file: string): Promise { + try { + let pojo = await readJsonFile(file); + + if (typeof pojo === "object" && pojo !== null && "version" in pojo) { + let manifest = pojo as Manifest; + if (semver.valid(manifest.version)) { + return manifest.version; + } + } + } + catch (error) { + return undefined; + } +} From 8bb2e2b7380b976cf57ceaf5dd8ccd73fbd349f7 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Tue, 1 Jan 2019 08:51:32 -0600 Subject: [PATCH 012/106] Implemented the basic happy path logic --- src/get-new-version.ts | 24 ++++++++++++++++++++++++ src/version-bump.ts | 11 ++++++----- 2 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 src/get-new-version.ts diff --git a/src/get-new-version.ts b/src/get-new-version.ts new file mode 100644 index 0000000..4f780cd --- /dev/null +++ b/src/get-new-version.ts @@ -0,0 +1,24 @@ +import { ReleaseType, SemVer } from "semver"; +import { isVersionBumpType, VersionBumpType } from "./version-bump-type"; + +/** + * Returns the new version number, possibly by prompting the user for it. + * + * @param oldVersion - The old (current) version number + * @param version - The new version number, or a VersionBumpType + * @param preid - Optional prerelease identifier (e.g. "alpha", "beta", etc.) + */ +export async function getNewVersion(oldVersion: string, newVersion: string, preid?: string): Promise { + if (newVersion === VersionBumpType.Prompt) { + return ""; + } + else if (isVersionBumpType(newVersion)) { + let oldSemVer = new SemVer(oldVersion); + let newSemVer = oldSemVer.inc(newVersion as ReleaseType, preid); + return newSemVer.version; + } + else { + let newSemVer = new SemVer(newVersion, true); + return newSemVer.version; + } +} diff --git a/src/version-bump.ts b/src/version-bump.ts index 4d76ed1..f673687 100644 --- a/src/version-bump.ts +++ b/src/version-bump.ts @@ -1,3 +1,5 @@ +import { getNewVersion } from "./get-new-version"; +import { getOldVersion } from "./get-old-version"; import { Options } from "./options"; import { VersionBumpOptions } from "./version-bump-options"; import { VersionBumpResults } from "./version-bump-results"; @@ -30,13 +32,12 @@ export async function versionBump(arg: VersionBumpOptions | string = {}): Promis } let options = new Options(arg); - - console.log("\n\n", options); - process.exit(0); + let oldVersion = await getOldVersion(options.files); + let newVersion = await getNewVersion(oldVersion, options.version, options.preid); return { - oldVersion: "1.2.3", - newVersion: "1.2.3", + oldVersion, + newVersion, commit: options.commitMessage || false, tag: options.tagName || false, files: options.files, From f65acc761147fdda504712a4c30a32d8ebbed1a8 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Tue, 1 Jan 2019 08:53:00 -0600 Subject: [PATCH 013/106] Added tests for basic CLI functionality, such as "--help", "--version", and exit codes --- test/fixtures/mocks/index.js | 2 +- test/specs/cli.spec.js | 120 +++++++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 test/specs/cli.spec.js diff --git a/test/fixtures/mocks/index.js b/test/fixtures/mocks/index.js index 15a3049..1b82d7c 100644 --- a/test/fixtures/mocks/index.js +++ b/test/fixtures/mocks/index.js @@ -8,7 +8,7 @@ const files = require("../files"); fs.chmodSync(path.join(__dirname, "git"), "0777"); fs.chmodSync(path.join(__dirname, "npm"), "0777"); -// Inject our this directory path into the PATH variable, +// Inject our mocks directory path into the PATH variable, // so that version-bump-prompt runs our mock `git` and `npm` binaries // instead of the real ones. let otherPaths = getEnvPath(); diff --git a/test/specs/cli.spec.js b/test/specs/cli.spec.js new file mode 100644 index 0000000..e895814 --- /dev/null +++ b/test/specs/cli.spec.js @@ -0,0 +1,120 @@ +"use strict"; + +const files = require("../fixtures/files"); +const chaiExec = require("chai-exec"); +const manifest = require("../../package.json"); + +describe("bump", () => { + + it("should run without any arguments", () => { + files.create("package.json", { version: "1.0.0" }); + + let bump = chaiExec("", { timeout: 1000 }); + + bump.signal.should.equal("SIGKILL"); + + bump.stderr.should.be.empty; + bump.stdout.should.contain("PROMPT TEXT"); + }); + + it("should error if an invalid argument is used", () => { + let bump = chaiExec("--commit --help --fizzbuzz --tag"); + + bump.should.have.exitCode(1); + bump.should.have.stdout(""); + bump.stderr.should.match(/^Unknown option: --fizzbuzz\n\nUsage: bump \[version\] \[options\] \[files...\]\n/); + bump.stderr.should.contain(manifest.description); + }); + + it("should error if an invalid shorthand argument is used", () => { + let bump = chaiExec("-chzt"); + + bump.should.have.exitCode(1); + bump.should.have.stdout(""); + bump.stderr.should.match(/^Unknown option: -z\n\nUsage: bump \[version\] \[options\] \[files...\]\n/); + bump.stderr.should.contain(manifest.description); + }); + + it("should error if an argument is missing its value", () => { + let bump = chaiExec("--commit --help --preid --tag"); + + bump.should.have.exitCode(1); + bump.should.have.stdout(""); + bump.stderr.should.match( + /^The --preid option requires a value, such as "alpha", "beta", etc\.\n\nUsage: bump \[version\] \[options\] \[files...\]\n/ + ); + bump.stderr.should.contain(manifest.description); + }); + + describe("bump --help", () => { + it("should show usage text", () => { + let bump = chaiExec("--help"); + + bump.should.have.exitCode(0); + bump.stderr.should.be.empty; + bump.stdout.should.match(/^\nUsage: bump \[version\] \[options\] \[files...\]\n/); + bump.stdout.should.contain(manifest.description); + }); + + it("should support -h shorthand", () => { + let bump = chaiExec("-h"); + + bump.should.have.exitCode(0); + bump.stderr.should.be.empty; + bump.stdout.should.match(/^\nUsage: bump \[version\] \[options\] \[files...\]\n/); + bump.stdout.should.contain(manifest.description); + }); + + it("should ignore other arguments", () => { + let bump = chaiExec("--commit --help --tag"); + + bump.should.have.exitCode(0); + bump.stderr.should.be.empty; + bump.stdout.should.match(/^\nUsage: bump \[version\] \[options\] \[files...\]\n/); + bump.stdout.should.contain(manifest.description); + }); + + it("should ignore other shorthand arguments", () => { + let bump = chaiExec("-cht"); + + bump.should.have.exitCode(0); + bump.stderr.should.be.empty; + bump.stdout.should.match(/^\nUsage: bump \[version\] \[options\] \[files...\]\n/); + bump.stdout.should.contain(manifest.description); + }); + }); + + describe("bump --version", () => { + it("should show the version number", () => { + let bump = chaiExec("--version"); + + bump.should.have.exitCode(0); + bump.stderr.should.be.empty; + bump.should.have.stdout(manifest.version + "\n"); + }); + + it("should support -v shorthand", () => { + let bump = chaiExec("-v"); + + bump.should.have.exitCode(0); + bump.stderr.should.be.empty; + bump.should.have.stdout(manifest.version + "\n"); + }); + + it("should ignore other arguments", () => { + let bump = chaiExec("--commit --version --tag"); + + bump.should.have.exitCode(0); + bump.stderr.should.be.empty; + bump.should.have.stdout(manifest.version + "\n"); + }); + + it("should ignore other shorthand arguments", () => { + let bump = chaiExec("-cvt"); + + bump.should.have.exitCode(0); + bump.stderr.should.be.empty; + bump.should.have.stdout(manifest.version + "\n"); + }); + }); +}); From 2af8abc5e60a851522aa554cb737350807b1fee8 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Tue, 1 Jan 2019 08:53:46 -0600 Subject: [PATCH 014/106] Added tests for the Node API --- test/specs/exports.spec.js | 142 +++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 test/specs/exports.spec.js diff --git a/test/specs/exports.spec.js b/test/specs/exports.spec.js new file mode 100644 index 0000000..843bd20 --- /dev/null +++ b/test/specs/exports.spec.js @@ -0,0 +1,142 @@ +"use strict"; + +const versionBump = require("../../"); +const defaultExport = require("../../"); +const { versionBump: namedExport } = require("../../"); +const mocks = require("../fixtures/mocks"); +const files = require("../fixtures/files"); + +describe("versionBup() API", () => { + + it("should export the versionBump() function as the default export", () => { + defaultExport.should.be.a("function"); + defaultExport.should.have.property("default"); + defaultExport.default.should.equal(defaultExport); + }); + + it("should export the versionBump() function as a named export", () => { + defaultExport.should.have.property("versionBump"); + namedExport.should.be.a("function"); + namedExport.should.equal(defaultExport); + }); + + it("should not export anything else", () => { + Object.keys(defaultExport).should.have.same.members([ + "default", + "versionBump", + ]); + }); + + it("should work without any arguments", async () => { + files.create("package.json", { version: "1.0.0" }); + + // Change the cwd, since we're not setting the `cwd` option + process.chdir("test/.tmp"); + + let results = await versionBump(); + + results.should.deep.equal({ + + }); + + // Git and NPM should NOT have been called + mocks.git().should.be.empty; + mocks.npm().should.be.empty; + + // Restore the previous cwd + process.chdir("../.."); + }); + + it.only("should accept a specific version number", async () => { + files.create("package.json", { version: "1.0.0" }); + + // Change the cwd, since we're not setting the `cwd` option + process.chdir("test/.tmp"); + + let results = await versionBump("2.34.567"); + + results.should.deep.equal({ + oldVersion: "1.0.0", + newVersion: "2.34.567", + commit: false, + tag: false, + files: [ + "package.json", + "package-lock.json", + ], + }); + + // Git and NPM should NOT have been called + mocks.git().should.be.empty; + mocks.npm().should.be.empty; + + // Restore the previous cwd + process.chdir("../.."); + }); + + it("should accept a bump type", async () => { + files.create("package.json", { version: "1.0.0" }); + + // Change the cwd, since we're not setting the `cwd` option + process.chdir("test/.tmp"); + + let results = await versionBump("minor"); + + results.should.deep.equal({ + + }); + + // Git and NPM should NOT have been called + mocks.git().should.be.empty; + mocks.npm().should.be.empty; + + // Restore the previous cwd + process.chdir("../.."); + }); + + it("should accept an empty options object", async () => { + files.create("package.json", { version: "1.0.0" }); + + // Change the cwd, since we're not setting the `cwd` option + process.chdir("test/.tmp"); + + let results = await versionBump({}); + + results.should.deep.equal({ + + }); + + // Git and NPM should NOT have been called + mocks.git().should.be.empty; + mocks.npm().should.be.empty; + + // Restore the previous cwd + process.chdir("../.."); + }); + + it("should accept options", async () => { + files.create("package.json", { version: "1.0.0" }); + + let results = await versionBump({ + cwd: "test/.tmp", + version: "preminor", + preid: "test", + commit: "A test of the upcoming v", + tag: "", + }); + + results.should.deep.equal({ + + }); + + // A git commit and tag should have been created + mocks.git().should.deep.equal([ + 'git commit package.json -m "release v2.0.0"', + 'git tag package.json -m "release v2.0.0"', + ]); + + // NPM should NOT have been called + mocks.npm().should.be.empty; + }); + +}); From f6a9753a489919afcd2d5050edab2e5bcecdfbcd Mon Sep 17 00:00:00 2001 From: James Messinger Date: Tue, 1 Jan 2019 12:21:07 -0600 Subject: [PATCH 015/106] Updated dependencies --- package-lock.json | 18 +++++++++--------- package.json | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9a57b4d..a682900 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1285,9 +1285,9 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "eslint": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.11.0.tgz", - "integrity": "sha512-gbEg0ttToZPkZUv2yYjpipxuYrv/9aSSmgM4V6GkiO3u04QosHYBtduUCqLEulEg3YvNDAkk3OWzyQJ/heZ3Nw==", + "version": "5.11.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.11.1.tgz", + "integrity": "sha512-gOKhM8JwlFOc2acbOrkYR05NW8M6DCMSvfcJiBB5NDxRE1gv8kbvxKaC9u69e6ZGEMWXcswA/7eKR229cEIpvg==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -1365,9 +1365,9 @@ } }, "eslint-config-modular": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eslint-config-modular/-/eslint-config-modular-5.0.1.tgz", - "integrity": "sha512-fJyVQWfMdTFuneVOqgAiZPjaO4+0/oVAPTM1np31PZCssj+rqRwBd/z24RIAtIgUpByUO8hQFvoRfZIFOUTpig==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-modular/-/eslint-config-modular-6.0.0.tgz", + "integrity": "sha512-M766C/t7Ofm9zw4U7Ej4DzK6bOpBQ2lN/ZahKrrRr05W5Y9rwXFeIPfMlixPF1W/Y/Z1MTIrxU4ZC0UU3e0UeA==", "dev": true }, "eslint-scope": { @@ -4924,9 +4924,9 @@ } }, "tslint-modular": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/tslint-modular/-/tslint-modular-1.0.0.tgz", - "integrity": "sha512-WLtNdd7GrwzqNQY6xcpDXKq00YbtxwNWhPSegRgqwu90waWUD8mIKk6baYDjvqSfjnGT7ZZ9AjdhsaORzYfyIw==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/tslint-modular/-/tslint-modular-1.1.1.tgz", + "integrity": "sha512-fYZ9CzVIWnkBbVJVzLQ16p/dzx3COopwHKcsXCaOE6YGhlf7cy8Mq4+QiT5xDQWokOHKtYW/pf/wb9FAjd5B0g==", "dev": true }, "tsutils": { diff --git a/package.json b/package.json index 46840fd..dcf6a3b 100644 --- a/package.json +++ b/package.json @@ -59,14 +59,14 @@ "chai-exec": "^1.1.1", "coveralls": "^3.0.2", "del": "^3.0.0", - "eslint": "^5.11.0", - "eslint-config-modular": "^5.0.1", + "eslint": "^5.11.1", + "eslint-config-modular": "^6.0.0", "mocha": "^5.2.0", "npm-check": "^5.9.0", "nyc": "^13.1.0", "strip-ansi": "^5.0.0", "tslint": "^5.12.0", - "tslint-modular": "^1.0.0", + "tslint-modular": "^1.1.1", "typescript": "^3.2.2", "typescript-tslint-plugin": "^0.2.1" }, From 7ecc2794a5714f03a653d8934a24f0247f001d7a Mon Sep 17 00:00:00 2001 From: James Messinger Date: Tue, 1 Jan 2019 12:21:37 -0600 Subject: [PATCH 016/106] Enforce LF line endings for all text files --- .gitattributes | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..4ca9ecd --- /dev/null +++ b/.gitattributes @@ -0,0 +1,25 @@ +# Git attributes +# https://git-scm.com/docs/gitattributes +# https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes + +# Normalize line endings for all files that git determines to be text. +# https://git-scm.com/docs/gitattributes#gitattributes-Settostringvalueauto +* text=auto + +# Normalize line endings to LF on checkin, and do NOT convert to CRLF when checking-out on Windows. +# https://git-scm.com/docs/gitattributes#gitattributes-Settostringvaluelf +*.txt text eol=lf +*.html text eol=lf +*.md text eol=lf +*.css text eol=lf +*.scss text eol=lf +*.map text eol=lf +*.js text eol=lf +*.jsx text eol=lf +*.ts text eol=lf +*.tsx text eol=lf +*.json text eol=lf +*.yml text eol=lf +*.yaml text eol=lf +*.xml text eol=lf +*.svg text eol=lf From e07e5dcb8b936b5625b7a25a4fe43a829f34cf31 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 2 Jan 2019 03:53:53 -0600 Subject: [PATCH 017/106] Added a `cwd` option that defaults to `process.cwd()` --- src/get-old-version.ts | 6 +++++- src/options.ts | 4 +++- src/version-bump-options.ts | 7 +++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/get-old-version.ts b/src/get-old-version.ts index b95cd6e..0b95d66 100644 --- a/src/get-old-version.ts +++ b/src/get-old-version.ts @@ -1,3 +1,4 @@ +import * as path from "path"; import * as semver from "semver"; import { Manifest } from "./cli/manifest"; import { readJsonFile } from "./fs"; @@ -7,8 +8,9 @@ import { readJsonFile } from "./fs"; * An error is thrown if no version number can be found. * * @param files - The files to check for a version number + * @param cwd - The directory used to resolve relative file paths */ -export async function getOldVersion(files: string[]): Promise { +export async function getOldVersion(files: string[], cwd: string): Promise { // Check all JSON files in the files list let filesToCheck = files.filter((file) => file.endsWith(".json")); @@ -19,7 +21,9 @@ export async function getOldVersion(files: string[]): Promise { // Check each file, in order, and return the first valid version number we find for (let file of filesToCheck) { + file = path.join(cwd, file); let version = await readVersion(file); + if (version) { return version; } diff --git a/src/options.ts b/src/options.ts index ee061fe..4bd993e 100644 --- a/src/options.ts +++ b/src/options.ts @@ -14,12 +14,14 @@ export class Options { public push: boolean; public all: boolean; public files: string[]; + public cwd: string; public constructor(props: VersionBumpOptions) { this.version = props.version || VersionBumpType.Prompt; - this.preid = props.preid || "beta"; + this.preid = typeof props.preid === "string" ? props.preid : "beta"; this.push = Boolean(props.push); this.all = Boolean(props.all); + this.cwd = props.cwd || process.cwd(); if (typeof props.tag === "string") { this.tag = true; diff --git a/src/version-bump-options.ts b/src/version-bump-options.ts index 98a0ede..8869352 100644 --- a/src/version-bump-options.ts +++ b/src/version-bump-options.ts @@ -58,4 +58,11 @@ export interface VersionBumpOptions { * Defaults to ["package.json", "package-lock.json"] */ files?: string[]; + + /** + * The working directory, which is used as the basis for locating all files. + * + * Defaults to `process.cwd()` + */ + cwd?: string; } From fbda4719e4bc7120c4e13a33b1313b488aa1c1f0 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 2 Jan 2019 04:04:36 -0600 Subject: [PATCH 018/106] Added an `interface` option for specifying the command-line interface --- src/options.ts | 35 ++++++++++++++++++++++------------- src/version-bump-options.ts | 10 ++++++++++ 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/options.ts b/src/options.ts index 4bd993e..3816f50 100644 --- a/src/options.ts +++ b/src/options.ts @@ -1,3 +1,4 @@ +import { ReadLineOptions } from "readline"; import { VersionBumpOptions } from "./version-bump-options"; import { VersionBumpType } from "./version-bump-type"; @@ -15,19 +16,27 @@ export class Options { public all: boolean; public files: string[]; public cwd: string; + public interface: ReadLineOptions; public constructor(props: VersionBumpOptions) { - this.version = props.version || VersionBumpType.Prompt; - this.preid = typeof props.preid === "string" ? props.preid : "beta"; - this.push = Boolean(props.push); - this.all = Boolean(props.all); - this.cwd = props.cwd || process.cwd(); + let { version, preid, commit, tag, push, all, files, cwd } = props; - if (typeof props.tag === "string") { + this.version = version || VersionBumpType.Prompt; + this.preid = typeof preid === "string" ? preid : "beta"; + this.push = Boolean(push); + this.all = Boolean(all); + this.cwd = cwd || process.cwd(); + this.interface = { + input: process.stdin, + output: process.stdout, + ...props.interface, + }; + + if (typeof tag === "string") { this.tag = true; - this.tagName = props.tag; + this.tagName = tag; } - else if (props.tag) { + else if (tag) { this.tag = true; this.tagName = "v"; } @@ -36,11 +45,11 @@ export class Options { this.tagName = ""; } - if (typeof props.commit === "string") { + if (typeof commit === "string") { this.commit = true; - this.commitMessage = props.commit; + this.commitMessage = commit; } - else if (props.commit || this.tag || this.push) { + else if (commit || this.tag || this.push) { this.commit = true; this.commitMessage = "release v"; } @@ -49,8 +58,8 @@ export class Options { this.commitMessage = ""; } - if (Array.isArray(props.files) && props.files.length > 0) { - this.files = props.files.slice(); + if (Array.isArray(files) && files.length > 0) { + this.files = files.slice(); } else { this.files = ["package.json", "package-lock.json"]; diff --git a/src/version-bump-options.ts b/src/version-bump-options.ts index 8869352..b45a3c1 100644 --- a/src/version-bump-options.ts +++ b/src/version-bump-options.ts @@ -1,3 +1,5 @@ +import { ReadLineOptions } from "readline"; + /** * Options for the `versionBump()` function. */ @@ -65,4 +67,12 @@ export interface VersionBumpOptions { * Defaults to `process.cwd()` */ cwd?: string; + + /** + * Options for the command-line interface. This object is passed to `readline.createInterface()`. + * + * The `input` property defaults to `process.stdin`. + * The `output` property defaults to `process.stdout`. + */ + interface?: Partial; } From 06b4cdb6643dcaf1040d07d2c2312a1946c1f74d Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 2 Jan 2019 04:30:20 -0600 Subject: [PATCH 019/106] Renamed the `version` option to `release` to avoid confusion --- src/cli/help.ts | 6 ++-- src/cli/parse-args.ts | 8 ++--- src/options.ts | 58 ++++++++++++++++++--------------- src/release-type.ts | 26 +++++++++++++++ src/version-bump-options.ts | 10 +++--- src/version-bump-results.ts | 7 ++++ src/version-bump-type.ts | 64 ------------------------------------- src/version-bump.ts | 31 ++++++++++++------ 8 files changed, 101 insertions(+), 109 deletions(-) create mode 100644 src/release-type.ts delete mode 100644 src/version-bump-type.ts diff --git a/src/cli/help.ts b/src/cli/help.ts index 37339c1..94af458 100644 --- a/src/cli/help.ts +++ b/src/cli/help.ts @@ -4,12 +4,12 @@ import { manifest } from "./manifest"; * The CLI help text */ export const helpText = ` -Usage: ${manifest.name} [version] [options] [files...] +Usage: ${manifest.name} [release] [options] [files...] ${manifest.description} -version - One of the following: +release: + The release version or type. Can be one of the following: - A semver version number (ex: 1.23.456) - prompt: Prompt for the version number (this is the default) - major: Increase major version diff --git a/src/cli/parse-args.ts b/src/cli/parse-args.ts index f1e328b..b1c4662 100644 --- a/src/cli/parse-args.ts +++ b/src/cli/parse-args.ts @@ -1,7 +1,7 @@ import * as commandLineArgs from "command-line-args"; import * as semver from "semver"; +import { isReleaseType } from "../release-type"; import { VersionBumpOptions } from "../version-bump-options"; -import { isVersionBumpType } from "../version-bump-type"; /** * The parsed command-line arguments @@ -59,12 +59,12 @@ export function parseArgs(argv: string[]): ParsedArgs { parsedArgs.options.tag = true; } - // If a version number or bump type was specified, then it will mistakenly be added to the "files" array + // If a version number or release type was specified, then it will mistakenly be added to the "files" array if (parsedArgs.options.files && parsedArgs.options.files.length > 0) { let firstArg = parsedArgs.options.files[0]; - if (isVersionBumpType(firstArg) || semver.valid(firstArg)) { - parsedArgs.options.version = firstArg; + if (firstArg === "prompt" || isReleaseType(firstArg) || semver.valid(firstArg)) { + parsedArgs.options.release = firstArg; parsedArgs.options.files.shift(); } } diff --git a/src/options.ts b/src/options.ts index 3816f50..2956f5d 100644 --- a/src/options.ts +++ b/src/options.ts @@ -1,27 +1,33 @@ import { ReadLineOptions } from "readline"; +import { isReleaseType, ReleaseType } from "./release-type"; import { VersionBumpOptions } from "./version-bump-options"; -import { VersionBumpType } from "./version-bump-type"; + +interface Interface extends ReadLineOptions { + output: NodeJS.WritableStream; +} /** * Normalized and sanitized options */ export class Options { - public version: string; + public release: "prompt" | ReleaseType | { version: string }; public preid: string; - public commit: boolean; - public commitMessage: string; - public tag: boolean; - public tagName: string; + public commit?: { + message: string; + }; + public tag?: { + name: string; + }; public push: boolean; public all: boolean; public files: string[]; public cwd: string; - public interface: ReadLineOptions; + public interface: Interface; public constructor(props: VersionBumpOptions) { - let { version, preid, commit, tag, push, all, files, cwd } = props; + let { release, preid, commit, tag, push, all, files, cwd } = props; - this.version = version || VersionBumpType.Prompt; + // Set the simple properties first this.preid = typeof preid === "string" ? preid : "beta"; this.push = Boolean(push); this.all = Boolean(all); @@ -32,32 +38,34 @@ export class Options { ...props.interface, }; - if (typeof tag === "string") { - this.tag = true; - this.tagName = tag; + // release + if (!release || release === "prompt") { + this.release = "prompt"; } - else if (tag) { - this.tag = true; - this.tagName = "v"; + else if (isReleaseType(release)) { + this.release = release; } else { - this.tag = false; - this.tagName = ""; + this.release = { version: release }; } + // tag + if (typeof tag === "string") { + this.tag = { name: tag }; + } + else if (tag) { + this.tag = { name: "v" }; + } + + // commit - This must come AFTER tag, because it relies on it if (typeof commit === "string") { - this.commit = true; - this.commitMessage = commit; + this.commit = { message: commit }; } else if (commit || this.tag || this.push) { - this.commit = true; - this.commitMessage = "release v"; - } - else { - this.commit = false; - this.commitMessage = ""; + this.commit = { message: "release v" }; } + // files if (Array.isArray(files) && files.length > 0) { this.files = files.slice(); } diff --git a/src/release-type.ts b/src/release-type.ts new file mode 100644 index 0000000..ecde28d --- /dev/null +++ b/src/release-type.ts @@ -0,0 +1,26 @@ +import { ReleaseType } from "semver"; +export { ReleaseType } from "semver"; + +/** + * The different types of pre-releases. + */ +export const prereleaseTypes = ["preminor", "patch", "prepatch", "prerelease"]; + +/** + * All possible release types. + */ +export const releaseTypes = prereleaseTypes.concat(["major", "premajor", "minor"]); + +/** + * Determines whether the specified value is a pre-release. + */ +export function isPrerelease(value: string): boolean { + return prereleaseTypes.includes(value); +} + +/** + * Determines whether the specified value is a valid ReleaseType string. + */ +export function isReleaseType(value: string): value is ReleaseType { + return releaseTypes.includes(value); +} diff --git a/src/version-bump-options.ts b/src/version-bump-options.ts index b45a3c1..8325582 100644 --- a/src/version-bump-options.ts +++ b/src/version-bump-options.ts @@ -5,13 +5,15 @@ import { ReadLineOptions } from "readline"; */ export interface VersionBumpOptions { /** - * The new version number (e.g. "1.23.456") or the type of version bump to perform - * (e.g. "major", "minor", "patch", "prerelease", etc.). Use "prompt" to prompt the - * user for the version number. + * The release version or type. Can be one of the following: + * + * - The new version number (e.g. "1.23.456") + * - A release type (e.g. "major", "minor", "patch", "prerelease", etc.) + * - "prompt" to prompt the user for the version number * * Defaults to "prompt". */ - version?: string; + release?: string; /** * The prerelease type (e.g. "alpha", "beta", "next"). diff --git a/src/version-bump-results.ts b/src/version-bump-results.ts index 01514e7..473dad4 100644 --- a/src/version-bump-results.ts +++ b/src/version-bump-results.ts @@ -1,7 +1,14 @@ +import { ReleaseType } from "./release-type"; + /** * Information about the work that was performed by the `versionBump()` function. */ export interface VersionBumpResults { + /** + * The release type that was used, or `undefined` if an explicit version number was used. + */ + release?: ReleaseType; + /** * The previous version number in package.json. */ diff --git a/src/version-bump-type.ts b/src/version-bump-type.ts deleted file mode 100644 index edbe1ef..0000000 --- a/src/version-bump-type.ts +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Types of version bumps that can be performed. - */ -export enum VersionBumpType { - /** - * Prompts the user for the version number. - */ - Prompt = "prompt", - - /** - * Bumps the major version number (e.g. 1.23.456 => 2.0.0) - */ - Major = "major", - - /** - * Bumps the minor version number (e.g. 1.23.456 => 1.3.0) - */ - Minor = "minor", - - /** - * Bumps the patch version number (e.g. 1.23.456 => 1.23.457) - */ - Patch = "patch", - - /** - * Bumps the premajor version number (e.g. 1.23.456 => 2.0.0-beta.1) - */ - Premajor = "premajor", - - /** - * Bumps the preminor version number (e.g. 1.23.456 => 1.3.0-beta.1) - */ - Preminor = "preminor", - - /** - * Bumps the prepatch version number (e.g. 1.23.456 => 1.23.457-beta.1) - */ - Prepatch = "prepatch", - - /** - * Bumps the prerelease version number (e.g. 1.23.456-beta.7 => 1.23.456-beta.8) - */ - Prerelease = "prerelease", -} - -/** - * Determines whether the specified value is a valid VersionBumpType string. - */ -export function isVersionBumpType(value: string): value is VersionBumpType { - switch (value) { - case VersionBumpType.Prompt: - case VersionBumpType.Major: - case VersionBumpType.Minor: - case VersionBumpType.Patch: - case VersionBumpType.Premajor: - case VersionBumpType.Preminor: - case VersionBumpType.Prepatch: - case VersionBumpType.Prerelease: - return true; - - default: - return false; - } -} diff --git a/src/version-bump.ts b/src/version-bump.ts index f673687..29f474f 100644 --- a/src/version-bump.ts +++ b/src/version-bump.ts @@ -1,3 +1,4 @@ +import { ReleaseType } from "semver"; import { getNewVersion } from "./get-new-version"; import { getOldVersion } from "./get-old-version"; import { Options } from "./options"; @@ -14,11 +15,14 @@ export async function versionBump(): Promise; /** * Bumps the version number in package.json, package-lock.json. * - * @param version - * The new version number, or a bump type, such as "major", "minor", "patch", etc. - * Use "prompt" to prompt the user for the version number. + * @param release + * The release version or type. Can be one of the following: + * + * - The new version number (e.g. "1.23.456") + * - A release type (e.g. "major", "minor", "patch", "prerelease", etc.) + * - "prompt" to prompt the user for the version number */ -export async function versionBump(version: string): Promise; +export async function versionBump(release: string): Promise; /** * Bumps the version number in one or more files, prompting the user if necessary. @@ -28,18 +32,27 @@ export async function versionBump(options: VersionBumpOptions): Promise { if (typeof arg === "string") { - arg = { version: arg }; + arg = { release: arg }; } let options = new Options(arg); - let oldVersion = await getOldVersion(options.files); - let newVersion = await getNewVersion(oldVersion, options.version, options.preid); + let oldVersion = await getOldVersion(options); + let newVersion = await getNewVersion({ ...options, oldVersion }); + + if (options.commit) { + options.commit.message += newVersion; + } + + if (options.tag) { + options.tag.name += newVersion; + } return { + release: typeof options.release === "string" ? options.release as ReleaseType : undefined, oldVersion, newVersion, - commit: options.commitMessage || false, - tag: options.tagName || false, + commit: options.commit ? options.commit.message : false, + tag: options.tag ? options.tag.name : false, files: options.files, }; } From 0dc0c62d38efc0166432be9494c72652c1504352 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 2 Jan 2019 06:36:57 -0600 Subject: [PATCH 020/106] Use parameter destructuring --- src/get-old-version.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/get-old-version.ts b/src/get-old-version.ts index 0b95d66..a0d6996 100644 --- a/src/get-old-version.ts +++ b/src/get-old-version.ts @@ -2,15 +2,13 @@ import * as path from "path"; import * as semver from "semver"; import { Manifest } from "./cli/manifest"; import { readJsonFile } from "./fs"; +import { Options } from "./options"; /** * Returns the current version number from files such as package.json. * An error is thrown if no version number can be found. - * - * @param files - The files to check for a version number - * @param cwd - The directory used to resolve relative file paths */ -export async function getOldVersion(files: string[], cwd: string): Promise { +export async function getOldVersion({ files, cwd }: Options): Promise { // Check all JSON files in the files list let filesToCheck = files.filter((file) => file.endsWith(".json")); From 02b51be143fdf26a12030198eb60cb0bc4bff5dc Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 2 Jan 2019 06:58:09 -0600 Subject: [PATCH 021/106] Corrected the `prereleaseTypes` and `releaseTypes` --- src/release-type.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/release-type.ts b/src/release-type.ts index ecde28d..3f4eea0 100644 --- a/src/release-type.ts +++ b/src/release-type.ts @@ -4,23 +4,25 @@ export { ReleaseType } from "semver"; /** * The different types of pre-releases. */ -export const prereleaseTypes = ["preminor", "patch", "prepatch", "prerelease"]; +export const prereleaseTypes: ReleaseType[] = ["premajor", "preminor", "prepatch", "prerelease"]; /** * All possible release types. */ -export const releaseTypes = prereleaseTypes.concat(["major", "premajor", "minor"]); +export const releaseTypes: ReleaseType[] = prereleaseTypes.concat(["major", "minor", "patch"]); + +// tslint:disable: no-any no-unsafe-any /** * Determines whether the specified value is a pre-release. */ -export function isPrerelease(value: string): boolean { +export function isPrerelease(value: any): boolean { return prereleaseTypes.includes(value); } /** * Determines whether the specified value is a valid ReleaseType string. */ -export function isReleaseType(value: string): value is ReleaseType { +export function isReleaseType(value: any): value is ReleaseType { return releaseTypes.includes(value); } From a335e4d3c5a8ba9065fd98d7e13504da1de2f3af Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 2 Jan 2019 07:08:14 -0600 Subject: [PATCH 022/106] Implemented the `getNewVersion()` function, including prompting the user --- src/get-new-version.ts | 128 ++++++++++++++++++++++++++++++++++++----- src/version-bump.ts | 5 +- 2 files changed, 116 insertions(+), 17 deletions(-) diff --git a/src/get-new-version.ts b/src/get-new-version.ts index 4f780cd..2ed8d24 100644 --- a/src/get-new-version.ts +++ b/src/get-new-version.ts @@ -1,24 +1,124 @@ -import { ReleaseType, SemVer } from "semver"; -import { isVersionBumpType, VersionBumpType } from "./version-bump-type"; +import * as inquirer from "inquirer"; +import * as semver from "semver"; +import { ReleaseType, SemVer } from "semver"; // tslint:disable-line: no-duplicate-imports +import { Options } from "./options"; +import { isPrerelease, isReleaseType, releaseTypes } from "./release-type"; + +type Params = Options & { oldVersion: string }; +type VersionAndReleaseType = [string, ReleaseType?]; /** * Returns the new version number, possibly by prompting the user for it. * - * @param oldVersion - The old (current) version number - * @param version - The new version number, or a VersionBumpType - * @param preid - Optional prerelease identifier (e.g. "alpha", "beta", etc.) + * @returns - A tuple containing the new version number and the release type (if any) */ -export async function getNewVersion(oldVersion: string, newVersion: string, preid?: string): Promise { - if (newVersion === VersionBumpType.Prompt) { - return ""; +export async function getNewVersion(params: Params): Promise { + let { release } = params; + + if (release === "prompt") { + return promptForNewVersion(params); } - else if (isVersionBumpType(newVersion)) { - let oldSemVer = new SemVer(oldVersion); - let newSemVer = oldSemVer.inc(newVersion as ReleaseType, preid); - return newSemVer.version; + else if (isReleaseType(release)) { + return [getNextVersion(params), release]; } else { - let newSemVer = new SemVer(newVersion, true); - return newSemVer.version; + let newSemVer = new SemVer(release.version, true); + return [newSemVer.version]; + } +} + +/** + * Returns the next version number of the specified type. + */ +function getNextVersion({ oldVersion, release, preid }: Params): string { + let oldSemVer = new SemVer(oldVersion); + let newSemVer = oldSemVer.inc(release as ReleaseType, preid); + + if ( + isPrerelease(release) && + newSemVer.prerelease.length === 2 && + newSemVer.prerelease[0] === preid && + String(newSemVer.prerelease[1]) === "0" + ) { + // This is a special case when going from a non-prerelease version to a prerelease version. + // SemVer sets the prerelease version to zero (e.g. "1.23.456" => "1.23.456-beta.0"). + // But the user probably expected it to be "1.23.456-beta.1" instead. + newSemVer.prerelease[1] = "1"; + newSemVer.format(); + } + + return newSemVer.version; +} + +/** + * Returns the next version number for all release types. + */ +function getNextVersions(params: Params): Record { + let next: Record = {}; + + for (let release of releaseTypes) { + next[release] = getNextVersion({ ...params, release }); + } + + return next; +} + +/** + * Prompts the user for the new version number. + * + * @returns - A tuple containing the new version number and the release type (if any) + */ +async function promptForNewVersion(params: Params): Promise { + let { oldVersion, interface: ui } = params; + let next = getNextVersions(params); + let prompts = inquirer.createPromptModule(ui as inquirer.StreamOptions); + + let answers: { + release: ReleaseType | "none" | "custom"; + newVersion?: string; + }; + + answers = await prompts([ + { + type: "list", + name: "release", + message: `\nThe current version is ${oldVersion}\nHow would you like to bump it?`, + default: "patch", + pageSize: 10, + choices: [ + { value: "major", name: `major (${next.major})` }, + { value: "minor", name: `minor (${next.minor})` }, + { value: "patch", name: `patch (${next.patch})` }, + { value: "premajor", name: `pre-release major (${next.premajor})` }, + { value: "preminor", name: `pre-release minor (${next.preminor})` }, + { value: "prepatch", name: `pre-release patch (${next.prepatch})` }, + { value: "prerelease", name: `pre-release (${next.prerelease})` }, + new inquirer.Separator(), + { value: "none", name: `leave as-is (${oldVersion})`}, + { value: "custom", name: "custom..." }, + ] + }, + { + type: "input", + name: "newVersion", + message: "Enter the new version number:", + default: oldVersion, + when: ({ release }) => release === "custom", + filter: semver.clean, + validate: (newVersion: string) => { + return semver.valid(newVersion) ? true : "That's not a valid version number"; + }, + } + ]); + + switch (answers.release) { + case "none": + return [oldVersion]; + + case "custom": + return [answers.newVersion!]; + + default: + return [next[answers.release], answers.release]; } } diff --git a/src/version-bump.ts b/src/version-bump.ts index 29f474f..78b6b0c 100644 --- a/src/version-bump.ts +++ b/src/version-bump.ts @@ -1,4 +1,3 @@ -import { ReleaseType } from "semver"; import { getNewVersion } from "./get-new-version"; import { getOldVersion } from "./get-old-version"; import { Options } from "./options"; @@ -37,7 +36,7 @@ export async function versionBump(arg: VersionBumpOptions | string = {}): Promis let options = new Options(arg); let oldVersion = await getOldVersion(options); - let newVersion = await getNewVersion({ ...options, oldVersion }); + let [newVersion, release] = await getNewVersion({ ...options, oldVersion }); if (options.commit) { options.commit.message += newVersion; @@ -48,7 +47,7 @@ export async function versionBump(arg: VersionBumpOptions | string = {}): Promis } return { - release: typeof options.release === "string" ? options.release as ReleaseType : undefined, + release, oldVersion, newVersion, commit: options.commit ? options.commit.message : false, From c9b6b39f49f415da430ba612568e54e2c5f2cf0e Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 2 Jan 2019 07:57:52 -0600 Subject: [PATCH 023/106] Enhanced the "fs" module to include file metadata --- package-lock.json | 17 ++++++++++ package.json | 3 ++ src/fs.ts | 76 +++++++++++++++++++++++++++++++++++++----- src/get-old-version.ts | 12 +++---- 4 files changed, 92 insertions(+), 16 deletions(-) diff --git a/package-lock.json b/package-lock.json index a682900..9df6825 100644 --- a/package-lock.json +++ b/package-lock.json @@ -131,6 +131,18 @@ "integrity": "sha512-4eOPXyn5DmP64MCMF8ePDvdlvlzt2a+F8ZaVjqmh2yFCpGjc1kI3kGnCFYX9SCsGTjQcWIyVZ86IHCEyjy/MNg==", "dev": true }, + "@types/detect-indent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/detect-indent/-/detect-indent-5.0.0.tgz", + "integrity": "sha512-eOFBOFCqusnH0i1s9XoURksqTZbsv5vbMMgOBKgSt67TsOw6ViaHO0Ii5DMhRoiU5TJ51uf9NsOpnxXsN96ywg==", + "dev": true + }, + "@types/detect-newline": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/detect-newline/-/detect-newline-2.1.0.tgz", + "integrity": "sha512-vcHS4yQkTfy+8QISuAFS+2SCjNcGs37+CWzxrrIOMv7yvPnYd6f1AeUErVEHVCu8dZreAHUqzV8RrjzeBorvtQ==", + "dev": true + }, "@types/inquirer": { "version": "0.0.43", "resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-0.0.43.tgz", @@ -1220,6 +1232,11 @@ "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-5.0.0.tgz", "integrity": "sha1-OHHMCmoALow+Wzz38zYmRnXwa50=" }, + "detect-newline": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-2.1.0.tgz", + "integrity": "sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I=" + }, "diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", diff --git a/package.json b/package.json index dcf6a3b..953fd97 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,8 @@ "devDependencies": { "@types/chai": "^4.1.7", "@types/command-line-args": "^5.0.0", + "@types/detect-indent": "^5.0.0", + "@types/detect-newline": "^2.1.0", "@types/inquirer": "0.0.43", "@types/mocha": "^5.2.5", "@types/node": "^10.12.18", @@ -74,6 +76,7 @@ "chalk": "^2.4.1", "command-line-args": "^5.0.2", "detect-indent": "^5.0.0", + "detect-newline": "^2.1.0", "ez-spawn": "^2.1.1", "glob": "^7.1.3", "inquirer": "^6.2.1", diff --git a/src/fs.ts b/src/fs.ts index b612d51..1c6ff46 100644 --- a/src/fs.ts +++ b/src/fs.ts @@ -1,28 +1,86 @@ +import * as detectIndent from "detect-indent"; +import * as detectNewline from "detect-newline"; import * as fs from "fs"; +import * as path from "path"; + +/** + * Describes a plain-text file. + */ +export interface TextFile { + path: string; + data: string; +} + +/** + * Describes a JSON file. + */ +interface JsonFile { + path: string; + data: unknown; + indent: string; + newline: string | null; +} + +/** + * Reads a JSON file and returns the parsed data. + */ +export async function readJsonFile(name: string, cwd: string): Promise { + let file = await readTextFile(name, cwd); + let data = JSON.parse(file.data) as unknown; + let indent = detectIndent(file.data).indent; + let newline = detectNewline(file.data); + + return { ...file, data, indent, newline }; +} + +/** + * Writes the given data to the specified JSON file. + */ +export async function writeJsonFile(file: JsonFile): Promise { + let json = JSON.stringify(file.data, undefined, file.indent); + + if (file.newline) { + json += file.newline; + } + + return writeTextFile({ ...file, data: json }); +} /** * Reads a text file and returns its contents. */ -export function readTextFile(file: string): Promise { // tslint:disable-line: promise-function-async +export function readTextFile(name: string, cwd: string): Promise { // tslint:disable-line: promise-function-async return new Promise((resolve, reject) => { + let filePath = path.join(cwd, name); + // tslint:disable-next-line ban - fs.readFile(file, "utf8", (err, text) => { + fs.readFile(filePath, "utf8", (err, text) => { if (err) { reject(err); } else { - resolve(text); + resolve({ + path: filePath, + data: text, + }); } }); }); } /** - * Reads a JSON file and returns the parsed data. + * Writes the given text to the specified file. */ -export async function readJsonFile(file: string): Promise { - let json = await readTextFile(file); - let pojo = JSON.parse(json) as unknown; - - return pojo; +export function writeTextFile(file: TextFile): Promise { // tslint:disable-line: promise-function-async + return new Promise((resolve, reject) => { + // tslint:disable-next-line ban + fs.writeFile(file.path, file.data, (err) => { + if (err) { + reject(err); + } + else { + resolve(); + } + }); + }); } diff --git a/src/get-old-version.ts b/src/get-old-version.ts index a0d6996..378342f 100644 --- a/src/get-old-version.ts +++ b/src/get-old-version.ts @@ -1,4 +1,3 @@ -import * as path from "path"; import * as semver from "semver"; import { Manifest } from "./cli/manifest"; import { readJsonFile } from "./fs"; @@ -19,8 +18,7 @@ export async function getOldVersion({ files, cwd }: Options): Promise { // Check each file, in order, and return the first valid version number we find for (let file of filesToCheck) { - file = path.join(cwd, file); - let version = await readVersion(file); + let version = await readVersion(file, cwd); if (version) { return version; @@ -38,12 +36,12 @@ export async function getOldVersion({ files, cwd }: Options): Promise { * * @returns - The version number, or undefined if the file doesn't have a version number */ -async function readVersion(file: string): Promise { +async function readVersion(file: string, cwd: string): Promise { try { - let pojo = await readJsonFile(file); + let { data } = await readJsonFile(file, cwd); - if (typeof pojo === "object" && pojo !== null && "version" in pojo) { - let manifest = pojo as Manifest; + if (typeof data === "object" && data !== null && "version" in data) { + let manifest = data as Manifest; if (semver.valid(manifest.version)) { return manifest.version; } From 39b1ca0034bfc05dc7c13c2cdc03780bc75a70e6 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 2 Jan 2019 08:28:45 -0600 Subject: [PATCH 024/106] Moved the "manifest.ts" file up a directory so it can be reused in both the lib and the cli --- src/cli/help.ts | 2 +- src/cli/index.ts | 2 +- src/get-old-version.ts | 7 +++---- src/{cli => }/manifest.ts | 21 ++++++++++++++++----- 4 files changed, 21 insertions(+), 11 deletions(-) rename src/{cli => }/manifest.ts (53%) diff --git a/src/cli/help.ts b/src/cli/help.ts index 94af458..d05bf2f 100644 --- a/src/cli/help.ts +++ b/src/cli/help.ts @@ -1,4 +1,4 @@ -import { manifest } from "./manifest"; +import { manifest } from "../manifest"; /** * The CLI help text diff --git a/src/cli/index.ts b/src/cli/index.ts index 7cddec7..c753127 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -1,8 +1,8 @@ // tslint:disable: no-console +import { manifest } from "../manifest"; import { versionBump } from "../version-bump"; import { VersionBumpOptions } from "../version-bump-options"; import { helpText } from "./help"; -import { manifest } from "./manifest"; import { parseArgs } from "./parse-args"; enum ExitCode { diff --git a/src/get-old-version.ts b/src/get-old-version.ts index 378342f..a110649 100644 --- a/src/get-old-version.ts +++ b/src/get-old-version.ts @@ -1,6 +1,6 @@ import * as semver from "semver"; -import { Manifest } from "./cli/manifest"; import { readJsonFile } from "./fs"; +import { isManifest } from "./manifest"; import { Options } from "./options"; /** @@ -38,10 +38,9 @@ export async function getOldVersion({ files, cwd }: Options): Promise { */ async function readVersion(file: string, cwd: string): Promise { try { - let { data } = await readJsonFile(file, cwd); + let { data: manifest } = await readJsonFile(file, cwd); - if (typeof data === "object" && data !== null && "version" in data) { - let manifest = data as Manifest; + if (isManifest(manifest)) { if (semver.valid(manifest.version)) { return manifest.version; } diff --git a/src/cli/manifest.ts b/src/manifest.ts similarity index 53% rename from src/cli/manifest.ts rename to src/manifest.ts index 8958715..8d9ab56 100644 --- a/src/cli/manifest.ts +++ b/src/manifest.ts @@ -1,10 +1,10 @@ // NOTE: We can't `import` the package.json file because it's outside of the "src" directory. // tslint:disable-next-line: no-var-requires no-require-imports -const manifest = require("../../package.json") as Manifest; +const manifest = require("../package.json") as Manifest; // Don't use the npm package name ("version-bump-prompt"). // Use the name of the binary ("bump") instead. -let name = Object.keys(manifest.bin)[0]; +let name = Object.keys(manifest.bin!)[0]; const alteredManifest: Manifest = { ...manifest, name }; export { alteredManifest as manifest }; @@ -12,9 +12,20 @@ export { alteredManifest as manifest }; * The npm package manifest (package.json) */ export interface Manifest { - name: string; + name?: string; version: string; - description: string; - bin: Record; + description?: string; + bin?: Record; [key: string]: unknown; } + +// tslint:disable: no-any no-unsafe-any + +/** + * Determines whether the specified object is a package manifest. + */ +export function isManifest (obj: any): obj is Manifest { + return obj && + typeof obj === "object" && + typeof obj.version === "string"; +} From 3f0593cf0ec7406b838a0a8fc3cb6221732dd6fc Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 2 Jan 2019 08:29:12 -0600 Subject: [PATCH 025/106] Started implementing the logic to update the files (WIP) --- src/update-files.ts | 84 +++++++++++++++++++++++++++++++++++++++++++++ src/version-bump.ts | 4 ++- 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 src/update-files.ts diff --git a/src/update-files.ts b/src/update-files.ts new file mode 100644 index 0000000..d1bc1ad --- /dev/null +++ b/src/update-files.ts @@ -0,0 +1,84 @@ +import * as path from "path"; +import { readJsonFile, readTextFile } from "./fs"; +import { isManifest } from "./manifest"; +import { Options } from "./options"; + +type Params = Options & { oldVersion: string; newVersion: string }; +type FileParams = Params & { name: string }; + +/** + * Updates the version number in the specified files. + * + * @returns - The files that were actually modified + */ +export async function updateFiles(params: Params): Promise { + let { files } = params; + let modifiedFiles = []; + + for (let name of files) { + let modified = await updateFile({ ...params, name }); + + if (modified) { + modifiedFiles.push(name); + } + } + + return modifiedFiles; +} + +/** + * Updates the version number in the specified file. + * + * @returns - `true` if the file was actually modified + */ +async function updateFile(params: FileParams): Promise { + let { name } = params; + name = path.basename(name).trim().toLowerCase(); + + switch (name) { + case "package.json": + case "package-lock.json": + case "bower.json": + case "component.json": + return updateManifestFile(params); + + default: + return updateTextFile(params); + } +} + +/** + * Updates the version number in the specified JSON manifest file. + * + * @returns - `true` if the file was actually modified + */ +async function updateManifestFile(params: FileParams): Promise { + let { name, cwd, oldVersion, newVersion } = params; + + let file = await readJsonFile(name, cwd); + + if (isManifest(file.data)) { + // TODO: Update the file + return true; + } + + return false; +} + +/** + * Updates all occurrences of the version number in the specified text file. + * + * @returns - `true` if the file was actually modified + */ +async function updateTextFile(params: FileParams): Promise { + let { name, cwd, oldVersion, newVersion } = params; + + let file = await readTextFile(name, cwd); + + if (isManifest(file.data)) { + // TODO: Update the file + return true; + } + + return false; +} diff --git a/src/version-bump.ts b/src/version-bump.ts index 78b6b0c..486fd0c 100644 --- a/src/version-bump.ts +++ b/src/version-bump.ts @@ -1,6 +1,7 @@ import { getNewVersion } from "./get-new-version"; import { getOldVersion } from "./get-old-version"; import { Options } from "./options"; +import { updateFiles } from "./update-files"; import { VersionBumpOptions } from "./version-bump-options"; import { VersionBumpResults } from "./version-bump-results"; @@ -37,6 +38,7 @@ export async function versionBump(arg: VersionBumpOptions | string = {}): Promis let options = new Options(arg); let oldVersion = await getOldVersion(options); let [newVersion, release] = await getNewVersion({ ...options, oldVersion }); + let files = await updateFiles({ ...options, oldVersion, newVersion }); if (options.commit) { options.commit.message += newVersion; @@ -52,6 +54,6 @@ export async function versionBump(arg: VersionBumpOptions | string = {}): Promis newVersion, commit: options.commit ? options.commit.message : false, tag: options.tag ? options.tag.name : false, - files: options.files, + files, }; } From b12dae91aa792485779a4cba46d3463ba76d322c Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 2 Jan 2019 08:44:36 -0600 Subject: [PATCH 026/106] Updated dev dependencies --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9df6825..54a3d2e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4941,9 +4941,9 @@ } }, "tslint-modular": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/tslint-modular/-/tslint-modular-1.1.1.tgz", - "integrity": "sha512-fYZ9CzVIWnkBbVJVzLQ16p/dzx3COopwHKcsXCaOE6YGhlf7cy8Mq4+QiT5xDQWokOHKtYW/pf/wb9FAjd5B0g==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/tslint-modular/-/tslint-modular-1.1.2.tgz", + "integrity": "sha512-aUA+uEO0Q7R09gec/niTDByA/BHeBs/t3NmXh22RwzDE2sjd9V4/rAkVP+cGJA8LipUiYSzlquJuUuewt6iztg==", "dev": true }, "tsutils": { diff --git a/package.json b/package.json index 953fd97..7011e9a 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "nyc": "^13.1.0", "strip-ansi": "^5.0.0", "tslint": "^5.12.0", - "tslint-modular": "^1.1.1", + "tslint-modular": "^1.1.2", "typescript": "^3.2.2", "typescript-tslint-plugin": "^0.2.1" }, From 7d257510d5cc40e563abc2eb3b4be4392d3a1ca2 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 2 Jan 2019 08:45:59 -0600 Subject: [PATCH 027/106] TSLint fix --- src/manifest.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/manifest.ts b/src/manifest.ts index 8d9ab56..98d5943 100644 --- a/src/manifest.ts +++ b/src/manifest.ts @@ -24,7 +24,7 @@ export interface Manifest { /** * Determines whether the specified object is a package manifest. */ -export function isManifest (obj: any): obj is Manifest { +export function isManifest(obj: any): obj is Manifest { return obj && typeof obj === "object" && typeof obj.version === "string"; From fba3d77c2509a9cf3e28d42cf577b758614f2de8 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Thu, 3 Jan 2019 05:43:36 -0600 Subject: [PATCH 028/106] Made the "clean .tmp directory" hook async --- test/fixtures/clean-temp-dir.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/fixtures/clean-temp-dir.js b/test/fixtures/clean-temp-dir.js index cac8d59..acaaecb 100644 --- a/test/fixtures/clean-temp-dir.js +++ b/test/fixtures/clean-temp-dir.js @@ -6,10 +6,12 @@ const del = require("del"); /** * Clean the .tmp directory before each test */ -beforeEach(() => { +beforeEach("clean the .tmp directory", async () => { // Delete the .tmp directory, if it exists - del.sync("test/.tmp"); + await del("test/.tmp"); // Re-create the .tmp directory - fs.mkdirSync("test/.tmp"); + await new Promise((resolve, reject) => { + fs.mkdir("test/.tmp", (err) => err ? reject(err) : resolve()); + }); }); From 45e7f7994b2c4c9645b1f3bf36c98714fccd9c8d Mon Sep 17 00:00:00 2001 From: James Messinger Date: Thu, 3 Jan 2019 05:54:34 -0600 Subject: [PATCH 029/106] Added logic to expand globs into files --- package-lock.json | 1160 +++++++++++++++++++++++++++++++++++++++++-- package.json | 4 +- src/cli/help.ts | 2 +- src/options.ts | 83 ++-- src/version-bump.ts | 2 +- 5 files changed, 1182 insertions(+), 69 deletions(-) diff --git a/package-lock.json b/package-lock.json index 54a3d2e..9139d69 100644 --- a/package-lock.json +++ b/package-lock.json @@ -119,6 +119,20 @@ } } }, + "@mrmlnc/readdir-enhanced": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", + "integrity": "sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==", + "requires": { + "call-me-maybe": "^1.0.1", + "glob-to-regexp": "^0.3.0" + } + }, + "@nodelib/fs.stat": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz", + "integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==" + }, "@types/chai": { "version": "4.1.7", "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.1.7.tgz", @@ -143,6 +157,33 @@ "integrity": "sha512-vcHS4yQkTfy+8QISuAFS+2SCjNcGs37+CWzxrrIOMv7yvPnYd6f1AeUErVEHVCu8dZreAHUqzV8RrjzeBorvtQ==", "dev": true }, + "@types/events": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@types/events/-/events-1.2.0.tgz", + "integrity": "sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA==", + "dev": true + }, + "@types/glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", + "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", + "dev": true, + "requires": { + "@types/events": "*", + "@types/minimatch": "*", + "@types/node": "*" + } + }, + "@types/globby": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@types/globby/-/globby-8.0.0.tgz", + "integrity": "sha512-xDtsX5tlctxJzvg29r/LN12z30oJpoFP9cE8eJ8nY5cbSvN0c0RdRHrVlEq4LRh362Sd+JsqxJ3QWw0Wnyto8w==", + "dev": true, + "requires": { + "@types/glob": "*", + "fast-glob": "^2.0.2" + } + }, "@types/inquirer": { "version": "0.0.43", "resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-0.0.43.tgz", @@ -153,6 +194,12 @@ "@types/through": "*" } }, + "@types/minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", + "dev": true + }, "@types/mocha": { "version": "5.2.5", "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.5.tgz", @@ -375,6 +422,21 @@ "find-replace": "^2.0.1" } }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=" + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==" + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=" + }, "array-back": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/array-back/-/array-back-2.0.0.tgz", @@ -393,7 +455,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", - "dev": true, "requires": { "array-uniq": "^1.0.1" } @@ -401,14 +462,17 @@ "array-uniq": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", - "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", - "dev": true + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=" + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=" }, "arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", - "dev": true + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=" }, "asn1": { "version": "0.2.4", @@ -431,6 +495,11 @@ "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=" + }, "astral-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", @@ -443,6 +512,11 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", "dev": true }, + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==" + }, "aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", @@ -596,6 +670,56 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz", "integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=" }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, "bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", @@ -630,6 +754,33 @@ "concat-map": "0.0.1" } }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, "browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", @@ -642,6 +793,22 @@ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + } + }, "call-me-maybe": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", @@ -816,6 +983,27 @@ "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", "dev": true }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, "cli-boxes": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-1.0.0.tgz", @@ -853,6 +1041,15 @@ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -893,6 +1090,11 @@ "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==", "dev": true }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -912,6 +1114,11 @@ "xdg-basedir": "^3.0.0" } }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=" + }, "core-js": { "version": "2.5.7", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", @@ -1008,6 +1215,11 @@ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, "deep-eql": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", @@ -1029,6 +1241,43 @@ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, "del": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz", @@ -1041,6 +1290,29 @@ "p-map": "^1.1.1", "pify": "^3.0.0", "rimraf": "^2.2.8" + }, + "dependencies": { + "globby": { + "version": "6.1.0", + "resolved": "http://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", + "dev": true, + "requires": { + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + } } }, "delayed-stream": { @@ -1243,6 +1515,25 @@ "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true }, + "dir-glob": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.0.0.tgz", + "integrity": "sha512-37qirFDz8cA5fimp9feo43fSuRo2gHwaIn6dXL8Ber1dGwUosDrGZeCCXq57WnIqE4aQ+u3eQZzsk1yOzhdwag==", + "requires": { + "arrify": "^1.0.1", + "path-type": "^3.0.0" + }, + "dependencies": { + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "requires": { + "pify": "^3.0.0" + } + } + } + }, "doctrine": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", @@ -1492,6 +1783,51 @@ "integrity": "sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g=", "dev": true }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, "expand-tilde": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", @@ -1507,6 +1843,25 @@ "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "dev": true }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, "external-editor": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz", @@ -1517,6 +1872,65 @@ "tmp": "^0.0.33" } }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, "extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", @@ -1540,6 +1954,19 @@ "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", "dev": true }, + "fast-glob": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.4.tgz", + "integrity": "sha512-FjK2nCGI/McyzgNtTESqaWP3trPvHyRyoyY70hxjc3oKPNmDe8taohLZpoVKoUjW85tbU5txaYUZCNtVzygl1g==", + "requires": { + "@mrmlnc/readdir-enhanced": "^2.2.1", + "@nodelib/fs.stat": "^1.1.2", + "glob-parent": "^3.1.0", + "is-glob": "^4.0.0", + "merge2": "^1.2.3", + "micromatch": "^3.1.10" + } + }, "fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", @@ -1570,6 +1997,27 @@ "object-assign": "^4.0.1" } }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, "find-replace": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-2.0.1.tgz", @@ -1591,6 +2039,11 @@ "write": "^0.2.1" } }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=" + }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -1619,6 +2072,14 @@ } } }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "requires": { + "map-cache": "^0.2.2" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -1654,6 +2115,11 @@ "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", "dev": true }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=" + }, "getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", @@ -1682,6 +2148,30 @@ "path-is-absolute": "^1.0.0" } }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "requires": { + "is-extglob": "^2.1.0" + } + } + } + }, + "glob-to-regexp": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz", + "integrity": "sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=" + }, "global-dirs": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", @@ -1722,23 +2212,23 @@ "dev": true }, "globby": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", - "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", - "dev": true, + "version": "8.0.1", + "resolved": "http://registry.npmjs.org/globby/-/globby-8.0.1.tgz", + "integrity": "sha512-oMrYrJERnKBLXNLVTqhm3vPEdJ/b2ZE28xN4YARiix1NOIOBPEpOUnm844K1iu/BkphCaf2WNFwMszv8Soi1pw==", "requires": { "array-union": "^1.0.1", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" + "dir-glob": "^2.0.0", + "fast-glob": "^2.0.2", + "glob": "^7.1.2", + "ignore": "^3.3.5", + "pify": "^3.0.0", + "slash": "^1.0.0" }, "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true + "ignore": { + "version": "3.3.10", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", + "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==" } } }, @@ -1812,6 +2302,35 @@ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", @@ -1947,12 +2466,35 @@ "loose-envify": "^1.0.0" } }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "http://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", "dev": true }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, "is-builtin-module": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", @@ -1962,13 +2504,48 @@ "builtin-modules": "^1.0.0" } }, - "is-ci": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.2.1.tgz", - "integrity": "sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg==", - "dev": true, + "is-ci": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.2.1.tgz", + "integrity": "sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg==", + "dev": true, + "requires": { + "ci-info": "^1.5.0" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "http://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", "requires": { - "ci-info": "^1.5.0" + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" + } } }, "is-es2016-keyword": { @@ -1977,6 +2554,16 @@ "integrity": "sha1-9uVOEQxeT40mXmnS7Q6vjPX0dxg=", "dev": true }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=" + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" + }, "is-finite": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", @@ -1991,6 +2578,14 @@ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" }, + "is-glob": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", + "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", + "requires": { + "is-extglob": "^2.1.1" + } + }, "is-installed-globally": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.1.0.tgz", @@ -2007,6 +2602,24 @@ "integrity": "sha1-8vtjpl5JBbQGyGBydloaTceTufQ=", "dev": true }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, "is-obj": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", @@ -2037,6 +2650,14 @@ "path-is-inside": "^1.0.1" } }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "requires": { + "isobject": "^3.0.1" + } + }, "is-promise": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", @@ -2075,14 +2696,23 @@ "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", - "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", - "dev": true + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -2175,6 +2805,11 @@ "verror": "1.10.0" } }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" + }, "latest-version": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-3.1.0.tgz", @@ -2314,12 +2949,25 @@ "pify": "^3.0.0" } }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=" + }, "map-obj": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", "dev": true }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "requires": { + "object-visit": "^1.0.0" + } + }, "meow": { "version": "3.7.0", "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", @@ -2410,6 +3058,31 @@ } } }, + "merge2": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.2.3.tgz", + "integrity": "sha512-gdUU1Fwj5ep4kplwcmftruWofEFt6lfpkkr3h860CXbAB9c3hGb55EOL2ali0Td5oebvW0E1+3Sr+Ur7XfKpRA==" + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, "mime-db": { "version": "1.36.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", @@ -2444,6 +3117,25 @@ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true }, + "mixin-deep": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", + "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", @@ -2547,6 +3239,24 @@ "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=" }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + } + }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -3954,6 +4664,50 @@ "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "requires": { + "isobject": "^3.0.0" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "requires": { + "isobject": "^3.0.1" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -4107,6 +4861,16 @@ "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=", "dev": true }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=" + }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=" + }, "path-exists": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", @@ -4170,8 +4934,7 @@ "pify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" }, "pinkie": { "version": "2.0.4", @@ -4215,6 +4978,11 @@ "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", "dev": true }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=" + }, "preferred-pm": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/preferred-pm/-/preferred-pm-1.0.1.tgz", @@ -4403,6 +5171,15 @@ "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", "dev": true }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, "regexpp": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", @@ -4434,6 +5211,16 @@ "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", "dev": true }, + "repeat-element": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==" + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" + }, "repeating": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", @@ -4524,6 +5311,11 @@ "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", "dev": true }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=" + }, "restore-cursor": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", @@ -4533,6 +5325,11 @@ "signal-exit": "^3.0.2" } }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==" + }, "rimraf": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", @@ -4570,6 +5367,14 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, + "safe-regex": { + "version": "1.1.0", + "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "requires": { + "ret": "~0.1.10" + } + }, "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -4595,6 +5400,27 @@ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true }, + "set-value": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", @@ -4613,6 +5439,11 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" }, + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=" + }, "slice-ansi": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.0.0.tgz", @@ -4624,11 +5455,137 @@ "is-fullwidth-code-point": "^2.0.0" } }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "requires": { + "kind-of": "^3.2.0" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + }, + "source-map-resolve": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "requires": { + "atob": "^2.1.1", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=" }, "spdx-correct": { "version": "3.0.1", @@ -4662,6 +5619,14 @@ "integrity": "sha512-TfOfPcYGBB5sDuPn3deByxPhmfegAhpDYKSOXZQN81Oyrrif8ZCodOLzK3AesELnCx03kikhyDwh0pfvvQvF8w==", "dev": true }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "requires": { + "extend-shallow": "^3.0.0" + } + }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -4691,6 +5656,25 @@ "integrity": "sha1-M6qE8Rd6VUjIk1Uzy/6zQgl19aQ=", "dev": true }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, "string-argv": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.1.1.tgz", @@ -4893,6 +5877,44 @@ "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", "dev": true }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + }, "tough-cookie": { "version": "2.4.3", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", @@ -5007,6 +6029,38 @@ "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=" }, + "union-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^0.4.3" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + }, + "set-value": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.1", + "to-object-path": "^0.3.0" + } + } + } + }, "unique-string": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz", @@ -5016,6 +6070,42 @@ "crypto-random-string": "^1.0.0" } }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=" + } + } + }, "unzip-response": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-2.0.1.tgz", @@ -5057,6 +6147,11 @@ } } }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=" + }, "url-parse-lax": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", @@ -5066,6 +6161,11 @@ "prepend-http": "^1.0.1" } }, + "use": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==" + }, "uuid": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", diff --git a/package.json b/package.json index 7011e9a..6f4a400 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "@types/command-line-args": "^5.0.0", "@types/detect-indent": "^5.0.0", "@types/detect-newline": "^2.1.0", + "@types/globby": "^8.0.0", "@types/inquirer": "0.0.43", "@types/mocha": "^5.2.5", "@types/node": "^10.12.18", @@ -73,12 +74,11 @@ "typescript-tslint-plugin": "^0.2.1" }, "dependencies": { - "chalk": "^2.4.1", "command-line-args": "^5.0.2", "detect-indent": "^5.0.0", "detect-newline": "^2.1.0", "ez-spawn": "^2.1.1", - "glob": "^7.1.3", + "globby": "^8.0.1", "inquirer": "^6.2.1", "log-symbols": "^2.2.0", "semver": "^5.6.0" diff --git a/src/cli/help.ts b/src/cli/help.ts index d05bf2f..445c51b 100644 --- a/src/cli/help.ts +++ b/src/cli/help.ts @@ -40,7 +40,7 @@ options: -h, --help Show usage information files... - One or more files and/or globs to bump (ex: README.md *.txt). + One or more files and/or globs to bump (ex: README.md *.txt docs/**/*). Defaults to package.json and package-lock.json. Examples: diff --git a/src/options.ts b/src/options.ts index 2956f5d..8bf4ef7 100644 --- a/src/options.ts +++ b/src/options.ts @@ -1,3 +1,4 @@ +import * as globby from "globby"; import { ReadLineOptions } from "readline"; import { isReleaseType, ReleaseType } from "./release-type"; import { VersionBumpOptions } from "./version-bump-options"; @@ -6,71 +7,83 @@ interface Interface extends ReadLineOptions { output: NodeJS.WritableStream; } +type Release = "prompt" | ReleaseType | { version: string }; + /** * Normalized and sanitized options */ export class Options { - public release: "prompt" | ReleaseType | { version: string }; - public preid: string; + public release!: Release; + public preid!: string; public commit?: { message: string; }; public tag?: { name: string; }; - public push: boolean; - public all: boolean; - public files: string[]; - public cwd: string; - public interface: Interface; + public push!: boolean; + public all!: boolean; + public files!: string[]; + public cwd!: string; + public interface!: Interface; - public constructor(props: VersionBumpOptions) { - let { release, preid, commit, tag, push, all, files, cwd } = props; + private constructor(props: Readonly) { + Object.assign(this, props); + } + /** + * Converts raw VersionBumpOptions to a normalized and sanitized Options object. + */ + public static async normalize(raw: VersionBumpOptions): Promise { // Set the simple properties first - this.preid = typeof preid === "string" ? preid : "beta"; - this.push = Boolean(push); - this.all = Boolean(all); - this.cwd = cwd || process.cwd(); - this.interface = { + let preid = typeof raw.preid === "string" ? raw.preid : "beta"; + let push = Boolean(raw.push); + let all = Boolean(raw.all); + let cwd = raw.cwd || process.cwd(); + let ui = { input: process.stdin, output: process.stdout, - ...props.interface, + ...raw.interface, }; - // release - if (!release || release === "prompt") { - this.release = "prompt"; + let release: Release; + if (!raw.release || raw.release === "prompt") { + release = "prompt"; } - else if (isReleaseType(release)) { - this.release = release; + else if (isReleaseType(raw.release)) { + release = raw.release; } else { - this.release = { version: release }; + release = { version: raw.release }; } - // tag - if (typeof tag === "string") { - this.tag = { name: tag }; + let tag; + if (typeof raw.tag === "string") { + tag = { name: raw.tag }; } - else if (tag) { - this.tag = { name: "v" }; + else if (raw.tag) { + tag = { name: "v" }; } - // commit - This must come AFTER tag, because it relies on it - if (typeof commit === "string") { - this.commit = { message: commit }; + // NOTE: This must come AFTER `tag` and `push`, because it relies on them + let commit; + if (typeof raw.commit === "string") { + commit = { message: raw.commit }; } - else if (commit || this.tag || this.push) { - this.commit = { message: "release v" }; + else if (raw.commit || tag || push) { + commit = { message: "release v" }; } - // files - if (Array.isArray(files) && files.length > 0) { - this.files = files.slice(); + let files; + if (Array.isArray(raw.files) && raw.files.length > 0) { + files = await globby(raw.files, { cwd }); } else { - this.files = ["package.json", "package-lock.json"]; + files = ["package.json", "package-lock.json"]; } + + return new Options({ + release, preid, commit, tag, push, all, files, cwd, interface: ui + }); } } diff --git a/src/version-bump.ts b/src/version-bump.ts index 486fd0c..e08cf3d 100644 --- a/src/version-bump.ts +++ b/src/version-bump.ts @@ -35,7 +35,7 @@ export async function versionBump(arg: VersionBumpOptions | string = {}): Promis arg = { release: arg }; } - let options = new Options(arg); + let options = await Options.normalize(arg); let oldVersion = await getOldVersion(options); let [newVersion, release] = await getNewVersion({ ...options, oldVersion }); let files = await updateFiles({ ...options, oldVersion, newVersion }); From a775324b3cf33861b1229113d99212f23907c1c3 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Thu, 3 Jan 2019 07:49:36 -0600 Subject: [PATCH 030/106] Modified the `isManifest()` function to allow for missing or null keys --- src/get-new-version.ts | 2 +- src/get-old-version.ts | 2 +- src/manifest.ts | 21 ++++++++++++++++----- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/get-new-version.ts b/src/get-new-version.ts index 2ed8d24..758930a 100644 --- a/src/get-new-version.ts +++ b/src/get-new-version.ts @@ -94,7 +94,7 @@ async function promptForNewVersion(params: Params): Promise)[0]; const alteredManifest: Manifest = { ...manifest, name }; export { alteredManifest as manifest }; @@ -13,19 +13,30 @@ export { alteredManifest as manifest }; */ export interface Manifest { name?: string; - version: string; + version?: string; description?: string; - bin?: Record; [key: string]: unknown; } // tslint:disable: no-any no-unsafe-any /** - * Determines whether the specified object is a package manifest. + * Determines whether the specified value is a package manifest. */ export function isManifest(obj: any): obj is Manifest { return obj && typeof obj === "object" && - typeof obj.version === "string"; + isOptionalString(obj.name) && + isOptionalString(obj.version) && + isOptionalString(obj.description); +} + +/** + * Determines whether the specified value is a string, null, or undefined. + */ +function isOptionalString(value: any): value is string | null | undefined { + let type = typeof value; + return value === null || + type === "undefined" || + type === "string"; } From 9c23c33252f9b1830d9e97dfd8d63f8a32516ca3 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Thu, 3 Jan 2019 07:50:20 -0600 Subject: [PATCH 031/106] Finished implementing the `updateFiles()` logic --- src/update-files.ts | 56 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/src/update-files.ts b/src/update-files.ts index d1bc1ad..84f558a 100644 --- a/src/update-files.ts +++ b/src/update-files.ts @@ -1,5 +1,5 @@ import * as path from "path"; -import { readJsonFile, readTextFile } from "./fs"; +import { readJsonFile, readTextFile, writeJsonFile, writeTextFile } from "./fs"; import { isManifest } from "./manifest"; import { Options } from "./options"; @@ -50,19 +50,32 @@ async function updateFile(params: FileParams): Promise { /** * Updates the version number in the specified JSON manifest file. * + * NOTE: Unlike text files, this is NOT a global find-and-replace. It _specifically_ sets + * the top-level `version` property. + * * @returns - `true` if the file was actually modified */ async function updateManifestFile(params: FileParams): Promise { - let { name, cwd, oldVersion, newVersion } = params; + let { name, cwd, newVersion } = params; + let modified = false; - let file = await readJsonFile(name, cwd); + try { + let file = await readJsonFile(name, cwd); - if (isManifest(file.data)) { - // TODO: Update the file - return true; + if (isManifest(file.data) && file.data.version !== newVersion) { + file.data.version = newVersion; + await writeJsonFile(file); + modified = true; + } + } + catch (error) { + // Ignore nonexistent files + if ((error as NodeJS.ErrnoException).code !== "ENOENT") { + throw error; + } } - return false; + return modified; } /** @@ -72,13 +85,32 @@ async function updateManifestFile(params: FileParams): Promise { */ async function updateTextFile(params: FileParams): Promise { let { name, cwd, oldVersion, newVersion } = params; + let modified = false; + + try { + let file = await readTextFile(name, cwd); - let file = await readTextFile(name, cwd); + // Only update the file if it contains at least one occurrence of the old version + if (file.data.includes(oldVersion)) { + // Escape all non-alphanumeric characters in the version + let sanitizedVersion = oldVersion.replace(/(\W)/g, "\\$1"); - if (isManifest(file.data)) { - // TODO: Update the file - return true; + // Replace occurrences of the old version number that are surrounded by word boundaries. + // This ensures that it matches "1.23.456" or "v1.23.456", but not "321.23.456". + let replacePattern = new RegExp("(\\b|v)" + sanitizedVersion + "\\b", "g"); + + file.data = file.data.replace(replacePattern, "$1" + newVersion); + await writeTextFile(file); + + return true; + } + } + catch (error) { + // Ignore nonexistent files + if ((error as NodeJS.ErrnoException).code !== "ENOENT") { + throw error; + } } - return false; + return modified; } From 0a702ccf6995036aa2d86c2e1ba6e42d142ef32a Mon Sep 17 00:00:00 2001 From: James Messinger Date: Thu, 3 Jan 2019 07:50:43 -0600 Subject: [PATCH 032/106] Only print stack traces when DEBUG or NODE_ENV is set --- src/cli/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cli/index.ts b/src/cli/index.ts index c753127..9d72299 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -48,7 +48,13 @@ async function bump(options: VersionBumpOptions): Promise { console.log("\n\nRESULTS:", results, "\n\n"); } catch (error) { - console.error((error as Error).stack || (error as Error).message); + let message = (error as Error).message; + + if (process.env.DEBUG || process.env.NODE_ENV === "development") { + message = (error as Error).stack || message; + } + + console.error(message); process.exit(ExitCode.RuntimeError); } } From feeede2282187633c110c75c6d30975017ef9b5d Mon Sep 17 00:00:00 2001 From: James Messinger Date: Thu, 3 Jan 2019 08:16:54 -0600 Subject: [PATCH 033/106] Enhanced the `interface` option to support boolean values --- src/options.ts | 37 ++++++++++++++++++++++------- src/version-bump-options.ts | 46 +++++++++++++++++++++++++++++++++---- 2 files changed, 70 insertions(+), 13 deletions(-) diff --git a/src/options.ts b/src/options.ts index 8bf4ef7..5658616 100644 --- a/src/options.ts +++ b/src/options.ts @@ -1,10 +1,11 @@ import * as globby from "globby"; -import { ReadLineOptions } from "readline"; import { isReleaseType, ReleaseType } from "./release-type"; import { VersionBumpOptions } from "./version-bump-options"; -interface Interface extends ReadLineOptions { - output: NodeJS.WritableStream; +interface Interface { + input?: NodeJS.ReadableStream | NodeJS.ReadStream | false; + output?: NodeJS.WritableStream | NodeJS.WriteStream | false; + [key: string]: unknown; } type Release = "prompt" | ReleaseType | { version: string }; @@ -29,6 +30,10 @@ export class Options { private constructor(props: Readonly) { Object.assign(this, props); + + if (this.release === "prompt" && !(this.interface.input && this.interface)) { + throw new Error(`Cannot prompt for the version number because input or output has been disabled.`); + } } /** @@ -40,11 +45,6 @@ export class Options { let push = Boolean(raw.push); let all = Boolean(raw.all); let cwd = raw.cwd || process.cwd(); - let ui = { - input: process.stdin, - output: process.stdout, - ...raw.interface, - }; let release: Release; if (!raw.release || raw.release === "prompt") { @@ -82,6 +82,27 @@ export class Options { files = ["package.json", "package-lock.json"]; } + let ui: Interface; + if (raw.interface === false) { + ui = { input: false, outut: false }; + } + else if (raw.interface === true || !raw.interface) { + ui = { input: process.stdin, output: process.stdout }; + } + else { + let { input, output, ...other } = raw.interface; + + if (input === true || (input !== false && !input)) { + input = process.stdin; + } + + if (output === true || (output !== false && !input)) { + output = process.stdout; + } + + ui = { input, output, ...other }; + } + return new Options({ release, preid, commit, tag, push, all, files, cwd, interface: ui }); diff --git a/src/version-bump-options.ts b/src/version-bump-options.ts index 8325582..2fc0ce4 100644 --- a/src/version-bump-options.ts +++ b/src/version-bump-options.ts @@ -1,4 +1,3 @@ -import { ReadLineOptions } from "readline"; /** * Options for the `versionBump()` function. @@ -71,10 +70,47 @@ export interface VersionBumpOptions { cwd?: string; /** - * Options for the command-line interface. This object is passed to `readline.createInterface()`. + * Options for the command-line interface. Can be one of the following: * - * The `input` property defaults to `process.stdin`. - * The `output` property defaults to `process.stdout`. + * - `true` - To default to `process.stdin` and `process.stdout`. + * - `false` - To disable all CLI output. Cannot be used when `release` is "prompt". + * - An object that will be passed to `readline.createInterface()`. + * + * Defaults to `true`. + */ + interface?: boolean | InterfaceOptions; +} + +/** + * Options for the command-line interface. + */ +export interface InterfaceOptions { + /** + * The stream that will be used to read user input. Can be one of the following: + * + * - `true` - To default to `process.stdin` + * - `false` - To disable all CLI input + * - Any readable stream + * + * Defaults to `true`. + */ + input?: NodeJS.ReadableStream | NodeJS.ReadStream | boolean; + + /** + * The stream that will be used to write output, such as prompts and progress. + * Can be one of the following: + * + * - `true` - To default to `process.stdout` + * - `false` - To disable all CLI output + * - Any writable stream + * + * Defaults to `true`. + */ + output?: NodeJS.WritableStream | NodeJS.WriteStream | boolean; + + /** + * Any other properties will be passed directly to `readline.createInterface()`. + * See the `ReadLineOptions` interface for possible options. */ - interface?: Partial; + [key: string]: unknown; } From 6b276ca8a6a55e0f8d84e023e78b9ea2e4ddf08c Mon Sep 17 00:00:00 2001 From: James Messinger Date: Thu, 3 Jan 2019 08:18:41 -0600 Subject: [PATCH 034/106] Updated test fixtures --- test/fixtures/files/README.md | 3 ++- test/fixtures/files/script1.js | 3 +-- test/fixtures/files/script2.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/fixtures/files/README.md b/test/fixtures/files/README.md index 0b2ceb9..6599e93 100644 --- a/test/fixtures/files/README.md +++ b/test/fixtures/files/README.md @@ -1,3 +1,4 @@ -This file is for testing the `--grep` option. +This is a test to make sure that `version-bump-prompt` correctly updates plain-text files. +It does a global find-and-replace, so all occurrances of the old version number should be replaced with the new version, but any other version numbers should remain unchanged. If all goes well, version 1.2.3 and v1.2.3 should both get updated, but version 5.6.7 and v8.9.10 should not be changed. diff --git a/test/fixtures/files/script1.js b/test/fixtures/files/script1.js index 7afec07..d93bca3 100644 --- a/test/fixtures/files/script1.js +++ b/test/fixtures/files/script1.js @@ -2,8 +2,7 @@ (function () { "use strict"; - // This file is for testing the --grep option - // to make sure v1.2.3 gets replaced correctly + // Testing to make sure v1.2.3 gets replaced in code files let version = "1.2.3"; return version; diff --git a/test/fixtures/files/script2.js b/test/fixtures/files/script2.js index e243a70..480490a 100644 --- a/test/fixtures/files/script2.js +++ b/test/fixtures/files/script2.js @@ -1,4 +1,4 @@ "use strict"; -// This file should not get updated when the --grep option is used, -// because version 3.2.1 and v8.9.10 don't match the old version number +// This file should not get updated because version 3.2.1 +// and v8.9.10 don't match the old version number From d2ded3df575ba02654137581b49779b079e5a587 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Thu, 3 Jan 2019 08:21:19 -0600 Subject: [PATCH 035/106] Changed assertion syntax to provide better failure messages --- test/specs/cli.spec.js | 18 +++++----- test/specs/{grep.spec.js => files.spec.js} | 8 ++--- .../{commit.spec.js => git-commit.spec.js} | 10 +++--- test/specs/{push.spec.js => git-push.spec.js} | 8 ++--- test/specs/{tag.spec.js => git-tag.spec.js} | 10 +++--- test/specs/lock.spec.js | 34 ------------------- test/specs/major.spec.js | 10 +++--- test/specs/minor.spec.js | 14 ++++---- .../{version-hooks.spec.js => npm.spec.js} | 10 +++--- test/specs/patch.spec.js | 14 ++++---- test/specs/premajor.spec.js | 14 ++++---- test/specs/preminor.spec.js | 14 ++++---- test/specs/prepatch.spec.js | 14 ++++---- test/specs/prerelease.spec.js | 14 ++++---- 14 files changed, 79 insertions(+), 113 deletions(-) rename test/specs/{grep.spec.js => files.spec.js} (95%) rename test/specs/{commit.spec.js => git-commit.spec.js} (92%) rename test/specs/{push.spec.js => git-push.spec.js} (93%) rename test/specs/{tag.spec.js => git-tag.spec.js} (93%) delete mode 100644 test/specs/lock.spec.js rename test/specs/{version-hooks.spec.js => npm.spec.js} (95%) diff --git a/test/specs/cli.spec.js b/test/specs/cli.spec.js index e895814..a66fe67 100644 --- a/test/specs/cli.spec.js +++ b/test/specs/cli.spec.js @@ -13,7 +13,7 @@ describe("bump", () => { bump.signal.should.equal("SIGKILL"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.stdout.should.contain("PROMPT TEXT"); }); @@ -51,7 +51,7 @@ describe("bump", () => { let bump = chaiExec("--help"); bump.should.have.exitCode(0); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.stdout.should.match(/^\nUsage: bump \[version\] \[options\] \[files...\]\n/); bump.stdout.should.contain(manifest.description); }); @@ -60,7 +60,7 @@ describe("bump", () => { let bump = chaiExec("-h"); bump.should.have.exitCode(0); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.stdout.should.match(/^\nUsage: bump \[version\] \[options\] \[files...\]\n/); bump.stdout.should.contain(manifest.description); }); @@ -69,7 +69,7 @@ describe("bump", () => { let bump = chaiExec("--commit --help --tag"); bump.should.have.exitCode(0); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.stdout.should.match(/^\nUsage: bump \[version\] \[options\] \[files...\]\n/); bump.stdout.should.contain(manifest.description); }); @@ -78,7 +78,7 @@ describe("bump", () => { let bump = chaiExec("-cht"); bump.should.have.exitCode(0); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.stdout.should.match(/^\nUsage: bump \[version\] \[options\] \[files...\]\n/); bump.stdout.should.contain(manifest.description); }); @@ -89,7 +89,7 @@ describe("bump", () => { let bump = chaiExec("--version"); bump.should.have.exitCode(0); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.stdout(manifest.version + "\n"); }); @@ -97,7 +97,7 @@ describe("bump", () => { let bump = chaiExec("-v"); bump.should.have.exitCode(0); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.stdout(manifest.version + "\n"); }); @@ -105,7 +105,7 @@ describe("bump", () => { let bump = chaiExec("--commit --version --tag"); bump.should.have.exitCode(0); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.stdout(manifest.version + "\n"); }); @@ -113,7 +113,7 @@ describe("bump", () => { let bump = chaiExec("-cvt"); bump.should.have.exitCode(0); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.stdout(manifest.version + "\n"); }); }); diff --git a/test/specs/grep.spec.js b/test/specs/files.spec.js similarity index 95% rename from test/specs/grep.spec.js rename to test/specs/files.spec.js index a4cf3c3..f96d710 100644 --- a/test/specs/grep.spec.js +++ b/test/specs/files.spec.js @@ -4,7 +4,7 @@ const files = require("../fixtures/files"); const check = require("../fixtures/check"); const chaiExec = require("chai-exec"); -describe("bump --grep", () => { +describe("bump [files...]", () => { it("should replace the version number in non-manifest files", () => { files.create("package.json", { version: "1.2.3" }); @@ -15,7 +15,7 @@ describe("bump --grep", () => { let bump = chaiExec("--major --grep LICENSE README.* *.js"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -42,7 +42,7 @@ describe("bump --grep", () => { let bump = chaiExec("--major --grep LICENSE README.* *.js"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -65,7 +65,7 @@ describe("bump --grep", () => { let bump = chaiExec("--major --grep LICENSE README.* *.js"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( diff --git a/test/specs/commit.spec.js b/test/specs/git-commit.spec.js similarity index 92% rename from test/specs/commit.spec.js rename to test/specs/git-commit.spec.js index 688be73..aabcb8f 100644 --- a/test/specs/commit.spec.js +++ b/test/specs/git-commit.spec.js @@ -5,14 +5,14 @@ const files = require("../fixtures/files"); const check = require("../fixtures/check"); const chaiExec = require("chai-exec"); -describe("bump --commit", () => { +describe.skip("bump --commit", () => { it("should commit the manifest file to git", () => { files.create("package.json", { version: "1.0.0" }); let bump = chaiExec("--major --commit"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -33,7 +33,7 @@ describe("bump --commit", () => { let bump = chaiExec("--minor --commit"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -54,7 +54,7 @@ describe("bump --commit", () => { let bump = chaiExec("--minor --commit --all"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -73,7 +73,7 @@ describe("bump --commit", () => { let bump = chaiExec("--patch --all --commit my-message"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( diff --git a/test/specs/push.spec.js b/test/specs/git-push.spec.js similarity index 93% rename from test/specs/push.spec.js rename to test/specs/git-push.spec.js index d386794..d9d9a33 100644 --- a/test/specs/push.spec.js +++ b/test/specs/git-push.spec.js @@ -5,14 +5,14 @@ const files = require("../fixtures/files"); const check = require("../fixtures/check"); const chaiExec = require("chai-exec"); -describe("bump --push", () => { +describe.skip("bump --push", () => { it("should commit and push to git", () => { files.create("package.json", { version: "1.0.0" }); let bump = chaiExec("--major --push"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -33,7 +33,7 @@ describe("bump --push", () => { let bump = chaiExec("--minor --push --all"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -54,7 +54,7 @@ describe("bump --push", () => { let bump = chaiExec("--premajor --tag --push"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( diff --git a/test/specs/tag.spec.js b/test/specs/git-tag.spec.js similarity index 93% rename from test/specs/tag.spec.js rename to test/specs/git-tag.spec.js index f77f4f5..537b52a 100644 --- a/test/specs/tag.spec.js +++ b/test/specs/git-tag.spec.js @@ -5,14 +5,14 @@ const files = require("../fixtures/files"); const check = require("../fixtures/check"); const chaiExec = require("chai-exec"); -describe("bump --tag", () => { +describe.skip("bump --tag", () => { it("should add a git tag", () => { files.create("package.json", { version: "1.0.0" }); let bump = chaiExec("--major --commit --tag"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -33,7 +33,7 @@ describe("bump --tag", () => { let bump = chaiExec("--minor --tag"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -54,7 +54,7 @@ describe("bump --tag", () => { let bump = chaiExec("--patch --tag --all"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -76,7 +76,7 @@ describe("bump --tag", () => { let bump = chaiExec("--premajor --tag --push"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( diff --git a/test/specs/lock.spec.js b/test/specs/lock.spec.js deleted file mode 100644 index c64f570..0000000 --- a/test/specs/lock.spec.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; - -const files = require("../fixtures/files"); -const check = require("../fixtures/check"); -const chaiExec = require("chai-exec"); - -describe("bump --lock", () => { - it("should not increment lock file by default", () => { - files.create("package-lock.json", { version: "1.0.0" }); - - let bump = chaiExec("--patch"); - - bump.stderr.should.be.empty; - bump.stdout.should.be.empty; - bump.should.have.exitCode(0); - - files.json("package-lock.json").should.deep.equal({ version: "1.0.0" }); - }); - - it("should increment version when lock option is provided", () => { - files.create("package-lock.json", { version: "0.0.0" }); - - let bump = chaiExec("--patch --lock"); - - bump.stderr.should.be.empty; - bump.should.have.exitCode(0); - - bump.should.have.stdout( - `${check} Updated package-lock.json to 0.0.1\n` - ); - - files.json("package-lock.json").should.deep.equal({ version: "0.0.1" }); - }); -}); diff --git a/test/specs/major.spec.js b/test/specs/major.spec.js index 8e6f133..1ef3216 100644 --- a/test/specs/major.spec.js +++ b/test/specs/major.spec.js @@ -43,9 +43,9 @@ describe("bump --major", () => { it("should increment an all-zero version number", () => { files.create("package.json", { version: "0.0.0" }); - let bump = chaiExec("--major"); + let bump = chaiExec("major"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -60,7 +60,7 @@ describe("bump --major", () => { let bump = chaiExec("--major"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -75,7 +75,7 @@ describe("bump --major", () => { let bump = chaiExec("--major"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -90,7 +90,7 @@ describe("bump --major", () => { let bump = chaiExec("--major --preid alpha"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( diff --git a/test/specs/minor.spec.js b/test/specs/minor.spec.js index 41f4048..cfbd58e 100644 --- a/test/specs/minor.spec.js +++ b/test/specs/minor.spec.js @@ -11,8 +11,8 @@ describe("bump --minor", () => { let bump = chaiExec("--minor"); - bump.stderr.should.be.empty; - bump.stdout.should.be.empty; + bump.should.have.stderr(""); + bump.should.have.stdout(""); bump.should.have.exitCode(0); files.json("package.json").should.deep.equal({}); @@ -26,7 +26,7 @@ describe("bump --minor", () => { let bump = chaiExec("--minor"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -45,7 +45,7 @@ describe("bump --minor", () => { let bump = chaiExec("--minor"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -60,7 +60,7 @@ describe("bump --minor", () => { let bump = chaiExec("--minor"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -75,7 +75,7 @@ describe("bump --minor", () => { let bump = chaiExec("--minor"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -90,7 +90,7 @@ describe("bump --minor", () => { let bump = chaiExec("--minor --preid alpha"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( diff --git a/test/specs/version-hooks.spec.js b/test/specs/npm.spec.js similarity index 95% rename from test/specs/version-hooks.spec.js rename to test/specs/npm.spec.js index 58d7f47..9905b48 100644 --- a/test/specs/version-hooks.spec.js +++ b/test/specs/npm.spec.js @@ -5,7 +5,7 @@ const files = require("../fixtures/files"); const check = require("../fixtures/check"); const chaiExec = require("chai-exec"); -describe("npm version hooks", () => { +describe.skip("npm version hooks", () => { if (process.platform === "win32" && process.env.CI) { // Spawning NPM fails on Windows due to a bug in NYC (actually in its dependency, spawn-wrap) // So skip these tests until this bug is fixed: https://github.com/istanbuljs/nyc/issues/760 @@ -22,7 +22,7 @@ describe("npm version hooks", () => { let bump = chaiExec("--major"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -46,7 +46,7 @@ describe("npm version hooks", () => { let bump = chaiExec("--major"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -70,7 +70,7 @@ describe("npm version hooks", () => { let bump = chaiExec("--major"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -96,7 +96,7 @@ describe("npm version hooks", () => { let bump = chaiExec("--major --commit --tag --push"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( diff --git a/test/specs/patch.spec.js b/test/specs/patch.spec.js index cb539f7..257d4de 100644 --- a/test/specs/patch.spec.js +++ b/test/specs/patch.spec.js @@ -11,8 +11,8 @@ describe("bump --patch", () => { let bump = chaiExec("--patch"); - bump.stderr.should.be.empty; - bump.stdout.should.be.empty; + bump.should.have.stderr(""); + bump.should.have.stdout(""); bump.should.have.exitCode(0); files.json("package.json").should.deep.equal({}); @@ -26,7 +26,7 @@ describe("bump --patch", () => { let bump = chaiExec("--patch"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -45,7 +45,7 @@ describe("bump --patch", () => { let bump = chaiExec("--patch"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -60,7 +60,7 @@ describe("bump --patch", () => { let bump = chaiExec("--patch"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -75,7 +75,7 @@ describe("bump --patch", () => { let bump = chaiExec("--patch"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -90,7 +90,7 @@ describe("bump --patch", () => { let bump = chaiExec("--patch --preid alpha"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( diff --git a/test/specs/premajor.spec.js b/test/specs/premajor.spec.js index 07f2c23..07b5210 100644 --- a/test/specs/premajor.spec.js +++ b/test/specs/premajor.spec.js @@ -11,8 +11,8 @@ describe("bump --premajor", () => { let bump = chaiExec("--premajor"); - bump.stderr.should.be.empty; - bump.stdout.should.be.empty; + bump.should.have.stderr(""); + bump.should.have.stdout(""); bump.should.have.exitCode(0); files.json("package.json").should.deep.equal({}); @@ -26,7 +26,7 @@ describe("bump --premajor", () => { let bump = chaiExec("--premajor"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -45,7 +45,7 @@ describe("bump --premajor", () => { let bump = chaiExec("--premajor"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -60,7 +60,7 @@ describe("bump --premajor", () => { let bump = chaiExec("--premajor"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -75,7 +75,7 @@ describe("bump --premajor", () => { let bump = chaiExec("--premajor"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -90,7 +90,7 @@ describe("bump --premajor", () => { let bump = chaiExec("--premajor --preid alpha"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( diff --git a/test/specs/preminor.spec.js b/test/specs/preminor.spec.js index aad658f..6886748 100644 --- a/test/specs/preminor.spec.js +++ b/test/specs/preminor.spec.js @@ -11,8 +11,8 @@ describe("bump --preminor", () => { let bump = chaiExec("--preminor"); - bump.stderr.should.be.empty; - bump.stdout.should.be.empty; + bump.should.have.stderr(""); + bump.should.have.stdout(""); bump.should.have.exitCode(0); files.json("package.json").should.deep.equal({}); @@ -26,7 +26,7 @@ describe("bump --preminor", () => { let bump = chaiExec("--preminor"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -45,7 +45,7 @@ describe("bump --preminor", () => { let bump = chaiExec("--preminor"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -60,7 +60,7 @@ describe("bump --preminor", () => { let bump = chaiExec("--preminor"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -75,7 +75,7 @@ describe("bump --preminor", () => { let bump = chaiExec("--preminor"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -90,7 +90,7 @@ describe("bump --preminor", () => { let bump = chaiExec("--preminor --preid alpha"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( diff --git a/test/specs/prepatch.spec.js b/test/specs/prepatch.spec.js index 8c0a7ce..0e1c612 100644 --- a/test/specs/prepatch.spec.js +++ b/test/specs/prepatch.spec.js @@ -11,8 +11,8 @@ describe("bump --prepatch", () => { let bump = chaiExec("--prepatch"); - bump.stderr.should.be.empty; - bump.stdout.should.be.empty; + bump.should.have.stderr(""); + bump.should.have.stdout(""); bump.should.have.exitCode(0); files.json("package.json").should.deep.equal({}); @@ -26,7 +26,7 @@ describe("bump --prepatch", () => { let bump = chaiExec("--prepatch"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -45,7 +45,7 @@ describe("bump --prepatch", () => { let bump = chaiExec("--prepatch"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -60,7 +60,7 @@ describe("bump --prepatch", () => { let bump = chaiExec("--prepatch"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -75,7 +75,7 @@ describe("bump --prepatch", () => { let bump = chaiExec("--prepatch"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -90,7 +90,7 @@ describe("bump --prepatch", () => { let bump = chaiExec("--prepatch --preid alpha"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( diff --git a/test/specs/prerelease.spec.js b/test/specs/prerelease.spec.js index e5f09be..97ff801 100644 --- a/test/specs/prerelease.spec.js +++ b/test/specs/prerelease.spec.js @@ -11,8 +11,8 @@ describe("bump --prerelease", () => { let bump = chaiExec("--prerelease"); - bump.stderr.should.be.empty; - bump.stdout.should.be.empty; + bump.should.have.stderr(""); + bump.should.have.stdout(""); bump.should.have.exitCode(0); files.json("package.json").should.deep.equal({}); @@ -26,7 +26,7 @@ describe("bump --prerelease", () => { let bump = chaiExec("--prerelease"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -45,7 +45,7 @@ describe("bump --prerelease", () => { let bump = chaiExec("--prerelease"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -60,7 +60,7 @@ describe("bump --prerelease", () => { let bump = chaiExec("--prerelease"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -75,7 +75,7 @@ describe("bump --prerelease", () => { let bump = chaiExec("--prerelease"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( @@ -90,7 +90,7 @@ describe("bump --prerelease", () => { let bump = chaiExec("--prerelease --preid alpha"); - bump.stderr.should.be.empty; + bump.should.have.stderr(""); bump.should.have.exitCode(0); bump.should.have.stdout( From 8f4c43a5afa4a9ae53fc8f7af38a5ed36dd53c5f Mon Sep 17 00:00:00 2001 From: James Messinger Date: Thu, 3 Jan 2019 08:21:45 -0600 Subject: [PATCH 036/106] Finished implementing all the "exports" tests --- test/specs/exports.spec.js | 158 ++++++++++++++++++++++++------------- 1 file changed, 103 insertions(+), 55 deletions(-) diff --git a/test/specs/exports.spec.js b/test/specs/exports.spec.js index 843bd20..d411dc1 100644 --- a/test/specs/exports.spec.js +++ b/test/specs/exports.spec.js @@ -6,7 +6,13 @@ const { versionBump: namedExport } = require("../../"); const mocks = require("../fixtures/mocks"); const files = require("../fixtures/files"); -describe("versionBup() API", () => { +const ORIGINAL_CWD = process.cwd(); + +describe.only("versionBup() API", () => { + afterEach("restore the CWD", () => { + // Many of the tests in this file change the CWD, so change it back after each test + process.chdir(ORIGINAL_CWD); + }); it("should export the versionBump() function as the default export", () => { defaultExport.should.be.a("function"); @@ -27,27 +33,7 @@ describe("versionBup() API", () => { ]); }); - it("should work without any arguments", async () => { - files.create("package.json", { version: "1.0.0" }); - - // Change the cwd, since we're not setting the `cwd` option - process.chdir("test/.tmp"); - - let results = await versionBump(); - - results.should.deep.equal({ - - }); - - // Git and NPM should NOT have been called - mocks.git().should.be.empty; - mocks.npm().should.be.empty; - - // Restore the previous cwd - process.chdir("../.."); - }); - - it.only("should accept a specific version number", async () => { + it("should accept a specific version number", async () => { files.create("package.json", { version: "1.0.0" }); // Change the cwd, since we're not setting the `cwd` option @@ -56,22 +42,20 @@ describe("versionBup() API", () => { let results = await versionBump("2.34.567"); results.should.deep.equal({ + release: undefined, oldVersion: "1.0.0", newVersion: "2.34.567", commit: false, tag: false, - files: [ - "package.json", - "package-lock.json", - ], + files: ["package.json"], }); + // The package.json file should have been updated + files.json("package.json").should.deep.equal({ version: "2.34.567" }); + // Git and NPM should NOT have been called mocks.git().should.be.empty; mocks.npm().should.be.empty; - - // Restore the previous cwd - process.chdir("../.."); }); it("should accept a bump type", async () => { @@ -83,50 +67,67 @@ describe("versionBup() API", () => { let results = await versionBump("minor"); results.should.deep.equal({ - + release: "minor", + oldVersion: "1.0.0", + newVersion: "1.1.0", + commit: false, + tag: false, + files: ["package.json"], }); - // Git and NPM should NOT have been called - mocks.git().should.be.empty; - mocks.npm().should.be.empty; - - // Restore the previous cwd - process.chdir("../.."); - }); - - it("should accept an empty options object", async () => { - files.create("package.json", { version: "1.0.0" }); - - // Change the cwd, since we're not setting the `cwd` option - process.chdir("test/.tmp"); - - let results = await versionBump({}); - - results.should.deep.equal({ - - }); + // The package.json file should have been updated + files.json("package.json").should.deep.equal({ version: "1.1.0" }); // Git and NPM should NOT have been called mocks.git().should.be.empty; mocks.npm().should.be.empty; - - // Restore the previous cwd - process.chdir("../.."); }); - it("should accept options", async () => { + it.skip("should accept options", async () => { files.create("package.json", { version: "1.0.0" }); + files.create("README.md", "The latest release is v1.0.0\n"); + files.create("random-file.json", { + name: "v1.0.0", + version: "1.0.0", + desc: "This is version 1.0.0.", + }); let results = await versionBump({ - cwd: "test/.tmp", - version: "preminor", + release: "preminor", preid: "test", commit: "A test of the upcoming v", tag: "", + cwd: "test/.tmp", + files: [ + "random-file.json", + "**/*.md", + ] }); results.should.deep.equal({ + release: "preminor", + oldVersion: "1.0.0", + newVersion: "1.1.0-test.1", + commit: "A test of the upcoming v1.1.0-test.1", + tag: "1.1.0-test.1", + files: [ + "random-file.json", + "README.md" + ], + }); + + // The CWD should not have changed + process.cwd().should.equal(ORIGINAL_CWD); + // The package.json file should NOT have been updated, because it wasn't in the `files` list + files.json("package.json").should.deep.equal({ version: "1.0.0" }); + + // The other two files should have been updated + files.text("README.md", "The latest release is v1.1.0-test.1\n"); + files.json("random-file.json").should.deep.equal({ + name: "v1.1.0-test.1", + version: "1.1.0-test.1", + desc: "This is version 1.1.0-test.1.", }); // A git commit and tag should have been created @@ -139,4 +140,51 @@ describe("versionBup() API", () => { mocks.npm().should.be.empty; }); + it("should throw an error if the options are invalid", async () => { + try { + let results = await versionBump({ release: "hello world" }); + throw new Error( + "An error should have been thrown, but results were returned:\n" + + JSON.stringify(results, null, 2) + ); + } + catch (error) { + error.should.be.an.instanceOf(Error); + error.message.should.equal("Invalid Version: hello world"); + } + }); + + it("should throw an error if the current version number is invalid", async () => { + files.create("package.json", { version: "hello world" }); + + try { + let results = await versionBump({ + release: "major", + cwd: "test/.tmp", + }); + + throw new Error( + "An error should have been thrown, but results were returned:\n" + + JSON.stringify(results, null, 2) + ); + } + catch (error) { + error.should.be.an.instanceOf(Error); + error.message.should.equal( + "Unable to determine the current version number. " + + "Checked package.json, package-lock.json." + ); + + // The CWD should not have changed + process.cwd().should.equal(ORIGINAL_CWD); + + // The package.json file should not have changed + files.json("package.json").should.deep.equal({ version: "hello world" }); + + // Git and NPM should NOT have been called + mocks.git().should.be.empty; + mocks.npm().should.be.empty; + } + }); + }); From 5679873a62152aeb4cf640637e93d002ca983ff3 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Thu, 3 Jan 2019 08:24:09 -0600 Subject: [PATCH 037/106] Separated the "exports" and "api" tests --- test/specs/api.spec.js | 169 +++++++++++++++++++++++++++++++++++++ test/specs/exports.spec.js | 165 +----------------------------------- 2 files changed, 170 insertions(+), 164 deletions(-) create mode 100644 test/specs/api.spec.js diff --git a/test/specs/api.spec.js b/test/specs/api.spec.js new file mode 100644 index 0000000..1b199c6 --- /dev/null +++ b/test/specs/api.spec.js @@ -0,0 +1,169 @@ +"use strict"; + +const versionBump = require("../../"); +const mocks = require("../fixtures/mocks"); +const files = require("../fixtures/files"); + +const ORIGINAL_CWD = process.cwd(); + +describe("versionBup() API", () => { + afterEach("restore the CWD", () => { + // Many of the tests in this file change the CWD, so change it back after each test + process.chdir(ORIGINAL_CWD); + }); + + it("should accept a specific version number", async () => { + files.create("package.json", { version: "1.0.0" }); + + // Change the cwd, since we're not setting the `cwd` option + process.chdir("test/.tmp"); + + let results = await versionBump("2.34.567"); + + results.should.deep.equal({ + release: undefined, + oldVersion: "1.0.0", + newVersion: "2.34.567", + commit: false, + tag: false, + files: ["package.json"], + }); + + // The package.json file should have been updated + files.json("package.json").should.deep.equal({ version: "2.34.567" }); + + // Git and NPM should NOT have been called + mocks.git().should.be.empty; + mocks.npm().should.be.empty; + }); + + it("should accept a bump type", async () => { + files.create("package.json", { version: "1.0.0" }); + + // Change the cwd, since we're not setting the `cwd` option + process.chdir("test/.tmp"); + + let results = await versionBump("minor"); + + results.should.deep.equal({ + release: "minor", + oldVersion: "1.0.0", + newVersion: "1.1.0", + commit: false, + tag: false, + files: ["package.json"], + }); + + // The package.json file should have been updated + files.json("package.json").should.deep.equal({ version: "1.1.0" }); + + // Git and NPM should NOT have been called + mocks.git().should.be.empty; + mocks.npm().should.be.empty; + }); + + it.skip("should accept options", async () => { + files.create("package.json", { version: "1.0.0" }); + files.create("README.md", "The latest release is v1.0.0\n"); + files.create("random-file.json", { + name: "v1.0.0", + version: "1.0.0", + desc: "This is version 1.0.0.", + }); + + let results = await versionBump({ + release: "preminor", + preid: "test", + commit: "A test of the upcoming v", + tag: "", + cwd: "test/.tmp", + files: [ + "random-file.json", + "**/*.md", + ] + }); + + results.should.deep.equal({ + release: "preminor", + oldVersion: "1.0.0", + newVersion: "1.1.0-test.1", + commit: "A test of the upcoming v1.1.0-test.1", + tag: "1.1.0-test.1", + files: [ + "random-file.json", + "README.md" + ], + }); + + // The CWD should not have changed + process.cwd().should.equal(ORIGINAL_CWD); + + // The package.json file should NOT have been updated, because it wasn't in the `files` list + files.json("package.json").should.deep.equal({ version: "1.0.0" }); + + // The other two files should have been updated + files.text("README.md", "The latest release is v1.1.0-test.1\n"); + files.json("random-file.json").should.deep.equal({ + name: "v1.1.0-test.1", + version: "1.1.0-test.1", + desc: "This is version 1.1.0-test.1.", + }); + + // A git commit and tag should have been created + mocks.git().should.deep.equal([ + 'git commit package.json -m "release v2.0.0"', + 'git tag package.json -m "release v2.0.0"', + ]); + + // NPM should NOT have been called + mocks.npm().should.be.empty; + }); + + it("should throw an error if the options are invalid", async () => { + try { + let results = await versionBump({ release: "hello world" }); + throw new Error( + "An error should have been thrown, but results were returned:\n" + + JSON.stringify(results, null, 2) + ); + } + catch (error) { + error.should.be.an.instanceOf(Error); + error.message.should.equal("Invalid Version: hello world"); + } + }); + + it("should throw an error if the current version number is invalid", async () => { + files.create("package.json", { version: "hello world" }); + + try { + let results = await versionBump({ + release: "major", + cwd: "test/.tmp", + }); + + throw new Error( + "An error should have been thrown, but results were returned:\n" + + JSON.stringify(results, null, 2) + ); + } + catch (error) { + error.should.be.an.instanceOf(Error); + error.message.should.equal( + "Unable to determine the current version number. " + + "Checked package.json, package-lock.json." + ); + + // The CWD should not have changed + process.cwd().should.equal(ORIGINAL_CWD); + + // The package.json file should not have changed + files.json("package.json").should.deep.equal({ version: "hello world" }); + + // Git and NPM should NOT have been called + mocks.git().should.be.empty; + mocks.npm().should.be.empty; + } + }); + +}); diff --git a/test/specs/exports.spec.js b/test/specs/exports.spec.js index d411dc1..051c356 100644 --- a/test/specs/exports.spec.js +++ b/test/specs/exports.spec.js @@ -1,18 +1,9 @@ "use strict"; -const versionBump = require("../../"); const defaultExport = require("../../"); const { versionBump: namedExport } = require("../../"); -const mocks = require("../fixtures/mocks"); -const files = require("../fixtures/files"); -const ORIGINAL_CWD = process.cwd(); - -describe.only("versionBup() API", () => { - afterEach("restore the CWD", () => { - // Many of the tests in this file change the CWD, so change it back after each test - process.chdir(ORIGINAL_CWD); - }); +describe("version-bump-prompt module exports", () => { it("should export the versionBump() function as the default export", () => { defaultExport.should.be.a("function"); @@ -33,158 +24,4 @@ describe.only("versionBup() API", () => { ]); }); - it("should accept a specific version number", async () => { - files.create("package.json", { version: "1.0.0" }); - - // Change the cwd, since we're not setting the `cwd` option - process.chdir("test/.tmp"); - - let results = await versionBump("2.34.567"); - - results.should.deep.equal({ - release: undefined, - oldVersion: "1.0.0", - newVersion: "2.34.567", - commit: false, - tag: false, - files: ["package.json"], - }); - - // The package.json file should have been updated - files.json("package.json").should.deep.equal({ version: "2.34.567" }); - - // Git and NPM should NOT have been called - mocks.git().should.be.empty; - mocks.npm().should.be.empty; - }); - - it("should accept a bump type", async () => { - files.create("package.json", { version: "1.0.0" }); - - // Change the cwd, since we're not setting the `cwd` option - process.chdir("test/.tmp"); - - let results = await versionBump("minor"); - - results.should.deep.equal({ - release: "minor", - oldVersion: "1.0.0", - newVersion: "1.1.0", - commit: false, - tag: false, - files: ["package.json"], - }); - - // The package.json file should have been updated - files.json("package.json").should.deep.equal({ version: "1.1.0" }); - - // Git and NPM should NOT have been called - mocks.git().should.be.empty; - mocks.npm().should.be.empty; - }); - - it.skip("should accept options", async () => { - files.create("package.json", { version: "1.0.0" }); - files.create("README.md", "The latest release is v1.0.0\n"); - files.create("random-file.json", { - name: "v1.0.0", - version: "1.0.0", - desc: "This is version 1.0.0.", - }); - - let results = await versionBump({ - release: "preminor", - preid: "test", - commit: "A test of the upcoming v", - tag: "", - cwd: "test/.tmp", - files: [ - "random-file.json", - "**/*.md", - ] - }); - - results.should.deep.equal({ - release: "preminor", - oldVersion: "1.0.0", - newVersion: "1.1.0-test.1", - commit: "A test of the upcoming v1.1.0-test.1", - tag: "1.1.0-test.1", - files: [ - "random-file.json", - "README.md" - ], - }); - - // The CWD should not have changed - process.cwd().should.equal(ORIGINAL_CWD); - - // The package.json file should NOT have been updated, because it wasn't in the `files` list - files.json("package.json").should.deep.equal({ version: "1.0.0" }); - - // The other two files should have been updated - files.text("README.md", "The latest release is v1.1.0-test.1\n"); - files.json("random-file.json").should.deep.equal({ - name: "v1.1.0-test.1", - version: "1.1.0-test.1", - desc: "This is version 1.1.0-test.1.", - }); - - // A git commit and tag should have been created - mocks.git().should.deep.equal([ - 'git commit package.json -m "release v2.0.0"', - 'git tag package.json -m "release v2.0.0"', - ]); - - // NPM should NOT have been called - mocks.npm().should.be.empty; - }); - - it("should throw an error if the options are invalid", async () => { - try { - let results = await versionBump({ release: "hello world" }); - throw new Error( - "An error should have been thrown, but results were returned:\n" + - JSON.stringify(results, null, 2) - ); - } - catch (error) { - error.should.be.an.instanceOf(Error); - error.message.should.equal("Invalid Version: hello world"); - } - }); - - it("should throw an error if the current version number is invalid", async () => { - files.create("package.json", { version: "hello world" }); - - try { - let results = await versionBump({ - release: "major", - cwd: "test/.tmp", - }); - - throw new Error( - "An error should have been thrown, but results were returned:\n" + - JSON.stringify(results, null, 2) - ); - } - catch (error) { - error.should.be.an.instanceOf(Error); - error.message.should.equal( - "Unable to determine the current version number. " + - "Checked package.json, package-lock.json." - ); - - // The CWD should not have changed - process.cwd().should.equal(ORIGINAL_CWD); - - // The package.json file should not have changed - files.json("package.json").should.deep.equal({ version: "hello world" }); - - // Git and NPM should NOT have been called - mocks.git().should.be.empty; - mocks.npm().should.be.empty; - } - }); - }); From f7d04cabfb30a30cfe5759c6ff2226c69b934539 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Thu, 3 Jan 2019 08:24:47 -0600 Subject: [PATCH 038/106] Started rewriting the "release" tests --- test/specs/{major.spec.js => release.spec.js} | 67 +++++++++---------- 1 file changed, 32 insertions(+), 35 deletions(-) rename test/specs/{major.spec.js => release.spec.js} (64%) diff --git a/test/specs/major.spec.js b/test/specs/release.spec.js similarity index 64% rename from test/specs/major.spec.js rename to test/specs/release.spec.js index 1ef3216..4ae1279 100644 --- a/test/specs/major.spec.js +++ b/test/specs/release.spec.js @@ -4,41 +4,7 @@ const files = require("../fixtures/files"); const check = require("../fixtures/check"); const chaiExec = require("chai-exec"); -describe("bump --major", () => { - it("should not increment a non-existent version number", () => { - files.create("package.json", {}); - files.create("bower.json", { name: "my-app" }); - - let bump = chaiExec("--major"); - - bump.stderr.should.be.empty; - bump.stdout.should.be.empty; - bump.should.have.exitCode(0); - - files.json("package.json").should.deep.equal({}); - files.json("bower.json").should.deep.equal({ name: "my-app" }); - }); - - it("should treat empty version numbers as 0.0.0", () => { - files.create("package.json", { version: "" }); - files.create("bower.json", { version: null }); - files.create("component.json", { version: 0 }); - - let bump = chaiExec("--major"); - - bump.stderr.should.be.empty; - bump.should.have.exitCode(0); - - bump.should.have.stdout( - `${check} Updated package.json to 1.0.0\n` + - `${check} Updated bower.json to 1.0.0\n` + - `${check} Updated component.json to 1.0.0\n` - ); - - files.json("package.json").should.deep.equal({ version: "1.0.0" }); - files.json("bower.json").should.deep.equal({ version: "1.0.0" }); - files.json("component.json").should.deep.equal({ version: "1.0.0" }); - }); +describe.skip("bump [release]", () => { it("should increment an all-zero version number", () => { files.create("package.json", { version: "0.0.0" }); @@ -99,4 +65,35 @@ describe("bump --major", () => { files.json("package.json").should.deep.equal({ version: "2.0.0" }); }); + + it("should error if there's no current version number", () => { + files.create("package.json", {}); + + let bump = chaiExec("major"); + + bump.should.have.stdout(""); + bump.should.have.exitCode(2); + + bump.should.have.stderr( + "Unable to determine the current version number. Checked package.json, package-lock.json.\n" + ); + + files.json("package.json").should.deep.equal({}); + }); + + it("should print a more detailed error if DEBUG is set", () => { + files.create("package.json", { version: "" }); + + let bump = chaiExec("major", { env: { DEBUG: "true" }}); + + bump.should.have.stdout(""); + bump.should.have.exitCode(2); + + bump.should.have.stderr.that.matches( + /^Error: Unable to determine the current version number. Checked package.json, package-lock.json.\n\s+at \w+/ + ); + + files.json("package.json").should.deep.equal({}); + }); + }); From 67b98f5f606a71628fee166464f3e370811aa2c8 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Thu, 3 Jan 2019 08:27:51 -0600 Subject: [PATCH 039/106] Disabled tests that haven't been refactored yet --- test/specs/cli.spec.js | 16 ++++++++-------- test/specs/files.spec.js | 2 +- test/specs/minor.spec.js | 2 +- test/specs/patch.spec.js | 2 +- test/specs/premajor.spec.js | 2 +- test/specs/preminor.spec.js | 2 +- test/specs/prepatch.spec.js | 2 +- test/specs/prerelease.spec.js | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/test/specs/cli.spec.js b/test/specs/cli.spec.js index a66fe67..986213d 100644 --- a/test/specs/cli.spec.js +++ b/test/specs/cli.spec.js @@ -6,7 +6,7 @@ const manifest = require("../../package.json"); describe("bump", () => { - it("should run without any arguments", () => { + it.skip("should run without any arguments", () => { files.create("package.json", { version: "1.0.0" }); let bump = chaiExec("", { timeout: 1000 }); @@ -22,7 +22,7 @@ describe("bump", () => { bump.should.have.exitCode(1); bump.should.have.stdout(""); - bump.stderr.should.match(/^Unknown option: --fizzbuzz\n\nUsage: bump \[version\] \[options\] \[files...\]\n/); + bump.stderr.should.match(/^Unknown option: --fizzbuzz\n\nUsage: bump \[release\] \[options\] \[files...\]\n/); bump.stderr.should.contain(manifest.description); }); @@ -31,7 +31,7 @@ describe("bump", () => { bump.should.have.exitCode(1); bump.should.have.stdout(""); - bump.stderr.should.match(/^Unknown option: -z\n\nUsage: bump \[version\] \[options\] \[files...\]\n/); + bump.stderr.should.match(/^Unknown option: -z\n\nUsage: bump \[release\] \[options\] \[files...\]\n/); bump.stderr.should.contain(manifest.description); }); @@ -41,7 +41,7 @@ describe("bump", () => { bump.should.have.exitCode(1); bump.should.have.stdout(""); bump.stderr.should.match( - /^The --preid option requires a value, such as "alpha", "beta", etc\.\n\nUsage: bump \[version\] \[options\] \[files...\]\n/ + /^The --preid option requires a value, such as "alpha", "beta", etc\.\n\nUsage: bump \[release\] \[options\] \[files...\]\n/ ); bump.stderr.should.contain(manifest.description); }); @@ -52,7 +52,7 @@ describe("bump", () => { bump.should.have.exitCode(0); bump.should.have.stderr(""); - bump.stdout.should.match(/^\nUsage: bump \[version\] \[options\] \[files...\]\n/); + bump.stdout.should.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/); bump.stdout.should.contain(manifest.description); }); @@ -61,7 +61,7 @@ describe("bump", () => { bump.should.have.exitCode(0); bump.should.have.stderr(""); - bump.stdout.should.match(/^\nUsage: bump \[version\] \[options\] \[files...\]\n/); + bump.stdout.should.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/); bump.stdout.should.contain(manifest.description); }); @@ -70,7 +70,7 @@ describe("bump", () => { bump.should.have.exitCode(0); bump.should.have.stderr(""); - bump.stdout.should.match(/^\nUsage: bump \[version\] \[options\] \[files...\]\n/); + bump.stdout.should.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/); bump.stdout.should.contain(manifest.description); }); @@ -79,7 +79,7 @@ describe("bump", () => { bump.should.have.exitCode(0); bump.should.have.stderr(""); - bump.stdout.should.match(/^\nUsage: bump \[version\] \[options\] \[files...\]\n/); + bump.stdout.should.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/); bump.stdout.should.contain(manifest.description); }); }); diff --git a/test/specs/files.spec.js b/test/specs/files.spec.js index f96d710..31f5868 100644 --- a/test/specs/files.spec.js +++ b/test/specs/files.spec.js @@ -4,7 +4,7 @@ const files = require("../fixtures/files"); const check = require("../fixtures/check"); const chaiExec = require("chai-exec"); -describe("bump [files...]", () => { +describe.skip("bump [files...]", () => { it("should replace the version number in non-manifest files", () => { files.create("package.json", { version: "1.2.3" }); diff --git a/test/specs/minor.spec.js b/test/specs/minor.spec.js index cfbd58e..4227f08 100644 --- a/test/specs/minor.spec.js +++ b/test/specs/minor.spec.js @@ -4,7 +4,7 @@ const files = require("../fixtures/files"); const check = require("../fixtures/check"); const chaiExec = require("chai-exec"); -describe("bump --minor", () => { +describe.skip("bump --minor", () => { it("should not increment a non-existent version number", () => { files.create("package.json", {}); files.create("bower.json", { name: "my-app" }); diff --git a/test/specs/patch.spec.js b/test/specs/patch.spec.js index 257d4de..249b895 100644 --- a/test/specs/patch.spec.js +++ b/test/specs/patch.spec.js @@ -4,7 +4,7 @@ const files = require("../fixtures/files"); const check = require("../fixtures/check"); const chaiExec = require("chai-exec"); -describe("bump --patch", () => { +describe.skip("bump --patch", () => { it("should not increment a non-existent version number", () => { files.create("package.json", {}); files.create("bower.json", { name: "my-app" }); diff --git a/test/specs/premajor.spec.js b/test/specs/premajor.spec.js index 07b5210..520c74f 100644 --- a/test/specs/premajor.spec.js +++ b/test/specs/premajor.spec.js @@ -4,7 +4,7 @@ const files = require("../fixtures/files"); const check = require("../fixtures/check"); const chaiExec = require("chai-exec"); -describe("bump --premajor", () => { +describe.skip("bump --premajor", () => { it("should not increment a non-existent version number", () => { files.create("package.json", {}); files.create("bower.json", { name: "my-app" }); diff --git a/test/specs/preminor.spec.js b/test/specs/preminor.spec.js index 6886748..dcb8423 100644 --- a/test/specs/preminor.spec.js +++ b/test/specs/preminor.spec.js @@ -4,7 +4,7 @@ const files = require("../fixtures/files"); const check = require("../fixtures/check"); const chaiExec = require("chai-exec"); -describe("bump --preminor", () => { +describe.skip("bump --preminor", () => { it("should not increment a non-existent version number", () => { files.create("package.json", {}); files.create("bower.json", { name: "my-app" }); diff --git a/test/specs/prepatch.spec.js b/test/specs/prepatch.spec.js index 0e1c612..0aa60ba 100644 --- a/test/specs/prepatch.spec.js +++ b/test/specs/prepatch.spec.js @@ -4,7 +4,7 @@ const files = require("../fixtures/files"); const check = require("../fixtures/check"); const chaiExec = require("chai-exec"); -describe("bump --prepatch", () => { +describe.skip("bump --prepatch", () => { it("should not increment a non-existent version number", () => { files.create("package.json", {}); files.create("bower.json", { name: "my-app" }); diff --git a/test/specs/prerelease.spec.js b/test/specs/prerelease.spec.js index 97ff801..b72208e 100644 --- a/test/specs/prerelease.spec.js +++ b/test/specs/prerelease.spec.js @@ -4,7 +4,7 @@ const files = require("../fixtures/files"); const check = require("../fixtures/check"); const chaiExec = require("chai-exec"); -describe("bump --prerelease", () => { +describe.skip("bump --prerelease", () => { it("should not increment a non-existent version number", () => { files.create("package.json", {}); files.create("bower.json", { name: "my-app" }); From 6ec467a9d3a70cfaac54638f76fb853e5bfd8c4b Mon Sep 17 00:00:00 2001 From: James Messinger Date: Mon, 25 Feb 2019 06:24:18 -0600 Subject: [PATCH 040/106] Replaced mocha.opts with .mocharc.yml --- .mocharc.yml | 12 ++++++++++++ test/mocha.opts | 6 ------ 2 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 .mocharc.yml delete mode 100644 test/mocha.opts diff --git a/.mocharc.yml b/.mocharc.yml new file mode 100644 index 0000000..1ea3ca3 --- /dev/null +++ b/.mocharc.yml @@ -0,0 +1,12 @@ +# Mocha options +# https://mochajs.org/#configuring-mocha-nodejs +# https://github.com/mochajs/mocha/blob/master/example/config/.mocharc.yml + +spec: + - test/fixtures/**/*.js + - test/specs/**/*.spec.js + +bail: true +timeout: 6000 +retries: 2 +recursive: true diff --git a/test/mocha.opts b/test/mocha.opts deleted file mode 100644 index 6406b99..0000000 --- a/test/mocha.opts +++ /dev/null @@ -1,6 +0,0 @@ ---bail ---timeout 6000 ---retries 2 ---recursive -test/fixtures/**/*.js -test/specs/**/*.js \ No newline at end of file From 566b4e7814757304ad1588d2fe66644161d47617 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Mon, 25 Feb 2019 06:25:01 -0600 Subject: [PATCH 041/106] Updated dependencies --- package-lock.json | 1571 +++++++++++++++++++++++++++------------------ package.json | 27 +- 2 files changed, 964 insertions(+), 634 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9139d69..15f7a80 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,14 +14,14 @@ } }, "@babel/generator": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.2.0.tgz", - "integrity": "sha512-BA75MVfRlFQG2EZgFYIwyT1r6xSkwfP2bdkY/kLZusEYWiJs4xCowab/alaEaT0wSvmVuXGqiefeBlP+7V1yKg==", + "version": "7.3.3", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.3.3.tgz", + "integrity": "sha512-aEADYwRRZjJyMnKN7llGIlircxTCofm3dtV5pmY6ob18MSIuipHpA2yZWkPlycwu5HJcx/pADS3zssd8eY7/6A==", "dev": true, "requires": { - "@babel/types": "^7.2.0", + "@babel/types": "^7.3.3", "jsesc": "^2.5.1", - "lodash": "^4.17.10", + "lodash": "^4.17.11", "source-map": "^0.5.0", "trim-right": "^1.0.1" } @@ -67,47 +67,47 @@ } }, "@babel/parser": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.2.0.tgz", - "integrity": "sha512-M74+GvK4hn1eejD9lZ7967qAwvqTZayQa3g10ag4s9uewgR7TKjeaT0YMyoq+gVfKYABiWZ4MQD701/t5e1Jhg==", + "version": "7.3.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.3.3.tgz", + "integrity": "sha512-xsH1CJoln2r74hR+y7cg2B5JCPaTh+Hd+EbBRk9nWGSNspuo6krjhX0Om6RnRQuIvFq8wVXCLKH3kwKDYhanSg==", "dev": true }, "@babel/template": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.1.2.tgz", - "integrity": "sha512-SY1MmplssORfFiLDcOETrW7fCLl+PavlwMh92rrGcikQaRq4iWPVH0MpwPpY3etVMx6RnDjXtr6VZYr/IbP/Ag==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.2.2.tgz", + "integrity": "sha512-zRL0IMM02AUDwghf5LMSSDEz7sBCO2YnNmpg3uWTZj/v1rcG2BmQUvaGU8GhU8BvfMh1k2KIAYZ7Ji9KXPUg7g==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.1.2", - "@babel/types": "^7.1.2" + "@babel/parser": "^7.2.2", + "@babel/types": "^7.2.2" } }, "@babel/traverse": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.1.6.tgz", - "integrity": "sha512-CXedit6GpISz3sC2k2FsGCUpOhUqKdyL0lqNrImQojagnUMXf8hex4AxYFRuMkNGcvJX5QAFGzB5WJQmSv8SiQ==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.2.3.tgz", + "integrity": "sha512-Z31oUD/fJvEWVR0lNZtfgvVt512ForCTNKYcJBGbPb1QZfve4WGH8Wsy7+Mev33/45fhP/hwQtvgusNdcCMgSw==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "@babel/generator": "^7.1.6", + "@babel/generator": "^7.2.2", "@babel/helper-function-name": "^7.1.0", "@babel/helper-split-export-declaration": "^7.0.0", - "@babel/parser": "^7.1.6", - "@babel/types": "^7.1.6", + "@babel/parser": "^7.2.3", + "@babel/types": "^7.2.2", "debug": "^4.1.0", "globals": "^11.1.0", "lodash": "^4.17.10" } }, "@babel/types": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.2.0.tgz", - "integrity": "sha512-b4v7dyfApuKDvmPb+O488UlGuR1WbwMXFsO/cyqMrnfvRAChZKJAYeeglWTjUO1b9UghKKgepAQM5tsvBJca6A==", + "version": "7.3.3", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.3.3.tgz", + "integrity": "sha512-2tACZ80Wg09UnPg5uGAOUvvInaqLk3l/IAhQzlxLQOIXacr6bMsra5SH6AWw/hIDRCSbCdHP2KzSOD+cT7TzMQ==", "dev": true, "requires": { "esutils": "^2.0.2", - "lodash": "^4.17.10", + "lodash": "^4.17.11", "to-fast-properties": "^2.0.0" }, "dependencies": { @@ -201,15 +201,15 @@ "dev": true }, "@types/mocha": { - "version": "5.2.5", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.5.tgz", - "integrity": "sha512-lAVp+Kj54ui/vLUFxsJTMtWvZraZxum3w3Nwkble2dNuV5VnPA+Mi2oGX9XYJAaIvZi3tn3cbjS/qcJXRb6Bww==", + "version": "5.2.6", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.6.tgz", + "integrity": "sha512-1axi39YdtBI7z957vdqXI4Ac25e7YihYQtJa+Clnxg1zTJEaIRbndt71O3sP4GAMgiAm0pY26/b9BrY4MR/PMw==", "dev": true }, "@types/node": { - "version": "10.12.18", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.18.tgz", - "integrity": "sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ==", + "version": "11.9.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-11.9.5.tgz", + "integrity": "sha512-vVjM0SVzgaOUpflq4GYBvCpozes8OgIIS5gVXVka+OfK3hvnkC1i93U8WiY2OtNE4XUWyyy/86Kf6e0IHTQw1Q==", "dev": true }, "@types/rx": { @@ -354,9 +354,9 @@ } }, "acorn": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.0.4.tgz", - "integrity": "sha512-VY4i5EKSKkofY2I+6QLTbTTN/UvEQPCo6eiwzzSaSWfpaDhOmStMCMod6wmuPciNq+XS0faCglFu2lHZpdHUtg==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.1.0.tgz", + "integrity": "sha512-MW/FjM+IvU9CgBzjO3UIPCE2pyEwUsoFl+VGdczOPEdxfGFjuKny/gN54mOuX7Qxmb9Rg9MCn2oKiSUeW+pjrw==", "dev": true }, "acorn-jsx": { @@ -366,15 +366,15 @@ "dev": true }, "ajv": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", - "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "version": "6.9.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.9.2.tgz", + "integrity": "sha512-4UFy0/LgDo7Oa/+wOAlj44tp9K78u38E5/359eSrqEp1Z5PdVfimCcs7SluXMP755RUQu6d2b4AvF0R1C9RZjg==", "dev": true, "requires": { - "co": "^4.6.0", - "fast-deep-equal": "^1.0.0", + "fast-deep-equal": "^2.0.1", "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.3.0" + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" } }, "ansi-align": { @@ -386,10 +386,16 @@ "string-width": "^2.0.0" } }, + "ansi-colors": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", + "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==", + "dev": true + }, "ansi-escapes": { - "version": "3.1.0", - "resolved": "http://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", - "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==" + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", + "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==" }, "ansi-regex": { "version": "3.0.0", @@ -472,7 +478,8 @@ "arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=" + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true }, "asn1": { "version": "0.2.4", @@ -725,7 +732,6 @@ "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", "dev": true, - "optional": true, "requires": { "tweetnacl": "^0.14.3" } @@ -814,15 +820,6 @@ "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", "integrity": "sha1-JtII6onje1y95gJQoV8DHBak1ms=" }, - "caller-path": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", - "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", - "dev": true, - "requires": { - "callsites": "^0.2.0" - } - }, "callsite": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", @@ -886,9 +883,9 @@ } }, "callsites": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", - "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.0.0.tgz", + "integrity": "sha512-tWnkwu9YEq2uzlBDI4RcLn8jrFvF9AOi8PxDNU3hZZjJcjkcRAq3vCI+vZcg1SuxISDYe86k9VZFwAxDiJGoAw==", "dev": true }, "camelcase": { @@ -977,12 +974,6 @@ "integrity": "sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A==", "dev": true }, - "circular-json": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", - "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", - "dev": true - }, "class-utils": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", @@ -1029,6 +1020,28 @@ "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.1.0.tgz", "integrity": "sha1-sjTKIJsp72b8UY2bmNWEewDt8Ao=" }, + "cliui": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "dev": true, + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" + }, + "dependencies": { + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -1132,9 +1145,9 @@ "dev": true }, "coveralls": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.0.2.tgz", - "integrity": "sha512-Tv0LKe/MkBOilH2v7WBiTBdudg2ChfGbdXafc/s330djpF3zKOmuehTeRwjXWc7pzfj9FrDUTA7tEx6Div8NFw==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.0.3.tgz", + "integrity": "sha512-viNfeGlda2zJr8Gj1zqXpDMRjw9uM54p7wzZdvLRyOgnAfCe974Dq4veZkjJdxQXbmdppu6flEajFYseHYaUhg==", "dev": true, "requires": { "growl": "~> 1.10.0", @@ -1142,7 +1155,7 @@ "lcov-parse": "^0.0.10", "log-driver": "^1.2.7", "minimist": "^1.2.0", - "request": "^2.85.0" + "request": "^2.86.0" } }, "create-error-class": { @@ -1201,9 +1214,9 @@ } }, "debug": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", - "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "dev": true, "requires": { "ms": "^2.1.1" @@ -1241,6 +1254,15 @@ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "requires": { + "object-keys": "^1.0.12" + } + }, "define-property": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", @@ -1499,6 +1521,12 @@ "integrity": "sha1-UYZnt2kUYKXn4KNBvnbrfOgJAYQ=", "dev": true }, + "detect-file": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", + "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=", + "dev": true + }, "detect-indent": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-5.0.0.tgz", @@ -1516,11 +1544,10 @@ "dev": true }, "dir-glob": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.0.0.tgz", - "integrity": "sha512-37qirFDz8cA5fimp9feo43fSuRo2gHwaIn6dXL8Ber1dGwUosDrGZeCCXq57WnIqE4aQ+u3eQZzsk1yOzhdwag==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.2.2.tgz", + "integrity": "sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw==", "requires": { - "arrify": "^1.0.1", "path-type": "^3.0.0" }, "dependencies": { @@ -1535,9 +1562,9 @@ } }, "doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", "dev": true, "requires": { "esutils": "^2.0.2" @@ -1563,12 +1590,26 @@ "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", "dev": true, - "optional": true, "requires": { "jsbn": "~0.1.0", "safer-buffer": "^2.1.0" } }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "end-of-stream": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", + "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, "error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -1587,80 +1628,86 @@ "stackframe": "^0.3.1" } }, + "es-abstract": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.13.0.tgz", + "integrity": "sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==", + "dev": true, + "requires": { + "es-to-primitive": "^1.2.0", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "is-callable": "^1.1.4", + "is-regex": "^1.0.4", + "object-keys": "^1.0.12" + } + }, + "es-to-primitive": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", + "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", + "dev": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "es6-object-assign": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", + "integrity": "sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=", + "dev": true + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "eslint": { - "version": "5.11.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.11.1.tgz", - "integrity": "sha512-gOKhM8JwlFOc2acbOrkYR05NW8M6DCMSvfcJiBB5NDxRE1gv8kbvxKaC9u69e6ZGEMWXcswA/7eKR229cEIpvg==", + "version": "5.14.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.14.1.tgz", + "integrity": "sha512-CyUMbmsjxedx8B0mr79mNOqetvkbij/zrXnFeK2zc3pGRn3/tibjiNAv/3UxFEyfMDjh+ZqTrJrEGBFiGfD5Og==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "ajv": "^6.5.3", + "ajv": "^6.9.1", "chalk": "^2.1.0", "cross-spawn": "^6.0.5", "debug": "^4.0.1", - "doctrine": "^2.1.0", + "doctrine": "^3.0.0", "eslint-scope": "^4.0.0", "eslint-utils": "^1.3.1", "eslint-visitor-keys": "^1.0.0", - "espree": "^5.0.0", + "espree": "^5.0.1", "esquery": "^1.0.1", "esutils": "^2.0.2", - "file-entry-cache": "^2.0.0", + "file-entry-cache": "^5.0.1", "functional-red-black-tree": "^1.0.1", "glob": "^7.1.2", "globals": "^11.7.0", "ignore": "^4.0.6", + "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", - "inquirer": "^6.1.0", + "inquirer": "^6.2.2", "js-yaml": "^3.12.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.3.0", - "lodash": "^4.17.5", + "lodash": "^4.17.11", "minimatch": "^3.0.4", "mkdirp": "^0.5.1", "natural-compare": "^1.4.0", "optionator": "^0.8.2", "path-is-inside": "^1.0.2", - "pluralize": "^7.0.0", "progress": "^2.0.0", "regexpp": "^2.0.1", - "require-uncached": "^1.0.3", "semver": "^5.5.1", "strip-ansi": "^4.0.0", "strip-json-comments": "^2.0.1", - "table": "^5.0.2", + "table": "^5.2.3", "text-table": "^0.2.0" }, "dependencies": { - "ajv": { - "version": "6.6.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.6.2.tgz", - "integrity": "sha512-FBHEW6Jf5TB9MGBgUUA9XHkTbjXYfAUjY43ACMfmdMRHniyoMHjHjzD50OK8LGDWQwp4rWEsIq5kEqq7rvIM1g==", - "dev": true, - "requires": { - "fast-deep-equal": "^2.0.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, "strip-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", @@ -1673,9 +1720,9 @@ } }, "eslint-config-modular": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-modular/-/eslint-config-modular-6.0.0.tgz", - "integrity": "sha512-M766C/t7Ofm9zw4U7Ej4DzK6bOpBQ2lN/ZahKrrRr05W5Y9rwXFeIPfMlixPF1W/Y/Z1MTIrxU4ZC0UU3e0UeA==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-modular/-/eslint-config-modular-7.0.0.tgz", + "integrity": "sha512-FapBmO/8EzKuETlImFHAHXeug2roKabLPqwaPLJ/NA/0lRG71Ca7vNWdMedexLgCAGaqMkWJ5Kd19Q2XOOup1w==", "dev": true }, "eslint-scope": { @@ -1701,12 +1748,12 @@ "dev": true }, "espree": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-5.0.0.tgz", - "integrity": "sha512-1MpUfwsdS9MMoN7ZXqAr9e9UKdVHDcvrJpyx7mm1WuQlx/ygErEQBzgi5Nh5qBHIoYweprhtMkTCb9GhcAIcsA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-5.0.1.tgz", + "integrity": "sha512-qWAZcWh4XE/RwzLJejfcofscgMc9CamR6Tn1+XRXNzrvUSSbiAjGOI/fggztjIi7y9VLPqnICMIPiGyr8JaZ0A==", "dev": true, "requires": { - "acorn": "^6.0.2", + "acorn": "^6.0.7", "acorn-jsx": "^5.0.0", "eslint-visitor-keys": "^1.0.0" } @@ -1949,15 +1996,16 @@ } }, "fast-deep-equal": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", - "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", "dev": true }, "fast-glob": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.4.tgz", "integrity": "sha512-FjK2nCGI/McyzgNtTESqaWP3trPvHyRyoyY70hxjc3oKPNmDe8taohLZpoVKoUjW85tbU5txaYUZCNtVzygl1g==", + "dev": true, "requires": { "@mrmlnc/readdir-enhanced": "^2.2.1", "@nodelib/fs.stat": "^1.1.2", @@ -1988,13 +2036,12 @@ } }, "file-entry-cache": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", - "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", + "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", "dev": true, "requires": { - "flat-cache": "^1.2.1", - "object-assign": "^4.0.1" + "flat-cache": "^2.0.1" } }, "fill-range": { @@ -2027,18 +2074,83 @@ "test-value": "^3.0.0" } }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "findup-sync": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-2.0.0.tgz", + "integrity": "sha1-kyaxSIwi0aYIhlCoaQGy2akKLLw=", + "dev": true, + "requires": { + "detect-file": "^1.0.0", + "is-glob": "^3.1.0", + "micromatch": "^3.0.4", + "resolve-dir": "^1.0.1" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "requires": { + "is-extglob": "^2.1.0" + } + } + } + }, + "flat": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", + "integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==", + "dev": true, + "requires": { + "is-buffer": "~2.0.3" + }, + "dependencies": { + "is-buffer": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", + "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==", + "dev": true + } + } + }, "flat-cache": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.4.tgz", - "integrity": "sha512-VwyB3Lkgacfik2vhqR4uv2rvebqmDvFu4jlN/C1RzWoJEo8I7z4Q404oiqYCkq41mni8EzQnm95emU9seckwtg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", + "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", "dev": true, "requires": { - "circular-json": "^0.3.1", - "graceful-fs": "^4.1.2", - "rimraf": "~2.6.2", - "write": "^0.2.1" + "flatted": "^2.0.0", + "rimraf": "2.6.3", + "write": "1.0.3" + }, + "dependencies": { + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } } }, + "flatted": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.0.tgz", + "integrity": "sha512-R+H8IZclI8AAkSBRQJLVOsxwAoHd6WC40b4QTNWIjzAa6BXOBfQcM587MXDTVPeYaopFNWHUFLx7eNmHDSxMWg==", + "dev": true + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -2051,25 +2163,14 @@ "dev": true }, "form-data": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", - "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", "dev": true, "requires": { "asynckit": "^0.4.0", - "combined-stream": "1.0.6", + "combined-stream": "^1.0.6", "mime-types": "^2.1.12" - }, - "dependencies": { - "combined-stream": { - "version": "1.0.6", - "resolved": "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", - "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - } } }, "fragment-cache": { @@ -2085,6 +2186,12 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, "functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", @@ -2206,29 +2313,42 @@ } }, "globals": { - "version": "11.9.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.9.0.tgz", - "integrity": "sha512-5cJVtyXWH8PiJPVLZzzoIizXx944O4OmRro5MWKx5fT4MgcN7OfaMutPeaTdJCCURwbWdhhcCWcKIffPnmTzBg==", + "version": "11.11.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.11.0.tgz", + "integrity": "sha512-WHq43gS+6ufNOEqlrDBxVEbb8ntfXrfAUU2ZOpCxrBdGKW3gyv8mCxAfIBD0DroPKGrJ2eSsXsLtY9MPntsyTw==", "dev": true }, "globby": { - "version": "8.0.1", - "resolved": "http://registry.npmjs.org/globby/-/globby-8.0.1.tgz", - "integrity": "sha512-oMrYrJERnKBLXNLVTqhm3vPEdJ/b2ZE28xN4YARiix1NOIOBPEpOUnm844K1iu/BkphCaf2WNFwMszv8Soi1pw==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-9.0.0.tgz", + "integrity": "sha512-q0qiO/p1w/yJ0hk8V9x1UXlgsXUxlGd0AHUOXZVXBO6aznDtpx7M8D1kBrCAItoPm+4l8r6ATXV1JpjY2SBQOw==", "requires": { - "array-union": "^1.0.1", - "dir-glob": "^2.0.0", - "fast-glob": "^2.0.2", - "glob": "^7.1.2", - "ignore": "^3.3.5", - "pify": "^3.0.0", - "slash": "^1.0.0" + "array-union": "^1.0.2", + "dir-glob": "^2.2.1", + "fast-glob": "^2.2.6", + "glob": "^7.1.3", + "ignore": "^4.0.3", + "pify": "^4.0.1", + "slash": "^2.0.0" }, "dependencies": { - "ignore": { - "version": "3.3.10", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", - "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==" + "fast-glob": { + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.6.tgz", + "integrity": "sha512-0BvMaZc1k9F+MeWWMe8pL6YltFzZYcJsYU7D4JyDA6PAczaXvxqQQ/z+mDF7/4Mw01DeUc+i3CTKajnkANkV4w==", + "requires": { + "@mrmlnc/readdir-enhanced": "^2.2.1", + "@nodelib/fs.stat": "^1.1.2", + "glob-parent": "^3.1.0", + "is-glob": "^4.0.0", + "merge2": "^1.2.3", + "micromatch": "^3.1.10" + } + }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" } } }, @@ -2270,15 +2390,24 @@ "dev": true }, "har-validator": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", - "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", "dev": true, "requires": { - "ajv": "^5.3.0", + "ajv": "^6.5.5", "har-schema": "^2.0.0" } }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, "has-ansi": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", @@ -2302,6 +2431,12 @@ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, + "has-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", + "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", + "dev": true + }, "has-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", @@ -2332,9 +2467,9 @@ } }, "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true }, "highlight-es": { @@ -2393,8 +2528,17 @@ "ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==" + }, + "import-fresh": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.0.0.tgz", + "integrity": "sha512-pOnA9tfM3Uwics+SaBLCNyZZZbK+4PTu0OPZtLlMIrv17EdBoC15S9Kn8ckJ9TZTyKb3ywNE5y1yeDxxGA7nTQ==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } }, "import-lazy": { "version": "2.1.0", @@ -2438,25 +2582,43 @@ "dev": true }, "inquirer": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.1.tgz", - "integrity": "sha512-088kl3DRT2dLU5riVMKKr1DlImd6X7smDhpXUCkJDCKvTEJeRiXh0G132HG9u5a+6Ylw9plFRY7RuTnwohYSpg==", + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.2.tgz", + "integrity": "sha512-Z2rREiXA6cHRR9KBOarR3WuLlFzlIfAEIiB45ll5SSadMg7WqOh1MKEjjndfuH5ewXdixWCxqnVfGOQzPeiztA==", "requires": { - "ansi-escapes": "^3.0.0", - "chalk": "^2.0.0", + "ansi-escapes": "^3.2.0", + "chalk": "^2.4.2", "cli-cursor": "^2.1.0", "cli-width": "^2.0.0", - "external-editor": "^3.0.0", + "external-editor": "^3.0.3", "figures": "^2.0.0", - "lodash": "^4.17.10", + "lodash": "^4.17.11", "mute-stream": "0.0.7", "run-async": "^2.2.0", - "rxjs": "^6.1.0", + "rxjs": "^6.4.0", "string-width": "^2.1.0", "strip-ansi": "^5.0.0", "through": "^2.3.6" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + } } }, + "interpret": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz", + "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==", + "dev": true + }, "invariant": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", @@ -2466,6 +2628,12 @@ "loose-envify": "^1.0.0" } }, + "invert-kv": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", + "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", + "dev": true + }, "is-accessor-descriptor": { "version": "0.1.6", "resolved": "http://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", @@ -2504,6 +2672,12 @@ "builtin-modules": "^1.0.0" } }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", + "dev": true + }, "is-ci": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.2.1.tgz", @@ -2531,6 +2705,12 @@ } } }, + "is-date-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", + "dev": true + }, "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", @@ -2669,6 +2849,15 @@ "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=", "dev": true }, + "is-regex": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", + "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "dev": true, + "requires": { + "has": "^1.0.1" + } + }, "is-retry-allowed": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz", @@ -2681,6 +2870,15 @@ "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, + "is-symbol": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", + "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", + "dev": true, + "requires": { + "has-symbols": "^1.0.0" + } + }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -2720,15 +2918,15 @@ "dev": true }, "istanbul-lib-coverage": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz", - "integrity": "sha512-nPvSZsVlbG9aLhZYaC3Oi1gT/tpyo3Yt5fNyf6NmcKIayz4VV/txxJFFKAK/gU4dcNn8ehsanBbVHVl0+amOLA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz", + "integrity": "sha512-dKWuzRGCs4G+67VfW9pBFFz2Jpi4vSp/k7zBcJ888ofV5Mi1g5CUML5GvMvV6u9Cjybftu+E8Cgp+k0dI1E5lw==", "dev": true }, "istanbul-lib-instrument": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-3.0.0.tgz", - "integrity": "sha512-eQY9vN9elYjdgN9Iv6NS/00bptm02EBBk70lRMaVjeA6QYocQgenVrSgC28TJurdnZa80AGO3ASdFN+w/njGiQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-3.1.0.tgz", + "integrity": "sha512-ooVllVGT38HIk8MxDj/OIHXSYvH+1tq/Vb38s8ixt9GoJadXska4WkGY+0wkmtYCZNYtaARniH/DixUGGLZ0uA==", "dev": true, "requires": { "@babel/generator": "^7.0.0", @@ -2736,7 +2934,7 @@ "@babel/template": "^7.0.0", "@babel/traverse": "^7.0.0", "@babel/types": "^7.0.0", - "istanbul-lib-coverage": "^2.0.1", + "istanbul-lib-coverage": "^2.0.3", "semver": "^5.5.0" } }, @@ -2760,8 +2958,7 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true, - "optional": true + "dev": true }, "jsesc": { "version": "2.5.2", @@ -2776,9 +2973,9 @@ "dev": true }, "json-schema-traverse": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, "json-stable-stringify-without-jsonify": { @@ -2819,6 +3016,15 @@ "package-json": "^4.0.0" } }, + "lcid": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", + "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", + "dev": true, + "requires": { + "invert-kv": "^2.0.0" + } + }, "lcov-parse": { "version": "0.0.10", "resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-0.0.10.tgz", @@ -2875,6 +3081,24 @@ } } }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "dependencies": { + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } + } + }, "lodash": { "version": "4.17.11", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", @@ -2949,6 +3173,15 @@ "pify": "^3.0.0" } }, + "map-age-cleaner": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", + "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", + "dev": true, + "requires": { + "p-defer": "^1.0.0" + } + }, "map-cache": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", @@ -2968,6 +3201,17 @@ "object-visit": "^1.0.0" } }, + "mem": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-4.1.0.tgz", + "integrity": "sha512-I5u6Q1x7wxO0kdOpYBB28xueHADYps5uty/zg936CiG8NTe5sJL8EjrCuLneuDW3PlMdZBGDIn8BirEVdovZvg==", + "dev": true, + "requires": { + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^1.0.0", + "p-is-promise": "^2.0.0" + } + }, "meow": { "version": "3.7.0", "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", @@ -3084,18 +3328,18 @@ } }, "mime-db": { - "version": "1.36.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", - "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==", + "version": "1.38.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.38.0.tgz", + "integrity": "sha512-bqVioMFFzc2awcdJZIzR3HjZFX20QhilVS7hytkKrv7xFAn8bM1gzc/FOX2awLISvWe0PV8ptFKcon+wZ5qYkg==", "dev": true }, "mime-types": { - "version": "2.1.20", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", - "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", + "version": "2.1.22", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.22.tgz", + "integrity": "sha512-aGl6TZGnhm/li6F7yx82bJiBZwgiEa4Hf6CNr8YO+r5UHr53tSTYZb102zyU50DOWWKeOv0uQLRL0/9EiKWCog==", "dev": true, "requires": { - "mime-db": "~1.36.0" + "mime-db": "~1.38.0" } }, "mimic-fn": { @@ -3154,74 +3398,69 @@ } }, "mocha": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", - "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.0.1.tgz", + "integrity": "sha512-tQzCxWqxSD6Oyg5r7Ptbev0yAMD8p+Vfh4snPFuiUsWqYj0eVYTDT2DkEY307FTj0WRlIWN9rWMMAUzRmijgVQ==", "dev": true, "requires": { + "ansi-colors": "3.2.3", "browser-stdout": "1.3.1", - "commander": "2.15.1", - "debug": "3.1.0", + "debug": "3.2.6", "diff": "3.5.0", "escape-string-regexp": "1.0.5", - "glob": "7.1.2", + "findup-sync": "2.0.0", + "glob": "7.1.3", "growl": "1.10.5", - "he": "1.1.1", + "he": "1.2.0", + "js-yaml": "3.12.0", + "log-symbols": "2.2.0", "minimatch": "3.0.4", "mkdirp": "0.5.1", - "supports-color": "5.4.0" + "ms": "2.1.1", + "node-environment-flags": "1.0.4", + "object.assign": "4.1.0", + "strip-json-comments": "2.0.1", + "supports-color": "6.0.0", + "which": "1.3.1", + "wide-align": "1.1.3", + "yargs": "12.0.5", + "yargs-parser": "11.1.1", + "yargs-unparser": "1.5.0" }, "dependencies": { - "commander": { - "version": "2.15.1", - "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", - "dev": true - }, "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", "dev": true, "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "supports-color": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", + "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", "dev": true, "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "has-flag": "^3.0.0" } }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "dev": true, "requires": { - "has-flag": "^3.0.0" + "isexe": "^2.0.0" } } } }, "mock-require": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/mock-require/-/mock-require-3.0.2.tgz", - "integrity": "sha512-aD/Y1ZFHqw5pHg3HVQ50dLbfaAAcytS6sqLuhP51Dk3TSPdFb2VkSAa3mjrHifLIlGAtwQHJHINafAyqAne7vA==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/mock-require/-/mock-require-3.0.3.tgz", + "integrity": "sha512-lLzfLHcyc10MKQnNUCv7dMcoY/2Qxd6wJfbqCcVk3LDb8An4hF6ohk5AztrvgKhJCqj36uyzi/p5se+tvyD+Wg==", "dev": true, "requires": { "get-caller-file": "^1.0.2", @@ -3277,6 +3516,15 @@ "lodash.toarray": "^4.4.0" } }, + "node-environment-flags": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.4.tgz", + "integrity": "sha512-M9rwCnWVLW7PX+NUWe3ejEdiLYinRpsEre9hMkU/6NS4h+EEulYaDH1gCEZ2gyXsmw+RXYDaV2JkkTNcsPDJ0Q==", + "dev": true, + "requires": { + "object.getownpropertydescriptors": "^2.0.3" + } + }, "normalize-package-data": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", @@ -3514,53 +3762,37 @@ "dev": true }, "nyc": { - "version": "13.1.0", - "resolved": "https://registry.npmjs.org/nyc/-/nyc-13.1.0.tgz", - "integrity": "sha512-3GyY6TpQ58z9Frpv4GMExE1SV2tAgYqC7HSy2omEhNiCT3mhT9NyiOvIE8zkbuJVFzmvvNTnE4h/7/wQae7xLg==", + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-13.3.0.tgz", + "integrity": "sha512-P+FwIuro2aFG6B0Esd9ZDWUd51uZrAEoGutqZxzrVmYl3qSfkLgcQpBPBjtDFsUQLFY1dvTQJPOyeqr8S9GF8w==", "dev": true, "requires": { "archy": "^1.0.0", "arrify": "^1.0.1", - "caching-transform": "^2.0.0", + "caching-transform": "^3.0.1", "convert-source-map": "^1.6.0", - "debug-log": "^1.0.1", "find-cache-dir": "^2.0.0", "find-up": "^3.0.0", "foreground-child": "^1.5.6", "glob": "^7.1.3", - "istanbul-lib-coverage": "^2.0.1", - "istanbul-lib-hook": "^2.0.1", - "istanbul-lib-instrument": "^3.0.0", - "istanbul-lib-report": "^2.0.2", - "istanbul-lib-source-maps": "^2.0.1", - "istanbul-reports": "^2.0.1", + "istanbul-lib-coverage": "^2.0.3", + "istanbul-lib-hook": "^2.0.3", + "istanbul-lib-instrument": "^3.1.0", + "istanbul-lib-report": "^2.0.4", + "istanbul-lib-source-maps": "^3.0.2", + "istanbul-reports": "^2.1.1", "make-dir": "^1.3.0", "merge-source-map": "^1.1.0", "resolve-from": "^4.0.0", - "rimraf": "^2.6.2", + "rimraf": "^2.6.3", "signal-exit": "^3.0.2", "spawn-wrap": "^1.4.2", - "test-exclude": "^5.0.0", + "test-exclude": "^5.1.0", "uuid": "^3.3.2", - "yargs": "11.1.0", - "yargs-parser": "^9.0.2" + "yargs": "^12.0.5", + "yargs-parser": "^11.1.1" }, "dependencies": { - "align-text": { - "version": "0.1.4", - "bundled": true, - "dev": true, - "requires": { - "kind-of": "^3.0.2", - "longest": "^1.0.1", - "repeat-string": "^1.5.2" - } - }, - "amdefine": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, "ansi-regex": { "version": "3.0.0", "bundled": true, @@ -3585,9 +3817,12 @@ "dev": true }, "async": { - "version": "1.5.2", + "version": "2.6.2", "bundled": true, - "dev": true + "dev": true, + "requires": { + "lodash": "^4.17.11" + } }, "balanced-match": { "version": "1.0.0", @@ -3603,55 +3838,30 @@ "concat-map": "0.0.1" } }, - "builtin-modules": { - "version": "1.1.1", - "bundled": true, - "dev": true - }, "caching-transform": { - "version": "2.0.0", + "version": "3.0.1", "bundled": true, "dev": true, "requires": { - "make-dir": "^1.0.0", - "md5-hex": "^2.0.0", - "package-hash": "^2.0.0", - "write-file-atomic": "^2.0.0" + "hasha": "^3.0.0", + "make-dir": "^1.3.0", + "package-hash": "^3.0.0", + "write-file-atomic": "^2.3.0" } }, "camelcase": { - "version": "1.2.1", - "bundled": true, - "dev": true, - "optional": true - }, - "center-align": { - "version": "0.1.3", + "version": "5.0.0", "bundled": true, - "dev": true, - "optional": true, - "requires": { - "align-text": "^0.1.3", - "lazy-cache": "^1.0.3" - } + "dev": true }, "cliui": { - "version": "2.1.0", + "version": "4.1.0", "bundled": true, "dev": true, - "optional": true, "requires": { - "center-align": "^0.1.1", - "right-align": "^0.1.1", - "wordwrap": "0.0.2" - }, - "dependencies": { - "wordwrap": { - "version": "0.0.2", - "bundled": true, - "dev": true, - "optional": true - } + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" } }, "code-point-at": { @@ -3659,6 +3869,12 @@ "bundled": true, "dev": true }, + "commander": { + "version": "2.17.1", + "bundled": true, + "dev": true, + "optional": true + }, "commondir": { "version": "1.0.1", "bundled": true, @@ -3687,18 +3903,13 @@ } }, "debug": { - "version": "3.1.0", + "version": "4.1.1", "bundled": true, "dev": true, "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, - "debug-log": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, "decamelize": { "version": "1.2.0", "bundled": true, @@ -3712,6 +3923,14 @@ "strip-bom": "^3.0.0" } }, + "end-of-stream": { + "version": "1.4.1", + "bundled": true, + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, "error-ex": { "version": "1.3.2", "bundled": true, @@ -3726,12 +3945,12 @@ "dev": true }, "execa": { - "version": "0.7.0", + "version": "1.0.0", "bundled": true, "dev": true, "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", "is-stream": "^1.1.0", "npm-run-path": "^2.0.0", "p-finally": "^1.0.0", @@ -3740,11 +3959,13 @@ }, "dependencies": { "cross-spawn": { - "version": "5.1.0", + "version": "6.0.5", "bundled": true, "dev": true, "requires": { - "lru-cache": "^4.0.1", + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", "shebang-command": "^1.2.0", "which": "^1.2.9" } @@ -3789,9 +4010,12 @@ "dev": true }, "get-stream": { - "version": "3.0.0", + "version": "4.1.0", "bundled": true, - "dev": true + "dev": true, + "requires": { + "pump": "^3.0.0" + } }, "glob": { "version": "7.1.3", @@ -3807,28 +4031,25 @@ } }, "graceful-fs": { - "version": "4.1.11", + "version": "4.1.15", "bundled": true, "dev": true }, "handlebars": { - "version": "4.0.11", + "version": "4.1.0", "bundled": true, "dev": true, "requires": { - "async": "^1.4.0", + "async": "^2.5.0", "optimist": "^0.6.1", - "source-map": "^0.4.4", - "uglify-js": "^2.6" + "source-map": "^0.6.1", + "uglify-js": "^3.1.4" }, "dependencies": { "source-map": { - "version": "0.4.4", + "version": "0.6.1", "bundled": true, - "dev": true, - "requires": { - "amdefine": ">=0.0.4" - } + "dev": true } } }, @@ -3837,6 +4058,14 @@ "bundled": true, "dev": true }, + "hasha": { + "version": "3.0.0", + "bundled": true, + "dev": true, + "requires": { + "is-stream": "^1.0.1" + } + }, "hosted-git-info": { "version": "2.7.1", "bundled": true, @@ -3862,7 +4091,7 @@ "dev": true }, "invert-kv": { - "version": "1.0.0", + "version": "2.0.0", "bundled": true, "dev": true }, @@ -3871,19 +4100,6 @@ "bundled": true, "dev": true }, - "is-buffer": { - "version": "1.1.6", - "bundled": true, - "dev": true - }, - "is-builtin-module": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "builtin-modules": "^1.0.0" - } - }, "is-fullwidth-code-point": { "version": "2.0.0", "bundled": true, @@ -3900,12 +4116,12 @@ "dev": true }, "istanbul-lib-coverage": { - "version": "2.0.1", + "version": "2.0.3", "bundled": true, "dev": true }, "istanbul-lib-hook": { - "version": "2.0.1", + "version": "2.0.3", "bundled": true, "dev": true, "requires": { @@ -3913,22 +4129,32 @@ } }, "istanbul-lib-report": { - "version": "2.0.2", + "version": "2.0.4", "bundled": true, "dev": true, "requires": { - "istanbul-lib-coverage": "^2.0.1", + "istanbul-lib-coverage": "^2.0.3", "make-dir": "^1.3.0", - "supports-color": "^5.4.0" + "supports-color": "^6.0.0" + }, + "dependencies": { + "supports-color": { + "version": "6.1.0", + "bundled": true, + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "istanbul-lib-source-maps": { - "version": "2.0.1", + "version": "3.0.2", "bundled": true, "dev": true, "requires": { - "debug": "^3.1.0", - "istanbul-lib-coverage": "^2.0.1", + "debug": "^4.1.1", + "istanbul-lib-coverage": "^2.0.3", "make-dir": "^1.3.0", "rimraf": "^2.6.2", "source-map": "^0.6.1" @@ -3942,11 +4168,11 @@ } }, "istanbul-reports": { - "version": "2.0.1", + "version": "2.1.1", "bundled": true, "dev": true, "requires": { - "handlebars": "^4.0.11" + "handlebars": "^4.1.0" } }, "json-parse-better-errors": { @@ -3954,26 +4180,12 @@ "bundled": true, "dev": true }, - "kind-of": { - "version": "3.2.2", - "bundled": true, - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - }, - "lazy-cache": { - "version": "1.0.4", - "bundled": true, - "dev": true, - "optional": true - }, "lcid": { - "version": "1.0.0", + "version": "2.0.0", "bundled": true, "dev": true, "requires": { - "invert-kv": "^1.0.0" + "invert-kv": "^2.0.0" } }, "load-json-file": { @@ -3996,18 +4208,18 @@ "path-exists": "^3.0.0" } }, - "lodash.flattendeep": { - "version": "4.4.0", + "lodash": { + "version": "4.17.11", "bundled": true, "dev": true }, - "longest": { - "version": "1.0.1", + "lodash.flattendeep": { + "version": "4.4.0", "bundled": true, "dev": true }, "lru-cache": { - "version": "4.1.3", + "version": "4.1.5", "bundled": true, "dev": true, "requires": { @@ -4023,25 +4235,22 @@ "pify": "^3.0.0" } }, - "md5-hex": { - "version": "2.0.0", + "map-age-cleaner": { + "version": "0.1.3", "bundled": true, "dev": true, "requires": { - "md5-o-matic": "^0.1.1" + "p-defer": "^1.0.0" } }, - "md5-o-matic": { - "version": "0.1.1", - "bundled": true, - "dev": true - }, "mem": { - "version": "1.1.0", + "version": "4.1.0", "bundled": true, "dev": true, "requires": { - "mimic-fn": "^1.0.0" + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^1.0.0", + "p-is-promise": "^2.0.0" } }, "merge-source-map": { @@ -4093,17 +4302,22 @@ } }, "ms": { - "version": "2.0.0", + "version": "2.1.1", + "bundled": true, + "dev": true + }, + "nice-try": { + "version": "1.0.5", "bundled": true, "dev": true }, "normalize-package-data": { - "version": "2.4.0", + "version": "2.5.0", "bundled": true, "dev": true, "requires": { "hosted-git-info": "^2.1.4", - "is-builtin-module": "^1.0.0", + "resolve": "^1.10.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" } @@ -4144,23 +4358,33 @@ "dev": true }, "os-locale": { - "version": "2.1.0", + "version": "3.1.0", "bundled": true, "dev": true, "requires": { - "execa": "^0.7.0", - "lcid": "^1.0.0", - "mem": "^1.1.0" + "execa": "^1.0.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" } }, + "p-defer": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, "p-finally": { "version": "1.0.0", "bundled": true, "dev": true }, - "p-limit": { + "p-is-promise": { "version": "2.0.0", "bundled": true, + "dev": true + }, + "p-limit": { + "version": "2.1.0", + "bundled": true, "dev": true, "requires": { "p-try": "^2.0.0" @@ -4180,13 +4404,13 @@ "dev": true }, "package-hash": { - "version": "2.0.0", + "version": "3.0.0", "bundled": true, "dev": true, "requires": { - "graceful-fs": "^4.1.11", + "graceful-fs": "^4.1.15", + "hasha": "^3.0.0", "lodash.flattendeep": "^4.4.0", - "md5-hex": "^2.0.0", "release-zalgo": "^1.0.0" } }, @@ -4214,6 +4438,11 @@ "bundled": true, "dev": true }, + "path-parse": { + "version": "1.0.6", + "bundled": true, + "dev": true + }, "path-type": { "version": "3.0.0", "bundled": true, @@ -4240,6 +4469,15 @@ "bundled": true, "dev": true }, + "pump": { + "version": "3.0.0", + "bundled": true, + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "read-pkg": { "version": "3.0.0", "bundled": true, @@ -4267,11 +4505,6 @@ "es6-error": "^4.0.1" } }, - "repeat-string": { - "version": "1.6.1", - "bundled": true, - "dev": true - }, "require-directory": { "version": "2.1.1", "bundled": true, @@ -4282,26 +4515,25 @@ "bundled": true, "dev": true }, - "resolve-from": { - "version": "4.0.0", - "bundled": true, - "dev": true - }, - "right-align": { - "version": "0.1.3", + "resolve": { + "version": "1.10.0", "bundled": true, "dev": true, - "optional": true, "requires": { - "align-text": "^0.1.1" + "path-parse": "^1.0.6" } }, + "resolve-from": { + "version": "4.0.0", + "bundled": true, + "dev": true + }, "rimraf": { - "version": "2.6.2", + "version": "2.6.3", "bundled": true, "dev": true, "requires": { - "glob": "^7.0.5" + "glob": "^7.1.3" } }, "safe-buffer": { @@ -4310,7 +4542,7 @@ "dev": true }, "semver": { - "version": "5.5.0", + "version": "5.6.0", "bundled": true, "dev": true }, @@ -4337,12 +4569,6 @@ "bundled": true, "dev": true }, - "source-map": { - "version": "0.5.7", - "bundled": true, - "dev": true, - "optional": true - }, "spawn-wrap": { "version": "1.4.2", "bundled": true, @@ -4357,7 +4583,7 @@ } }, "spdx-correct": { - "version": "3.0.0", + "version": "3.1.0", "bundled": true, "dev": true, "requires": { @@ -4366,7 +4592,7 @@ } }, "spdx-exceptions": { - "version": "2.1.0", + "version": "2.2.0", "bundled": true, "dev": true }, @@ -4380,7 +4606,7 @@ } }, "spdx-license-ids": { - "version": "3.0.0", + "version": "3.0.3", "bundled": true, "dev": true }, @@ -4411,16 +4637,8 @@ "bundled": true, "dev": true }, - "supports-color": { - "version": "5.4.0", - "bundled": true, - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, "test-exclude": { - "version": "5.0.0", + "version": "5.1.0", "bundled": true, "dev": true, "requires": { @@ -4431,43 +4649,30 @@ } }, "uglify-js": { - "version": "2.8.29", + "version": "3.4.9", "bundled": true, "dev": true, "optional": true, "requires": { - "source-map": "~0.5.1", - "uglify-to-browserify": "~1.0.0", - "yargs": "~3.10.0" + "commander": "~2.17.1", + "source-map": "~0.6.1" }, "dependencies": { - "yargs": { - "version": "3.10.0", + "source-map": { + "version": "0.6.1", "bundled": true, "dev": true, - "optional": true, - "requires": { - "camelcase": "^1.0.2", - "cliui": "^2.1.0", - "decamelize": "^1.0.0", - "window-size": "0.1.0" - } + "optional": true } } }, - "uglify-to-browserify": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, "uuid": { "version": "3.3.2", "bundled": true, "dev": true }, "validate-npm-package-license": { - "version": "3.0.3", + "version": "3.0.4", "bundled": true, "dev": true, "requires": { @@ -4488,12 +4693,6 @@ "bundled": true, "dev": true }, - "window-size": { - "version": "0.1.0", - "bundled": true, - "dev": true, - "optional": true - }, "wordwrap": { "version": "0.0.3", "bundled": true, @@ -4547,7 +4746,7 @@ "dev": true }, "write-file-atomic": { - "version": "2.3.0", + "version": "2.4.2", "bundled": true, "dev": true, "requires": { @@ -4557,7 +4756,7 @@ } }, "y18n": { - "version": "3.2.1", + "version": "4.0.0", "bundled": true, "dev": true }, @@ -4567,87 +4766,31 @@ "dev": true }, "yargs": { - "version": "11.1.0", + "version": "12.0.5", "bundled": true, "dev": true, "requires": { "cliui": "^4.0.0", - "decamelize": "^1.1.1", - "find-up": "^2.1.0", + "decamelize": "^1.2.0", + "find-up": "^3.0.0", "get-caller-file": "^1.0.1", - "os-locale": "^2.0.0", + "os-locale": "^3.0.0", "require-directory": "^2.1.1", "require-main-filename": "^1.0.1", "set-blocking": "^2.0.0", "string-width": "^2.0.0", "which-module": "^2.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^9.0.2" - }, - "dependencies": { - "cliui": { - "version": "4.1.0", - "bundled": true, - "dev": true, - "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0", - "wrap-ansi": "^2.0.0" - } - }, - "find-up": { - "version": "2.1.0", - "bundled": true, - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "locate-path": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "1.3.0", - "bundled": true, - "dev": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-try": { - "version": "1.0.0", - "bundled": true, - "dev": true - } + "y18n": "^3.2.1 || ^4.0.0", + "yargs-parser": "^11.1.1" } }, "yargs-parser": { - "version": "9.0.2", + "version": "11.1.1", "bundled": true, "dev": true, "requires": { - "camelcase": "^4.1.0" - }, - "dependencies": { - "camelcase": { - "version": "4.1.0", - "bundled": true, - "dev": true - } + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" } } } @@ -4692,6 +4835,12 @@ } } }, + "object-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.0.tgz", + "integrity": "sha512-6OO5X1+2tYkNyNEx6TsCxEqFfRWaqx6EtMiSbGrw8Ob8v9Ne+Hl8rBAgLBZn5wjEz3s/s6U1WXFUFOcxxAwUpg==", + "dev": true + }, "object-visit": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", @@ -4700,6 +4849,28 @@ "isobject": "^3.0.0" } }, + "object.assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.0", + "object-keys": "^1.0.11" + } + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", + "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } + }, "object.pick": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", @@ -4817,23 +4988,96 @@ } } }, + "os-locale": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", + "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", + "dev": true, + "requires": { + "execa": "^1.0.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" + }, + "dependencies": { + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "dev": true, + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + } + } + }, "os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" }, + "p-defer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", + "dev": true + }, "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", "dev": true }, + "p-is-promise": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.0.0.tgz", + "integrity": "sha512-pzQPhYMCAgLAKPWD2jC3Se9fEfrD9npNos0y150EeqZll7akhEgGhTW/slB6lHku8AvYGiJ+YJ5hfHKePPgFWg==", + "dev": true + }, + "p-limit": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.1.0.tgz", + "integrity": "sha512-NhURkNcrVB+8hNfLuysU8enY5xn2KXphsHBaC2YmRNTZRc7RWusw6apSpdEj3jo4CMb6W9nrF6tTnsJsJeyu6g==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, "p-map": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==", "dev": true }, + "p-try": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz", + "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==", + "dev": true + }, "package-json": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/package-json/-/package-json-4.0.1.tgz", @@ -4846,6 +5090,15 @@ "semver": "^5.1.0" } }, + "parent-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.0.tgz", + "integrity": "sha512-8Mf5juOMmiE4FcmzYc4IaiS9L3+9paz2KOiXzkRviCP6aDmN49Hz6EMWz0lGNp9pX80GvvAuLADtyGfW/Em3TA==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, "parse-json": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", @@ -4972,12 +5225,6 @@ } } }, - "pluralize": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", - "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", - "dev": true - }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", @@ -5026,15 +5273,25 @@ "dev": true }, "psl": { - "version": "1.1.29", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", - "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==", + "version": "1.1.31", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.31.tgz", + "integrity": "sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw==", "dev": true }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true }, "qs": { @@ -5155,6 +5412,15 @@ } } }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "dev": true, + "requires": { + "resolve": "^1.1.6" + } + }, "redent": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", @@ -5276,20 +5542,10 @@ "integrity": "sha1-wR6XJ2tluOKSP3Xav1+y7ww4Qbk=", "dev": true }, - "require-uncached": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", - "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", - "dev": true, - "requires": { - "caller-path": "^0.1.0", - "resolve-from": "^1.0.0" - } - }, "resolve": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.9.0.tgz", - "integrity": "sha512-TZNye00tI67lwYvzxCxHGjwTNlUV70io54/Ed4j6PscB8xVfuBJpRenI/o6dVk0cY0PYTY27AgCoGGxRnYuItQ==", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz", + "integrity": "sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==", "dev": true, "requires": { "path-parse": "^1.0.6" @@ -5306,9 +5562,9 @@ } }, "resolve-from": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", - "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, "resolve-url": { @@ -5354,9 +5610,9 @@ "dev": true }, "rxjs": { - "version": "6.3.3", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.3.3.tgz", - "integrity": "sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuhG4pcgOw==", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.4.0.tgz", + "integrity": "sha512-Z9Yfa11F6B9Sg/BK9MnqnQ+aQYicPLtilXBp2yUtDt2JRCE0h26d33EnfO3ZxoNxG0T92OUucP3Ct7cpfkdFfw==", "requires": { "tslib": "^1.9.0" } @@ -5434,20 +5690,42 @@ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" }, + "shelljs": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.3.tgz", + "integrity": "sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A==", + "dev": true, + "requires": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + } + }, + "shx": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.2.tgz", + "integrity": "sha512-aS0mWtW3T2sHAenrSrip2XGv39O9dXIFUqxAEWHEOS1ePtGIBavdPJY1kE2IHl14V/4iCbUiNDPGdyYTtmhSoA==", + "dev": true, + "requires": { + "es6-object-assign": "^1.0.3", + "minimist": "^1.2.0", + "shelljs": "^0.8.1" + } + }, "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" }, "slash": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", - "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==" }, "slice-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.0.0.tgz", - "integrity": "sha512-4j2WTWjp3GsZ+AOagyzVbzp4vWGtZ0hEZ/gDY/uTvm6MTxUfTUIsnMIFb1bn8o0RuXiqUw15H1bue8f22Vw2oQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", + "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", "dev": true, "requires": { "ansi-styles": "^3.2.0", @@ -5634,9 +5912,9 @@ "dev": true }, "sshpk": { - "version": "1.14.2", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", - "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", "dev": true, "requires": { "asn1": "~0.2.3", @@ -5757,40 +6035,27 @@ } }, "table": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/table/-/table-5.1.1.tgz", - "integrity": "sha512-NUjapYb/qd4PeFW03HnAuOJ7OMcBkJlqeClWxeNlQ0lXGSb52oZXGzkO0/I0ARegQ2eUT1g2VDJH0eUxDRcHmw==", + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/table/-/table-5.2.3.tgz", + "integrity": "sha512-N2RsDAMvDLvYwFcwbPyF3VmVSSkuF+G1e+8inhBLtHpvwXGw4QRPEZhihQNeEN0i1up6/f6ObCJXNdlRG3YVyQ==", "dev": true, "requires": { - "ajv": "^6.6.1", + "ajv": "^6.9.1", "lodash": "^4.17.11", - "slice-ansi": "2.0.0", - "string-width": "^2.1.1" + "slice-ansi": "^2.1.0", + "string-width": "^3.0.0" }, "dependencies": { - "ajv": { - "version": "6.6.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.6.2.tgz", - "integrity": "sha512-FBHEW6Jf5TB9MGBgUUA9XHkTbjXYfAUjY43ACMfmdMRHniyoMHjHjzD50OK8LGDWQwp4rWEsIq5kEqq7rvIM1g==", + "string-width": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.0.0.tgz", + "integrity": "sha512-rr8CUxBbvOZDUvc5lNIJ+OC1nPVpz+Siw9VBtUjB9b6jZehZLFt0JMCZzShFHIsI8cbhm0EsNIfWJMFV3cu3Ew==", "dev": true, "requires": { - "fast-deep-equal": "^2.0.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.0.0" } - }, - "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true } } }, @@ -5923,6 +6188,14 @@ "requires": { "psl": "^1.1.24", "punycode": "^1.4.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + } } }, "trim-newlines": { @@ -5943,9 +6216,9 @@ "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==" }, "tslint": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.12.0.tgz", - "integrity": "sha512-CKEcH1MHUBhoV43SA/Jmy1l24HJJgI0eyLbBNSRyFlsQvb9v6Zdq+Nz2vEOH00nC5SUx4SneJ59PZUS/ARcokQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.13.0.tgz", + "integrity": "sha512-ECOOQRxXCYnUUePG5h/+Z1Zouobk3KFpIHA9aKBB/nnMxs97S1JJPDGt5J4cGm1y9U9VmVlfboOxA8n1kSNzGw==", "dev": true, "requires": { "babel-code-frame": "^6.22.0", @@ -5956,6 +6229,7 @@ "glob": "^7.1.1", "js-yaml": "^3.7.0", "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", "resolve": "^1.3.2", "semver": "^5.3.0", "tslib": "^1.8.0", @@ -5963,9 +6237,9 @@ } }, "tslint-modular": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/tslint-modular/-/tslint-modular-1.1.2.tgz", - "integrity": "sha512-aUA+uEO0Q7R09gec/niTDByA/BHeBs/t3NmXh22RwzDE2sjd9V4/rAkVP+cGJA8LipUiYSzlquJuUuewt6iztg==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/tslint-modular/-/tslint-modular-1.2.0.tgz", + "integrity": "sha512-ymSGIiD3VxcZOHLxjP+wpd2h0SFqPLApBNdR33bzDueWsk99qSiznVyYOqR4SCLWqu5HTgGulPDNbUVD3xc1gQ==", "dev": true }, "tsutils": { @@ -5990,8 +6264,7 @@ "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true, - "optional": true + "dev": true }, "type-check": { "version": "0.3.2", @@ -6008,15 +6281,15 @@ "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==" }, "typescript": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.2.2.tgz", - "integrity": "sha512-VCj5UiSyHBjwfYacmDuc/NOk4QQixbE+Wn7MFJuS0nRuPQbof132Pw4u53dm264O8LPc2MVsc7RJNml5szurkg==", + "version": "3.3.3333", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.3.3333.tgz", + "integrity": "sha512-JjSKsAfuHBE/fB2oZ8NxtRTk5iGcg6hkYXMnZ3Wc+b2RSqejEqTaem11mHASMnFilHrax3sLK0GDzcJrekZYLw==", "dev": true }, "typescript-tslint-plugin": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/typescript-tslint-plugin/-/typescript-tslint-plugin-0.2.1.tgz", - "integrity": "sha512-j0Tn/2GlAwnaklSNMOZRNpv96j6IWkQF6RuTJ5WowfNlgdYqnJpSaVFwT22INwJiPDDGKNe/aATT0qkU0pWM4w==", + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/typescript-tslint-plugin/-/typescript-tslint-plugin-0.3.1.tgz", + "integrity": "sha512-h8HEPBm36UEs901ld1x6m5eY/UFb4mF+A0nvERr4BWMww5wnV5nfcm9ZFt18foYL0GQ5NVMt1Tb3466WUU8dRQ==", "dev": true, "requires": { "minimatch": "^3.0.4", @@ -6137,14 +6410,6 @@ "dev": true, "requires": { "punycode": "^2.1.0" - }, - "dependencies": { - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true - } } }, "urix": { @@ -6269,6 +6534,15 @@ } } }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "requires": { + "string-width": "^1.0.2 || 2" + } + }, "widest-line": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-2.0.0.tgz", @@ -6337,9 +6611,9 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "write": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", - "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", + "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", "dev": true, "requires": { "mkdirp": "^0.5.1" @@ -6368,11 +6642,66 @@ "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", "dev": true }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + }, "yallist": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "dev": true + }, + "yargs": { + "version": "12.0.5", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", + "integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==", + "dev": true, + "requires": { + "cliui": "^4.0.0", + "decamelize": "^1.2.0", + "find-up": "^3.0.0", + "get-caller-file": "^1.0.1", + "os-locale": "^3.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1 || ^4.0.0", + "yargs-parser": "^11.1.1" + } + }, + "yargs-parser": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", + "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "dependencies": { + "camelcase": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.0.0.tgz", + "integrity": "sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==", + "dev": true + } + } + }, + "yargs-unparser": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.5.0.tgz", + "integrity": "sha512-HK25qidFTCVuj/D1VfNiEndpLIeJN78aqgR23nL3y4N0U/91cOAzqfHlF8n2BvoNDcZmJKin3ddNSvOxSr8flw==", + "dev": true, + "requires": { + "flat": "^4.1.0", + "lodash": "^4.17.11", + "yargs": "^12.0.5" + } } } } diff --git a/package.json b/package.json index 6f4a400..7fb7c8e 100644 --- a/package.json +++ b/package.json @@ -55,31 +55,32 @@ "@types/detect-newline": "^2.1.0", "@types/globby": "^8.0.0", "@types/inquirer": "0.0.43", - "@types/mocha": "^5.2.5", - "@types/node": "^10.12.18", + "@types/mocha": "^5.2.6", + "@types/node": "^11.9.5", "@types/semver": "^5.5.0", "chai": "^4.2.0", "chai-exec": "^1.1.1", - "coveralls": "^3.0.2", + "coveralls": "^3.0.3", "del": "^3.0.0", - "eslint": "^5.11.1", - "eslint-config-modular": "^6.0.0", - "mocha": "^5.2.0", + "eslint": "^5.14.1", + "eslint-config-modular": "^7.0.0", + "mocha": "^6.0.1", "npm-check": "^5.9.0", - "nyc": "^13.1.0", + "nyc": "^13.3.0", + "shx": "^0.3.2", "strip-ansi": "^5.0.0", - "tslint": "^5.12.0", - "tslint-modular": "^1.1.2", - "typescript": "^3.2.2", - "typescript-tslint-plugin": "^0.2.1" + "tslint": "^5.13.0", + "tslint-modular": "^1.2.0", + "typescript": "^3.3.3333", + "typescript-tslint-plugin": "^0.3.1" }, "dependencies": { "command-line-args": "^5.0.2", "detect-indent": "^5.0.0", "detect-newline": "^2.1.0", "ez-spawn": "^2.1.1", - "globby": "^8.0.1", - "inquirer": "^6.2.1", + "globby": "^9.0.0", + "inquirer": "^6.2.2", "log-symbols": "^2.2.0", "semver": "^5.6.0" }, From 17c5a2bce543cdf8ae332da0db46bb8dda45b8b3 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Mon, 25 Feb 2019 06:25:20 -0600 Subject: [PATCH 042/106] Updated scripts --- package.json | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 7fb7c8e..2a98be5 100644 --- a/package.json +++ b/package.json @@ -18,17 +18,14 @@ "name": "James Messinger", "url": "https://jamesmessinger.com" }, - "contributors": [ - "Alexey Raspopov (https://github.com/alexeyraspopov)", - "James Messinger (https://jamesmessinger.com)" - ], - "homepage": "https://jsdevtools.org/version-bump-prompt", "license": "MIT", + "homepage": "https://jsdevtools.org/version-bump-prompt", "repository": { "type": "git", "url": "https://github.com/JS-DevTools/version-bump-prompt.git" }, "main": "lib/index.js", + "types": "lib/index.d.js", "bin": { "bump": "bin/bump.js" }, @@ -37,16 +34,17 @@ "lib" ], "scripts": { - "build": "tsc", - "watch": "tsc --watch", + "clean": "shx rm -rf .nyc_output coverage lib", "lint": "npm run lint:typescript && npm run lint:javascript", "lint:typescript": "tslint -p tsconfig.json", "lint:javascript": "eslint test", + "build": "tsc", + "watch": "tsc --watch", "test": "mocha && npm run lint", "coverage": "nyc --reporter=text --reporter=lcov mocha", "upgrade": "npm-check -u", "bump": "node bin/bump.js --tag --push --all", - "release": "npm run upgrade && npm run build && npm test && npm run bump" + "release": "npm run upgrade && npm run clean && npm run build && npm test && npm run bump" }, "devDependencies": { "@types/chai": "^4.1.7", From dbe2ad0de4ceb74b2bc8e44e81b9b234e02dadf0 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Mon, 25 Feb 2019 06:25:41 -0600 Subject: [PATCH 043/106] Fixed a broken link --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 244563c..c96a6ab 100644 --- a/readme.md +++ b/readme.md @@ -31,7 +31,7 @@ Installation -------------------------- -You can install `version-bump-prompt` via [npm](https://docs.npmjs.com/getting-started/what-is-npm). +You can install `version-bump-prompt` via [npm](https://docs.npmjs.com/about-npm/). ```bash npm install -g version-bump-prompt From b0efd5edd6618dc3848f1b2c42c0103dd10ed0d8 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Mon, 25 Feb 2019 06:25:52 -0600 Subject: [PATCH 044/106] Corrected the "Contributing" steps --- readme.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index c96a6ab..26d2911 100644 --- a/readme.md +++ b/readme.md @@ -96,7 +96,10 @@ To build the project locally on your computer: 2. __Install dependencies__
`npm install` -3. __Run the tests__
+3. __Build the code__
+`npm run build` + +4. __Run the tests__
`npm test` From c04fe77be00cd8a612a457f859a83180127c1e41 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Mon, 25 Feb 2019 06:26:28 -0600 Subject: [PATCH 045/106] Simplified the CommonJS default export hack --- src/index.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 518d0eb..13a9058 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,7 +8,6 @@ export { VersionBumpResults } from "./version-bump-results"; export default versionBump; // CommonJS default export hack -if (typeof module === "object" && typeof exports === "object") { - module.exports = versionBump; - Object.assign(versionBump, exports); +if (typeof module === "object" && typeof module.exports === "object") { + module.exports = Object.assign(module.exports.default, module.exports); // tslint:disable-line: no-unsafe-any } From 53880998e7d94dc9106a2be0fbcd3a1cdf0e96db Mon Sep 17 00:00:00 2001 From: James Messinger Date: Mon, 25 Feb 2019 06:26:44 -0600 Subject: [PATCH 046/106] Added doc comments --- src/version-bump.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/version-bump.ts b/src/version-bump.ts index e08cf3d..06a061c 100644 --- a/src/version-bump.ts +++ b/src/version-bump.ts @@ -30,6 +30,10 @@ export async function versionBump(release: string): Promise; */ export async function versionBump(options: VersionBumpOptions): Promise; +/** + * Bumps the version number in one or more files, prompting the user if necessary. + * Optionally also commits, tags, and pushes to git. + */ export async function versionBump(arg: VersionBumpOptions | string = {}): Promise { if (typeof arg === "string") { arg = { release: arg }; From 0890e16d7883e2a655426d8c87f50e8553b9748c Mon Sep 17 00:00:00 2001 From: James Messinger Date: Mon, 25 Feb 2019 06:39:31 -0600 Subject: [PATCH 047/106] Separated test fixtures from utils --- .mocharc.yml | 3 ++- test/fixtures/{clean-temp-dir.js => mocha-hooks.js} | 0 test/specs/api.spec.js | 4 ++-- test/specs/cli.spec.js | 2 +- test/specs/files.spec.js | 4 ++-- test/specs/git-commit.spec.js | 6 +++--- test/specs/git-push.spec.js | 6 +++--- test/specs/git-tag.spec.js | 6 +++--- test/specs/minor.spec.js | 4 ++-- test/specs/npm.spec.js | 6 +++--- test/specs/patch.spec.js | 4 ++-- test/specs/premajor.spec.js | 4 ++-- test/specs/preminor.spec.js | 4 ++-- test/specs/prepatch.spec.js | 4 ++-- test/specs/prerelease.spec.js | 4 ++-- test/specs/release.spec.js | 4 ++-- test/{fixtures => utils}/check.js | 0 test/{fixtures/files/index.js => utils/files.js} | 10 +++++----- test/{fixtures/mocks/index.js => utils/mocks.js} | 10 ++++++---- 19 files changed, 44 insertions(+), 41 deletions(-) rename test/fixtures/{clean-temp-dir.js => mocha-hooks.js} (100%) rename test/{fixtures => utils}/check.js (100%) rename test/{fixtures/files/index.js => utils/files.js} (81%) rename test/{fixtures/mocks/index.js => utils/mocks.js} (87%) diff --git a/.mocharc.yml b/.mocharc.yml index 1ea3ca3..f0fb05c 100644 --- a/.mocharc.yml +++ b/.mocharc.yml @@ -3,7 +3,8 @@ # https://github.com/mochajs/mocha/blob/master/example/config/.mocharc.yml spec: - - test/fixtures/**/*.js + - test/fixtures/mocha-hooks.js + - test/fixtures/setup-chai.js - test/specs/**/*.spec.js bail: true diff --git a/test/fixtures/clean-temp-dir.js b/test/fixtures/mocha-hooks.js similarity index 100% rename from test/fixtures/clean-temp-dir.js rename to test/fixtures/mocha-hooks.js diff --git a/test/specs/api.spec.js b/test/specs/api.spec.js index 1b199c6..82871fd 100644 --- a/test/specs/api.spec.js +++ b/test/specs/api.spec.js @@ -1,8 +1,8 @@ "use strict"; const versionBump = require("../../"); -const mocks = require("../fixtures/mocks"); -const files = require("../fixtures/files"); +const mocks = require("../utils/mocks"); +const files = require("../utils/files"); const ORIGINAL_CWD = process.cwd(); diff --git a/test/specs/cli.spec.js b/test/specs/cli.spec.js index 986213d..3a43b04 100644 --- a/test/specs/cli.spec.js +++ b/test/specs/cli.spec.js @@ -1,6 +1,6 @@ "use strict"; -const files = require("../fixtures/files"); +const files = require("../utils/files"); const chaiExec = require("chai-exec"); const manifest = require("../../package.json"); diff --git a/test/specs/files.spec.js b/test/specs/files.spec.js index 31f5868..9f3c2ee 100644 --- a/test/specs/files.spec.js +++ b/test/specs/files.spec.js @@ -1,7 +1,7 @@ "use strict"; -const files = require("../fixtures/files"); -const check = require("../fixtures/check"); +const files = require("../utils/files"); +const check = require("../utils/check"); const chaiExec = require("chai-exec"); describe.skip("bump [files...]", () => { diff --git a/test/specs/git-commit.spec.js b/test/specs/git-commit.spec.js index aabcb8f..0c8bbda 100644 --- a/test/specs/git-commit.spec.js +++ b/test/specs/git-commit.spec.js @@ -1,8 +1,8 @@ "use strict"; -const mocks = require("../fixtures/mocks"); -const files = require("../fixtures/files"); -const check = require("../fixtures/check"); +const mocks = require("../utils/mocks"); +const files = require("../utils/files"); +const check = require("../utils/check"); const chaiExec = require("chai-exec"); describe.skip("bump --commit", () => { diff --git a/test/specs/git-push.spec.js b/test/specs/git-push.spec.js index d9d9a33..8f1e519 100644 --- a/test/specs/git-push.spec.js +++ b/test/specs/git-push.spec.js @@ -1,8 +1,8 @@ "use strict"; -const mocks = require("../fixtures/mocks"); -const files = require("../fixtures/files"); -const check = require("../fixtures/check"); +const mocks = require("../utils/mocks"); +const files = require("../utils/files"); +const check = require("../utils/check"); const chaiExec = require("chai-exec"); describe.skip("bump --push", () => { diff --git a/test/specs/git-tag.spec.js b/test/specs/git-tag.spec.js index 537b52a..d98aea1 100644 --- a/test/specs/git-tag.spec.js +++ b/test/specs/git-tag.spec.js @@ -1,8 +1,8 @@ "use strict"; -const mocks = require("../fixtures/mocks"); -const files = require("../fixtures/files"); -const check = require("../fixtures/check"); +const mocks = require("../utils/mocks"); +const files = require("../utils/files"); +const check = require("../utils/check"); const chaiExec = require("chai-exec"); describe.skip("bump --tag", () => { diff --git a/test/specs/minor.spec.js b/test/specs/minor.spec.js index 4227f08..e2bd296 100644 --- a/test/specs/minor.spec.js +++ b/test/specs/minor.spec.js @@ -1,7 +1,7 @@ "use strict"; -const files = require("../fixtures/files"); -const check = require("../fixtures/check"); +const files = require("../utils/files"); +const check = require("../utils/check"); const chaiExec = require("chai-exec"); describe.skip("bump --minor", () => { diff --git a/test/specs/npm.spec.js b/test/specs/npm.spec.js index 9905b48..aa4fda0 100644 --- a/test/specs/npm.spec.js +++ b/test/specs/npm.spec.js @@ -1,8 +1,8 @@ "use strict"; -const mocks = require("../fixtures/mocks"); -const files = require("../fixtures/files"); -const check = require("../fixtures/check"); +const mocks = require("../utils/mocks"); +const files = require("../utils/files"); +const check = require("../utils/check"); const chaiExec = require("chai-exec"); describe.skip("npm version hooks", () => { diff --git a/test/specs/patch.spec.js b/test/specs/patch.spec.js index 249b895..a968e68 100644 --- a/test/specs/patch.spec.js +++ b/test/specs/patch.spec.js @@ -1,7 +1,7 @@ "use strict"; -const files = require("../fixtures/files"); -const check = require("../fixtures/check"); +const files = require("../utils/files"); +const check = require("../utils/check"); const chaiExec = require("chai-exec"); describe.skip("bump --patch", () => { diff --git a/test/specs/premajor.spec.js b/test/specs/premajor.spec.js index 520c74f..00cf077 100644 --- a/test/specs/premajor.spec.js +++ b/test/specs/premajor.spec.js @@ -1,7 +1,7 @@ "use strict"; -const files = require("../fixtures/files"); -const check = require("../fixtures/check"); +const files = require("../utils/files"); +const check = require("../utils/check"); const chaiExec = require("chai-exec"); describe.skip("bump --premajor", () => { diff --git a/test/specs/preminor.spec.js b/test/specs/preminor.spec.js index dcb8423..dbe22e6 100644 --- a/test/specs/preminor.spec.js +++ b/test/specs/preminor.spec.js @@ -1,7 +1,7 @@ "use strict"; -const files = require("../fixtures/files"); -const check = require("../fixtures/check"); +const files = require("../utils/files"); +const check = require("../utils/check"); const chaiExec = require("chai-exec"); describe.skip("bump --preminor", () => { diff --git a/test/specs/prepatch.spec.js b/test/specs/prepatch.spec.js index 0aa60ba..a33ab72 100644 --- a/test/specs/prepatch.spec.js +++ b/test/specs/prepatch.spec.js @@ -1,7 +1,7 @@ "use strict"; -const files = require("../fixtures/files"); -const check = require("../fixtures/check"); +const files = require("../utils/files"); +const check = require("../utils/check"); const chaiExec = require("chai-exec"); describe.skip("bump --prepatch", () => { diff --git a/test/specs/prerelease.spec.js b/test/specs/prerelease.spec.js index b72208e..2d00859 100644 --- a/test/specs/prerelease.spec.js +++ b/test/specs/prerelease.spec.js @@ -1,7 +1,7 @@ "use strict"; -const files = require("../fixtures/files"); -const check = require("../fixtures/check"); +const files = require("../utils/files"); +const check = require("../utils/check"); const chaiExec = require("chai-exec"); describe.skip("bump --prerelease", () => { diff --git a/test/specs/release.spec.js b/test/specs/release.spec.js index 4ae1279..7d0efa6 100644 --- a/test/specs/release.spec.js +++ b/test/specs/release.spec.js @@ -1,7 +1,7 @@ "use strict"; -const files = require("../fixtures/files"); -const check = require("../fixtures/check"); +const files = require("../utils/files"); +const check = require("../utils/check"); const chaiExec = require("chai-exec"); describe.skip("bump [release]", () => { diff --git a/test/fixtures/check.js b/test/utils/check.js similarity index 100% rename from test/fixtures/check.js rename to test/utils/check.js diff --git a/test/fixtures/files/index.js b/test/utils/files.js similarity index 81% rename from test/fixtures/files/index.js rename to test/utils/files.js index f8e18ba..2b5cd2b 100644 --- a/test/fixtures/files/index.js +++ b/test/utils/files.js @@ -3,8 +3,8 @@ const fs = require("fs"); const path = require("path"); -const srcDir = __dirname; -const destDir = path.join(__dirname, "../../.tmp"); +const filesDir = path.resolve("test", "fixtures", "files"); +const tempDir = path.resolve("test", ".tmp"); const files = module.exports = { /** @@ -17,7 +17,7 @@ const files = module.exports = { if (typeof contents === "object") { contents = JSON.stringify(contents, null, 2); } - fs.writeFileSync(path.join(destDir, name), contents); + fs.writeFileSync(path.join(tempDir, name), contents); }, /** @@ -26,7 +26,7 @@ const files = module.exports = { * @param {string} name - The name of the file to copy (e.g. "README.md", "script1.js") */ copy (name) { - let contents = fs.readFileSync(path.join(srcDir, name), "utf8"); + let contents = fs.readFileSync(path.join(filesDir, name), "utf8"); files.create(name, contents); }, @@ -38,7 +38,7 @@ const files = module.exports = { */ text (name) { try { - return fs.readFileSync(path.join(destDir, name), "utf8"); + return fs.readFileSync(path.join(tempDir, name), "utf8"); } catch (e) { return ""; diff --git a/test/fixtures/mocks/index.js b/test/utils/mocks.js similarity index 87% rename from test/fixtures/mocks/index.js rename to test/utils/mocks.js index 1b82d7c..d661e72 100644 --- a/test/fixtures/mocks/index.js +++ b/test/utils/mocks.js @@ -2,17 +2,19 @@ const fs = require("fs"); const path = require("path"); -const files = require("../files"); +const files = require("./files"); + +const mocksDir = path.resolve("test", "fixtures", "mocks"); // Ensure that the mock binaries are executable -fs.chmodSync(path.join(__dirname, "git"), "0777"); -fs.chmodSync(path.join(__dirname, "npm"), "0777"); +fs.chmodSync(path.join(mocksDir, "git"), "0777"); +fs.chmodSync(path.join(mocksDir, "npm"), "0777"); // Inject our mocks directory path into the PATH variable, // so that version-bump-prompt runs our mock `git` and `npm` binaries // instead of the real ones. let otherPaths = getEnvPath(); -process.env.PATH = __dirname + path.delimiter + otherPaths; // eslint-disable-line no-path-concat +process.env.PATH = mocksDir + path.delimiter + otherPaths; // eslint-disable-line no-path-concat const mocks = module.exports = { /** From 29c7993a1754b54927ce6a0ecb960c5e2af9ecd7 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Mon, 25 Feb 2019 06:45:33 -0600 Subject: [PATCH 048/106] Simplified importing test utils --- test/specs/api.spec.js | 3 +-- test/specs/cli.spec.js | 2 +- test/specs/files.spec.js | 3 +-- test/specs/git-commit.spec.js | 4 +--- test/specs/git-push.spec.js | 4 +--- test/specs/git-tag.spec.js | 4 +--- test/specs/minor.spec.js | 3 +-- test/specs/npm.spec.js | 4 +--- test/specs/patch.spec.js | 3 +-- test/specs/premajor.spec.js | 3 +-- test/specs/preminor.spec.js | 3 +-- test/specs/prepatch.spec.js | 3 +-- test/specs/prerelease.spec.js | 3 +-- test/specs/release.spec.js | 3 +-- test/utils/index.js | 7 +++++++ 15 files changed, 21 insertions(+), 31 deletions(-) create mode 100644 test/utils/index.js diff --git a/test/specs/api.spec.js b/test/specs/api.spec.js index 82871fd..bb31774 100644 --- a/test/specs/api.spec.js +++ b/test/specs/api.spec.js @@ -1,8 +1,7 @@ "use strict"; const versionBump = require("../../"); -const mocks = require("../utils/mocks"); -const files = require("../utils/files"); +const { files, mocks } = require("../utils"); const ORIGINAL_CWD = process.cwd(); diff --git a/test/specs/cli.spec.js b/test/specs/cli.spec.js index 3a43b04..a000331 100644 --- a/test/specs/cli.spec.js +++ b/test/specs/cli.spec.js @@ -1,6 +1,6 @@ "use strict"; -const files = require("../utils/files"); +const { files } = require("../utils"); const chaiExec = require("chai-exec"); const manifest = require("../../package.json"); diff --git a/test/specs/files.spec.js b/test/specs/files.spec.js index 9f3c2ee..7b9c879 100644 --- a/test/specs/files.spec.js +++ b/test/specs/files.spec.js @@ -1,7 +1,6 @@ "use strict"; -const files = require("../utils/files"); -const check = require("../utils/check"); +const { check, files } = require("../utils"); const chaiExec = require("chai-exec"); describe.skip("bump [files...]", () => { diff --git a/test/specs/git-commit.spec.js b/test/specs/git-commit.spec.js index 0c8bbda..41ec414 100644 --- a/test/specs/git-commit.spec.js +++ b/test/specs/git-commit.spec.js @@ -1,8 +1,6 @@ "use strict"; -const mocks = require("../utils/mocks"); -const files = require("../utils/files"); -const check = require("../utils/check"); +const { check, files, mocks } = require("../utils"); const chaiExec = require("chai-exec"); describe.skip("bump --commit", () => { diff --git a/test/specs/git-push.spec.js b/test/specs/git-push.spec.js index 8f1e519..8e1506b 100644 --- a/test/specs/git-push.spec.js +++ b/test/specs/git-push.spec.js @@ -1,8 +1,6 @@ "use strict"; -const mocks = require("../utils/mocks"); -const files = require("../utils/files"); -const check = require("../utils/check"); +const { check, files, mocks } = require("../utils"); const chaiExec = require("chai-exec"); describe.skip("bump --push", () => { diff --git a/test/specs/git-tag.spec.js b/test/specs/git-tag.spec.js index d98aea1..aa57095 100644 --- a/test/specs/git-tag.spec.js +++ b/test/specs/git-tag.spec.js @@ -1,8 +1,6 @@ "use strict"; -const mocks = require("../utils/mocks"); -const files = require("../utils/files"); -const check = require("../utils/check"); +const { check, files, mocks } = require("../utils"); const chaiExec = require("chai-exec"); describe.skip("bump --tag", () => { diff --git a/test/specs/minor.spec.js b/test/specs/minor.spec.js index e2bd296..b679cbf 100644 --- a/test/specs/minor.spec.js +++ b/test/specs/minor.spec.js @@ -1,7 +1,6 @@ "use strict"; -const files = require("../utils/files"); -const check = require("../utils/check"); +const { check, files } = require("../utils"); const chaiExec = require("chai-exec"); describe.skip("bump --minor", () => { diff --git a/test/specs/npm.spec.js b/test/specs/npm.spec.js index aa4fda0..7d95b47 100644 --- a/test/specs/npm.spec.js +++ b/test/specs/npm.spec.js @@ -1,8 +1,6 @@ "use strict"; -const mocks = require("../utils/mocks"); -const files = require("../utils/files"); -const check = require("../utils/check"); +const { check, files, mocks } = require("../utils"); const chaiExec = require("chai-exec"); describe.skip("npm version hooks", () => { diff --git a/test/specs/patch.spec.js b/test/specs/patch.spec.js index a968e68..2f90256 100644 --- a/test/specs/patch.spec.js +++ b/test/specs/patch.spec.js @@ -1,7 +1,6 @@ "use strict"; -const files = require("../utils/files"); -const check = require("../utils/check"); +const { check, files } = require("../utils"); const chaiExec = require("chai-exec"); describe.skip("bump --patch", () => { diff --git a/test/specs/premajor.spec.js b/test/specs/premajor.spec.js index 00cf077..0ed2a52 100644 --- a/test/specs/premajor.spec.js +++ b/test/specs/premajor.spec.js @@ -1,7 +1,6 @@ "use strict"; -const files = require("../utils/files"); -const check = require("../utils/check"); +const { check, files } = require("../utils"); const chaiExec = require("chai-exec"); describe.skip("bump --premajor", () => { diff --git a/test/specs/preminor.spec.js b/test/specs/preminor.spec.js index dbe22e6..9994829 100644 --- a/test/specs/preminor.spec.js +++ b/test/specs/preminor.spec.js @@ -1,7 +1,6 @@ "use strict"; -const files = require("../utils/files"); -const check = require("../utils/check"); +const { check, files } = require("../utils"); const chaiExec = require("chai-exec"); describe.skip("bump --preminor", () => { diff --git a/test/specs/prepatch.spec.js b/test/specs/prepatch.spec.js index a33ab72..bf19554 100644 --- a/test/specs/prepatch.spec.js +++ b/test/specs/prepatch.spec.js @@ -1,7 +1,6 @@ "use strict"; -const files = require("../utils/files"); -const check = require("../utils/check"); +const { check, files } = require("../utils"); const chaiExec = require("chai-exec"); describe.skip("bump --prepatch", () => { diff --git a/test/specs/prerelease.spec.js b/test/specs/prerelease.spec.js index 2d00859..4fbb9ac 100644 --- a/test/specs/prerelease.spec.js +++ b/test/specs/prerelease.spec.js @@ -1,7 +1,6 @@ "use strict"; -const files = require("../utils/files"); -const check = require("../utils/check"); +const { check, files } = require("../utils"); const chaiExec = require("chai-exec"); describe.skip("bump --prerelease", () => { diff --git a/test/specs/release.spec.js b/test/specs/release.spec.js index 7d0efa6..0a6e1ee 100644 --- a/test/specs/release.spec.js +++ b/test/specs/release.spec.js @@ -1,7 +1,6 @@ "use strict"; -const files = require("../utils/files"); -const check = require("../utils/check"); +const { check, files } = require("../utils"); const chaiExec = require("chai-exec"); describe.skip("bump [release]", () => { diff --git a/test/utils/index.js b/test/utils/index.js new file mode 100644 index 0000000..37c05dd --- /dev/null +++ b/test/utils/index.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = { + check: require("./check"), + files: require("./files"), + mocks: require("./mocks"), +}; From 4ca890b16584eabdae6545aed80095957f8ca1c2 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Mon, 25 Feb 2019 06:50:10 -0600 Subject: [PATCH 049/106] Made the "exports" tests more explicit --- test/specs/exports.spec.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/test/specs/exports.spec.js b/test/specs/exports.spec.js index 051c356..e27a226 100644 --- a/test/specs/exports.spec.js +++ b/test/specs/exports.spec.js @@ -1,24 +1,27 @@ "use strict"; -const defaultExport = require("../../"); -const { versionBump: namedExport } = require("../../"); +const commonJSExport = require("../../"); +const { default: defaultExport, versionBump: namedExport } = require("../../"); -describe("version-bump-prompt module exports", () => { +describe.only("version-bump-prompt module exports", () => { - it("should export the versionBump() function as the default export", () => { + it("should export the versionBump() function as the default CommonJS export", () => { + commonJSExport.should.be.a("function"); + commonJSExport.name.should.equal("versionBump"); + }); + + it("should export the versionBump() function as the default ESM export", () => { defaultExport.should.be.a("function"); - defaultExport.should.have.property("default"); - defaultExport.default.should.equal(defaultExport); + defaultExport.should.equal(commonJSExport); }); it("should export the versionBump() function as a named export", () => { - defaultExport.should.have.property("versionBump"); namedExport.should.be.a("function"); - namedExport.should.equal(defaultExport); + namedExport.should.equal(commonJSExport); }); it("should not export anything else", () => { - Object.keys(defaultExport).should.have.same.members([ + Object.keys(commonJSExport).should.have.same.members([ "default", "versionBump", ]); From 38fae07083f8c2010dbfcdb073196eea03690c11 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Mon, 25 Feb 2019 07:01:21 -0600 Subject: [PATCH 050/106] Moved the Chai setup to a utility module --- .mocharc.yml | 1 - test/specs/cli.spec.js | 2 +- test/specs/exports.spec.js | 2 +- test/specs/files.spec.js | 2 +- test/specs/git-commit.spec.js | 2 +- test/specs/git-push.spec.js | 2 +- test/specs/git-tag.spec.js | 2 +- test/specs/minor.spec.js | 2 +- test/specs/npm.spec.js | 2 +- test/specs/patch.spec.js | 2 +- test/specs/premajor.spec.js | 2 +- test/specs/preminor.spec.js | 2 +- test/specs/prepatch.spec.js | 2 +- test/specs/prerelease.spec.js | 2 +- test/specs/release.spec.js | 2 +- test/{fixtures/setup-chai.js => utils/chai.js} | 5 +++++ 16 files changed, 19 insertions(+), 15 deletions(-) rename test/{fixtures/setup-chai.js => utils/chai.js} (80%) diff --git a/.mocharc.yml b/.mocharc.yml index f0fb05c..9821d1c 100644 --- a/.mocharc.yml +++ b/.mocharc.yml @@ -4,7 +4,6 @@ spec: - test/fixtures/mocha-hooks.js - - test/fixtures/setup-chai.js - test/specs/**/*.spec.js bail: true diff --git a/test/specs/cli.spec.js b/test/specs/cli.spec.js index a000331..45fc2a6 100644 --- a/test/specs/cli.spec.js +++ b/test/specs/cli.spec.js @@ -1,7 +1,7 @@ "use strict"; const { files } = require("../utils"); -const chaiExec = require("chai-exec"); +const { chaiExec, expect } = require("../utils/chai"); const manifest = require("../../package.json"); describe("bump", () => { diff --git a/test/specs/exports.spec.js b/test/specs/exports.spec.js index e27a226..30505b5 100644 --- a/test/specs/exports.spec.js +++ b/test/specs/exports.spec.js @@ -3,7 +3,7 @@ const commonJSExport = require("../../"); const { default: defaultExport, versionBump: namedExport } = require("../../"); -describe.only("version-bump-prompt module exports", () => { +describe("version-bump-prompt module exports", () => { it("should export the versionBump() function as the default CommonJS export", () => { commonJSExport.should.be.a("function"); diff --git a/test/specs/files.spec.js b/test/specs/files.spec.js index 7b9c879..02c945d 100644 --- a/test/specs/files.spec.js +++ b/test/specs/files.spec.js @@ -1,7 +1,7 @@ "use strict"; const { check, files } = require("../utils"); -const chaiExec = require("chai-exec"); +const { chaiExec, expect } = require("../utils/chai"); describe.skip("bump [files...]", () => { diff --git a/test/specs/git-commit.spec.js b/test/specs/git-commit.spec.js index 41ec414..0eb2944 100644 --- a/test/specs/git-commit.spec.js +++ b/test/specs/git-commit.spec.js @@ -1,7 +1,7 @@ "use strict"; const { check, files, mocks } = require("../utils"); -const chaiExec = require("chai-exec"); +const { chaiExec, expect } = require("../utils/chai"); describe.skip("bump --commit", () => { diff --git a/test/specs/git-push.spec.js b/test/specs/git-push.spec.js index 8e1506b..0106193 100644 --- a/test/specs/git-push.spec.js +++ b/test/specs/git-push.spec.js @@ -1,7 +1,7 @@ "use strict"; const { check, files, mocks } = require("../utils"); -const chaiExec = require("chai-exec"); +const { chaiExec, expect } = require("../utils/chai"); describe.skip("bump --push", () => { diff --git a/test/specs/git-tag.spec.js b/test/specs/git-tag.spec.js index aa57095..a043ea6 100644 --- a/test/specs/git-tag.spec.js +++ b/test/specs/git-tag.spec.js @@ -1,7 +1,7 @@ "use strict"; const { check, files, mocks } = require("../utils"); -const chaiExec = require("chai-exec"); +const { chaiExec, expect } = require("../utils/chai"); describe.skip("bump --tag", () => { diff --git a/test/specs/minor.spec.js b/test/specs/minor.spec.js index b679cbf..093a712 100644 --- a/test/specs/minor.spec.js +++ b/test/specs/minor.spec.js @@ -1,7 +1,7 @@ "use strict"; const { check, files } = require("../utils"); -const chaiExec = require("chai-exec"); +const { chaiExec, expect } = require("../utils/chai"); describe.skip("bump --minor", () => { it("should not increment a non-existent version number", () => { diff --git a/test/specs/npm.spec.js b/test/specs/npm.spec.js index 7d95b47..32c0912 100644 --- a/test/specs/npm.spec.js +++ b/test/specs/npm.spec.js @@ -1,7 +1,7 @@ "use strict"; const { check, files, mocks } = require("../utils"); -const chaiExec = require("chai-exec"); +const { chaiExec, expect } = require("../utils/chai"); describe.skip("npm version hooks", () => { if (process.platform === "win32" && process.env.CI) { diff --git a/test/specs/patch.spec.js b/test/specs/patch.spec.js index 2f90256..0933cd1 100644 --- a/test/specs/patch.spec.js +++ b/test/specs/patch.spec.js @@ -1,7 +1,7 @@ "use strict"; const { check, files } = require("../utils"); -const chaiExec = require("chai-exec"); +const { chaiExec, expect } = require("../utils/chai"); describe.skip("bump --patch", () => { it("should not increment a non-existent version number", () => { diff --git a/test/specs/premajor.spec.js b/test/specs/premajor.spec.js index 0ed2a52..d1072c9 100644 --- a/test/specs/premajor.spec.js +++ b/test/specs/premajor.spec.js @@ -1,7 +1,7 @@ "use strict"; const { check, files } = require("../utils"); -const chaiExec = require("chai-exec"); +const { chaiExec, expect } = require("../utils/chai"); describe.skip("bump --premajor", () => { it("should not increment a non-existent version number", () => { diff --git a/test/specs/preminor.spec.js b/test/specs/preminor.spec.js index 9994829..3eee0b3 100644 --- a/test/specs/preminor.spec.js +++ b/test/specs/preminor.spec.js @@ -1,7 +1,7 @@ "use strict"; const { check, files } = require("../utils"); -const chaiExec = require("chai-exec"); +const { chaiExec, expect } = require("../utils/chai"); describe.skip("bump --preminor", () => { it("should not increment a non-existent version number", () => { diff --git a/test/specs/prepatch.spec.js b/test/specs/prepatch.spec.js index bf19554..a293e39 100644 --- a/test/specs/prepatch.spec.js +++ b/test/specs/prepatch.spec.js @@ -1,7 +1,7 @@ "use strict"; const { check, files } = require("../utils"); -const chaiExec = require("chai-exec"); +const { chaiExec, expect } = require("../utils/chai"); describe.skip("bump --prepatch", () => { it("should not increment a non-existent version number", () => { diff --git a/test/specs/prerelease.spec.js b/test/specs/prerelease.spec.js index 4fbb9ac..db943ed 100644 --- a/test/specs/prerelease.spec.js +++ b/test/specs/prerelease.spec.js @@ -1,7 +1,7 @@ "use strict"; const { check, files } = require("../utils"); -const chaiExec = require("chai-exec"); +const { chaiExec, expect } = require("../utils/chai"); describe.skip("bump --prerelease", () => { it("should not increment a non-existent version number", () => { diff --git a/test/specs/release.spec.js b/test/specs/release.spec.js index 0a6e1ee..3e0350a 100644 --- a/test/specs/release.spec.js +++ b/test/specs/release.spec.js @@ -1,7 +1,7 @@ "use strict"; const { check, files } = require("../utils"); -const chaiExec = require("chai-exec"); +const { chaiExec, expect } = require("../utils/chai"); describe.skip("bump [release]", () => { diff --git a/test/fixtures/setup-chai.js b/test/utils/chai.js similarity index 80% rename from test/fixtures/setup-chai.js rename to test/utils/chai.js index f753718..7217d47 100644 --- a/test/fixtures/setup-chai.js +++ b/test/utils/chai.js @@ -3,6 +3,11 @@ const chai = require("chai"); const chaiExec = require("chai-exec"); +module.exports = { + chaiExec, + expect: chai.expect, +}; + chai.use(chaiExec); chai.should(); From 8dbef344e822ed111fcfffabf2d6fec610eff5da Mon Sep 17 00:00:00 2001 From: James Messinger Date: Mon, 25 Feb 2019 07:09:20 -0600 Subject: [PATCH 051/106] Switched from Chai's `should` syntax to `expect` syntax --- test/specs/api.spec.js | 33 +++++++------- test/specs/cli.spec.js | 84 +++++++++++++++++------------------ test/specs/exports.spec.js | 13 +++--- test/specs/files.spec.js | 44 +++++++++--------- test/specs/git-commit.spec.js | 32 ++++++------- test/specs/git-push.spec.js | 34 +++++++------- test/specs/git-tag.spec.js | 44 +++++++++--------- test/specs/minor.spec.js | 44 +++++++++--------- test/specs/npm.spec.js | 64 +++++++++++++------------- test/specs/patch.spec.js | 44 +++++++++--------- test/specs/premajor.spec.js | 44 +++++++++--------- test/specs/preminor.spec.js | 44 +++++++++--------- test/specs/prepatch.spec.js | 44 +++++++++--------- test/specs/prerelease.spec.js | 44 +++++++++--------- test/specs/release.spec.js | 36 +++++++-------- 15 files changed, 325 insertions(+), 323 deletions(-) diff --git a/test/specs/api.spec.js b/test/specs/api.spec.js index bb31774..b192e6a 100644 --- a/test/specs/api.spec.js +++ b/test/specs/api.spec.js @@ -2,6 +2,7 @@ const versionBump = require("../../"); const { files, mocks } = require("../utils"); +const { expect } = require("../utils/chai"); const ORIGINAL_CWD = process.cwd(); @@ -29,11 +30,11 @@ describe("versionBup() API", () => { }); // The package.json file should have been updated - files.json("package.json").should.deep.equal({ version: "2.34.567" }); + expect(files.json("package.json")).to.deep.equal({ version: "2.34.567" }); // Git and NPM should NOT have been called - mocks.git().should.be.empty; - mocks.npm().should.be.empty; + expect(mocks.git()).to.be.empty; + expect(mocks.npm()).to.be.empty; }); it("should accept a bump type", async () => { @@ -54,11 +55,11 @@ describe("versionBup() API", () => { }); // The package.json file should have been updated - files.json("package.json").should.deep.equal({ version: "1.1.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.1.0" }); // Git and NPM should NOT have been called - mocks.git().should.be.empty; - mocks.npm().should.be.empty; + expect(mocks.git()).to.be.empty; + expect(mocks.npm()).to.be.empty; }); it.skip("should accept options", async () => { @@ -95,10 +96,10 @@ describe("versionBup() API", () => { }); // The CWD should not have changed - process.cwd().should.equal(ORIGINAL_CWD); + expect(process.cwd()).to.equal(ORIGINAL_CWD); // The package.json file should NOT have been updated, because it wasn't in the `files` list - files.json("package.json").should.deep.equal({ version: "1.0.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.0.0" }); // The other two files should have been updated files.text("README.md", "The latest release is v1.1.0-test.1\n"); @@ -115,7 +116,7 @@ describe("versionBup() API", () => { ]); // NPM should NOT have been called - mocks.npm().should.be.empty; + expect(mocks.npm()).to.be.empty; }); it("should throw an error if the options are invalid", async () => { @@ -127,8 +128,8 @@ describe("versionBup() API", () => { ); } catch (error) { - error.should.be.an.instanceOf(Error); - error.message.should.equal("Invalid Version: hello world"); + expect(error).to.be.an.instanceOf(Error); + expect(error.message).to.equal("Invalid Version: hello world"); } }); @@ -147,21 +148,21 @@ describe("versionBup() API", () => { ); } catch (error) { - error.should.be.an.instanceOf(Error); + expect(error).to.be.an.instanceOf(Error); error.message.should.equal( "Unable to determine the current version number. " + "Checked package.json, package-lock.json." ); // The CWD should not have changed - process.cwd().should.equal(ORIGINAL_CWD); + expect(process.cwd()).to.equal(ORIGINAL_CWD); // The package.json file should not have changed - files.json("package.json").should.deep.equal({ version: "hello world" }); + expect(files.json("package.json")).to.deep.equal({ version: "hello world" }); // Git and NPM should NOT have been called - mocks.git().should.be.empty; - mocks.npm().should.be.empty; + expect(mocks.git()).to.be.empty; + expect(mocks.npm()).to.be.empty; } }); diff --git a/test/specs/cli.spec.js b/test/specs/cli.spec.js index 45fc2a6..67322ff 100644 --- a/test/specs/cli.spec.js +++ b/test/specs/cli.spec.js @@ -11,76 +11,76 @@ describe("bump", () => { let bump = chaiExec("", { timeout: 1000 }); - bump.signal.should.equal("SIGKILL"); + expect(bump.signal).to.equal("SIGKILL"); - bump.should.have.stderr(""); - bump.stdout.should.contain("PROMPT TEXT"); + expect(bump).to.have.stderr(""); + expect(bump.stdout).to.contain("PROMPT TEXT"); }); it("should error if an invalid argument is used", () => { let bump = chaiExec("--commit --help --fizzbuzz --tag"); - bump.should.have.exitCode(1); - bump.should.have.stdout(""); - bump.stderr.should.match(/^Unknown option: --fizzbuzz\n\nUsage: bump \[release\] \[options\] \[files...\]\n/); - bump.stderr.should.contain(manifest.description); + expect(bump).to.have.exitCode(1); + expect(bump).to.have.stdout(""); + expect(bump.stderr).to.match(/^Unknown option: --fizzbuzz\n\nUsage: bump \[release\] \[options\] \[files...\]\n/); + expect(bump.stderr).to.contain(manifest.description); }); it("should error if an invalid shorthand argument is used", () => { let bump = chaiExec("-chzt"); - bump.should.have.exitCode(1); - bump.should.have.stdout(""); - bump.stderr.should.match(/^Unknown option: -z\n\nUsage: bump \[release\] \[options\] \[files...\]\n/); - bump.stderr.should.contain(manifest.description); + expect(bump).to.have.exitCode(1); + expect(bump).to.have.stdout(""); + expect(bump.stderr).to.match(/^Unknown option: -z\n\nUsage: bump \[release\] \[options\] \[files...\]\n/); + expect(bump.stderr).to.contain(manifest.description); }); it("should error if an argument is missing its value", () => { let bump = chaiExec("--commit --help --preid --tag"); - bump.should.have.exitCode(1); - bump.should.have.stdout(""); + expect(bump).to.have.exitCode(1); + expect(bump).to.have.stdout(""); bump.stderr.should.match( /^The --preid option requires a value, such as "alpha", "beta", etc\.\n\nUsage: bump \[release\] \[options\] \[files...\]\n/ ); - bump.stderr.should.contain(manifest.description); + expect(bump.stderr).to.contain(manifest.description); }); describe("bump --help", () => { it("should show usage text", () => { let bump = chaiExec("--help"); - bump.should.have.exitCode(0); - bump.should.have.stderr(""); - bump.stdout.should.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/); - bump.stdout.should.contain(manifest.description); + expect(bump).to.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump.stdout).to.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/); + expect(bump.stdout).to.contain(manifest.description); }); it("should support -h shorthand", () => { let bump = chaiExec("-h"); - bump.should.have.exitCode(0); - bump.should.have.stderr(""); - bump.stdout.should.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/); - bump.stdout.should.contain(manifest.description); + expect(bump).to.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump.stdout).to.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/); + expect(bump.stdout).to.contain(manifest.description); }); it("should ignore other arguments", () => { let bump = chaiExec("--commit --help --tag"); - bump.should.have.exitCode(0); - bump.should.have.stderr(""); - bump.stdout.should.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/); - bump.stdout.should.contain(manifest.description); + expect(bump).to.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump.stdout).to.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/); + expect(bump.stdout).to.contain(manifest.description); }); it("should ignore other shorthand arguments", () => { let bump = chaiExec("-cht"); - bump.should.have.exitCode(0); - bump.should.have.stderr(""); - bump.stdout.should.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/); - bump.stdout.should.contain(manifest.description); + expect(bump).to.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump.stdout).to.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/); + expect(bump.stdout).to.contain(manifest.description); }); }); @@ -88,33 +88,33 @@ describe("bump", () => { it("should show the version number", () => { let bump = chaiExec("--version"); - bump.should.have.exitCode(0); - bump.should.have.stderr(""); - bump.should.have.stdout(manifest.version + "\n"); + expect(bump).to.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.stdout(manifest.version + "\n"); }); it("should support -v shorthand", () => { let bump = chaiExec("-v"); - bump.should.have.exitCode(0); - bump.should.have.stderr(""); - bump.should.have.stdout(manifest.version + "\n"); + expect(bump).to.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.stdout(manifest.version + "\n"); }); it("should ignore other arguments", () => { let bump = chaiExec("--commit --version --tag"); - bump.should.have.exitCode(0); - bump.should.have.stderr(""); - bump.should.have.stdout(manifest.version + "\n"); + expect(bump).to.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.stdout(manifest.version + "\n"); }); it("should ignore other shorthand arguments", () => { let bump = chaiExec("-cvt"); - bump.should.have.exitCode(0); - bump.should.have.stderr(""); - bump.should.have.stdout(manifest.version + "\n"); + expect(bump).to.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.stdout(manifest.version + "\n"); }); }); }); diff --git a/test/specs/exports.spec.js b/test/specs/exports.spec.js index 30505b5..21291b4 100644 --- a/test/specs/exports.spec.js +++ b/test/specs/exports.spec.js @@ -1,23 +1,24 @@ "use strict"; const commonJSExport = require("../../"); +const { expect } = require("../utils/chai"); const { default: defaultExport, versionBump: namedExport } = require("../../"); describe("version-bump-prompt module exports", () => { it("should export the versionBump() function as the default CommonJS export", () => { - commonJSExport.should.be.a("function"); - commonJSExport.name.should.equal("versionBump"); + expect(commonJSExport).to.be.a("function"); + expect(commonJSExport.name).to.equal("versionBump"); }); it("should export the versionBump() function as the default ESM export", () => { - defaultExport.should.be.a("function"); - defaultExport.should.equal(commonJSExport); + expect(defaultExport).to.be.a("function"); + expect(defaultExport).to.equal(commonJSExport); }); it("should export the versionBump() function as a named export", () => { - namedExport.should.be.a("function"); - namedExport.should.equal(commonJSExport); + expect(namedExport).to.be.a("function"); + expect(namedExport).to.equal(commonJSExport); }); it("should not export anything else", () => { diff --git a/test/specs/files.spec.js b/test/specs/files.spec.js index 02c945d..275a404 100644 --- a/test/specs/files.spec.js +++ b/test/specs/files.spec.js @@ -14,8 +14,8 @@ describe.skip("bump [files...]", () => { let bump = chaiExec("--major --grep LICENSE README.* *.js"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 2.0.0\n` + @@ -24,12 +24,12 @@ describe.skip("bump [files...]", () => { `${check} Updated LICENSE to 2.0.0\n` ); - files.json("package.json").version.should.equal("2.0.0"); - files.text("LICENSE").should.match(/MyApp v2.0.0 Copyright/); - files.text("README.md").should.match(/version 2.0.0 and v2.0.0 should both get updated/); - files.text("script1.js").should.match(/make sure v2.0.0 gets replaced correctly/); - files.text("script1.js").should.match(/let version = "2.0.0";/); - files.text("script1.js").should.match(/let version = "2.0.0";/); + expect(files.json("package.json").version).to.equal("2.0.0"); + expect(files.text("LICENSE")).to.match(/MyApp v2.0.0 Copyright/); + expect(files.text("README.md")).to.match(/version 2.0.0 and v2.0.0 should both get updated/); + expect(files.text("script1.js")).to.match(/make sure v2.0.0 gets replaced correctly/); + expect(files.text("script1.js")).to.match(/let version = "2.0.0";/); + expect(files.text("script1.js")).to.match(/let version = "2.0.0";/); }); it("should not replace other version numbers in non-manifest files", () => { @@ -41,8 +41,8 @@ describe.skip("bump [files...]", () => { let bump = chaiExec("--major --grep LICENSE README.* *.js"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 2.0.0\n` + @@ -51,8 +51,8 @@ describe.skip("bump [files...]", () => { `${check} Updated LICENSE to 2.0.0\n` ); - files.text("README.md").should.match(/version 5.6.7 and v8.9.10 should not be changed/); - files.text("script2.js").should.match(/version 3.2.1 and v8.9.10 don't match the old version number/); + expect(files.text("README.md")).to.match(/version 5.6.7 and v8.9.10 should not be changed/); + expect(files.text("script2.js")).to.match(/version 3.2.1 and v8.9.10 don't match the old version number/); }); it("should not not modify non-manifest files that don't contain the old version number", () => { @@ -64,21 +64,21 @@ describe.skip("bump [files...]", () => { let bump = chaiExec("--major --grep LICENSE README.* *.js"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 5.0.0\n` ); - files.json("package.json").version.should.equal("5.0.0"); - files.text("LICENSE").should.match(/MyApp v1.2.3 Copyright/); - files.text("README.md").should.match(/version 5.6.7 and v8.9.10 should not be changed/); - files.text("README.md").should.match(/version 1.2.3 and v1.2.3 should both get updated/); - files.text("script1.js").should.match(/make sure v1.2.3 gets replaced correctly/); - files.text("script1.js").should.match(/let version = "1.2.3";/); - files.text("script1.js").should.match(/let version = "1.2.3";/); - files.text("script2.js").should.match(/version 3.2.1 and v8.9.10 don't match the old version number/); + expect(files.json("package.json").version).to.equal("5.0.0"); + expect(files.text("LICENSE")).to.match(/MyApp v1.2.3 Copyright/); + expect(files.text("README.md")).to.match(/version 5.6.7 and v8.9.10 should not be changed/); + expect(files.text("README.md")).to.match(/version 1.2.3 and v1.2.3 should both get updated/); + expect(files.text("script1.js")).to.match(/make sure v1.2.3 gets replaced correctly/); + expect(files.text("script1.js")).to.match(/let version = "1.2.3";/); + expect(files.text("script1.js")).to.match(/let version = "1.2.3";/); + expect(files.text("script2.js")).to.match(/version 3.2.1 and v8.9.10 don't match the old version number/); }); }); diff --git a/test/specs/git-commit.spec.js b/test/specs/git-commit.spec.js index 0eb2944..b920f70 100644 --- a/test/specs/git-commit.spec.js +++ b/test/specs/git-commit.spec.js @@ -10,8 +10,8 @@ describe.skip("bump --commit", () => { let bump = chaiExec("--major --commit"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 2.0.0\n` + @@ -19,9 +19,9 @@ describe.skip("bump --commit", () => { ); let git = mocks.git(); - git.length.should.equal(1); + expect(git.length).to.equal(1); - git[0].cmd.should.equal('git commit package.json -m "release v2.0.0"'); + expect(git[0].cmd).to.equal('git commit package.json -m "release v2.0.0"'); }); it("should commit multiple manifest files to git", () => { @@ -31,8 +31,8 @@ describe.skip("bump --commit", () => { let bump = chaiExec("--minor --commit"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.1.0\n` + @@ -42,9 +42,9 @@ describe.skip("bump --commit", () => { ); let git = mocks.git(); - git.length.should.equal(1); + expect(git.length).to.equal(1); - git[0].cmd.should.equal('git commit package.json bower.json component.json -m "release v1.1.0"'); + expect(git[0].cmd).to.equal('git commit package.json bower.json component.json -m "release v1.1.0"'); }); it("should commit all files to git", () => { @@ -52,8 +52,8 @@ describe.skip("bump --commit", () => { let bump = chaiExec("--minor --commit --all"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.1.0\n` + @@ -61,9 +61,9 @@ describe.skip("bump --commit", () => { ); let git = mocks.git(); - git.length.should.equal(1); + expect(git.length).to.equal(1); - git[0].cmd.should.equal('git commit -a -m "release v1.1.0"'); + expect(git[0].cmd).to.equal('git commit -a -m "release v1.1.0"'); }); it("should commit the manifest files to git with a message", () => { @@ -71,8 +71,8 @@ describe.skip("bump --commit", () => { let bump = chaiExec("--patch --all --commit my-message"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.0.1\n` + @@ -80,9 +80,9 @@ describe.skip("bump --commit", () => { ); let git = mocks.git(); - git.length.should.equal(1); + expect(git.length).to.equal(1); - git[0].cmd.should.equal('git commit -a -m "v1.0.1 my-message"'); + expect(git[0].cmd).to.equal('git commit -a -m "v1.0.1 my-message"'); }); }); diff --git a/test/specs/git-push.spec.js b/test/specs/git-push.spec.js index 0106193..73c19bd 100644 --- a/test/specs/git-push.spec.js +++ b/test/specs/git-push.spec.js @@ -10,8 +10,8 @@ describe.skip("bump --push", () => { let bump = chaiExec("--major --push"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 2.0.0\n` + @@ -20,10 +20,10 @@ describe.skip("bump --push", () => { ); let git = mocks.git(); - git.length.should.equal(2); + expect(git.length).to.equal(2); - git[0].cmd.should.equal('git commit package.json -m "release v2.0.0"'); - git[1].cmd.should.equal("git push"); + expect(git[0].cmd).to.equal('git commit package.json -m "release v2.0.0"'); + expect(git[1].cmd).to.equal("git push"); }); it("should push all files", () => { @@ -31,8 +31,8 @@ describe.skip("bump --push", () => { let bump = chaiExec("--minor --push --all"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.1.0\n` + @@ -41,10 +41,10 @@ describe.skip("bump --push", () => { ); let git = mocks.git(); - git.length.should.equal(2); + expect(git.length).to.equal(2); - git[0].cmd.should.equal('git commit -a -m "release v1.1.0"'); - git[1].cmd.should.equal("git push"); + expect(git[0].cmd).to.equal('git commit -a -m "release v1.1.0"'); + expect(git[1].cmd).to.equal("git push"); }); it("should push git tags", () => { @@ -52,8 +52,8 @@ describe.skip("bump --push", () => { let bump = chaiExec("--premajor --tag --push"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 2.0.0-beta.0\n` + @@ -63,11 +63,11 @@ describe.skip("bump --push", () => { ); let git = mocks.git(); - git.length.should.equal(4); + expect(git.length).to.equal(4); - git[0].cmd.should.equal('git commit package.json -m "release v2.0.0-beta.0"'); - git[1].cmd.should.equal("git tag -a v2.0.0-beta.0 -m 2.0.0-beta.0"); - git[2].cmd.should.equal("git push"); - git[3].cmd.should.equal("git push --tags"); + expect(git[0].cmd).to.equal('git commit package.json -m "release v2.0.0-beta.0"'); + expect(git[1].cmd).to.equal("git tag -a v2.0.0-beta.0 -m 2.0.0-beta.0"); + expect(git[2].cmd).to.equal("git push"); + expect(git[3].cmd).to.equal("git push --tags"); }); }); diff --git a/test/specs/git-tag.spec.js b/test/specs/git-tag.spec.js index a043ea6..ab9a205 100644 --- a/test/specs/git-tag.spec.js +++ b/test/specs/git-tag.spec.js @@ -10,8 +10,8 @@ describe.skip("bump --tag", () => { let bump = chaiExec("--major --commit --tag"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 2.0.0\n` + @@ -20,10 +20,10 @@ describe.skip("bump --tag", () => { ); let git = mocks.git(); - git.length.should.equal(2); + expect(git.length).to.equal(2); - git[0].cmd.should.equal('git commit package.json -m "release v2.0.0"'); - git[1].cmd.should.equal("git tag -a v2.0.0 -m 2.0.0"); + expect(git[0].cmd).to.equal('git commit package.json -m "release v2.0.0"'); + expect(git[1].cmd).to.equal("git tag -a v2.0.0 -m 2.0.0"); }); it("should add a git tag, even if --commit is not specified", () => { @@ -31,8 +31,8 @@ describe.skip("bump --tag", () => { let bump = chaiExec("--minor --tag"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.1.0\n` + @@ -41,10 +41,10 @@ describe.skip("bump --tag", () => { ); let git = mocks.git(); - git.length.should.equal(2); + expect(git.length).to.equal(2); - git[0].cmd.should.equal('git commit package.json -m "release v1.1.0"'); - git[1].cmd.should.equal("git tag -a v1.1.0 -m 1.1.0"); + expect(git[0].cmd).to.equal('git commit package.json -m "release v1.1.0"'); + expect(git[1].cmd).to.equal("git tag -a v1.1.0 -m 1.1.0"); }); it("should tag all files", () => { @@ -52,8 +52,8 @@ describe.skip("bump --tag", () => { let bump = chaiExec("--patch --tag --all"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.0.1\n` + @@ -62,10 +62,10 @@ describe.skip("bump --tag", () => { ); let git = mocks.git(); - git.length.should.equal(2); + expect(git.length).to.equal(2); - git[0].cmd.should.equal('git commit -a -m "release v1.0.1"'); - git[1].cmd.should.equal("git tag -a v1.0.1 -m 1.0.1"); + expect(git[0].cmd).to.equal('git commit -a -m "release v1.0.1"'); + expect(git[1].cmd).to.equal("git tag -a v1.0.1 -m 1.0.1"); }); it("should push git tags", () => { @@ -74,8 +74,8 @@ describe.skip("bump --tag", () => { let bump = chaiExec("--premajor --tag --push"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 2.0.0-beta.0\n` + @@ -86,11 +86,11 @@ describe.skip("bump --tag", () => { ); let git = mocks.git(); - git.length.should.equal(4); + expect(git.length).to.equal(4); - git[0].cmd.should.equal('git commit package.json bower.json -m "release v2.0.0-beta.0"'); - git[1].cmd.should.equal("git tag -a v2.0.0-beta.0 -m 2.0.0-beta.0"); - git[2].cmd.should.equal("git push"); - git[3].cmd.should.equal("git push --tags"); + expect(git[0].cmd).to.equal('git commit package.json bower.json -m "release v2.0.0-beta.0"'); + expect(git[1].cmd).to.equal("git tag -a v2.0.0-beta.0 -m 2.0.0-beta.0"); + expect(git[2].cmd).to.equal("git push"); + expect(git[3].cmd).to.equal("git push --tags"); }); }); diff --git a/test/specs/minor.spec.js b/test/specs/minor.spec.js index 093a712..6271ce2 100644 --- a/test/specs/minor.spec.js +++ b/test/specs/minor.spec.js @@ -10,12 +10,12 @@ describe.skip("bump --minor", () => { let bump = chaiExec("--minor"); - bump.should.have.stderr(""); - bump.should.have.stdout(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.stdout(""); + expect(bump).to.have.exitCode(0); - files.json("package.json").should.deep.equal({}); - files.json("bower.json").should.deep.equal({ name: "my-app" }); + expect(files.json("package.json")).to.deep.equal({}); + expect(files.json("bower.json")).to.deep.equal({ name: "my-app" }); }); it("should treat empty version numbers as 0.0.0", () => { @@ -25,8 +25,8 @@ describe.skip("bump --minor", () => { let bump = chaiExec("--minor"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 0.1.0\n` + @@ -34,9 +34,9 @@ describe.skip("bump --minor", () => { `${check} Updated component.json to 0.1.0\n` ); - files.json("package.json").should.deep.equal({ version: "0.1.0" }); - files.json("bower.json").should.deep.equal({ version: "0.1.0" }); - files.json("component.json").should.deep.equal({ version: "0.1.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "0.1.0" }); + expect(files.json("bower.json")).to.deep.equal({ version: "0.1.0" }); + expect(files.json("component.json")).to.deep.equal({ version: "0.1.0" }); }); it("should increment an all-zero version number", () => { @@ -44,14 +44,14 @@ describe.skip("bump --minor", () => { let bump = chaiExec("--minor"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 0.1.0\n` ); - files.json("package.json").should.deep.equal({ version: "0.1.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "0.1.0" }); }); it("should reset the patch", () => { @@ -59,14 +59,14 @@ describe.skip("bump --minor", () => { let bump = chaiExec("--minor"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.3.0\n` ); - files.json("package.json").should.deep.equal({ version: "1.3.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.3.0" }); }); it("should reset the prerelease version", () => { @@ -74,14 +74,14 @@ describe.skip("bump --minor", () => { let bump = chaiExec("--minor"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.3.0\n` ); - files.json("package.json").should.deep.equal({ version: "1.3.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.3.0" }); }); it("should not be affected by the --preid flag", () => { @@ -89,13 +89,13 @@ describe.skip("bump --minor", () => { let bump = chaiExec("--minor --preid alpha"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.3.0\n` ); - files.json("package.json").should.deep.equal({ version: "1.3.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.3.0" }); }); }); diff --git a/test/specs/npm.spec.js b/test/specs/npm.spec.js index 32c0912..a649efb 100644 --- a/test/specs/npm.spec.js +++ b/test/specs/npm.spec.js @@ -20,18 +20,18 @@ describe.skip("npm version hooks", () => { let bump = chaiExec("--major"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 2.0.0\n` ); let npm = mocks.npm(); - npm.length.should.equal(1); + expect(npm.length).to.equal(1); - npm[0].cmd.should.equal("npm run preversion"); - npm[0].version.should.equal("1.0.0"); + expect(npm[0].cmd).to.equal("npm run preversion"); + expect(npm[0].version).to.equal("1.0.0"); }); it("should run the version script after updating the version number", () => { @@ -44,18 +44,18 @@ describe.skip("npm version hooks", () => { let bump = chaiExec("--major"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 2.0.0\n` ); let npm = mocks.npm(); - npm.length.should.equal(1); + expect(npm.length).to.equal(1); - npm[0].cmd.should.equal("npm run version"); - npm[0].version.should.equal("2.0.0"); + expect(npm[0].cmd).to.equal("npm run version"); + expect(npm[0].version).to.equal("2.0.0"); }); it("should run the postversion script after updating the version number", () => { @@ -68,18 +68,18 @@ describe.skip("npm version hooks", () => { let bump = chaiExec("--major"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 2.0.0\n` ); let npm = mocks.npm(); - npm.length.should.equal(1); + expect(npm.length).to.equal(1); - npm[0].cmd.should.equal("npm run postversion"); - npm[0].version.should.equal("2.0.0"); + expect(npm[0].cmd).to.equal("npm run postversion"); + expect(npm[0].version).to.equal("2.0.0"); }); it("should run all the version scripts and git commands in the correct order", () => { @@ -94,8 +94,8 @@ describe.skip("npm version hooks", () => { let bump = chaiExec("--major --commit --tag --push"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 2.0.0\n` + @@ -105,34 +105,34 @@ describe.skip("npm version hooks", () => { ); let bin = mocks.all(); - bin.length.should.equal(7); + expect(bin.length).to.equal(7); // The preversion script runs before anything - bin[0].cmd.should.equal("npm run preversion"); - bin[0].version.should.equal("1.0.0"); + expect(bin[0].cmd).to.equal("npm run preversion"); + expect(bin[0].version).to.equal("1.0.0"); // The version script runs after the version has been updated, - bin[1].cmd.should.equal("npm run version"); - bin[1].version.should.equal("2.0.0"); + expect(bin[1].cmd).to.equal("npm run version"); + expect(bin[1].version).to.equal("2.0.0"); // Git commit happens after the version has been updated - bin[2].cmd.should.equal('git commit package.json -m "release v2.0.0"'); - bin[2].version.should.equal("2.0.0"); + expect(bin[2].cmd).to.equal('git commit package.json -m "release v2.0.0"'); + expect(bin[2].version).to.equal("2.0.0"); // Git tag happens after the version has been updated - bin[3].cmd.should.equal("git tag -a v2.0.0 -m 2.0.0"); - bin[3].version.should.equal("2.0.0"); + expect(bin[3].cmd).to.equal("git tag -a v2.0.0 -m 2.0.0"); + expect(bin[3].version).to.equal("2.0.0"); // The postversion script runs AFTER "git commit" and "git tag", but BEFORE "git push" - bin[4].cmd.should.equal("npm run postversion"); - bin[4].version.should.equal("2.0.0"); + expect(bin[4].cmd).to.equal("npm run postversion"); + expect(bin[4].version).to.equal("2.0.0"); // Git push happens after everything else - bin[5].cmd.should.equal("git push"); - bin[5].version.should.equal("2.0.0"); + expect(bin[5].cmd).to.equal("git push"); + expect(bin[5].version).to.equal("2.0.0"); - bin[6].cmd.should.equal("git push --tags"); - bin[6].version.should.equal("2.0.0"); + expect(bin[6].cmd).to.equal("git push --tags"); + expect(bin[6].version).to.equal("2.0.0"); }); }); diff --git a/test/specs/patch.spec.js b/test/specs/patch.spec.js index 0933cd1..daecba9 100644 --- a/test/specs/patch.spec.js +++ b/test/specs/patch.spec.js @@ -10,12 +10,12 @@ describe.skip("bump --patch", () => { let bump = chaiExec("--patch"); - bump.should.have.stderr(""); - bump.should.have.stdout(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.stdout(""); + expect(bump).to.have.exitCode(0); - files.json("package.json").should.deep.equal({}); - files.json("bower.json").should.deep.equal({ name: "my-app" }); + expect(files.json("package.json")).to.deep.equal({}); + expect(files.json("bower.json")).to.deep.equal({ name: "my-app" }); }); it("should treat empty version numbers as 0.0.0", () => { @@ -25,8 +25,8 @@ describe.skip("bump --patch", () => { let bump = chaiExec("--patch"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 0.0.1\n` + @@ -34,9 +34,9 @@ describe.skip("bump --patch", () => { `${check} Updated component.json to 0.0.1\n` ); - files.json("package.json").should.deep.equal({ version: "0.0.1" }); - files.json("bower.json").should.deep.equal({ version: "0.0.1" }); - files.json("component.json").should.deep.equal({ version: "0.0.1" }); + expect(files.json("package.json")).to.deep.equal({ version: "0.0.1" }); + expect(files.json("bower.json")).to.deep.equal({ version: "0.0.1" }); + expect(files.json("component.json")).to.deep.equal({ version: "0.0.1" }); }); it("should increment an all-zero version number", () => { @@ -44,14 +44,14 @@ describe.skip("bump --patch", () => { let bump = chaiExec("--patch"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 0.0.1\n` ); - files.json("package.json").should.deep.equal({ version: "0.0.1" }); + expect(files.json("package.json")).to.deep.equal({ version: "0.0.1" }); }); it("should increment the patch", () => { @@ -59,14 +59,14 @@ describe.skip("bump --patch", () => { let bump = chaiExec("--patch"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.2.4\n` ); - files.json("package.json").should.deep.equal({ version: "1.2.4" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.2.4" }); }); it("should reset the prerelease version", () => { @@ -74,14 +74,14 @@ describe.skip("bump --patch", () => { let bump = chaiExec("--patch"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.2.3\n` ); - files.json("package.json").should.deep.equal({ version: "1.2.3" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.2.3" }); }); it("should not be affected by the --preid flag", () => { @@ -89,13 +89,13 @@ describe.skip("bump --patch", () => { let bump = chaiExec("--patch --preid alpha"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.2.3\n` ); - files.json("package.json").should.deep.equal({ version: "1.2.3" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.2.3" }); }); }); diff --git a/test/specs/premajor.spec.js b/test/specs/premajor.spec.js index d1072c9..2264530 100644 --- a/test/specs/premajor.spec.js +++ b/test/specs/premajor.spec.js @@ -10,12 +10,12 @@ describe.skip("bump --premajor", () => { let bump = chaiExec("--premajor"); - bump.should.have.stderr(""); - bump.should.have.stdout(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.stdout(""); + expect(bump).to.have.exitCode(0); - files.json("package.json").should.deep.equal({}); - files.json("bower.json").should.deep.equal({ name: "my-app" }); + expect(files.json("package.json")).to.deep.equal({}); + expect(files.json("bower.json")).to.deep.equal({ name: "my-app" }); }); it("should treat empty version numbers as 0.0.0", () => { @@ -25,8 +25,8 @@ describe.skip("bump --premajor", () => { let bump = chaiExec("--premajor"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.0.0-beta.0\n` + @@ -34,9 +34,9 @@ describe.skip("bump --premajor", () => { `${check} Updated component.json to 1.0.0-beta.0\n` ); - files.json("package.json").should.deep.equal({ version: "1.0.0-beta.0" }); - files.json("bower.json").should.deep.equal({ version: "1.0.0-beta.0" }); - files.json("component.json").should.deep.equal({ version: "1.0.0-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.0.0-beta.0" }); + expect(files.json("bower.json")).to.deep.equal({ version: "1.0.0-beta.0" }); + expect(files.json("component.json")).to.deep.equal({ version: "1.0.0-beta.0" }); }); it("should increment an all-zero version number", () => { @@ -44,14 +44,14 @@ describe.skip("bump --premajor", () => { let bump = chaiExec("--premajor"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.0.0-beta.0\n` ); - files.json("package.json").should.deep.equal({ version: "1.0.0-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.0.0-beta.0" }); }); it("should reset the minor and patch", () => { @@ -59,14 +59,14 @@ describe.skip("bump --premajor", () => { let bump = chaiExec("--premajor"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 2.0.0-beta.0\n` ); - files.json("package.json").should.deep.equal({ version: "2.0.0-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "2.0.0-beta.0" }); }); it("should reset the prerelease version", () => { @@ -74,14 +74,14 @@ describe.skip("bump --premajor", () => { let bump = chaiExec("--premajor"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 2.0.0-beta.0\n` ); - files.json("package.json").should.deep.equal({ version: "2.0.0-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "2.0.0-beta.0" }); }); it("should honor the --preid flag", () => { @@ -89,13 +89,13 @@ describe.skip("bump --premajor", () => { let bump = chaiExec("--premajor --preid alpha"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 2.0.0-alpha.0\n` ); - files.json("package.json").should.deep.equal({ version: "2.0.0-alpha.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "2.0.0-alpha.0" }); }); }); diff --git a/test/specs/preminor.spec.js b/test/specs/preminor.spec.js index 3eee0b3..f7e5ab5 100644 --- a/test/specs/preminor.spec.js +++ b/test/specs/preminor.spec.js @@ -10,12 +10,12 @@ describe.skip("bump --preminor", () => { let bump = chaiExec("--preminor"); - bump.should.have.stderr(""); - bump.should.have.stdout(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.stdout(""); + expect(bump).to.have.exitCode(0); - files.json("package.json").should.deep.equal({}); - files.json("bower.json").should.deep.equal({ name: "my-app" }); + expect(files.json("package.json")).to.deep.equal({}); + expect(files.json("bower.json")).to.deep.equal({ name: "my-app" }); }); it("should treat empty version numbers as 0.0.0", () => { @@ -25,8 +25,8 @@ describe.skip("bump --preminor", () => { let bump = chaiExec("--preminor"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 0.1.0-beta.0\n` + @@ -34,9 +34,9 @@ describe.skip("bump --preminor", () => { `${check} Updated component.json to 0.1.0-beta.0\n` ); - files.json("package.json").should.deep.equal({ version: "0.1.0-beta.0" }); - files.json("bower.json").should.deep.equal({ version: "0.1.0-beta.0" }); - files.json("component.json").should.deep.equal({ version: "0.1.0-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "0.1.0-beta.0" }); + expect(files.json("bower.json")).to.deep.equal({ version: "0.1.0-beta.0" }); + expect(files.json("component.json")).to.deep.equal({ version: "0.1.0-beta.0" }); }); it("should increment an all-zero version number", () => { @@ -44,14 +44,14 @@ describe.skip("bump --preminor", () => { let bump = chaiExec("--preminor"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 0.1.0-beta.0\n` ); - files.json("package.json").should.deep.equal({ version: "0.1.0-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "0.1.0-beta.0" }); }); it("should reset the minor and patch", () => { @@ -59,14 +59,14 @@ describe.skip("bump --preminor", () => { let bump = chaiExec("--preminor"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.3.0-beta.0\n` ); - files.json("package.json").should.deep.equal({ version: "1.3.0-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.3.0-beta.0" }); }); it("should reset the prerelease version", () => { @@ -74,14 +74,14 @@ describe.skip("bump --preminor", () => { let bump = chaiExec("--preminor"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.3.0-beta.0\n` ); - files.json("package.json").should.deep.equal({ version: "1.3.0-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.3.0-beta.0" }); }); it("should honor the --preid flag", () => { @@ -89,13 +89,13 @@ describe.skip("bump --preminor", () => { let bump = chaiExec("--preminor --preid alpha"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.3.0-alpha.0\n` ); - files.json("package.json").should.deep.equal({ version: "1.3.0-alpha.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.3.0-alpha.0" }); }); }); diff --git a/test/specs/prepatch.spec.js b/test/specs/prepatch.spec.js index a293e39..eea49d7 100644 --- a/test/specs/prepatch.spec.js +++ b/test/specs/prepatch.spec.js @@ -10,12 +10,12 @@ describe.skip("bump --prepatch", () => { let bump = chaiExec("--prepatch"); - bump.should.have.stderr(""); - bump.should.have.stdout(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.stdout(""); + expect(bump).to.have.exitCode(0); - files.json("package.json").should.deep.equal({}); - files.json("bower.json").should.deep.equal({ name: "my-app" }); + expect(files.json("package.json")).to.deep.equal({}); + expect(files.json("bower.json")).to.deep.equal({ name: "my-app" }); }); it("should treat empty version numbers as 0.0.0", () => { @@ -25,8 +25,8 @@ describe.skip("bump --prepatch", () => { let bump = chaiExec("--prepatch"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 0.0.1-beta.0\n` + @@ -34,9 +34,9 @@ describe.skip("bump --prepatch", () => { `${check} Updated component.json to 0.0.1-beta.0\n` ); - files.json("package.json").should.deep.equal({ version: "0.0.1-beta.0" }); - files.json("bower.json").should.deep.equal({ version: "0.0.1-beta.0" }); - files.json("component.json").should.deep.equal({ version: "0.0.1-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "0.0.1-beta.0" }); + expect(files.json("bower.json")).to.deep.equal({ version: "0.0.1-beta.0" }); + expect(files.json("component.json")).to.deep.equal({ version: "0.0.1-beta.0" }); }); it("should increment an all-zero version number", () => { @@ -44,14 +44,14 @@ describe.skip("bump --prepatch", () => { let bump = chaiExec("--prepatch"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 0.0.1-beta.0\n` ); - files.json("package.json").should.deep.equal({ version: "0.0.1-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "0.0.1-beta.0" }); }); it("should reset the minor and patch", () => { @@ -59,14 +59,14 @@ describe.skip("bump --prepatch", () => { let bump = chaiExec("--prepatch"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.2.4-beta.0\n` ); - files.json("package.json").should.deep.equal({ version: "1.2.4-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.2.4-beta.0" }); }); it("should reset the prerelease version", () => { @@ -74,14 +74,14 @@ describe.skip("bump --prepatch", () => { let bump = chaiExec("--prepatch"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.2.4-beta.0\n` ); - files.json("package.json").should.deep.equal({ version: "1.2.4-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.2.4-beta.0" }); }); it("should honor the --preid flag", () => { @@ -89,13 +89,13 @@ describe.skip("bump --prepatch", () => { let bump = chaiExec("--prepatch --preid alpha"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.2.4-alpha.0\n` ); - files.json("package.json").should.deep.equal({ version: "1.2.4-alpha.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.2.4-alpha.0" }); }); }); diff --git a/test/specs/prerelease.spec.js b/test/specs/prerelease.spec.js index db943ed..9f60789 100644 --- a/test/specs/prerelease.spec.js +++ b/test/specs/prerelease.spec.js @@ -10,12 +10,12 @@ describe.skip("bump --prerelease", () => { let bump = chaiExec("--prerelease"); - bump.should.have.stderr(""); - bump.should.have.stdout(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.stdout(""); + expect(bump).to.have.exitCode(0); - files.json("package.json").should.deep.equal({}); - files.json("bower.json").should.deep.equal({ name: "my-app" }); + expect(files.json("package.json")).to.deep.equal({}); + expect(files.json("bower.json")).to.deep.equal({ name: "my-app" }); }); it("should treat empty version numbers as 0.0.0", () => { @@ -25,8 +25,8 @@ describe.skip("bump --prerelease", () => { let bump = chaiExec("--prerelease"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 0.0.1-beta.0\n` + @@ -34,9 +34,9 @@ describe.skip("bump --prerelease", () => { `${check} Updated component.json to 0.0.1-beta.0\n` ); - files.json("package.json").should.deep.equal({ version: "0.0.1-beta.0" }); - files.json("bower.json").should.deep.equal({ version: "0.0.1-beta.0" }); - files.json("component.json").should.deep.equal({ version: "0.0.1-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "0.0.1-beta.0" }); + expect(files.json("bower.json")).to.deep.equal({ version: "0.0.1-beta.0" }); + expect(files.json("component.json")).to.deep.equal({ version: "0.0.1-beta.0" }); }); it("should increment an all-zero version number", () => { @@ -44,14 +44,14 @@ describe.skip("bump --prerelease", () => { let bump = chaiExec("--prerelease"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 0.0.1-beta.0\n` ); - files.json("package.json").should.deep.equal({ version: "0.0.1-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "0.0.1-beta.0" }); }); it("should reset the minor and patch", () => { @@ -59,14 +59,14 @@ describe.skip("bump --prerelease", () => { let bump = chaiExec("--prerelease"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.2.4-beta.0\n` ); - files.json("package.json").should.deep.equal({ version: "1.2.4-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.2.4-beta.0" }); }); it("should reset the prerelease version", () => { @@ -74,14 +74,14 @@ describe.skip("bump --prerelease", () => { let bump = chaiExec("--prerelease"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.2.3-beta.5\n` ); - files.json("package.json").should.deep.equal({ version: "1.2.3-beta.5" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.2.3-beta.5" }); }); it("should honor the --preid flag", () => { @@ -89,13 +89,13 @@ describe.skip("bump --prerelease", () => { let bump = chaiExec("--prerelease --preid alpha"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.2.3-alpha.0\n` ); - files.json("package.json").should.deep.equal({ version: "1.2.3-alpha.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.2.3-alpha.0" }); }); }); diff --git a/test/specs/release.spec.js b/test/specs/release.spec.js index 3e0350a..5aa2863 100644 --- a/test/specs/release.spec.js +++ b/test/specs/release.spec.js @@ -10,14 +10,14 @@ describe.skip("bump [release]", () => { let bump = chaiExec("major"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 1.0.0\n` ); - files.json("package.json").should.deep.equal({ version: "1.0.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.0.0" }); }); it("should reset the minor and patch", () => { @@ -25,14 +25,14 @@ describe.skip("bump [release]", () => { let bump = chaiExec("--major"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 2.0.0\n` ); - files.json("package.json").should.deep.equal({ version: "2.0.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "2.0.0" }); }); it("should reset the prerelease version", () => { @@ -40,14 +40,14 @@ describe.skip("bump [release]", () => { let bump = chaiExec("--major"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 2.0.0\n` ); - files.json("package.json").should.deep.equal({ version: "2.0.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "2.0.0" }); }); it("should not be affected by the --preid flag", () => { @@ -55,14 +55,14 @@ describe.skip("bump [release]", () => { let bump = chaiExec("--major --preid alpha"); - bump.should.have.stderr(""); - bump.should.have.exitCode(0); + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); bump.should.have.stdout( `${check} Updated package.json to 2.0.0\n` ); - files.json("package.json").should.deep.equal({ version: "2.0.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "2.0.0" }); }); it("should error if there's no current version number", () => { @@ -70,14 +70,14 @@ describe.skip("bump [release]", () => { let bump = chaiExec("major"); - bump.should.have.stdout(""); - bump.should.have.exitCode(2); + expect(bump).to.have.stdout(""); + expect(bump).to.have.exitCode(2); bump.should.have.stderr( "Unable to determine the current version number. Checked package.json, package-lock.json.\n" ); - files.json("package.json").should.deep.equal({}); + expect(files.json("package.json")).to.deep.equal({}); }); it("should print a more detailed error if DEBUG is set", () => { @@ -85,14 +85,14 @@ describe.skip("bump [release]", () => { let bump = chaiExec("major", { env: { DEBUG: "true" }}); - bump.should.have.stdout(""); - bump.should.have.exitCode(2); + expect(bump).to.have.stdout(""); + expect(bump).to.have.exitCode(2); bump.should.have.stderr.that.matches( /^Error: Unable to determine the current version number. Checked package.json, package-lock.json.\n\s+at \w+/ ); - files.json("package.json").should.deep.equal({}); + expect(files.json("package.json")).to.deep.equal({}); }); }); From efb6e213abcd15c273a9a82dfb01f28b1e39b356 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Mon, 25 Feb 2019 07:33:23 -0600 Subject: [PATCH 052/106] Export all external-facing type definitions --- src/index.ts | 10 ++++++---- src/release-type.ts | 3 ++- src/version-bump-results.ts | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index 13a9058..b8af7cd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,10 +1,12 @@ +// tslint:disable: no-default-export import { versionBump } from "./version-bump"; -export { versionBump } from "./version-bump"; -export { VersionBumpOptions } from "./version-bump-options"; -export { VersionBumpResults } from "./version-bump-results"; +// Exprot the external type definitions as named exports +export * from "./version-bump-options"; +export * from "./version-bump-results"; -// tslint:disable-next-line: no-default-export +// Export `versionBump` as a named export and the default export +export { versionBump }; export default versionBump; // CommonJS default export hack diff --git a/src/release-type.ts b/src/release-type.ts index 3f4eea0..6816166 100644 --- a/src/release-type.ts +++ b/src/release-type.ts @@ -1,5 +1,6 @@ import { ReleaseType } from "semver"; -export { ReleaseType } from "semver"; + +export { ReleaseType }; /** * The different types of pre-releases. diff --git a/src/version-bump-results.ts b/src/version-bump-results.ts index 473dad4..8f411a4 100644 --- a/src/version-bump-results.ts +++ b/src/version-bump-results.ts @@ -1,5 +1,7 @@ import { ReleaseType } from "./release-type"; +export { ReleaseType }; + /** * Information about the work that was performed by the `versionBump()` function. */ From 902e04ab4e39a51f2fffaed96cb551363878df9d Mon Sep 17 00:00:00 2001 From: James Messinger Date: Mon, 25 Feb 2019 07:33:35 -0600 Subject: [PATCH 053/106] Fixed a couple typos --- src/options.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/options.ts b/src/options.ts index 5658616..39f2876 100644 --- a/src/options.ts +++ b/src/options.ts @@ -31,7 +31,7 @@ export class Options { private constructor(props: Readonly) { Object.assign(this, props); - if (this.release === "prompt" && !(this.interface.input && this.interface)) { + if (this.release === "prompt" && !(this.interface.input && this.interface.output)) { throw new Error(`Cannot prompt for the version number because input or output has been disabled.`); } } @@ -96,7 +96,7 @@ export class Options { input = process.stdin; } - if (output === true || (output !== false && !input)) { + if (output === true || (output !== false && !output)) { output = process.stdout; } From 1b9bfddd158eca1f507ddf2091372648dd800561 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Mon, 25 Feb 2019 07:38:19 -0600 Subject: [PATCH 054/106] Removed debugging code --- src/cli/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cli/index.ts b/src/cli/index.ts index 9d72299..bbf1067 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -44,8 +44,7 @@ export async function main(args: string[]): Promise { async function bump(options: VersionBumpOptions): Promise { try { - let results = await versionBump(options); - console.log("\n\nRESULTS:", results, "\n\n"); + await versionBump(options); } catch (error) { let message = (error as Error).message; From 6114d04b4d2ff715c9d10c7b53818b274fb185ee Mon Sep 17 00:00:00 2001 From: James Messinger Date: Tue, 26 Feb 2019 06:14:11 -0600 Subject: [PATCH 055/106] Updated Twitter handle --- _config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_config.yml b/_config.yml index f48341b..fe4821f 100644 --- a/_config.yml +++ b/_config.yml @@ -4,12 +4,12 @@ title: Version Bump Prompt logo: https://jsdevtools.org/img/logos/logo.png author: - twitter: JS_DevTools + twitter: JSDevTools google_analytics: UA-68102273-3 twitter: - username: JS_DevTools + username: JSDevTools card: summary defaults: From 902bc4b0bcd542e94a50bafaf73f2122051d2f87 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Tue, 26 Feb 2019 06:28:20 -0600 Subject: [PATCH 056/106] Added the "--no-verify" option --- src/cli/help.ts | 6 +++++- src/cli/parse-args.ts | 2 ++ src/options.ts | 4 +++- src/version-bump-options.ts | 7 +++++++ test/specs/git-commit.spec.js | 19 +++++++++++++++++++ 5 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/cli/help.ts b/src/cli/help.ts index 445c51b..f42b82e 100644 --- a/src/cli/help.ts +++ b/src/cli/help.ts @@ -33,7 +33,11 @@ options: -p, --push Push the Git commit. -a, --all Commit/tag/push ALL pending files, - not just the ones changed by bump (git commit -a) + not just the ones that were bumped. + (same as "git commit -a") + + --no-verify Bypass Git commit hooks + (same as "git commit --no-verify") -v, --version Show the version number diff --git a/src/cli/parse-args.ts b/src/cli/parse-args.ts index b1c4662..4133546 100644 --- a/src/cli/parse-args.ts +++ b/src/cli/parse-args.ts @@ -23,6 +23,7 @@ export function parseArgs(argv: string[]): ParsedArgs { { name: "tag", alias: "t", type: String }, { name: "push", alias: "p", type: Boolean }, { name: "all", alias: "a", type: Boolean }, + { name: "no-verify", type: Boolean }, { name: "version", alias: "v", type: Boolean }, { name: "help", alias: "h", type: Boolean }, { name: "files", type: String, multiple: true, defaultOption: true }, @@ -39,6 +40,7 @@ export function parseArgs(argv: string[]): ParsedArgs { tag: args.tag as string | boolean, push: args.push as boolean, all: args.all as boolean, + noVerify: args["no-verify"] as boolean, files: args.files as string[], } }; diff --git a/src/options.ts b/src/options.ts index 39f2876..bfcde77 100644 --- a/src/options.ts +++ b/src/options.ts @@ -24,6 +24,7 @@ export class Options { }; public push!: boolean; public all!: boolean; + public noVerify!: boolean; public files!: string[]; public cwd!: string; public interface!: Interface; @@ -44,6 +45,7 @@ export class Options { let preid = typeof raw.preid === "string" ? raw.preid : "beta"; let push = Boolean(raw.push); let all = Boolean(raw.all); + let noVerify = Boolean(raw.noVerify); let cwd = raw.cwd || process.cwd(); let release: Release; @@ -104,7 +106,7 @@ export class Options { } return new Options({ - release, preid, commit, tag, push, all, files, cwd, interface: ui + release, preid, commit, tag, push, all, noVerify, files, cwd, interface: ui }); } } diff --git a/src/version-bump-options.ts b/src/version-bump-options.ts index 2fc0ce4..e925fd0 100644 --- a/src/version-bump-options.ts +++ b/src/version-bump-options.ts @@ -52,6 +52,13 @@ export interface VersionBumpOptions { */ all?: boolean; + /** + * Indicates whether to bypass git commit hooks (`git commit --noverify`). + * + * Defaults to `false`. + */ + noVerify?: boolean; + /** * The files to be updated. For certain known files ("package.json", "bower.json", etc.) * `versionBump()` will explicitly update the file's version number. For other files diff --git a/test/specs/git-commit.spec.js b/test/specs/git-commit.spec.js index b920f70..497738b 100644 --- a/test/specs/git-commit.spec.js +++ b/test/specs/git-commit.spec.js @@ -66,6 +66,25 @@ describe.skip("bump --commit", () => { expect(git[0].cmd).to.equal('git commit -a -m "release v1.1.0"'); }); + it("should commit without running pre-commit hooks", () => { + files.create("package.json", { version: "1.0.0" }); + + let bump = chaiExec("--minor --commit --all --no-verify"); + + bump.stderr.should.be.empty; + bump.should.have.exitCode(0); + + bump.should.have.stdout( + `${check} Updated package.json to 1.1.0\n` + + `${check} Git commit\n` + ); + + let git = mocks.git(); + git.length.should.equal(1); + + git[0].cmd.should.equal('git commit --no-verify -a -m "release v1.1.0"'); + }); + it("should commit the manifest files to git with a message", () => { files.create("package.json", { version: "1.0.0" }); From d7ed6223c9ad0601f62ae061fd212fc12d2f43b7 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 27 Feb 2019 05:36:35 -0600 Subject: [PATCH 057/106] Split the mocks into separate files for initial setup and testing --- .mocharc.yml | 1 + test/fixtures/mocks/git | 6 +++--- test/fixtures/mocks/npm | 6 +++--- test/fixtures/setup-mocks.js | 30 ++++++++++++++++++++++++++++++ test/utils/mocks.js | 28 ---------------------------- 5 files changed, 37 insertions(+), 34 deletions(-) create mode 100644 test/fixtures/setup-mocks.js diff --git a/.mocharc.yml b/.mocharc.yml index 9821d1c..93dfdb4 100644 --- a/.mocharc.yml +++ b/.mocharc.yml @@ -3,6 +3,7 @@ # https://github.com/mochajs/mocha/blob/master/example/config/.mocharc.yml spec: + - test/fixtures/setup-mocks.js - test/fixtures/mocha-hooks.js - test/specs/**/*.spec.js diff --git a/test/fixtures/mocks/git b/test/fixtures/mocks/git index c4eb780..ed105e6 100644 --- a/test/fixtures/mocks/git +++ b/test/fixtures/mocks/git @@ -1,5 +1,5 @@ #!/usr/bin/env node -'use strict'; +"use strict"; /** * @@ -8,5 +8,5 @@ * */ -const mocks = require('./index'); -mocks.record('git', process.argv.slice(2)); +const mocks = require("../../utils/mocks"); +mocks.record("git", process.argv.slice(2)); diff --git a/test/fixtures/mocks/npm b/test/fixtures/mocks/npm index a43457f..9c81d6a 100644 --- a/test/fixtures/mocks/npm +++ b/test/fixtures/mocks/npm @@ -1,5 +1,5 @@ #!/usr/bin/env node -'use strict'; +"use strict"; /** * @@ -8,5 +8,5 @@ * */ -const mocks = require('./index'); -mocks.record('npm', process.argv.slice(2)); +const mocks = require("../../utils/mocks"); +mocks.record("npm", process.argv.slice(2)); diff --git a/test/fixtures/setup-mocks.js b/test/fixtures/setup-mocks.js new file mode 100644 index 0000000..16669bc --- /dev/null +++ b/test/fixtures/setup-mocks.js @@ -0,0 +1,30 @@ +"use strict"; + +const fs = require("fs"); +const path = require("path"); + +const mocksDir = path.resolve("test", "fixtures", "mocks"); + +// Ensure that the mock binaries are executable +fs.chmodSync(path.join(mocksDir, "git"), "0777"); +fs.chmodSync(path.join(mocksDir, "npm"), "0777"); + +// Inject our mocks directory path into the PATH variable, +// so that version-bump-prompt runs our mock `git` and `npm` binaries +// instead of the real ones. +let otherPaths = getEnvPath(); +process.env.PATH = mocksDir + path.delimiter + otherPaths; // eslint-disable-line no-path-concat + + +/** + * Returns the PATH environment variable, case-insensitively + */ +function getEnvPath () { + let keys = Object.keys(process.env); + + for (let key of keys) { + if (key.toUpperCase() === "PATH") { + return process.env[key]; + } + } +} diff --git a/test/utils/mocks.js b/test/utils/mocks.js index d661e72..4bf15f5 100644 --- a/test/utils/mocks.js +++ b/test/utils/mocks.js @@ -1,21 +1,7 @@ "use strict"; -const fs = require("fs"); -const path = require("path"); const files = require("./files"); -const mocksDir = path.resolve("test", "fixtures", "mocks"); - -// Ensure that the mock binaries are executable -fs.chmodSync(path.join(mocksDir, "git"), "0777"); -fs.chmodSync(path.join(mocksDir, "npm"), "0777"); - -// Inject our mocks directory path into the PATH variable, -// so that version-bump-prompt runs our mock `git` and `npm` binaries -// instead of the real ones. -let otherPaths = getEnvPath(); -process.env.PATH = mocksDir + path.delimiter + otherPaths; // eslint-disable-line no-path-concat - const mocks = module.exports = { /** * Returns information about each time `git` was executed. @@ -70,20 +56,6 @@ const mocks = module.exports = { }, }; - -/** - * Returns the PATH environment variable, case-insensitively - */ -function getEnvPath () { - let keys = Object.keys(process.env); - - for (let key of keys) { - if (key.toUpperCase() === "PATH") { - return process.env[key]; - } - } -} - /** * Adds quotes around an argument if it contains whitespace characters * From 8271b5b651273a6731ed3292acd5d895ec73d33e Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 27 Feb 2019 06:04:55 -0600 Subject: [PATCH 058/106] Created utility methods that return just the commands that were executed or detailed information about each execution --- test/utils/mocks.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/test/utils/mocks.js b/test/utils/mocks.js index 4bf15f5..27c5ee7 100644 --- a/test/utils/mocks.js +++ b/test/utils/mocks.js @@ -3,21 +3,39 @@ const files = require("./files"); const mocks = module.exports = { + /** + * Returns the `git` commands that were executed. + * + * @returns {string[]} + */ + git () { + return mocks.gitDetails().map(mock => mock.cmd); + }, + /** * Returns information about each time `git` was executed. * * @returns {object[]} */ - git () { + gitDetails () { return mocks.all().filter(mock => mock.bin === "git"); }, + /** + * Returns the `npm` commands that were executed. + * + * @returns {string[]} + */ + npm () { + return mocks.npmDetails().map(mock => mock.cmd); + }, + /** * Returns information about each time `npm` was executed. * * @returns {object[]} */ - npm () { + npmDetails () { return mocks.all().filter(mock => mock.bin === "npm"); }, @@ -44,6 +62,8 @@ const mocks = module.exports = { array.push({ bin, + args, + // Record the command that was executed cmd: bin + " " + args.map(quoteArgs).join(" "), From 861c0167821e78756e3a864390c50e049fe3f153 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 27 Feb 2019 06:21:04 -0600 Subject: [PATCH 059/106] Added support for deep file paths --- package.json | 1 + test/utils/files.js | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 2a98be5..0972cb0 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "del": "^3.0.0", "eslint": "^5.14.1", "eslint-config-modular": "^7.0.0", + "mkdirp": "^0.5.1", "mocha": "^6.0.1", "npm-check": "^5.9.0", "nyc": "^13.3.0", diff --git a/test/utils/files.js b/test/utils/files.js index 2b5cd2b..bebf4b8 100644 --- a/test/utils/files.js +++ b/test/utils/files.js @@ -2,6 +2,7 @@ const fs = require("fs"); const path = require("path"); +const mkdirp = require("mkdirp"); const filesDir = path.resolve("test", "fixtures", "files"); const tempDir = path.resolve("test", ".tmp"); @@ -17,7 +18,12 @@ const files = module.exports = { if (typeof contents === "object") { contents = JSON.stringify(contents, null, 2); } - fs.writeFileSync(path.join(tempDir, name), contents); + + let filePath = path.join(tempDir, name); + let dirPath = path.dirname(filePath); + + mkdirp.sync(dirPath); + fs.writeFileSync(filePath, contents); }, /** From b2416078cfa66162d1013119e31e99d3e45a8f18 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 27 Feb 2019 06:21:36 -0600 Subject: [PATCH 060/106] Implemented the Git logic --- src/git.ts | 98 +++++++++++++++++++++++++++++++++++++ src/options.ts | 10 ++-- src/update-files.ts | 2 +- src/version-bump-options.ts | 12 +++-- src/version-bump.ts | 21 ++++---- 5 files changed, 124 insertions(+), 19 deletions(-) create mode 100644 src/git.ts diff --git a/src/git.ts b/src/git.ts new file mode 100644 index 0000000..dd17af8 --- /dev/null +++ b/src/git.ts @@ -0,0 +1,98 @@ +import * as ezSpawn from "ez-spawn"; +import { Options } from "./options"; + +type Params = Options & { files: string[]; newVersion: string }; + +/** + * Commits the modififed files to Git, if the `commit` option is enabled. + * + * @returns - The commit message, or `false` if nothing was committed + */ +export async function gitCommit({ commit, files, newVersion }: Params): Promise { + if (!commit) { + return false; + } + + let { all, noVerify, message } = commit; + let args = []; + + if (all) { + // Commit ALL files, not just the ones that were bumped + args.push("--all"); + } + + if (noVerify) { + // Bypass git commit hooks + args.push("--no-verify"); + } + + // Create the commit message + message = formatVersionString(message, newVersion); + args.push("--message", message); + + // Append the file names last, as variadic arguments + if (!all) { + args = args.concat(files); + } + + await ezSpawn.async("git", ["commit", ...args]); + return message; +} + +/** + * Tags the Git commit, if the `tag` option is enabled. + * + * @returns - The tag name, or `false` if no tag was created + */ +export async function gitTag({ commit, tag, newVersion }: Params): Promise { + if (!commit || !tag) { + return false; + } + + let args = [ + // Create an annotated tag, which is recommended for releases. + // See https://git-scm.com/docs/git-tag + "--annotate", + + // Use the same commit message for the tag + "--message", formatVersionString(commit.message, newVersion), + ]; + + // Create the Tag name + let name = formatVersionString(tag.name, newVersion); + args.push(name); + + await ezSpawn.async("git", ["tag", ...args]); + return name; +} + +/** + * Pushes the Git commit and tag, if the `push` option is enabled. + */ +export async function gitPush({ push, tag }: Options): Promise { + if (!push) { + return; + } + + // Push the commit + await ezSpawn.async("git", "push"); + + if (tag) { + // Push the tag + await ezSpawn.async("git", ["push", "--tags"]); + } +} + +/** + * Accepts a version string template (e.g. "release v" or "This is the %s release"). + * If the template contains any "%s" placeholders, then they are replaced with the version number; + * otherwise, the version number is appended to the string. + */ +function formatVersionString(template: string, newVersion: string): string { + if (template.includes("%s")) { + return template.replace(/%s/g, newVersion); + } + else { + return template + newVersion; + } +} diff --git a/src/options.ts b/src/options.ts index bfcde77..19219e2 100644 --- a/src/options.ts +++ b/src/options.ts @@ -18,13 +18,13 @@ export class Options { public preid!: string; public commit?: { message: string; + noVerify: boolean; + all: boolean; }; public tag?: { name: string; }; public push!: boolean; - public all!: boolean; - public noVerify!: boolean; public files!: string[]; public cwd!: string; public interface!: Interface; @@ -70,10 +70,10 @@ export class Options { // NOTE: This must come AFTER `tag` and `push`, because it relies on them let commit; if (typeof raw.commit === "string") { - commit = { message: raw.commit }; + commit = { all, noVerify, message: raw.commit }; } else if (raw.commit || tag || push) { - commit = { message: "release v" }; + commit = { all, noVerify, message: "release v" }; } let files; @@ -106,7 +106,7 @@ export class Options { } return new Options({ - release, preid, commit, tag, push, all, noVerify, files, cwd, interface: ui + release, preid, commit, tag, push, files, cwd, interface: ui }); } } diff --git a/src/update-files.ts b/src/update-files.ts index 84f558a..71db3e6 100644 --- a/src/update-files.ts +++ b/src/update-files.ts @@ -9,7 +9,7 @@ type FileParams = Params & { name: string }; /** * Updates the version number in the specified files. * - * @returns - The files that were actually modified + * @returns - The relative paths of the files that were actually modified */ export async function updateFiles(params: Params): Promise { let { files } = params; diff --git a/src/version-bump-options.ts b/src/version-bump-options.ts index e925fd0..fcd3378 100644 --- a/src/version-bump-options.ts +++ b/src/version-bump-options.ts @@ -23,7 +23,9 @@ export interface VersionBumpOptions { /** * Indicates whether to create a git commit. Can be set to a custom commit message string - * or `true` to use "release v" (the version number will be appended). + * or `true` to use "release v". Any `%s` placeholders in the message string will be replaced + * with the new version number. If the message string does _not_ contain any `%s` placeholders, + * then the new version number will be appended to the message. * * Defaults to `false`. */ @@ -31,7 +33,9 @@ export interface VersionBumpOptions { /** * Indicates whether to tag the git commit. Can be set to a custom tag string - * or `true` to use "v" (the version number will be appended). + * or `true` to use "v". Any `%s` placeholders in the tag string will be replaced + * with the new version number. If the tag string does _not_ contain any `%s` placeholders, + * then the new version number will be appended to the tag. * * Defaults to `false`. */ @@ -45,7 +49,7 @@ export interface VersionBumpOptions { push?: boolean; /** - * Indicates whether the git commit should include ALL files (`git commit -a`) + * Indicates whether the git commit should include ALL files (`git commit --all`) * rather than just the files that were modified by `versionBump()`. * * Defaults to `false`. @@ -53,7 +57,7 @@ export interface VersionBumpOptions { all?: boolean; /** - * Indicates whether to bypass git commit hooks (`git commit --noverify`). + * Indicates whether to bypass git commit hooks (`git commit --no-verify`). * * Defaults to `false`. */ diff --git a/src/version-bump.ts b/src/version-bump.ts index 06a061c..04eed25 100644 --- a/src/version-bump.ts +++ b/src/version-bump.ts @@ -1,5 +1,6 @@ import { getNewVersion } from "./get-new-version"; import { getOldVersion } from "./get-old-version"; +import { gitCommit, gitPush, gitTag } from "./git"; import { Options } from "./options"; import { updateFiles } from "./update-files"; import { VersionBumpOptions } from "./version-bump-options"; @@ -39,25 +40,27 @@ export async function versionBump(arg: VersionBumpOptions | string = {}): Promis arg = { release: arg }; } + // Validate and normalize the options let options = await Options.normalize(arg); + + // Get the old and new version numbers let oldVersion = await getOldVersion(options); let [newVersion, release] = await getNewVersion({ ...options, oldVersion }); - let files = await updateFiles({ ...options, oldVersion, newVersion }); - if (options.commit) { - options.commit.message += newVersion; - } + // Update the version number in all files + let files = await updateFiles({ ...options, oldVersion, newVersion }); - if (options.tag) { - options.tag.name += newVersion; - } + // Git commit, tag, push (if enabled) + let commit = await gitCommit({ ...options, files, newVersion }); + let tag = await gitTag({ ...options, newVersion }); + await gitPush(options); return { release, oldVersion, newVersion, - commit: options.commit ? options.commit.message : false, - tag: options.tag ? options.tag.name : false, + commit, + tag, files, }; } From 65c16e78577b4c77b48947e69ba36e19b65e2592 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 27 Feb 2019 06:22:28 -0600 Subject: [PATCH 061/106] Enhanced a test to include a deep file --- test/specs/api.spec.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/specs/api.spec.js b/test/specs/api.spec.js index b192e6a..9259eb1 100644 --- a/test/specs/api.spec.js +++ b/test/specs/api.spec.js @@ -62,9 +62,10 @@ describe("versionBup() API", () => { expect(mocks.npm()).to.be.empty; }); - it.skip("should accept options", async () => { + it("should accept options", async () => { files.create("package.json", { version: "1.0.0" }); files.create("README.md", "The latest release is v1.0.0\n"); + files.create("subdir/deep/changelog.md", "# Changelog\n\n## v1.0.0\n\n## v0.0.1\n"); files.create("random-file.json", { name: "v1.0.0", version: "1.0.0", @@ -91,7 +92,8 @@ describe("versionBup() API", () => { tag: "1.1.0-test.1", files: [ "random-file.json", - "README.md" + "README.md", + "subdir/deep/changelog.md" ], }); @@ -101,8 +103,11 @@ describe("versionBup() API", () => { // The package.json file should NOT have been updated, because it wasn't in the `files` list expect(files.json("package.json")).to.deep.equal({ version: "1.0.0" }); - // The other two files should have been updated + // The other files should have been updated files.text("README.md", "The latest release is v1.1.0-test.1\n"); + + files.text("subdir/deep/changelog.md", "# Changelog\n\n## v1.1.0-test.1\n\n## v0.0.1\n"); + files.json("random-file.json").should.deep.equal({ name: "v1.1.0-test.1", version: "1.1.0-test.1", @@ -111,8 +116,8 @@ describe("versionBup() API", () => { // A git commit and tag should have been created mocks.git().should.deep.equal([ - 'git commit package.json -m "release v2.0.0"', - 'git tag package.json -m "release v2.0.0"', + 'git commit --message "A test of the upcoming v1.1.0-test.1" random-file.json README.md subdir/deep/changelog.md', + 'git tag --annotate --message "A test of the upcoming v1.1.0-test.1" 1.1.0-test.1', ]); // NPM should NOT have been called From 78b71afd7e45106743d8b178ebcdf6ab3f4b1062 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 27 Feb 2019 06:54:32 -0600 Subject: [PATCH 062/106] Refactored `NormalizedOptions` to be an interface instead of a class --- src/get-new-version.ts | 4 +- src/get-old-version.ts | 4 +- src/git.ts | 6 +-- src/normalize-options.ts | 106 ++++++++++++++++++++++++++++++++++++ src/options.ts | 112 --------------------------------------- src/update-files.ts | 4 +- src/version-bump.ts | 4 +- 7 files changed, 117 insertions(+), 123 deletions(-) create mode 100644 src/normalize-options.ts delete mode 100644 src/options.ts diff --git a/src/get-new-version.ts b/src/get-new-version.ts index 758930a..1747fa7 100644 --- a/src/get-new-version.ts +++ b/src/get-new-version.ts @@ -1,10 +1,10 @@ import * as inquirer from "inquirer"; import * as semver from "semver"; import { ReleaseType, SemVer } from "semver"; // tslint:disable-line: no-duplicate-imports -import { Options } from "./options"; +import { NormalizedOptions } from "./normalize-options"; import { isPrerelease, isReleaseType, releaseTypes } from "./release-type"; -type Params = Options & { oldVersion: string }; +type Params = NormalizedOptions & { oldVersion: string }; type VersionAndReleaseType = [string, ReleaseType?]; /** diff --git a/src/get-old-version.ts b/src/get-old-version.ts index e3e7d0f..17ebf0a 100644 --- a/src/get-old-version.ts +++ b/src/get-old-version.ts @@ -1,13 +1,13 @@ import * as semver from "semver"; import { readJsonFile } from "./fs"; import { isManifest } from "./manifest"; -import { Options } from "./options"; +import { NormalizedOptions } from "./normalize-options"; /** * Returns the current version number from files such as package.json. * An error is thrown if no version number can be found. */ -export async function getOldVersion({ files, cwd }: Options): Promise { +export async function getOldVersion({ files, cwd }: NormalizedOptions): Promise { // Check all JSON files in the files list let filesToCheck = files.filter((file) => file.endsWith(".json")); diff --git a/src/git.ts b/src/git.ts index dd17af8..4f2a87e 100644 --- a/src/git.ts +++ b/src/git.ts @@ -1,7 +1,7 @@ import * as ezSpawn from "ez-spawn"; -import { Options } from "./options"; +import { NormalizedOptions } from "./normalize-options"; -type Params = Options & { files: string[]; newVersion: string }; +type Params = NormalizedOptions & { files: string[]; newVersion: string }; /** * Commits the modififed files to Git, if the `commit` option is enabled. @@ -69,7 +69,7 @@ export async function gitTag({ commit, tag, newVersion }: Params): Promise { +export async function gitPush({ push, tag }: NormalizedOptions): Promise { if (!push) { return; } diff --git a/src/normalize-options.ts b/src/normalize-options.ts new file mode 100644 index 0000000..8f5a297 --- /dev/null +++ b/src/normalize-options.ts @@ -0,0 +1,106 @@ +import * as globby from "globby"; +import { isReleaseType, ReleaseType } from "./release-type"; +import { VersionBumpOptions } from "./version-bump-options"; + +interface Interface { + input?: NodeJS.ReadableStream | NodeJS.ReadStream | false; + output?: NodeJS.WritableStream | NodeJS.WriteStream | false; + [key: string]: unknown; +} + +type Release = "prompt" | ReleaseType | { version: string }; + +/** + * Normalized and sanitized options + */ +export interface NormalizedOptions { + release: Release; + preid: string; + commit?: { + message: string; + noVerify: boolean; + all: boolean; + }; + tag?: { + name: string; + }; + push: boolean; + files: string[]; + cwd: string; + interface: Interface; +} + +/** + * Converts raw VersionBumpOptions to a normalized and sanitized Options object. + */ +export async function normalizeOptions(raw: VersionBumpOptions): Promise { + // Set the simple properties first + let preid = typeof raw.preid === "string" ? raw.preid : "beta"; + let push = Boolean(raw.push); + let all = Boolean(raw.all); + let noVerify = Boolean(raw.noVerify); + let cwd = raw.cwd || process.cwd(); + + let release: Release; + if (!raw.release || raw.release === "prompt") { + release = "prompt"; + } + else if (isReleaseType(raw.release)) { + release = raw.release; + } + else { + release = { version: raw.release }; + } + + let tag; + if (typeof raw.tag === "string") { + tag = { name: raw.tag }; + } + else if (raw.tag) { + tag = { name: "v" }; + } + + // NOTE: This must come AFTER `tag` and `push`, because it relies on them + let commit; + if (typeof raw.commit === "string") { + commit = { all, noVerify, message: raw.commit }; + } + else if (raw.commit || tag || push) { + commit = { all, noVerify, message: "release v" }; + } + + let files; + if (Array.isArray(raw.files) && raw.files.length > 0) { + files = await globby(raw.files, { cwd }); + } + else { + files = ["package.json", "package-lock.json"]; + } + + let ui: Interface; + if (raw.interface === false) { + ui = { input: false, outut: false }; + } + else if (raw.interface === true || !raw.interface) { + ui = { input: process.stdin, output: process.stdout }; + } + else { + let { input, output, ...other } = raw.interface; + + if (input === true || (input !== false && !input)) { + input = process.stdin; + } + + if (output === true || (output !== false && !output)) { + output = process.stdout; + } + + ui = { input, output, ...other }; + } + + if (release === "prompt" && !(ui.input && ui.output)) { + throw new Error(`Cannot prompt for the version number because input or output has been disabled.`); + } + + return { release, preid, commit, tag, push, files, cwd, interface: ui }; +} diff --git a/src/options.ts b/src/options.ts deleted file mode 100644 index 19219e2..0000000 --- a/src/options.ts +++ /dev/null @@ -1,112 +0,0 @@ -import * as globby from "globby"; -import { isReleaseType, ReleaseType } from "./release-type"; -import { VersionBumpOptions } from "./version-bump-options"; - -interface Interface { - input?: NodeJS.ReadableStream | NodeJS.ReadStream | false; - output?: NodeJS.WritableStream | NodeJS.WriteStream | false; - [key: string]: unknown; -} - -type Release = "prompt" | ReleaseType | { version: string }; - -/** - * Normalized and sanitized options - */ -export class Options { - public release!: Release; - public preid!: string; - public commit?: { - message: string; - noVerify: boolean; - all: boolean; - }; - public tag?: { - name: string; - }; - public push!: boolean; - public files!: string[]; - public cwd!: string; - public interface!: Interface; - - private constructor(props: Readonly) { - Object.assign(this, props); - - if (this.release === "prompt" && !(this.interface.input && this.interface.output)) { - throw new Error(`Cannot prompt for the version number because input or output has been disabled.`); - } - } - - /** - * Converts raw VersionBumpOptions to a normalized and sanitized Options object. - */ - public static async normalize(raw: VersionBumpOptions): Promise { - // Set the simple properties first - let preid = typeof raw.preid === "string" ? raw.preid : "beta"; - let push = Boolean(raw.push); - let all = Boolean(raw.all); - let noVerify = Boolean(raw.noVerify); - let cwd = raw.cwd || process.cwd(); - - let release: Release; - if (!raw.release || raw.release === "prompt") { - release = "prompt"; - } - else if (isReleaseType(raw.release)) { - release = raw.release; - } - else { - release = { version: raw.release }; - } - - let tag; - if (typeof raw.tag === "string") { - tag = { name: raw.tag }; - } - else if (raw.tag) { - tag = { name: "v" }; - } - - // NOTE: This must come AFTER `tag` and `push`, because it relies on them - let commit; - if (typeof raw.commit === "string") { - commit = { all, noVerify, message: raw.commit }; - } - else if (raw.commit || tag || push) { - commit = { all, noVerify, message: "release v" }; - } - - let files; - if (Array.isArray(raw.files) && raw.files.length > 0) { - files = await globby(raw.files, { cwd }); - } - else { - files = ["package.json", "package-lock.json"]; - } - - let ui: Interface; - if (raw.interface === false) { - ui = { input: false, outut: false }; - } - else if (raw.interface === true || !raw.interface) { - ui = { input: process.stdin, output: process.stdout }; - } - else { - let { input, output, ...other } = raw.interface; - - if (input === true || (input !== false && !input)) { - input = process.stdin; - } - - if (output === true || (output !== false && !output)) { - output = process.stdout; - } - - ui = { input, output, ...other }; - } - - return new Options({ - release, preid, commit, tag, push, files, cwd, interface: ui - }); - } -} diff --git a/src/update-files.ts b/src/update-files.ts index 71db3e6..586b65f 100644 --- a/src/update-files.ts +++ b/src/update-files.ts @@ -1,9 +1,9 @@ import * as path from "path"; import { readJsonFile, readTextFile, writeJsonFile, writeTextFile } from "./fs"; import { isManifest } from "./manifest"; -import { Options } from "./options"; +import { NormalizedOptions } from "./normalize-options"; -type Params = Options & { oldVersion: string; newVersion: string }; +type Params = NormalizedOptions & { oldVersion: string; newVersion: string }; type FileParams = Params & { name: string }; /** diff --git a/src/version-bump.ts b/src/version-bump.ts index 04eed25..a8ab9e5 100644 --- a/src/version-bump.ts +++ b/src/version-bump.ts @@ -1,7 +1,7 @@ import { getNewVersion } from "./get-new-version"; import { getOldVersion } from "./get-old-version"; import { gitCommit, gitPush, gitTag } from "./git"; -import { Options } from "./options"; +import { normalizeOptions } from "./normalize-options"; import { updateFiles } from "./update-files"; import { VersionBumpOptions } from "./version-bump-options"; import { VersionBumpResults } from "./version-bump-results"; @@ -41,7 +41,7 @@ export async function versionBump(arg: VersionBumpOptions | string = {}): Promis } // Validate and normalize the options - let options = await Options.normalize(arg); + let options = await normalizeOptions(arg); // Get the old and new version numbers let oldVersion = await getOldVersion(options); From 57199fd6c560c5c1c9a55aa9b23a3ce3136bea19 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 27 Feb 2019 07:58:40 -0600 Subject: [PATCH 063/106] Match Node's exit code meanings --- src/cli/index.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cli/index.ts b/src/cli/index.ts index bbf1067..d3166d3 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -5,12 +5,16 @@ import { VersionBumpOptions } from "../version-bump-options"; import { helpText } from "./help"; import { parseArgs } from "./parse-args"; +/** + * @see https://nodejs.org/api/process.html#process_exit_codes + */ enum ExitCode { Success = 0, - SytaxError = 1, - RuntimeError = 2, + FatalError = 1, + InvalidArgument = 9, } + /** * The main entry point of the CLI * @@ -38,7 +42,7 @@ export async function main(args: string[]): Promise { // There was an error parsing the command-line args console.error((error as Error).message); console.error(helpText); - process.exit(ExitCode.SytaxError); + process.exit(ExitCode.InvalidArgument); } } From f2831a39400f2873d970f5fba35784b32329e9b8 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 27 Feb 2019 07:58:50 -0600 Subject: [PATCH 064/106] Added global error handlers --- src/cli/index.ts | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/cli/index.ts b/src/cli/index.ts index d3166d3..4ee8c16 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -22,6 +22,11 @@ enum ExitCode { */ export async function main(args: string[]): Promise { try { + // Setup global error handlers + process.on("uncaughtException", errorHandler); + process.on("unhandledRejection", errorHandler); + + // Parse the command-line arguments let { help, version, options } = parseArgs(args); if (help) { @@ -51,13 +56,18 @@ async function bump(options: VersionBumpOptions): Promise { await versionBump(options); } catch (error) { - let message = (error as Error).message; + errorHandler(error as Error); + } +} - if (process.env.DEBUG || process.env.NODE_ENV === "development") { - message = (error as Error).stack || message; - } - console.error(message); - process.exit(ExitCode.RuntimeError); +function errorHandler(error: Error): void { + let message = error.message || String(error); + + if (process.env.DEBUG || process.env.NODE_ENV === "development") { + message = error.stack || message; } + + console.error(message); + process.exit(ExitCode.FatalError); } From bd567af960e9ae2c7329c2b3232fa1211e6cc651 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 27 Feb 2019 07:59:16 -0600 Subject: [PATCH 065/106] "module" => "package" --- test/specs/exports.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/specs/exports.spec.js b/test/specs/exports.spec.js index 21291b4..cb69227 100644 --- a/test/specs/exports.spec.js +++ b/test/specs/exports.spec.js @@ -4,7 +4,7 @@ const commonJSExport = require("../../"); const { expect } = require("../utils/chai"); const { default: defaultExport, versionBump: namedExport } = require("../../"); -describe("version-bump-prompt module exports", () => { +describe("version-bump-prompt package exports", () => { it("should export the versionBump() function as the default CommonJS export", () => { expect(commonJSExport).to.be.a("function"); From 1e185d49bb4e328819fead9b52103c2d9664770b Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 27 Feb 2019 07:59:47 -0600 Subject: [PATCH 066/106] Updated error code tests --- test/specs/cli.spec.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/specs/cli.spec.js b/test/specs/cli.spec.js index 67322ff..0a9856f 100644 --- a/test/specs/cli.spec.js +++ b/test/specs/cli.spec.js @@ -20,7 +20,7 @@ describe("bump", () => { it("should error if an invalid argument is used", () => { let bump = chaiExec("--commit --help --fizzbuzz --tag"); - expect(bump).to.have.exitCode(1); + expect(bump).to.have.exitCode(9); expect(bump).to.have.stdout(""); expect(bump.stderr).to.match(/^Unknown option: --fizzbuzz\n\nUsage: bump \[release\] \[options\] \[files...\]\n/); expect(bump.stderr).to.contain(manifest.description); @@ -29,7 +29,7 @@ describe("bump", () => { it("should error if an invalid shorthand argument is used", () => { let bump = chaiExec("-chzt"); - expect(bump).to.have.exitCode(1); + expect(bump).to.have.exitCode(9); expect(bump).to.have.stdout(""); expect(bump.stderr).to.match(/^Unknown option: -z\n\nUsage: bump \[release\] \[options\] \[files...\]\n/); expect(bump.stderr).to.contain(manifest.description); @@ -38,7 +38,7 @@ describe("bump", () => { it("should error if an argument is missing its value", () => { let bump = chaiExec("--commit --help --preid --tag"); - expect(bump).to.have.exitCode(1); + expect(bump).to.have.exitCode(9); expect(bump).to.have.stdout(""); bump.stderr.should.match( /^The --preid option requires a value, such as "alpha", "beta", etc\.\n\nUsage: bump \[release\] \[options\] \[files...\]\n/ From f04a2c52b71544e0b6c1ca768beba05455715857 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 27 Feb 2019 08:00:10 -0600 Subject: [PATCH 067/106] Updated the "no args" test to work more reliably --- test/specs/cli.spec.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/test/specs/cli.spec.js b/test/specs/cli.spec.js index 0a9856f..b434f8b 100644 --- a/test/specs/cli.spec.js +++ b/test/specs/cli.spec.js @@ -6,15 +6,26 @@ const manifest = require("../../package.json"); describe("bump", () => { - it.skip("should run without any arguments", () => { + it("should run without any arguments", function () { + // Create a dummy package.json, otherwise an error will occur files.create("package.json", { version: "1.0.0" }); - let bump = chaiExec("", { timeout: 1000 }); - - expect(bump.signal).to.equal("SIGKILL"); - + // Run the CLI without any arguments. + // It will prompt the user and wait forever, so add a timeout. + this.timeout(Math.max(5000, this.timeout())); + let bump = chaiExec("", { timeout: 2500 }); + + if (bump.status) { + // The CLI threw an error, because there is no STDIN + expect(bump).to.have.exitCode(1); + } + else { + expect(bump.signal).to.be.oneOf(["SIGINT", "SIGTERM"]); + } + + // Regardless of how it exited, it should have prompted for input + expect(bump.stdout).to.contain("The current version is 1.0.0\nHow would you like to bump it? (Use arrow keys)"); expect(bump).to.have.stderr(""); - expect(bump.stdout).to.contain("PROMPT TEXT"); }); it("should error if an invalid argument is used", () => { From 3c95bc90b79302cc14584341e230458007fe3d85 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Fri, 1 Mar 2019 06:12:11 -0600 Subject: [PATCH 068/106] Updated the "no args" test to work more reliably --- test/specs/cli.spec.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/test/specs/cli.spec.js b/test/specs/cli.spec.js index b434f8b..a0feb37 100644 --- a/test/specs/cli.spec.js +++ b/test/specs/cli.spec.js @@ -15,17 +15,8 @@ describe("bump", () => { this.timeout(Math.max(5000, this.timeout())); let bump = chaiExec("", { timeout: 2500 }); - if (bump.status) { - // The CLI threw an error, because there is no STDIN - expect(bump).to.have.exitCode(1); - } - else { - expect(bump.signal).to.be.oneOf(["SIGINT", "SIGTERM"]); - } - - // Regardless of how it exited, it should have prompted for input + // It should have prompted for input expect(bump.stdout).to.contain("The current version is 1.0.0\nHow would you like to bump it? (Use arrow keys)"); - expect(bump).to.have.stderr(""); }); it("should error if an invalid argument is used", () => { From 4ba0ba505e6664f3f23e60f16d6ce431a18381b8 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Fri, 1 Mar 2019 06:35:26 -0600 Subject: [PATCH 069/106] Export the `ReleaseType` type directly, rather than via "version-bump-results.ts" --- src/index.ts | 1 + src/version-bump-results.ts | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index b8af7cd..ebaae8d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,6 +2,7 @@ import { versionBump } from "./version-bump"; // Exprot the external type definitions as named exports +export { ReleaseType } from "./release-type"; export * from "./version-bump-options"; export * from "./version-bump-results"; diff --git a/src/version-bump-results.ts b/src/version-bump-results.ts index 8f411a4..473dad4 100644 --- a/src/version-bump-results.ts +++ b/src/version-bump-results.ts @@ -1,7 +1,5 @@ import { ReleaseType } from "./release-type"; -export { ReleaseType }; - /** * Information about the work that was performed by the `versionBump()` function. */ From 5163c3fd150d11f78c6d2f01dc65408c9ff75b15 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Fri, 1 Mar 2019 06:51:49 -0600 Subject: [PATCH 070/106] Refactored the `NormalizedOptions.release` type to be more explicit --- src/get-new-version.ts | 36 ++++++++++++++++++++---------------- src/normalize-options.ts | 32 +++++++++++++++++++++++++------- 2 files changed, 45 insertions(+), 23 deletions(-) diff --git a/src/get-new-version.ts b/src/get-new-version.ts index 1747fa7..85d282b 100644 --- a/src/get-new-version.ts +++ b/src/get-new-version.ts @@ -1,8 +1,8 @@ import * as inquirer from "inquirer"; import * as semver from "semver"; import { ReleaseType, SemVer } from "semver"; // tslint:disable-line: no-duplicate-imports -import { NormalizedOptions } from "./normalize-options"; -import { isPrerelease, isReleaseType, releaseTypes } from "./release-type"; +import { BumpRelease, NormalizedOptions } from "./normalize-options"; +import { isPrerelease, releaseTypes } from "./release-type"; type Params = NormalizedOptions & { oldVersion: string }; type VersionAndReleaseType = [string, ReleaseType?]; @@ -15,29 +15,32 @@ type VersionAndReleaseType = [string, ReleaseType?]; export async function getNewVersion(params: Params): Promise { let { release } = params; - if (release === "prompt") { - return promptForNewVersion(params); - } - else if (isReleaseType(release)) { - return [getNextVersion(params), release]; - } - else { - let newSemVer = new SemVer(release.version, true); - return [newSemVer.version]; + switch (release.type) { + case "prompt": + return promptForNewVersion(params); + + case "version": + let newSemVer = new SemVer(release.version, true); + return [newSemVer.version]; + + default: + return [getNextVersion(params), release.type]; } } /** * Returns the next version number of the specified type. */ -function getNextVersion({ oldVersion, release, preid }: Params): string { +function getNextVersion({ oldVersion, release }: Params): string { + let bump = release as BumpRelease; + let oldSemVer = new SemVer(oldVersion); - let newSemVer = oldSemVer.inc(release as ReleaseType, preid); + let newSemVer = oldSemVer.inc(bump.type as ReleaseType, bump.preid); if ( isPrerelease(release) && newSemVer.prerelease.length === 2 && - newSemVer.prerelease[0] === preid && + newSemVer.prerelease[0] === bump.preid && String(newSemVer.prerelease[1]) === "0" ) { // This is a special case when going from a non-prerelease version to a prerelease version. @@ -54,10 +57,11 @@ function getNextVersion({ oldVersion, release, preid }: Params): string { * Returns the next version number for all release types. */ function getNextVersions(params: Params): Record { + let release = params.release as BumpRelease; let next: Record = {}; - for (let release of releaseTypes) { - next[release] = getNextVersion({ ...params, release }); + for (let type of releaseTypes) { + next[type] = getNextVersion({ ...params, release: { ...release, type }}); } return next; diff --git a/src/normalize-options.ts b/src/normalize-options.ts index 8f5a297..abd9e4d 100644 --- a/src/normalize-options.ts +++ b/src/normalize-options.ts @@ -8,14 +8,32 @@ interface Interface { [key: string]: unknown; } -type Release = "prompt" | ReleaseType | { version: string }; +/** + * A specific version release. + */ +export interface VersionRelease { + type: "version"; + version: string; +} + +/** + * A bump release (prompted or otherwise), relative to the current version number. + */ +export interface BumpRelease { + type: "prompt" | ReleaseType; + preid: string; +} + +/** + * One of the possible Release types. + */ +export type Release = VersionRelease | BumpRelease; /** * Normalized and sanitized options */ export interface NormalizedOptions { release: Release; - preid: string; commit?: { message: string; noVerify: boolean; @@ -43,13 +61,13 @@ export async function normalizeOptions(raw: VersionBumpOptions): Promise Date: Tue, 5 Mar 2019 07:51:56 -0600 Subject: [PATCH 071/106] Added a `progress` callback option --- src/index.ts | 1 + src/version-bump-options.ts | 6 ++++++ src/version-bump-progress.ts | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 src/version-bump-progress.ts diff --git a/src/index.ts b/src/index.ts index ebaae8d..a41e00d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,6 +5,7 @@ import { versionBump } from "./version-bump"; export { ReleaseType } from "./release-type"; export * from "./version-bump-options"; export * from "./version-bump-results"; +export * from "./version-bump-progress"; // Export `versionBump` as a named export and the default export export { versionBump }; diff --git a/src/version-bump-options.ts b/src/version-bump-options.ts index fcd3378..70e35ed 100644 --- a/src/version-bump-options.ts +++ b/src/version-bump-options.ts @@ -1,3 +1,4 @@ +import { VersionBumpProgress } from "./version-bump-progress"; /** * Options for the `versionBump()` function. @@ -90,6 +91,11 @@ export interface VersionBumpOptions { * Defaults to `true`. */ interface?: boolean | InterfaceOptions; + + /** + * A callback that is provides information about the progress of the `versionBump()` function. + */ + progress?(progress: VersionBumpProgress): void; } /** diff --git a/src/version-bump-progress.ts b/src/version-bump-progress.ts new file mode 100644 index 0000000..7d93882 --- /dev/null +++ b/src/version-bump-progress.ts @@ -0,0 +1,18 @@ +import { VersionBumpResults } from "./version-bump-results"; + +/** + * Progress events that indicate the progress of the `versionBump()` function. + */ +export const enum ProgressEvent { + FileUpdated = "file updated", + GitCommit = "git commit", + GitTag = "git tag", + GitPush = "git push", +} + +/** + * Information about the progress of the `versionBump()` function. + */ +export interface VersionBumpProgress extends VersionBumpResults { + event: ProgressEvent; +} From 7e0ea6f56efcf1f846e4a69bbd12cdbcfdf2a5d1 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Tue, 5 Mar 2019 07:52:56 -0600 Subject: [PATCH 072/106] Centralized all the operation state into an `Operation` class --- src/get-new-version.ts | 62 +++++++++++----------- src/get-old-version.ts | 14 +++-- src/git.ts | 63 ++++++++++++----------- src/normalize-options.ts | 14 +++-- src/operation.ts | 108 +++++++++++++++++++++++++++++++++++++++ src/update-files.ts | 39 +++++++------- src/version-bump.ts | 26 ++++------ 7 files changed, 222 insertions(+), 104 deletions(-) create mode 100644 src/operation.ts diff --git a/src/get-new-version.ts b/src/get-new-version.ts index 85d282b..e18ef84 100644 --- a/src/get-new-version.ts +++ b/src/get-new-version.ts @@ -1,44 +1,44 @@ import * as inquirer from "inquirer"; import * as semver from "semver"; import { ReleaseType, SemVer } from "semver"; // tslint:disable-line: no-duplicate-imports -import { BumpRelease, NormalizedOptions } from "./normalize-options"; +import { BumpRelease, PromptRelease } from "./normalize-options"; +import { Operation } from "./operation"; import { isPrerelease, releaseTypes } from "./release-type"; -type Params = NormalizedOptions & { oldVersion: string }; -type VersionAndReleaseType = [string, ReleaseType?]; - /** - * Returns the new version number, possibly by prompting the user for it. - * - * @returns - A tuple containing the new version number and the release type (if any) + * Determines the new version number, possibly by prompting the user for it. */ -export async function getNewVersion(params: Params): Promise { - let { release } = params; +export async function getNewVersion(operation: Operation): Promise { + let { release } = operation.options; + let { oldVersion } = operation.state; switch (release.type) { case "prompt": - return promptForNewVersion(params); + return promptForNewVersion(operation); case "version": let newSemVer = new SemVer(release.version, true); - return [newSemVer.version]; + return operation.update({ + newVersion: newSemVer.version, + }); default: - return [getNextVersion(params), release.type]; + return operation.update({ + release: release.type, + newVersion: getNextVersion(oldVersion, release), + }); } } /** * Returns the next version number of the specified type. */ -function getNextVersion({ oldVersion, release }: Params): string { - let bump = release as BumpRelease; - +function getNextVersion(oldVersion: string, bump: BumpRelease): string { let oldSemVer = new SemVer(oldVersion); - let newSemVer = oldSemVer.inc(bump.type as ReleaseType, bump.preid); + let newSemVer = oldSemVer.inc(bump.type, bump.preid); if ( - isPrerelease(release) && + isPrerelease(bump.type) && newSemVer.prerelease.length === 2 && newSemVer.prerelease[0] === bump.preid && String(newSemVer.prerelease[1]) === "0" @@ -56,12 +56,11 @@ function getNextVersion({ oldVersion, release }: Params): string { /** * Returns the next version number for all release types. */ -function getNextVersions(params: Params): Record { - let release = params.release as BumpRelease; +function getNextVersions(oldVersion: string, preid: string): Record { let next: Record = {}; for (let type of releaseTypes) { - next[type] = getNextVersion({ ...params, release: { ...release, type }}); + next[type] = getNextVersion(oldVersion, { type, preid }); } return next; @@ -72,10 +71,12 @@ function getNextVersions(params: Params): Record { * * @returns - A tuple containing the new version number and the release type (if any) */ -async function promptForNewVersion(params: Params): Promise { - let { oldVersion, interface: ui } = params; - let next = getNextVersions(params); - let prompts = inquirer.createPromptModule(ui as inquirer.StreamOptions); +async function promptForNewVersion(operation: Operation): Promise { + let { oldVersion, oldVersionSource } = operation.state; + let release = operation.options.release as PromptRelease; + let prompts = inquirer.createPromptModule(operation.options.interface as inquirer.StreamOptions); + + let next = getNextVersions(oldVersion, release.preid); let answers: { release: ReleaseType | "none" | "custom"; @@ -86,7 +87,7 @@ async function promptForNewVersion(params: Params): Promise release === "custom", + when: (previousAnswer) => previousAnswer.release === "custom", filter: semver.clean, validate: (newVersion: string) => { return semver.valid(newVersion) ? true : "That's not a valid version number"; @@ -117,12 +118,15 @@ async function promptForNewVersion(params: Params): Promise { +export async function getOldVersion(operation: Operation): Promise { + let { cwd, files } = operation.options; + // Check all JSON files in the files list let filesToCheck = files.filter((file) => file.endsWith(".json")); @@ -21,7 +23,11 @@ export async function getOldVersion({ files, cwd }: NormalizedOptions): Promise< let version = await readVersion(file, cwd); if (version) { - return version; + // We found the current version number! + return operation.update({ + oldVersionSource: file, + oldVersion: version, + }); } } diff --git a/src/git.ts b/src/git.ts index 4f2a87e..c9556b8 100644 --- a/src/git.ts +++ b/src/git.ts @@ -1,19 +1,17 @@ import * as ezSpawn from "ez-spawn"; -import { NormalizedOptions } from "./normalize-options"; - -type Params = NormalizedOptions & { files: string[]; newVersion: string }; +import { Operation } from "./operation"; +import { ProgressEvent } from "./version-bump-progress"; /** * Commits the modififed files to Git, if the `commit` option is enabled. - * - * @returns - The commit message, or `false` if nothing was committed */ -export async function gitCommit({ commit, files, newVersion }: Params): Promise { - if (!commit) { - return false; +export async function gitCommit(operation: Operation): Promise { + if (!operation.options.commit) { + return operation; } - let { all, noVerify, message } = commit; + let { all, noVerify, message } = operation.options.commit; + let { files, newVersion } = operation.state; let args = []; if (all) { @@ -27,8 +25,8 @@ export async function gitCommit({ commit, files, newVersion }: Params): Promise< } // Create the commit message - message = formatVersionString(message, newVersion); - args.push("--message", message); + let commitMessage = formatVersionString(message, newVersion); + args.push("--message", commitMessage); // Append the file names last, as variadic arguments if (!all) { @@ -36,51 +34,54 @@ export async function gitCommit({ commit, files, newVersion }: Params): Promise< } await ezSpawn.async("git", ["commit", ...args]); - return message; + + return operation.update({ event: ProgressEvent.GitCommit, commitMessage }); } /** * Tags the Git commit, if the `tag` option is enabled. - * - * @returns - The tag name, or `false` if no tag was created */ -export async function gitTag({ commit, tag, newVersion }: Params): Promise { - if (!commit || !tag) { - return false; +export async function gitTag(operation: Operation): Promise { + if (!operation.options.tag) { + return operation; } + let { commit, tag } = operation.options; + let { newVersion } = operation.state; + let args = [ // Create an annotated tag, which is recommended for releases. // See https://git-scm.com/docs/git-tag "--annotate", // Use the same commit message for the tag - "--message", formatVersionString(commit.message, newVersion), + "--message", formatVersionString(commit!.message, newVersion), ]; // Create the Tag name - let name = formatVersionString(tag.name, newVersion); - args.push(name); + let tagName = formatVersionString(tag.name, newVersion); + args.push(tagName); await ezSpawn.async("git", ["tag", ...args]); - return name; + + return operation.update({ event: ProgressEvent.GitTag, tagName }); } /** * Pushes the Git commit and tag, if the `push` option is enabled. */ -export async function gitPush({ push, tag }: NormalizedOptions): Promise { - if (!push) { - return; +export async function gitPush(operation: Operation): Promise { + if (operation.options.push) { + // Push the commit + await ezSpawn.async("git", "push"); + + if (operation.options.tag) { + // Push the tag + await ezSpawn.async("git", ["push", "--tags"]); + } } - // Push the commit - await ezSpawn.async("git", "push"); - - if (tag) { - // Push the tag - await ezSpawn.async("git", ["push", "--tags"]); - } + return operation.update({ event: ProgressEvent.GitPush }); } /** diff --git a/src/normalize-options.ts b/src/normalize-options.ts index abd9e4d..f59c9ed 100644 --- a/src/normalize-options.ts +++ b/src/normalize-options.ts @@ -17,17 +17,25 @@ export interface VersionRelease { } /** - * A bump release (prompted or otherwise), relative to the current version number. + * Prompt the user for the release number. + */ +export interface PromptRelease { + type: "prompt"; + preid: string; +} + +/** + * A bump release, relative to the current version number. */ export interface BumpRelease { - type: "prompt" | ReleaseType; + type: ReleaseType; preid: string; } /** * One of the possible Release types. */ -export type Release = VersionRelease | BumpRelease; +export type Release = VersionRelease | PromptRelease | BumpRelease; /** * Normalized and sanitized options diff --git a/src/operation.ts b/src/operation.ts new file mode 100644 index 0000000..5cda79c --- /dev/null +++ b/src/operation.ts @@ -0,0 +1,108 @@ +import { NormalizedOptions, normalizeOptions } from "./normalize-options"; +import { ReleaseType } from "./release-type"; +import { VersionBumpOptions } from "./version-bump-options"; +import { ProgressEvent, VersionBumpProgress } from "./version-bump-progress"; +import { VersionBumpResults } from "./version-bump-results"; + +type ProgressCallback = (progress: VersionBumpProgress) => void; + +interface OperationState { + release: ReleaseType | undefined; + oldVersionSource: string; + oldVersion: string; + newVersion: string; + commitMessage: string; + tagName: string; + files: string[]; +} + +interface UpdateOperationState extends Partial { + event?: ProgressEvent; +} + +/** + * All of the inputs, outputs, and state of a single `versionBump()` call. + */ +export class Operation { + /** + * The options for this operation. + */ + public options: NormalizedOptions; + + /** + * The current state of the operation. + */ + public readonly state: Readonly = { + release: undefined, + oldVersion: "", + oldVersionSource: "", + newVersion: "", + commitMessage: "", + tagName: "", + files: [], + }; + + /** + * The results of the operation. + */ + public get results(): VersionBumpResults { + let options = this.options; + let state = this.state; + + return { + release: state.release, + oldVersion: state.oldVersion, + newVersion: state.newVersion, + commit: options.commit ? state.commitMessage : false, + tag: options.tag ? state.tagName : false, + files: state.files, + }; + } + + /** + * The callback that's used to report the progress of the operation. + */ + private readonly _progress?: ProgressCallback; + + /** + * Private constructor. Use the `Operation.start()` static method instead. + */ + private constructor(options: NormalizedOptions, progress?: ProgressCallback) { + this.options = options; + this._progress = progress; + } + + /** + * Starts a new `versionBump()` operation. + */ + public static async start(input: VersionBumpOptions): Promise { + // Validate and normalize the options + let options = await normalizeOptions(input); + + // tslint:disable-next-line: no-unbound-method + return new Operation(options, input.progress); + } + + /** + * Updates the operation state and results, and reports the updated progress to the user. + */ + public update(state: UpdateOperationState): this { + if (state.files) { + // Concatenate the two `files` arrays, rather than overwriting + state.files = this.state.files.concat(state.files); + } + + // Update the operation state + Object.assign(this.state, state); + + if (state.event && this._progress) { + // Report the progress to the user + this._progress({ + event: state.event, + ...this.results + }); + } + + return this; + } +} diff --git a/src/update-files.ts b/src/update-files.ts index 586b65f..f5785b8 100644 --- a/src/update-files.ts +++ b/src/update-files.ts @@ -1,29 +1,27 @@ import * as path from "path"; import { readJsonFile, readTextFile, writeJsonFile, writeTextFile } from "./fs"; import { isManifest } from "./manifest"; -import { NormalizedOptions } from "./normalize-options"; - -type Params = NormalizedOptions & { oldVersion: string; newVersion: string }; -type FileParams = Params & { name: string }; +import { Operation } from "./operation"; +import { ProgressEvent } from "./version-bump-progress"; /** * Updates the version number in the specified files. - * - * @returns - The relative paths of the files that were actually modified */ -export async function updateFiles(params: Params): Promise { - let { files } = params; - let modifiedFiles = []; +export async function updateFiles(operation: Operation): Promise { + let { files } = operation.options; for (let name of files) { - let modified = await updateFile({ ...params, name }); + let modified = await updateFile(name, operation); if (modified) { - modifiedFiles.push(name); + operation.update({ + event: ProgressEvent.FileUpdated, + files: [name], + }); } } - return modifiedFiles; + return operation; } /** @@ -31,8 +29,7 @@ export async function updateFiles(params: Params): Promise { * * @returns - `true` if the file was actually modified */ -async function updateFile(params: FileParams): Promise { - let { name } = params; +async function updateFile(name: string, operation: Operation): Promise { name = path.basename(name).trim().toLowerCase(); switch (name) { @@ -40,10 +37,10 @@ async function updateFile(params: FileParams): Promise { case "package-lock.json": case "bower.json": case "component.json": - return updateManifestFile(params); + return updateManifestFile(name, operation); default: - return updateTextFile(params); + return updateTextFile(name, operation); } } @@ -55,8 +52,9 @@ async function updateFile(params: FileParams): Promise { * * @returns - `true` if the file was actually modified */ -async function updateManifestFile(params: FileParams): Promise { - let { name, cwd, newVersion } = params; +async function updateManifestFile(name: string, operation: Operation): Promise { + let { cwd } = operation.options; + let { newVersion } = operation.state; let modified = false; try { @@ -83,8 +81,9 @@ async function updateManifestFile(params: FileParams): Promise { * * @returns - `true` if the file was actually modified */ -async function updateTextFile(params: FileParams): Promise { - let { name, cwd, oldVersion, newVersion } = params; +async function updateTextFile(name: string, operation: Operation): Promise { + let { cwd } = operation.options; + let { oldVersion, newVersion } = operation.state; let modified = false; try { diff --git a/src/version-bump.ts b/src/version-bump.ts index a8ab9e5..48ad0f0 100644 --- a/src/version-bump.ts +++ b/src/version-bump.ts @@ -1,7 +1,7 @@ import { getNewVersion } from "./get-new-version"; import { getOldVersion } from "./get-old-version"; import { gitCommit, gitPush, gitTag } from "./git"; -import { normalizeOptions } from "./normalize-options"; +import { Operation } from "./operation"; import { updateFiles } from "./update-files"; import { VersionBumpOptions } from "./version-bump-options"; import { VersionBumpResults } from "./version-bump-results"; @@ -40,27 +40,19 @@ export async function versionBump(arg: VersionBumpOptions | string = {}): Promis arg = { release: arg }; } - // Validate and normalize the options - let options = await normalizeOptions(arg); + let operation = await Operation.start(arg); // Get the old and new version numbers - let oldVersion = await getOldVersion(options); - let [newVersion, release] = await getNewVersion({ ...options, oldVersion }); + await getOldVersion(operation); + await getNewVersion(operation); // Update the version number in all files - let files = await updateFiles({ ...options, oldVersion, newVersion }); + await updateFiles(operation); // Git commit, tag, push (if enabled) - let commit = await gitCommit({ ...options, files, newVersion }); - let tag = await gitTag({ ...options, newVersion }); - await gitPush(options); + await gitCommit(operation); + await gitTag(operation); + await gitPush(operation); - return { - release, - oldVersion, - newVersion, - commit, - tag, - files, - }; + return operation.results; } From 7abd3fa5f9dcc83a17322d95a60902256b1843d9 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 6 Mar 2019 03:52:34 -0600 Subject: [PATCH 073/106] Return a *copy* of the `files` array, so users can modify it without affecting the operation --- src/operation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/operation.ts b/src/operation.ts index 5cda79c..f8bd523 100644 --- a/src/operation.ts +++ b/src/operation.ts @@ -55,7 +55,7 @@ export class Operation { newVersion: state.newVersion, commit: options.commit ? state.commitMessage : false, tag: options.tag ? state.tagName : false, - files: state.files, + files: state.files.slice(), }; } From a086c0c175422ad7ae21401e7b8e87b74217ed87 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 6 Mar 2019 03:53:21 -0600 Subject: [PATCH 074/106] Show the progress of the bump command as it completes steps --- package-lock.json | 6 ++++++ package.json | 1 + src/cli/index.ts | 25 ++++++++++++++++++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 15f7a80..86f4093 100644 --- a/package-lock.json +++ b/package-lock.json @@ -194,6 +194,12 @@ "@types/through": "*" } }, + "@types/log-symbols": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/log-symbols/-/log-symbols-2.0.0.tgz", + "integrity": "sha512-YJhbp0sz3egFFKl3BcCNPQKzuGFOP4PACcsifhK6ROGnJUW9ViYLuLybQ9GQZm7Zejy3tkGuiXYMq3GiyGkU4g==", + "dev": true + }, "@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", diff --git a/package.json b/package.json index 0972cb0..24855ad 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "@types/detect-newline": "^2.1.0", "@types/globby": "^8.0.0", "@types/inquirer": "0.0.43", + "@types/log-symbols": "^2.0.0", "@types/mocha": "^5.2.6", "@types/node": "^11.9.5", "@types/semver": "^5.5.0", diff --git a/src/cli/index.ts b/src/cli/index.ts index 4ee8c16..c98a84e 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -1,7 +1,9 @@ // tslint:disable: no-console +import { success } from "log-symbols"; import { manifest } from "../manifest"; import { versionBump } from "../version-bump"; import { VersionBumpOptions } from "../version-bump-options"; +import { ProgressEvent, VersionBumpProgress } from "../version-bump-progress"; import { helpText } from "./help"; import { parseArgs } from "./parse-args"; @@ -14,7 +16,6 @@ enum ExitCode { InvalidArgument = 9, } - /** * The main entry point of the CLI * @@ -53,6 +54,7 @@ export async function main(args: string[]): Promise { async function bump(options: VersionBumpOptions): Promise { try { + options.progress = progress; await versionBump(options); } catch (error) { @@ -60,6 +62,27 @@ async function bump(options: VersionBumpOptions): Promise { } } +function progress({ event, files, newVersion }: VersionBumpProgress): void { + // tslint:disable-next-line: switch-default + switch (event) { + case ProgressEvent.FileUpdated: + console.log(success, `Updated ${files.pop()} to ${newVersion}`); + break; + + case ProgressEvent.GitCommit: + console.log(success, "Git commit"); + break; + + case ProgressEvent.GitTag: + console.log(success, "Git tag"); + break; + + case ProgressEvent.GitPush: + console.log(success, "Git push"); + break; + } +} + function errorHandler(error: Error): void { let message = error.message || String(error); From 0b3b2305e23d2f8bfe8e035d316e07747d87d885 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 6 Mar 2019 03:59:46 -0600 Subject: [PATCH 075/106] Added a "--quiet" CLI option --- src/cli/index.ts | 7 +++++-- src/cli/parse-args.ts | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cli/index.ts b/src/cli/index.ts index c98a84e..7cd825c 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -28,7 +28,7 @@ export async function main(args: string[]): Promise { process.on("unhandledRejection", errorHandler); // Parse the command-line arguments - let { help, version, options } = parseArgs(args); + let { help, version, quiet, options } = parseArgs(args); if (help) { // Show the help text and exit @@ -41,6 +41,10 @@ export async function main(args: string[]): Promise { process.exit(ExitCode.Success); } else { + if (!quiet) { + options.progress = progress; + } + await bump(options); } } @@ -54,7 +58,6 @@ export async function main(args: string[]): Promise { async function bump(options: VersionBumpOptions): Promise { try { - options.progress = progress; await versionBump(options); } catch (error) { diff --git a/src/cli/parse-args.ts b/src/cli/parse-args.ts index 4133546..f6943c5 100644 --- a/src/cli/parse-args.ts +++ b/src/cli/parse-args.ts @@ -9,6 +9,7 @@ import { VersionBumpOptions } from "../version-bump-options"; export interface ParsedArgs { help?: boolean; version?: boolean; + quiet?: boolean; options: VersionBumpOptions; } @@ -24,6 +25,7 @@ export function parseArgs(argv: string[]): ParsedArgs { { name: "push", alias: "p", type: Boolean }, { name: "all", alias: "a", type: Boolean }, { name: "no-verify", type: Boolean }, + { name: "quiet", alias: "q", type: Boolean }, { name: "version", alias: "v", type: Boolean }, { name: "help", alias: "h", type: Boolean }, { name: "files", type: String, multiple: true, defaultOption: true }, @@ -34,6 +36,7 @@ export function parseArgs(argv: string[]): ParsedArgs { let parsedArgs: ParsedArgs = { help: args.help as boolean, version: args.version as boolean, + quiet: args.quiet as boolean, options: { preid: args.preid as string, commit: args.commit as string | boolean, From 2f6d1c79a72fcade23b1dcc4dcc86d61412788a9 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 6 Mar 2019 04:09:37 -0600 Subject: [PATCH 076/106] Cleaned-up error-handling code --- src/cli/exit-code.ts | 10 ++++ src/cli/index.ts | 25 +--------- src/cli/parse-args.ts | 111 +++++++++++++++++++++++------------------- 3 files changed, 73 insertions(+), 73 deletions(-) create mode 100644 src/cli/exit-code.ts diff --git a/src/cli/exit-code.ts b/src/cli/exit-code.ts new file mode 100644 index 0000000..c47b961 --- /dev/null +++ b/src/cli/exit-code.ts @@ -0,0 +1,10 @@ +/** + * CLI exit codes. + * + * @see https://nodejs.org/api/process.html#process_exit_codes + */ +export enum ExitCode { + Success = 0, + FatalError = 1, + InvalidArgument = 9 +} diff --git a/src/cli/index.ts b/src/cli/index.ts index 7cd825c..69e0944 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -2,20 +2,11 @@ import { success } from "log-symbols"; import { manifest } from "../manifest"; import { versionBump } from "../version-bump"; -import { VersionBumpOptions } from "../version-bump-options"; import { ProgressEvent, VersionBumpProgress } from "../version-bump-progress"; +import { ExitCode } from "./exit-code"; import { helpText } from "./help"; import { parseArgs } from "./parse-args"; -/** - * @see https://nodejs.org/api/process.html#process_exit_codes - */ -enum ExitCode { - Success = 0, - FatalError = 1, - InvalidArgument = 9, -} - /** * The main entry point of the CLI * @@ -45,21 +36,9 @@ export async function main(args: string[]): Promise { options.progress = progress; } - await bump(options); + await versionBump(options); } } - catch (error) { - // There was an error parsing the command-line args - console.error((error as Error).message); - console.error(helpText); - process.exit(ExitCode.InvalidArgument); - } -} - -async function bump(options: VersionBumpOptions): Promise { - try { - await versionBump(options); - } catch (error) { errorHandler(error as Error); } diff --git a/src/cli/parse-args.ts b/src/cli/parse-args.ts index f6943c5..d9c063d 100644 --- a/src/cli/parse-args.ts +++ b/src/cli/parse-args.ts @@ -1,7 +1,10 @@ +// tslint:disable: no-console import * as commandLineArgs from "command-line-args"; import * as semver from "semver"; import { isReleaseType } from "../release-type"; import { VersionBumpOptions } from "../version-bump-options"; +import { ExitCode } from "./exit-code"; +import { helpText } from "./help"; /** * The parsed command-line arguments @@ -17,62 +20,70 @@ export interface ParsedArgs { * Parses the command-line arguments */ export function parseArgs(argv: string[]): ParsedArgs { - let args = commandLineArgs( - [ - { name: "preid", type: String }, - { name: "commit", alias: "c", type: String }, - { name: "tag", alias: "t", type: String }, - { name: "push", alias: "p", type: Boolean }, - { name: "all", alias: "a", type: Boolean }, - { name: "no-verify", type: Boolean }, - { name: "quiet", alias: "q", type: Boolean }, - { name: "version", alias: "v", type: Boolean }, - { name: "help", alias: "h", type: Boolean }, - { name: "files", type: String, multiple: true, defaultOption: true }, - ], - { argv } - ); + try { + let args = commandLineArgs( + [ + { name: "preid", type: String }, + { name: "commit", alias: "c", type: String }, + { name: "tag", alias: "t", type: String }, + { name: "push", alias: "p", type: Boolean }, + { name: "all", alias: "a", type: Boolean }, + { name: "no-verify", type: Boolean }, + { name: "quiet", alias: "q", type: Boolean }, + { name: "version", alias: "v", type: Boolean }, + { name: "help", alias: "h", type: Boolean }, + { name: "files", type: String, multiple: true, defaultOption: true }, + ], + { argv } + ); - let parsedArgs: ParsedArgs = { - help: args.help as boolean, - version: args.version as boolean, - quiet: args.quiet as boolean, - options: { - preid: args.preid as string, - commit: args.commit as string | boolean, - tag: args.tag as string | boolean, - push: args.push as boolean, - all: args.all as boolean, - noVerify: args["no-verify"] as boolean, - files: args.files as string[], - } - }; + let parsedArgs: ParsedArgs = { + help: args.help as boolean, + version: args.version as boolean, + quiet: args.quiet as boolean, + options: { + preid: args.preid as string, + commit: args.commit as string | boolean, + tag: args.tag as string | boolean, + push: args.push as boolean, + all: args.all as boolean, + noVerify: args["no-verify"] as boolean, + files: args.files as string[], + } + }; - // If --preid is used without an argument, then throw an error, since it's probably a mistake. - // If they want to use the default value ("beta"), then they should not pass the argument at all - if (args.preid === null) { - throw new Error(`The --preid option requires a value, such as "alpha", "beta", etc.`); - } + // If --preid is used without an argument, then throw an error, since it's probably a mistake. + // If they want to use the default value ("beta"), then they should not pass the argument at all + if (args.preid === null) { + throw new Error(`The --preid option requires a value, such as "alpha", "beta", etc.`); + } - // If --commit is used without an argument, then treat it as a boolean flag - if (args.commit === null) { - parsedArgs.options.commit = true; - } + // If --commit is used without an argument, then treat it as a boolean flag + if (args.commit === null) { + parsedArgs.options.commit = true; + } - // If --tag is used without an argument, then treat it as a boolean flag - if (args.tag === null) { - parsedArgs.options.tag = true; - } + // If --tag is used without an argument, then treat it as a boolean flag + if (args.tag === null) { + parsedArgs.options.tag = true; + } - // If a version number or release type was specified, then it will mistakenly be added to the "files" array - if (parsedArgs.options.files && parsedArgs.options.files.length > 0) { - let firstArg = parsedArgs.options.files[0]; + // If a version number or release type was specified, then it will mistakenly be added to the "files" array + if (parsedArgs.options.files && parsedArgs.options.files.length > 0) { + let firstArg = parsedArgs.options.files[0]; - if (firstArg === "prompt" || isReleaseType(firstArg) || semver.valid(firstArg)) { - parsedArgs.options.release = firstArg; - parsedArgs.options.files.shift(); + if (firstArg === "prompt" || isReleaseType(firstArg) || semver.valid(firstArg)) { + parsedArgs.options.release = firstArg; + parsedArgs.options.files.shift(); + } } - } - return parsedArgs; + return parsedArgs; + } + catch (error) { + // There was an error parsing the command-line args + console.error((error as Error).message); + console.error(helpText); + return process.exit(ExitCode.InvalidArgument); + } } From 3d67c71372fb6394eb15721c66c13628ac3320e2 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 6 Mar 2019 04:16:16 -0600 Subject: [PATCH 077/106] Added the "--quiet" option to the help text --- src/cli/help.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cli/help.ts b/src/cli/help.ts index f42b82e..df02835 100644 --- a/src/cli/help.ts +++ b/src/cli/help.ts @@ -41,6 +41,8 @@ options: -v, --version Show the version number + -q, --quiet Suppress unnecessary output + -h, --help Show usage information files... From 1019c9f9987ba0ba44bd1176b518906dd00faaa9 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 6 Mar 2019 05:18:30 -0600 Subject: [PATCH 078/106] Added tests for the "--quiet" option --- test/specs/cli.spec.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/specs/cli.spec.js b/test/specs/cli.spec.js index a0feb37..6ea29f8 100644 --- a/test/specs/cli.spec.js +++ b/test/specs/cli.spec.js @@ -16,11 +16,11 @@ describe("bump", () => { let bump = chaiExec("", { timeout: 2500 }); // It should have prompted for input - expect(bump.stdout).to.contain("The current version is 1.0.0\nHow would you like to bump it? (Use arrow keys)"); + expect(bump.stdout).to.contain("The current version in package.json is 1.0.0\nHow would you like to bump it? (Use arrow keys)"); }); it("should error if an invalid argument is used", () => { - let bump = chaiExec("--commit --help --fizzbuzz --tag"); + let bump = chaiExec("--commit --help --fizzbuzz --quiet"); expect(bump).to.have.exitCode(9); expect(bump).to.have.stdout(""); @@ -29,7 +29,7 @@ describe("bump", () => { }); it("should error if an invalid shorthand argument is used", () => { - let bump = chaiExec("-chzt"); + let bump = chaiExec("-cqhzt"); expect(bump).to.have.exitCode(9); expect(bump).to.have.stdout(""); @@ -38,7 +38,7 @@ describe("bump", () => { }); it("should error if an argument is missing its value", () => { - let bump = chaiExec("--commit --help --preid --tag"); + let bump = chaiExec("--commit --help --preid --quiet"); expect(bump).to.have.exitCode(9); expect(bump).to.have.stdout(""); @@ -68,7 +68,7 @@ describe("bump", () => { }); it("should ignore other arguments", () => { - let bump = chaiExec("--commit --help --tag"); + let bump = chaiExec("--quiet --help --tag"); expect(bump).to.have.exitCode(0); expect(bump).to.have.stderr(""); @@ -104,7 +104,7 @@ describe("bump", () => { }); it("should ignore other arguments", () => { - let bump = chaiExec("--commit --version --tag"); + let bump = chaiExec("--quiet --version --tag"); expect(bump).to.have.exitCode(0); expect(bump).to.have.stderr(""); From 4c4c35382a647ab5d3e724828b8761ba8410d55b Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 6 Mar 2019 05:23:05 -0600 Subject: [PATCH 079/106] Verify that all explicitly-specified files and/or globs exist. Don't silently ignore missing files --- src/get-old-version.ts | 2 ++ src/normalize-options.ts | 44 ++++++++++++++++++++++++++++++++++++++-- src/update-files.ts | 13 ------------ test/specs/api.spec.js | 3 +-- 4 files changed, 45 insertions(+), 17 deletions(-) diff --git a/src/get-old-version.ts b/src/get-old-version.ts index 55b19a3..8c7b16e 100644 --- a/src/get-old-version.ts +++ b/src/get-old-version.ts @@ -53,6 +53,8 @@ async function readVersion(file: string, cwd: string): Promise 0) { - files = await globby(raw.files, { cwd }); + files = await strictGlobMatches(raw.files, { cwd }); } else { - files = ["package.json", "package-lock.json"]; + // Try to find these files by default. + // If they don't exist, then they will NOT be included in the `files` array. + files = await globby(["package.json", "package-lock.json"], { cwd }); } let ui: Interface; @@ -130,3 +132,41 @@ export async function normalizeOptions(raw: VersionBumpOptions): Promise { + // Match all glob patterns simultaneously + let matches = await Promise.all(files.map((file) => strictGlobMatch(file, options))); + + // Get all the unique files + let matchedFiles = new Set(); + for (let match of matches) { + for (let file of match) { + matchedFiles.add(file); + } + } + + return [...matchedFiles]; +} + +/** + * Returns all files that match the given glob pattern. + * An error is thrown if the pattern matches zero files. + */ +async function strictGlobMatch(file: string, options: object): Promise { + let matches = await globby(file, options); + + if (matches.length === 0) { + if (globby.hasMagic(file)) { + throw new Error(`Could not find any files matching "${file}".`); + } + else { + throw new Error(`Could not find file: ${file}.`); + } + } + + return matches; +} diff --git a/src/update-files.ts b/src/update-files.ts index f5785b8..ad8f53f 100644 --- a/src/update-files.ts +++ b/src/update-files.ts @@ -57,7 +57,6 @@ async function updateManifestFile(name: string, operation: Operation): Promise { catch (error) { expect(error).to.be.an.instanceOf(Error); error.message.should.equal( - "Unable to determine the current version number. " + - "Checked package.json, package-lock.json." + "Unable to determine the current version number. Checked package.json." ); // The CWD should not have changed From de7f2bee3338a9e56bdeaa665e1601777fdcc05e Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 6 Mar 2019 05:25:01 -0600 Subject: [PATCH 080/106] Renamed the `name` variable to `relPath` to be more clear --- src/update-files.ts | 53 +++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/src/update-files.ts b/src/update-files.ts index ad8f53f..d535de8 100644 --- a/src/update-files.ts +++ b/src/update-files.ts @@ -10,13 +10,13 @@ import { ProgressEvent } from "./version-bump-progress"; export async function updateFiles(operation: Operation): Promise { let { files } = operation.options; - for (let name of files) { - let modified = await updateFile(name, operation); + for (let relPath of files) { + let modified = await updateFile(relPath, operation); if (modified) { operation.update({ event: ProgressEvent.FileUpdated, - files: [name], + files: [relPath], }); } } @@ -29,18 +29,18 @@ export async function updateFiles(operation: Operation): Promise { * * @returns - `true` if the file was actually modified */ -async function updateFile(name: string, operation: Operation): Promise { - name = path.basename(name).trim().toLowerCase(); +async function updateFile(relPath: string, operation: Operation): Promise { + let name = path.basename(relPath).trim().toLowerCase(); switch (name) { case "package.json": case "package-lock.json": case "bower.json": case "component.json": - return updateManifestFile(name, operation); + return updateManifestFile(relPath, operation); default: - return updateTextFile(name, operation); + return updateTextFile(relPath, operation); } } @@ -52,19 +52,17 @@ async function updateFile(name: string, operation: Operation): Promise * * @returns - `true` if the file was actually modified */ -async function updateManifestFile(name: string, operation: Operation): Promise { +async function updateManifestFile(relPath: string, operation: Operation): Promise { let { cwd } = operation.options; let { newVersion } = operation.state; let modified = false; - let file = await readJsonFile(name, cwd); + let file = await readJsonFile(relPath, cwd); - if (isManifest(file.data) && file.data.version !== newVersion) { - file.data.version = newVersion; - await writeJsonFile(file); - modified = true; - } - } + if (isManifest(file.data) && file.data.version !== newVersion) { + file.data.version = newVersion; + await writeJsonFile(file); + modified = true; } return modified; @@ -75,27 +73,26 @@ async function updateManifestFile(name: string, operation: Operation): Promise { +async function updateTextFile(relPath: string, operation: Operation): Promise { let { cwd } = operation.options; let { oldVersion, newVersion } = operation.state; let modified = false; - let file = await readTextFile(name, cwd); + let file = await readTextFile(relPath, cwd); - // Only update the file if it contains at least one occurrence of the old version - if (file.data.includes(oldVersion)) { - // Escape all non-alphanumeric characters in the version - let sanitizedVersion = oldVersion.replace(/(\W)/g, "\\$1"); + // Only update the file if it contains at least one occurrence of the old version + if (file.data.includes(oldVersion)) { + // Escape all non-alphanumeric characters in the version + let sanitizedVersion = oldVersion.replace(/(\W)/g, "\\$1"); - // Replace occurrences of the old version number that are surrounded by word boundaries. - // This ensures that it matches "1.23.456" or "v1.23.456", but not "321.23.456". - let replacePattern = new RegExp("(\\b|v)" + sanitizedVersion + "\\b", "g"); + // Replace occurrences of the old version number that are surrounded by word boundaries. + // This ensures that it matches "1.23.456" or "v1.23.456", but not "321.23.456". + let replacePattern = new RegExp("(\\b|v)" + sanitizedVersion + "\\b", "g"); - file.data = file.data.replace(replacePattern, "$1" + newVersion); - await writeTextFile(file); + file.data = file.data.replace(replacePattern, "$1" + newVersion); + await writeTextFile(file); - return true; - } + return true; } return modified; From 10cd9ed15a1a5fdbbe3bed22388f37f3ab3d33bb Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 6 Mar 2019 06:24:03 -0600 Subject: [PATCH 081/106] Moved types-only files to the "types" directory --- src/cli/index.ts | 2 +- src/cli/parse-args.ts | 2 +- src/git.ts | 2 +- src/index.ts | 6 +++--- src/normalize-options.ts | 2 +- src/operation.ts | 6 +++--- src/{ => types}/version-bump-options.ts | 0 src/{ => types}/version-bump-progress.ts | 0 src/{ => types}/version-bump-results.ts | 2 +- src/update-files.ts | 2 +- src/version-bump.ts | 4 ++-- 11 files changed, 14 insertions(+), 14 deletions(-) rename src/{ => types}/version-bump-options.ts (100%) rename src/{ => types}/version-bump-progress.ts (100%) rename src/{ => types}/version-bump-results.ts (95%) diff --git a/src/cli/index.ts b/src/cli/index.ts index 69e0944..26de893 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -1,8 +1,8 @@ // tslint:disable: no-console import { success } from "log-symbols"; import { manifest } from "../manifest"; +import { ProgressEvent, VersionBumpProgress } from "../types/version-bump-progress"; import { versionBump } from "../version-bump"; -import { ProgressEvent, VersionBumpProgress } from "../version-bump-progress"; import { ExitCode } from "./exit-code"; import { helpText } from "./help"; import { parseArgs } from "./parse-args"; diff --git a/src/cli/parse-args.ts b/src/cli/parse-args.ts index d9c063d..86cb224 100644 --- a/src/cli/parse-args.ts +++ b/src/cli/parse-args.ts @@ -2,7 +2,7 @@ import * as commandLineArgs from "command-line-args"; import * as semver from "semver"; import { isReleaseType } from "../release-type"; -import { VersionBumpOptions } from "../version-bump-options"; +import { VersionBumpOptions } from "../types/version-bump-options"; import { ExitCode } from "./exit-code"; import { helpText } from "./help"; diff --git a/src/git.ts b/src/git.ts index c9556b8..1d7a9a5 100644 --- a/src/git.ts +++ b/src/git.ts @@ -1,6 +1,6 @@ import * as ezSpawn from "ez-spawn"; import { Operation } from "./operation"; -import { ProgressEvent } from "./version-bump-progress"; +import { ProgressEvent } from "./types/version-bump-progress"; /** * Commits the modififed files to Git, if the `commit` option is enabled. diff --git a/src/index.ts b/src/index.ts index a41e00d..dfbe40b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,9 +3,9 @@ import { versionBump } from "./version-bump"; // Exprot the external type definitions as named exports export { ReleaseType } from "./release-type"; -export * from "./version-bump-options"; -export * from "./version-bump-results"; -export * from "./version-bump-progress"; +export * from "./types/version-bump-options"; +export * from "./types/version-bump-results"; +export * from "./types/version-bump-progress"; // Export `versionBump` as a named export and the default export export { versionBump }; diff --git a/src/normalize-options.ts b/src/normalize-options.ts index 15c495a..47e5dd3 100644 --- a/src/normalize-options.ts +++ b/src/normalize-options.ts @@ -1,6 +1,6 @@ import * as globby from "globby"; import { isReleaseType, ReleaseType } from "./release-type"; -import { VersionBumpOptions } from "./version-bump-options"; +import { VersionBumpOptions } from "./types/version-bump-options"; interface Interface { input?: NodeJS.ReadableStream | NodeJS.ReadStream | false; diff --git a/src/operation.ts b/src/operation.ts index f8bd523..f7c647a 100644 --- a/src/operation.ts +++ b/src/operation.ts @@ -1,8 +1,8 @@ import { NormalizedOptions, normalizeOptions } from "./normalize-options"; import { ReleaseType } from "./release-type"; -import { VersionBumpOptions } from "./version-bump-options"; -import { ProgressEvent, VersionBumpProgress } from "./version-bump-progress"; -import { VersionBumpResults } from "./version-bump-results"; +import { VersionBumpOptions } from "./types/version-bump-options"; +import { ProgressEvent, VersionBumpProgress } from "./types/version-bump-progress"; +import { VersionBumpResults } from "./types/version-bump-results"; type ProgressCallback = (progress: VersionBumpProgress) => void; diff --git a/src/version-bump-options.ts b/src/types/version-bump-options.ts similarity index 100% rename from src/version-bump-options.ts rename to src/types/version-bump-options.ts diff --git a/src/version-bump-progress.ts b/src/types/version-bump-progress.ts similarity index 100% rename from src/version-bump-progress.ts rename to src/types/version-bump-progress.ts diff --git a/src/version-bump-results.ts b/src/types/version-bump-results.ts similarity index 95% rename from src/version-bump-results.ts rename to src/types/version-bump-results.ts index 473dad4..b345707 100644 --- a/src/version-bump-results.ts +++ b/src/types/version-bump-results.ts @@ -1,4 +1,4 @@ -import { ReleaseType } from "./release-type"; +import { ReleaseType } from "../release-type"; /** * Information about the work that was performed by the `versionBump()` function. diff --git a/src/update-files.ts b/src/update-files.ts index d535de8..8b2805e 100644 --- a/src/update-files.ts +++ b/src/update-files.ts @@ -2,7 +2,7 @@ import * as path from "path"; import { readJsonFile, readTextFile, writeJsonFile, writeTextFile } from "./fs"; import { isManifest } from "./manifest"; import { Operation } from "./operation"; -import { ProgressEvent } from "./version-bump-progress"; +import { ProgressEvent } from "./types/version-bump-progress"; /** * Updates the version number in the specified files. diff --git a/src/version-bump.ts b/src/version-bump.ts index 48ad0f0..bf9f0d2 100644 --- a/src/version-bump.ts +++ b/src/version-bump.ts @@ -2,9 +2,9 @@ import { getNewVersion } from "./get-new-version"; import { getOldVersion } from "./get-old-version"; import { gitCommit, gitPush, gitTag } from "./git"; import { Operation } from "./operation"; +import { VersionBumpOptions } from "./types/version-bump-options"; +import { VersionBumpResults } from "./types/version-bump-results"; import { updateFiles } from "./update-files"; -import { VersionBumpOptions } from "./version-bump-options"; -import { VersionBumpResults } from "./version-bump-results"; /** * Prompts the user for a version number and updates package.json and package-lock.json. From a6fa150f707f2565cd092a6f27e9a340c475264c Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 6 Mar 2019 07:02:46 -0600 Subject: [PATCH 082/106] Don't call `Operation.update()` when the `push` option is disabled --- src/git.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/git.ts b/src/git.ts index 1d7a9a5..0a6e1fd 100644 --- a/src/git.ts +++ b/src/git.ts @@ -71,14 +71,16 @@ export async function gitTag(operation: Operation): Promise { * Pushes the Git commit and tag, if the `push` option is enabled. */ export async function gitPush(operation: Operation): Promise { - if (operation.options.push) { - // Push the commit - await ezSpawn.async("git", "push"); - - if (operation.options.tag) { - // Push the tag - await ezSpawn.async("git", ["push", "--tags"]); - } + if (!operation.options.push) { + return operation; + } + + // Push the commit + await ezSpawn.async("git", "push"); + + if (operation.options.tag) { + // Push the tag + await ezSpawn.async("git", ["push", "--tags"]); } return operation.update({ event: ProgressEvent.GitPush }); From 038d2cfac6d138d73b5408680c1ba15849dbe77c Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 6 Mar 2019 07:03:23 -0600 Subject: [PATCH 083/106] Separated "fixtures" and "files" --- test/specs/files.spec.js | 83 +++++++++++++++++++++++++++++++--------- test/utils/files.js | 11 ------ test/utils/fixtures.js | 13 +++++++ test/utils/index.js | 1 + 4 files changed, 78 insertions(+), 30 deletions(-) create mode 100644 test/utils/fixtures.js diff --git a/test/specs/files.spec.js b/test/specs/files.spec.js index 275a404..8fa55ed 100644 --- a/test/specs/files.spec.js +++ b/test/specs/files.spec.js @@ -1,27 +1,28 @@ "use strict"; -const { check, files } = require("../utils"); +const { check, files, fixtures } = require("../utils"); const { chaiExec, expect } = require("../utils/chai"); describe.skip("bump [files...]", () => { it("should replace the version number in non-manifest files", () => { files.create("package.json", { version: "1.2.3" }); - files.copy("LICENSE"); - files.copy("README.md"); - files.copy("script1.js"); - files.copy("script2.js"); + files.create("LICENSE", fixtures.license); + files.create("README.md", fixtures.readme); + files.create("script1.js", fixtures.script1); + files.create("script2.js", fixtures.script2); + files.create("subdir/deep/script1.js", fixtures.script1); + files.create("subdir/deep/script2.js", fixtures.script2); - let bump = chaiExec("--major --grep LICENSE README.* *.js"); + let bump = chaiExec("major LICENSE README.* *.js"); expect(bump).to.have.stderr(""); expect(bump).to.have.exitCode(0); bump.should.have.stdout( - `${check} Updated package.json to 2.0.0\n` + + `${check} Updated LICENSE to 2.0.0\n` + `${check} Updated README.md to 2.0.0\n` + - `${check} Updated script1.js to 2.0.0\n` + - `${check} Updated LICENSE to 2.0.0\n` + `${check} Updated script1.js to 2.0.0\n` ); expect(files.json("package.json").version).to.equal("2.0.0"); @@ -34,12 +35,12 @@ describe.skip("bump [files...]", () => { it("should not replace other version numbers in non-manifest files", () => { files.create("package.json", { version: "1.2.3" }); - files.copy("LICENSE"); - files.copy("README.md"); - files.copy("script1.js"); - files.copy("script2.js"); + files.create("LICENSE", fixtures.license); + files.create("README.md", fixtures.readme); + files.create("script1.js", fixtures.script1); + files.create("script2.js", fixtures.script2); - let bump = chaiExec("--major --grep LICENSE README.* *.js"); + let bump = chaiExec("major LICENSE README.* *.js"); expect(bump).to.have.stderr(""); expect(bump).to.have.exitCode(0); @@ -57,12 +58,56 @@ describe.skip("bump [files...]", () => { it("should not not modify non-manifest files that don't contain the old version number", () => { files.create("package.json", { version: "4.5.6" }); - files.copy("LICENSE"); - files.copy("README.md"); - files.copy("script1.js"); - files.copy("script2.js"); + files.create("LICENSE", fixtures.license); + files.create("README.md", fixtures.readme); + files.create("script1.js", fixtures.script1); + files.create("script2.js", fixtures.script2); + + let bump = chaiExec("major LICENSE README.* *.js"); + + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); + + bump.should.have.stdout( + `${check} Updated package.json to 5.0.0\n` + ); + + expect(files.json("package.json").version).to.equal("5.0.0"); + expect(files.text("LICENSE")).to.match(/MyApp v1.2.3 Copyright/); + expect(files.text("README.md")).to.match(/version 5.6.7 and v8.9.10 should not be changed/); + expect(files.text("README.md")).to.match(/version 1.2.3 and v1.2.3 should both get updated/); + expect(files.text("script1.js")).to.match(/make sure v1.2.3 gets replaced correctly/); + expect(files.text("script1.js")).to.match(/let version = "1.2.3";/); + expect(files.text("script1.js")).to.match(/let version = "1.2.3";/); + expect(files.text("script2.js")).to.match(/version 3.2.1 and v8.9.10 don't match the old version number/); + }); + + it("should error if an explicitly-specified file doesn't exist", () => { + files.create("package.json", { version: "4.5.6" }); + + let bump = chaiExec("major LICENSE README.* *.js"); + + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); + + bump.should.have.stdout( + `${check} Updated package.json to 5.0.0\n` + ); + + expect(files.json("package.json").version).to.equal("5.0.0"); + expect(files.text("LICENSE")).to.match(/MyApp v1.2.3 Copyright/); + expect(files.text("README.md")).to.match(/version 5.6.7 and v8.9.10 should not be changed/); + expect(files.text("README.md")).to.match(/version 1.2.3 and v1.2.3 should both get updated/); + expect(files.text("script1.js")).to.match(/make sure v1.2.3 gets replaced correctly/); + expect(files.text("script1.js")).to.match(/let version = "1.2.3";/); + expect(files.text("script1.js")).to.match(/let version = "1.2.3";/); + expect(files.text("script2.js")).to.match(/version 3.2.1 and v8.9.10 don't match the old version number/); + }); + + it("should error if a glob pattern doesn't match any files", () => { + files.create("package.json", { version: "4.5.6" }); - let bump = chaiExec("--major --grep LICENSE README.* *.js"); + let bump = chaiExec("major README.* *.js"); expect(bump).to.have.stderr(""); expect(bump).to.have.exitCode(0); diff --git a/test/utils/files.js b/test/utils/files.js index bebf4b8..ba70694 100644 --- a/test/utils/files.js +++ b/test/utils/files.js @@ -4,7 +4,6 @@ const fs = require("fs"); const path = require("path"); const mkdirp = require("mkdirp"); -const filesDir = path.resolve("test", "fixtures", "files"); const tempDir = path.resolve("test", ".tmp"); const files = module.exports = { @@ -26,16 +25,6 @@ const files = module.exports = { fs.writeFileSync(filePath, contents); }, - /** - * Copies a file from the "test/fixtures/files" directory to the "test/.tmp" directory. - * - * @param {string} name - The name of the file to copy (e.g. "README.md", "script1.js") - */ - copy (name) { - let contents = fs.readFileSync(path.join(filesDir, name), "utf8"); - files.create(name, contents); - }, - /** * Reads a file in the "test/.tmp" directory, and returns its contents as a string. * diff --git a/test/utils/fixtures.js b/test/utils/fixtures.js new file mode 100644 index 0000000..4f32a2c --- /dev/null +++ b/test/utils/fixtures.js @@ -0,0 +1,13 @@ +"use strict"; + +const fs = require("fs"); +const path = require("path"); + +const filesDir = path.resolve("test", "fixtures", "files"); + +module.exports = { + license: fs.readFileSync(path.join(filesDir, "LICENSE"), "utf8"), + readme: fs.readFileSync(path.join(filesDir, "README.md"), "utf8"), + script1: fs.readFileSync(path.join(filesDir, "script1.js"), "utf8"), + script2: fs.readFileSync(path.join(filesDir, "script2.js"), "utf8"), +}; diff --git a/test/utils/index.js b/test/utils/index.js index 37c05dd..914d8ce 100644 --- a/test/utils/index.js +++ b/test/utils/index.js @@ -3,5 +3,6 @@ module.exports = { check: require("./check"), files: require("./files"), + fixtures: require("./fixtures"), mocks: require("./mocks"), }; From fe901ea148e16cf8125ee31023ed3d362b1842f2 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Wed, 6 Mar 2019 08:42:34 -0600 Subject: [PATCH 084/106] Added some debugging code to figure out why a test is failing in CI --- test/specs/cli.spec.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/specs/cli.spec.js b/test/specs/cli.spec.js index 6ea29f8..f1a40d8 100644 --- a/test/specs/cli.spec.js +++ b/test/specs/cli.spec.js @@ -15,8 +15,16 @@ describe("bump", () => { this.timeout(Math.max(5000, this.timeout())); let bump = chaiExec("", { timeout: 2500 }); - // It should have prompted for input - expect(bump.stdout).to.contain("The current version in package.json is 1.0.0\nHow would you like to bump it? (Use arrow keys)"); + try { + // It should have prompted for input + expect(bump.stdout).to.contain("The current version in package.json is 1.0.0\nHow would you like to bump it? (Use arrow keys)"); + } + catch (error) { + console.log("====================== begin bump output ======================"); + console.log(bump); + console.log("====================== end bump output ======================"); + throw error; + } }); it("should error if an invalid argument is used", () => { From 742932b7e55ff3d9958295970ef122d109b186d1 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Fri, 8 Mar 2019 06:23:05 -0600 Subject: [PATCH 085/106] Increased a test timeout to see if it produces different results --- test/specs/cli.spec.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/specs/cli.spec.js b/test/specs/cli.spec.js index f1a40d8..88fd756 100644 --- a/test/specs/cli.spec.js +++ b/test/specs/cli.spec.js @@ -12,17 +12,19 @@ describe("bump", () => { // Run the CLI without any arguments. // It will prompt the user and wait forever, so add a timeout. - this.timeout(Math.max(5000, this.timeout())); - let bump = chaiExec("", { timeout: 2500 }); + this.timeout(Math.max(10000, this.timeout())); + let bump = chaiExec("", { timeout: 5000 }); try { // It should have prompted for input expect(bump.stdout).to.contain("The current version in package.json is 1.0.0\nHow would you like to bump it? (Use arrow keys)"); } catch (error) { - console.log("====================== begin bump output ======================"); - console.log(bump); - console.log("====================== end bump output ======================"); + console.log( + "====================== begin bump output ======================\n", + bump, + "\n====================== end bump output ======================" + ); throw error; } }); From d8e2f3cebd0e5c7ad4a274c03692d5369c3cc00e Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sat, 9 Mar 2019 08:37:37 -0600 Subject: [PATCH 086/106] Removed debugging code --- test/specs/cli.spec.js | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/test/specs/cli.spec.js b/test/specs/cli.spec.js index 88fd756..3448c01 100644 --- a/test/specs/cli.spec.js +++ b/test/specs/cli.spec.js @@ -13,20 +13,10 @@ describe("bump", () => { // Run the CLI without any arguments. // It will prompt the user and wait forever, so add a timeout. this.timeout(Math.max(10000, this.timeout())); - let bump = chaiExec("", { timeout: 5000 }); - - try { - // It should have prompted for input - expect(bump.stdout).to.contain("The current version in package.json is 1.0.0\nHow would you like to bump it? (Use arrow keys)"); - } - catch (error) { - console.log( - "====================== begin bump output ======================\n", - bump, - "\n====================== end bump output ======================" - ); - throw error; - } + let bump = chaiExec("", { timeout: 6000 }); + + // It should have prompted for input + expect(bump.stdout).to.contain("The current version in package.json is 1.0.0\nHow would you like to bump it? (Use arrow keys)"); }); it("should error if an invalid argument is used", () => { From 420ffe0cb93979611cd8dfda089be11841c98f6f Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sat, 9 Mar 2019 09:51:04 -0600 Subject: [PATCH 087/106] Added additional file tests --- test/specs/files.spec.js | 57 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/test/specs/files.spec.js b/test/specs/files.spec.js index 8fa55ed..97ad41a 100644 --- a/test/specs/files.spec.js +++ b/test/specs/files.spec.js @@ -5,6 +5,42 @@ const { chaiExec, expect } = require("../utils/chai"); describe.skip("bump [files...]", () => { + it("should update the package.json and package-lock.json by default", () => { + files.create("package.json", { version: "1.2.3" }); + files.create("package-lock.json", { version: "1.2.3" }); + + let bump = chaiExec("major"); + + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); + + bump.should.have.stdout( + `${check} Updated package.json to 2.0.0\n` + + `${check} Updated package-lock.json to 2.0.0\n` + ); + + expect(files.json("package.json").version).to.equal("2.0.0"); + expect(files.json("package-lock.json").version).to.equal("2.0.0"); + }); + + it("should not update package.json if package-lock.json is explicitly specified", () => { + files.create("package.json", { version: "1.2.3" }); + files.create("package-lock.json", { version: "1.2.3" }); + + let bump = chaiExec("major"); + + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); + + bump.should.have.stdout( + `${check} Updated package.json to 2.0.0\n` + + `${check} Updated package-lock.json to 2.0.0\n` + ); + + expect(files.json("package.json").version).to.equal("2.0.0"); + expect(files.json("package-lock.json").version).to.equal("2.0.0"); + }); + it("should replace the version number in non-manifest files", () => { files.create("package.json", { version: "1.2.3" }); files.create("LICENSE", fixtures.license); @@ -14,7 +50,7 @@ describe.skip("bump [files...]", () => { files.create("subdir/deep/script1.js", fixtures.script1); files.create("subdir/deep/script2.js", fixtures.script2); - let bump = chaiExec("major LICENSE README.* *.js"); + let bump = chaiExec("major LICENSE README.* **/*.js"); expect(bump).to.have.stderr(""); expect(bump).to.have.exitCode(0); @@ -33,8 +69,27 @@ describe.skip("bump [files...]", () => { expect(files.text("script1.js")).to.match(/let version = "2.0.0";/); }); + it("should not replace other version fields in manifest files", () => { + files.create("package.json", { version: "1.2.3", notTheVersion: "1.2.3" }); + files.create("package-lock.json", { version: "1.2.3", notTheVersion: "1.2.3" }); + + let bump = chaiExec("major"); + + expect(bump).to.have.stderr(""); + expect(bump).to.have.exitCode(0); + + bump.should.have.stdout( + `${check} Updated package.json to 2.0.0\n` + + `${check} Updated package-lock.json to 2.0.0\n` + ); + + expect(files.text("README.md")).to.match(/version 5.6.7 and v8.9.10 should not be changed/); + expect(files.text("script2.js")).to.match(/version 3.2.1 and v8.9.10 don't match the old version number/); + }); + it("should not replace other version numbers in non-manifest files", () => { files.create("package.json", { version: "1.2.3" }); + files.create("package-lock.json", { version: "1.2.3" }); files.create("LICENSE", fixtures.license); files.create("README.md", fixtures.readme); files.create("script1.js", fixtures.script1); From e8222069529c82b20f9c6230369f2553501452ee Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sat, 9 Mar 2019 10:06:14 -0600 Subject: [PATCH 088/106] Replaced Chai's `.should()` syntax with `expect()` syntax --- test/specs/api.spec.js | 14 ++-- test/specs/cli.spec.js | 110 ++++++++++++++++---------------- test/specs/exports.spec.js | 4 +- test/specs/files.spec.js | 68 ++++++++++---------- test/specs/git-commit.spec.js | 48 +++++++------- test/specs/git-push.spec.js | 28 ++++---- test/specs/git-tag.spec.js | 36 +++++------ test/specs/minor.spec.js | 52 +++++++-------- test/specs/npm.spec.js | 36 +++++------ test/specs/patch.spec.js | 52 +++++++-------- test/specs/premajor.spec.js | 52 +++++++-------- test/specs/preminor.spec.js | 52 +++++++-------- test/specs/prepatch.spec.js | 52 +++++++-------- test/specs/prerelease.spec.js | 52 +++++++-------- test/specs/release.spec.js | 52 +++++++-------- test/utils/{chai.js => bump.js} | 8 +-- test/utils/index.js | 1 + 17 files changed, 357 insertions(+), 360 deletions(-) rename test/utils/{chai.js => bump.js} (75%) diff --git a/test/specs/api.spec.js b/test/specs/api.spec.js index db9362d..3822dbc 100644 --- a/test/specs/api.spec.js +++ b/test/specs/api.spec.js @@ -2,7 +2,7 @@ const versionBump = require("../../"); const { files, mocks } = require("../utils"); -const { expect } = require("../utils/chai"); +const { expect } = require("chai"); const ORIGINAL_CWD = process.cwd(); @@ -20,7 +20,7 @@ describe("versionBup() API", () => { let results = await versionBump("2.34.567"); - results.should.deep.equal({ + expect(results).to.deep.equal({ release: undefined, oldVersion: "1.0.0", newVersion: "2.34.567", @@ -45,7 +45,7 @@ describe("versionBup() API", () => { let results = await versionBump("minor"); - results.should.deep.equal({ + expect(results).to.deep.equal({ release: "minor", oldVersion: "1.0.0", newVersion: "1.1.0", @@ -84,7 +84,7 @@ describe("versionBup() API", () => { ] }); - results.should.deep.equal({ + expect(results).to.deep.equal({ release: "preminor", oldVersion: "1.0.0", newVersion: "1.1.0-test.1", @@ -108,14 +108,14 @@ describe("versionBup() API", () => { files.text("subdir/deep/changelog.md", "# Changelog\n\n## v1.1.0-test.1\n\n## v0.0.1\n"); - files.json("random-file.json").should.deep.equal({ + expect(files.json("random-file.json")).to.deep.equal({ name: "v1.1.0-test.1", version: "1.1.0-test.1", desc: "This is version 1.1.0-test.1.", }); // A git commit and tag should have been created - mocks.git().should.deep.equal([ + expect(mocks.git()).to.deep.equal([ 'git commit --message "A test of the upcoming v1.1.0-test.1" random-file.json README.md subdir/deep/changelog.md', 'git tag --annotate --message "A test of the upcoming v1.1.0-test.1" 1.1.0-test.1', ]); @@ -154,7 +154,7 @@ describe("versionBup() API", () => { } catch (error) { expect(error).to.be.an.instanceOf(Error); - error.message.should.equal( + expect(error.message).to.equal( "Unable to determine the current version number. Checked package.json." ); diff --git a/test/specs/cli.spec.js b/test/specs/cli.spec.js index 3448c01..cf9583a 100644 --- a/test/specs/cli.spec.js +++ b/test/specs/cli.spec.js @@ -1,7 +1,7 @@ "use strict"; -const { files } = require("../utils"); -const { chaiExec, expect } = require("../utils/chai"); +const { files, bump } = require("../utils"); +const { expect } = require("chai"); const manifest = require("../../package.json"); describe("bump", () => { @@ -13,110 +13,110 @@ describe("bump", () => { // Run the CLI without any arguments. // It will prompt the user and wait forever, so add a timeout. this.timeout(Math.max(10000, this.timeout())); - let bump = chaiExec("", { timeout: 6000 }); + let cli = bump("", { timeout: 6000 }); // It should have prompted for input - expect(bump.stdout).to.contain("The current version in package.json is 1.0.0\nHow would you like to bump it? (Use arrow keys)"); + expect(cli.stdout).to.contain("The current version in package.json is 1.0.0\nHow would you like to bump it? (Use arrow keys)"); }); it("should error if an invalid argument is used", () => { - let bump = chaiExec("--commit --help --fizzbuzz --quiet"); + let cli = bump("--commit --help --fizzbuzz --quiet"); - expect(bump).to.have.exitCode(9); - expect(bump).to.have.stdout(""); - expect(bump.stderr).to.match(/^Unknown option: --fizzbuzz\n\nUsage: bump \[release\] \[options\] \[files...\]\n/); - expect(bump.stderr).to.contain(manifest.description); + expect(cli).to.have.exitCode(9); + expect(cli).to.have.stdout(""); + expect(cli.stderr).to.match(/^Unknown option: --fizzbuzz\n\nUsage: bump \[release\] \[options\] \[files...\]\n/); + expect(cli.stderr).to.contain(manifest.description); }); it("should error if an invalid shorthand argument is used", () => { - let bump = chaiExec("-cqhzt"); + let cli = bump("-cqhzt"); - expect(bump).to.have.exitCode(9); - expect(bump).to.have.stdout(""); - expect(bump.stderr).to.match(/^Unknown option: -z\n\nUsage: bump \[release\] \[options\] \[files...\]\n/); - expect(bump.stderr).to.contain(manifest.description); + expect(cli).to.have.exitCode(9); + expect(cli).to.have.stdout(""); + expect(cli.stderr).to.match(/^Unknown option: -z\n\nUsage: bump \[release\] \[options\] \[files...\]\n/); + expect(cli.stderr).to.contain(manifest.description); }); it("should error if an argument is missing its value", () => { - let bump = chaiExec("--commit --help --preid --quiet"); + let cli = bump("--commit --help --preid --quiet"); - expect(bump).to.have.exitCode(9); - expect(bump).to.have.stdout(""); - bump.stderr.should.match( + expect(cli).to.have.exitCode(9); + expect(cli).to.have.stdout(""); + expect(cli.stderr).to.match( /^The --preid option requires a value, such as "alpha", "beta", etc\.\n\nUsage: bump \[release\] \[options\] \[files...\]\n/ ); - expect(bump.stderr).to.contain(manifest.description); + expect(cli.stderr).to.contain(manifest.description); }); describe("bump --help", () => { it("should show usage text", () => { - let bump = chaiExec("--help"); + let cli = bump("--help"); - expect(bump).to.have.exitCode(0); - expect(bump).to.have.stderr(""); - expect(bump.stdout).to.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/); - expect(bump.stdout).to.contain(manifest.description); + expect(cli).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli.stdout).to.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/); + expect(cli.stdout).to.contain(manifest.description); }); it("should support -h shorthand", () => { - let bump = chaiExec("-h"); + let cli = bump("-h"); - expect(bump).to.have.exitCode(0); - expect(bump).to.have.stderr(""); - expect(bump.stdout).to.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/); - expect(bump.stdout).to.contain(manifest.description); + expect(cli).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli.stdout).to.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/); + expect(cli.stdout).to.contain(manifest.description); }); it("should ignore other arguments", () => { - let bump = chaiExec("--quiet --help --tag"); + let cli = bump("--quiet --help --tag"); - expect(bump).to.have.exitCode(0); - expect(bump).to.have.stderr(""); - expect(bump.stdout).to.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/); - expect(bump.stdout).to.contain(manifest.description); + expect(cli).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli.stdout).to.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/); + expect(cli.stdout).to.contain(manifest.description); }); it("should ignore other shorthand arguments", () => { - let bump = chaiExec("-cht"); + let cli = bump("-cht"); - expect(bump).to.have.exitCode(0); - expect(bump).to.have.stderr(""); - expect(bump.stdout).to.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/); - expect(bump.stdout).to.contain(manifest.description); + expect(cli).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli.stdout).to.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/); + expect(cli.stdout).to.contain(manifest.description); }); }); describe("bump --version", () => { it("should show the version number", () => { - let bump = chaiExec("--version"); + let cli = bump("--version"); - expect(bump).to.have.exitCode(0); - expect(bump).to.have.stderr(""); - expect(bump).to.have.stdout(manifest.version + "\n"); + expect(cli).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.stdout(manifest.version + "\n"); }); it("should support -v shorthand", () => { - let bump = chaiExec("-v"); + let cli = bump("-v"); - expect(bump).to.have.exitCode(0); - expect(bump).to.have.stderr(""); - expect(bump).to.have.stdout(manifest.version + "\n"); + expect(cli).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.stdout(manifest.version + "\n"); }); it("should ignore other arguments", () => { - let bump = chaiExec("--quiet --version --tag"); + let cli = bump("--quiet --version --tag"); - expect(bump).to.have.exitCode(0); - expect(bump).to.have.stderr(""); - expect(bump).to.have.stdout(manifest.version + "\n"); + expect(cli).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.stdout(manifest.version + "\n"); }); it("should ignore other shorthand arguments", () => { - let bump = chaiExec("-cvt"); + let cli = bump("-cvt"); - expect(bump).to.have.exitCode(0); - expect(bump).to.have.stderr(""); - expect(bump).to.have.stdout(manifest.version + "\n"); + expect(cli).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.stdout(manifest.version + "\n"); }); }); }); diff --git a/test/specs/exports.spec.js b/test/specs/exports.spec.js index cb69227..a30e79f 100644 --- a/test/specs/exports.spec.js +++ b/test/specs/exports.spec.js @@ -1,7 +1,7 @@ "use strict"; const commonJSExport = require("../../"); -const { expect } = require("../utils/chai"); +const { expect } = require("chai"); const { default: defaultExport, versionBump: namedExport } = require("../../"); describe("version-bump-prompt package exports", () => { @@ -22,7 +22,7 @@ describe("version-bump-prompt package exports", () => { }); it("should not export anything else", () => { - Object.keys(commonJSExport).should.have.same.members([ + expect(Object.keys(commonJSExport)).to.have.same.members([ "default", "versionBump", ]); diff --git a/test/specs/files.spec.js b/test/specs/files.spec.js index 97ad41a..bd3d46a 100644 --- a/test/specs/files.spec.js +++ b/test/specs/files.spec.js @@ -1,7 +1,7 @@ "use strict"; -const { check, files, fixtures } = require("../utils"); -const { chaiExec, expect } = require("../utils/chai"); +const { check, files, fixtures, bump } = require("../utils"); +const { expect } = require("chai"); describe.skip("bump [files...]", () => { @@ -9,12 +9,12 @@ describe.skip("bump [files...]", () => { files.create("package.json", { version: "1.2.3" }); files.create("package-lock.json", { version: "1.2.3" }); - let bump = chaiExec("major"); + let cli = bump("major"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 2.0.0\n` + `${check} Updated package-lock.json to 2.0.0\n` ); @@ -27,12 +27,12 @@ describe.skip("bump [files...]", () => { files.create("package.json", { version: "1.2.3" }); files.create("package-lock.json", { version: "1.2.3" }); - let bump = chaiExec("major"); + let cli = bump("major"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 2.0.0\n` + `${check} Updated package-lock.json to 2.0.0\n` ); @@ -50,12 +50,12 @@ describe.skip("bump [files...]", () => { files.create("subdir/deep/script1.js", fixtures.script1); files.create("subdir/deep/script2.js", fixtures.script2); - let bump = chaiExec("major LICENSE README.* **/*.js"); + let cli = bump("major LICENSE README.* **/*.js"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated LICENSE to 2.0.0\n` + `${check} Updated README.md to 2.0.0\n` + `${check} Updated script1.js to 2.0.0\n` @@ -73,12 +73,12 @@ describe.skip("bump [files...]", () => { files.create("package.json", { version: "1.2.3", notTheVersion: "1.2.3" }); files.create("package-lock.json", { version: "1.2.3", notTheVersion: "1.2.3" }); - let bump = chaiExec("major"); + let cli = bump("major"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 2.0.0\n` + `${check} Updated package-lock.json to 2.0.0\n` ); @@ -95,12 +95,12 @@ describe.skip("bump [files...]", () => { files.create("script1.js", fixtures.script1); files.create("script2.js", fixtures.script2); - let bump = chaiExec("major LICENSE README.* *.js"); + let cli = bump("major LICENSE README.* *.js"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 2.0.0\n` + `${check} Updated README.md to 2.0.0\n` + `${check} Updated script1.js to 2.0.0\n` + @@ -118,12 +118,12 @@ describe.skip("bump [files...]", () => { files.create("script1.js", fixtures.script1); files.create("script2.js", fixtures.script2); - let bump = chaiExec("major LICENSE README.* *.js"); + let cli = bump("major LICENSE README.* *.js"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 5.0.0\n` ); @@ -140,12 +140,12 @@ describe.skip("bump [files...]", () => { it("should error if an explicitly-specified file doesn't exist", () => { files.create("package.json", { version: "4.5.6" }); - let bump = chaiExec("major LICENSE README.* *.js"); + let cli = bump("major LICENSE README.* *.js"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 5.0.0\n` ); @@ -162,12 +162,12 @@ describe.skip("bump [files...]", () => { it("should error if a glob pattern doesn't match any files", () => { files.create("package.json", { version: "4.5.6" }); - let bump = chaiExec("major README.* *.js"); + let cli = bump("major README.* *.js"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 5.0.0\n` ); diff --git a/test/specs/git-commit.spec.js b/test/specs/git-commit.spec.js index 497738b..aa9f89d 100644 --- a/test/specs/git-commit.spec.js +++ b/test/specs/git-commit.spec.js @@ -1,19 +1,19 @@ "use strict"; -const { check, files, mocks } = require("../utils"); -const { chaiExec, expect } = require("../utils/chai"); +const { check, files, mocks, bump } = require("../utils"); +const { expect } = require("chai"); describe.skip("bump --commit", () => { it("should commit the manifest file to git", () => { files.create("package.json", { version: "1.0.0" }); - let bump = chaiExec("--major --commit"); + let cli = bump("--major --commit"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 2.0.0\n` + `${check} Git commit\n` ); @@ -29,12 +29,12 @@ describe.skip("bump --commit", () => { files.create("bower.json", { version: "1.0.0" }); files.create("component.json", { version: "1.0.0" }); - let bump = chaiExec("--minor --commit"); + let cli = bump("--minor --commit"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.1.0\n` + `${check} Updated bower.json to 1.1.0\n` + `${check} Updated component.json to 1.1.0\n` + @@ -50,12 +50,12 @@ describe.skip("bump --commit", () => { it("should commit all files to git", () => { files.create("package.json", { version: "1.0.0" }); - let bump = chaiExec("--minor --commit --all"); + let cli = bump("--minor --commit --all"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.1.0\n` + `${check} Git commit\n` ); @@ -69,31 +69,31 @@ describe.skip("bump --commit", () => { it("should commit without running pre-commit hooks", () => { files.create("package.json", { version: "1.0.0" }); - let bump = chaiExec("--minor --commit --all --no-verify"); + let cli = bump("--minor --commit --all --no-verify"); - bump.stderr.should.be.empty; - bump.should.have.exitCode(0); + expect(cli.stderr).to.be.empty; + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.1.0\n` + `${check} Git commit\n` ); let git = mocks.git(); - git.length.should.equal(1); + expect(git.length).to.equal(1); - git[0].cmd.should.equal('git commit --no-verify -a -m "release v1.1.0"'); + expect(git[0].cmd).to.equal('git commit --no-verify -a -m "release v1.1.0"'); }); it("should commit the manifest files to git with a message", () => { files.create("package.json", { version: "1.0.0" }); - let bump = chaiExec("--patch --all --commit my-message"); + let cli = bump("--patch --all --commit my-message"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.0.1\n` + `${check} Git commit\n` ); diff --git a/test/specs/git-push.spec.js b/test/specs/git-push.spec.js index 73c19bd..c6ee4d0 100644 --- a/test/specs/git-push.spec.js +++ b/test/specs/git-push.spec.js @@ -1,19 +1,19 @@ "use strict"; -const { check, files, mocks } = require("../utils"); -const { chaiExec, expect } = require("../utils/chai"); +const { check, files, mocks, bump } = require("../utils"); +const { expect } = require("chai"); describe.skip("bump --push", () => { it("should commit and push to git", () => { files.create("package.json", { version: "1.0.0" }); - let bump = chaiExec("--major --push"); + let cli = bump("--major --push"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 2.0.0\n` + `${check} Git commit\n` + `${check} Git push\n` @@ -29,12 +29,12 @@ describe.skip("bump --push", () => { it("should push all files", () => { files.create("package.json", { version: "1.0.0" }); - let bump = chaiExec("--minor --push --all"); + let cli = bump("--minor --push --all"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.1.0\n` + `${check} Git commit\n` + `${check} Git push\n` @@ -50,12 +50,12 @@ describe.skip("bump --push", () => { it("should push git tags", () => { files.create("package.json", { version: "1.0.0" }); - let bump = chaiExec("--premajor --tag --push"); + let cli = bump("--premajor --tag --push"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 2.0.0-beta.0\n` + `${check} Git commit\n` + `${check} Git tag\n` + diff --git a/test/specs/git-tag.spec.js b/test/specs/git-tag.spec.js index ab9a205..cb88827 100644 --- a/test/specs/git-tag.spec.js +++ b/test/specs/git-tag.spec.js @@ -1,19 +1,19 @@ "use strict"; -const { check, files, mocks } = require("../utils"); -const { chaiExec, expect } = require("../utils/chai"); +const { check, files, mocks, bump } = require("../utils"); +const { expect } = require("chai"); describe.skip("bump --tag", () => { it("should add a git tag", () => { files.create("package.json", { version: "1.0.0" }); - let bump = chaiExec("--major --commit --tag"); + let cli = bump("--major --commit --tag"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 2.0.0\n` + `${check} Git commit\n` + `${check} Git tag\n` @@ -29,12 +29,12 @@ describe.skip("bump --tag", () => { it("should add a git tag, even if --commit is not specified", () => { files.create("package.json", { version: "1.0.0" }); - let bump = chaiExec("--minor --tag"); + let cli = bump("--minor --tag"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.1.0\n` + `${check} Git commit\n` + `${check} Git tag\n` @@ -50,12 +50,12 @@ describe.skip("bump --tag", () => { it("should tag all files", () => { files.create("package.json", { version: "1.0.0" }); - let bump = chaiExec("--patch --tag --all"); + let cli = bump("--patch --tag --all"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.0.1\n` + `${check} Git commit\n` + `${check} Git tag\n` @@ -72,12 +72,12 @@ describe.skip("bump --tag", () => { files.create("package.json", { version: "1.0.0" }); files.create("bower.json", { version: "1.0.0" }); - let bump = chaiExec("--premajor --tag --push"); + let cli = bump("--premajor --tag --push"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 2.0.0-beta.0\n` + `${check} Updated bower.json to 2.0.0-beta.0\n` + `${check} Git commit\n` + diff --git a/test/specs/minor.spec.js b/test/specs/minor.spec.js index 6271ce2..bd6554b 100644 --- a/test/specs/minor.spec.js +++ b/test/specs/minor.spec.js @@ -1,18 +1,18 @@ "use strict"; -const { check, files } = require("../utils"); -const { chaiExec, expect } = require("../utils/chai"); +const { check, files, bump } = require("../utils"); +const { expect } = require("chai"); describe.skip("bump --minor", () => { it("should not increment a non-existent version number", () => { files.create("package.json", {}); files.create("bower.json", { name: "my-app" }); - let bump = chaiExec("--minor"); + let cli = bump("--minor"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.stdout(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.stdout(""); + expect(cli).to.have.exitCode(0); expect(files.json("package.json")).to.deep.equal({}); expect(files.json("bower.json")).to.deep.equal({ name: "my-app" }); @@ -23,12 +23,12 @@ describe.skip("bump --minor", () => { files.create("bower.json", { version: null }); files.create("component.json", { version: 0 }); - let bump = chaiExec("--minor"); + let cli = bump("--minor"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 0.1.0\n` + `${check} Updated bower.json to 0.1.0\n` + `${check} Updated component.json to 0.1.0\n` @@ -42,12 +42,12 @@ describe.skip("bump --minor", () => { it("should increment an all-zero version number", () => { files.create("package.json", { version: "0.0.0" }); - let bump = chaiExec("--minor"); + let cli = bump("--minor"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 0.1.0\n` ); @@ -57,12 +57,12 @@ describe.skip("bump --minor", () => { it("should reset the patch", () => { files.create("package.json", { version: "1.2.3" }); - let bump = chaiExec("--minor"); + let cli = bump("--minor"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.3.0\n` ); @@ -72,12 +72,12 @@ describe.skip("bump --minor", () => { it("should reset the prerelease version", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let bump = chaiExec("--minor"); + let cli = bump("--minor"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.3.0\n` ); @@ -87,12 +87,12 @@ describe.skip("bump --minor", () => { it("should not be affected by the --preid flag", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let bump = chaiExec("--minor --preid alpha"); + let cli = bump("--minor --preid alpha"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.3.0\n` ); diff --git a/test/specs/npm.spec.js b/test/specs/npm.spec.js index a649efb..d905dc1 100644 --- a/test/specs/npm.spec.js +++ b/test/specs/npm.spec.js @@ -1,7 +1,7 @@ "use strict"; -const { check, files, mocks } = require("../utils"); -const { chaiExec, expect } = require("../utils/chai"); +const { check, files, mocks, bump } = require("../utils"); +const { expect } = require("chai"); describe.skip("npm version hooks", () => { if (process.platform === "win32" && process.env.CI) { @@ -18,12 +18,12 @@ describe.skip("npm version hooks", () => { }, }); - let bump = chaiExec("--major"); + let cli = bump("--major"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 2.0.0\n` ); @@ -42,12 +42,12 @@ describe.skip("npm version hooks", () => { }, }); - let bump = chaiExec("--major"); + let cli = bump("--major"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 2.0.0\n` ); @@ -66,12 +66,12 @@ describe.skip("npm version hooks", () => { }, }); - let bump = chaiExec("--major"); + let cli = bump("--major"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 2.0.0\n` ); @@ -92,12 +92,12 @@ describe.skip("npm version hooks", () => { }, }); - let bump = chaiExec("--major --commit --tag --push"); + let cli = bump("--major --commit --tag --push"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 2.0.0\n` + `${check} Git commit\n` + `${check} Git tag\n` + diff --git a/test/specs/patch.spec.js b/test/specs/patch.spec.js index daecba9..eebb0a7 100644 --- a/test/specs/patch.spec.js +++ b/test/specs/patch.spec.js @@ -1,18 +1,18 @@ "use strict"; -const { check, files } = require("../utils"); -const { chaiExec, expect } = require("../utils/chai"); +const { check, files, bump } = require("../utils"); +const { expect } = require("chai"); describe.skip("bump --patch", () => { it("should not increment a non-existent version number", () => { files.create("package.json", {}); files.create("bower.json", { name: "my-app" }); - let bump = chaiExec("--patch"); + let cli = bump("--patch"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.stdout(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.stdout(""); + expect(cli).to.have.exitCode(0); expect(files.json("package.json")).to.deep.equal({}); expect(files.json("bower.json")).to.deep.equal({ name: "my-app" }); @@ -23,12 +23,12 @@ describe.skip("bump --patch", () => { files.create("bower.json", { version: null }); files.create("component.json", { version: 0 }); - let bump = chaiExec("--patch"); + let cli = bump("--patch"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 0.0.1\n` + `${check} Updated bower.json to 0.0.1\n` + `${check} Updated component.json to 0.0.1\n` @@ -42,12 +42,12 @@ describe.skip("bump --patch", () => { it("should increment an all-zero version number", () => { files.create("package.json", { version: "0.0.0" }); - let bump = chaiExec("--patch"); + let cli = bump("--patch"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 0.0.1\n` ); @@ -57,12 +57,12 @@ describe.skip("bump --patch", () => { it("should increment the patch", () => { files.create("package.json", { version: "1.2.3" }); - let bump = chaiExec("--patch"); + let cli = bump("--patch"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.2.4\n` ); @@ -72,12 +72,12 @@ describe.skip("bump --patch", () => { it("should reset the prerelease version", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let bump = chaiExec("--patch"); + let cli = bump("--patch"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.2.3\n` ); @@ -87,12 +87,12 @@ describe.skip("bump --patch", () => { it("should not be affected by the --preid flag", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let bump = chaiExec("--patch --preid alpha"); + let cli = bump("--patch --preid alpha"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.2.3\n` ); diff --git a/test/specs/premajor.spec.js b/test/specs/premajor.spec.js index 2264530..7aa06da 100644 --- a/test/specs/premajor.spec.js +++ b/test/specs/premajor.spec.js @@ -1,18 +1,18 @@ "use strict"; -const { check, files } = require("../utils"); -const { chaiExec, expect } = require("../utils/chai"); +const { check, files, bump } = require("../utils"); +const { expect } = require("chai"); describe.skip("bump --premajor", () => { it("should not increment a non-existent version number", () => { files.create("package.json", {}); files.create("bower.json", { name: "my-app" }); - let bump = chaiExec("--premajor"); + let cli = bump("--premajor"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.stdout(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.stdout(""); + expect(cli).to.have.exitCode(0); expect(files.json("package.json")).to.deep.equal({}); expect(files.json("bower.json")).to.deep.equal({ name: "my-app" }); @@ -23,12 +23,12 @@ describe.skip("bump --premajor", () => { files.create("bower.json", { version: null }); files.create("component.json", { version: 0 }); - let bump = chaiExec("--premajor"); + let cli = bump("--premajor"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.0.0-beta.0\n` + `${check} Updated bower.json to 1.0.0-beta.0\n` + `${check} Updated component.json to 1.0.0-beta.0\n` @@ -42,12 +42,12 @@ describe.skip("bump --premajor", () => { it("should increment an all-zero version number", () => { files.create("package.json", { version: "0.0.0" }); - let bump = chaiExec("--premajor"); + let cli = bump("--premajor"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.0.0-beta.0\n` ); @@ -57,12 +57,12 @@ describe.skip("bump --premajor", () => { it("should reset the minor and patch", () => { files.create("package.json", { version: "1.2.3" }); - let bump = chaiExec("--premajor"); + let cli = bump("--premajor"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 2.0.0-beta.0\n` ); @@ -72,12 +72,12 @@ describe.skip("bump --premajor", () => { it("should reset the prerelease version", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let bump = chaiExec("--premajor"); + let cli = bump("--premajor"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 2.0.0-beta.0\n` ); @@ -87,12 +87,12 @@ describe.skip("bump --premajor", () => { it("should honor the --preid flag", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let bump = chaiExec("--premajor --preid alpha"); + let cli = bump("--premajor --preid alpha"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 2.0.0-alpha.0\n` ); diff --git a/test/specs/preminor.spec.js b/test/specs/preminor.spec.js index f7e5ab5..f4c4d81 100644 --- a/test/specs/preminor.spec.js +++ b/test/specs/preminor.spec.js @@ -1,18 +1,18 @@ "use strict"; -const { check, files } = require("../utils"); -const { chaiExec, expect } = require("../utils/chai"); +const { check, files, bump } = require("../utils"); +const { expect } = require("chai"); describe.skip("bump --preminor", () => { it("should not increment a non-existent version number", () => { files.create("package.json", {}); files.create("bower.json", { name: "my-app" }); - let bump = chaiExec("--preminor"); + let cli = bump("--preminor"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.stdout(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.stdout(""); + expect(cli).to.have.exitCode(0); expect(files.json("package.json")).to.deep.equal({}); expect(files.json("bower.json")).to.deep.equal({ name: "my-app" }); @@ -23,12 +23,12 @@ describe.skip("bump --preminor", () => { files.create("bower.json", { version: null }); files.create("component.json", { version: 0 }); - let bump = chaiExec("--preminor"); + let cli = bump("--preminor"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 0.1.0-beta.0\n` + `${check} Updated bower.json to 0.1.0-beta.0\n` + `${check} Updated component.json to 0.1.0-beta.0\n` @@ -42,12 +42,12 @@ describe.skip("bump --preminor", () => { it("should increment an all-zero version number", () => { files.create("package.json", { version: "0.0.0" }); - let bump = chaiExec("--preminor"); + let cli = bump("--preminor"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 0.1.0-beta.0\n` ); @@ -57,12 +57,12 @@ describe.skip("bump --preminor", () => { it("should reset the minor and patch", () => { files.create("package.json", { version: "1.2.3" }); - let bump = chaiExec("--preminor"); + let cli = bump("--preminor"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.3.0-beta.0\n` ); @@ -72,12 +72,12 @@ describe.skip("bump --preminor", () => { it("should reset the prerelease version", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let bump = chaiExec("--preminor"); + let cli = bump("--preminor"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.3.0-beta.0\n` ); @@ -87,12 +87,12 @@ describe.skip("bump --preminor", () => { it("should honor the --preid flag", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let bump = chaiExec("--preminor --preid alpha"); + let cli = bump("--preminor --preid alpha"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.3.0-alpha.0\n` ); diff --git a/test/specs/prepatch.spec.js b/test/specs/prepatch.spec.js index eea49d7..e591316 100644 --- a/test/specs/prepatch.spec.js +++ b/test/specs/prepatch.spec.js @@ -1,18 +1,18 @@ "use strict"; -const { check, files } = require("../utils"); -const { chaiExec, expect } = require("../utils/chai"); +const { check, files, bump } = require("../utils"); +const { expect } = require("chai"); describe.skip("bump --prepatch", () => { it("should not increment a non-existent version number", () => { files.create("package.json", {}); files.create("bower.json", { name: "my-app" }); - let bump = chaiExec("--prepatch"); + let cli = bump("--prepatch"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.stdout(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.stdout(""); + expect(cli).to.have.exitCode(0); expect(files.json("package.json")).to.deep.equal({}); expect(files.json("bower.json")).to.deep.equal({ name: "my-app" }); @@ -23,12 +23,12 @@ describe.skip("bump --prepatch", () => { files.create("bower.json", { version: null }); files.create("component.json", { version: 0 }); - let bump = chaiExec("--prepatch"); + let cli = bump("--prepatch"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 0.0.1-beta.0\n` + `${check} Updated bower.json to 0.0.1-beta.0\n` + `${check} Updated component.json to 0.0.1-beta.0\n` @@ -42,12 +42,12 @@ describe.skip("bump --prepatch", () => { it("should increment an all-zero version number", () => { files.create("package.json", { version: "0.0.0" }); - let bump = chaiExec("--prepatch"); + let cli = bump("--prepatch"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 0.0.1-beta.0\n` ); @@ -57,12 +57,12 @@ describe.skip("bump --prepatch", () => { it("should reset the minor and patch", () => { files.create("package.json", { version: "1.2.3" }); - let bump = chaiExec("--prepatch"); + let cli = bump("--prepatch"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.2.4-beta.0\n` ); @@ -72,12 +72,12 @@ describe.skip("bump --prepatch", () => { it("should reset the prerelease version", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let bump = chaiExec("--prepatch"); + let cli = bump("--prepatch"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.2.4-beta.0\n` ); @@ -87,12 +87,12 @@ describe.skip("bump --prepatch", () => { it("should honor the --preid flag", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let bump = chaiExec("--prepatch --preid alpha"); + let cli = bump("--prepatch --preid alpha"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.2.4-alpha.0\n` ); diff --git a/test/specs/prerelease.spec.js b/test/specs/prerelease.spec.js index 9f60789..b64f8ab 100644 --- a/test/specs/prerelease.spec.js +++ b/test/specs/prerelease.spec.js @@ -1,18 +1,18 @@ "use strict"; -const { check, files } = require("../utils"); -const { chaiExec, expect } = require("../utils/chai"); +const { check, files, bump } = require("../utils"); +const { expect } = require("chai"); describe.skip("bump --prerelease", () => { it("should not increment a non-existent version number", () => { files.create("package.json", {}); files.create("bower.json", { name: "my-app" }); - let bump = chaiExec("--prerelease"); + let cli = bump("--prerelease"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.stdout(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.stdout(""); + expect(cli).to.have.exitCode(0); expect(files.json("package.json")).to.deep.equal({}); expect(files.json("bower.json")).to.deep.equal({ name: "my-app" }); @@ -23,12 +23,12 @@ describe.skip("bump --prerelease", () => { files.create("bower.json", { version: null }); files.create("component.json", { version: 0 }); - let bump = chaiExec("--prerelease"); + let cli = bump("--prerelease"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 0.0.1-beta.0\n` + `${check} Updated bower.json to 0.0.1-beta.0\n` + `${check} Updated component.json to 0.0.1-beta.0\n` @@ -42,12 +42,12 @@ describe.skip("bump --prerelease", () => { it("should increment an all-zero version number", () => { files.create("package.json", { version: "0.0.0" }); - let bump = chaiExec("--prerelease"); + let cli = bump("--prerelease"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 0.0.1-beta.0\n` ); @@ -57,12 +57,12 @@ describe.skip("bump --prerelease", () => { it("should reset the minor and patch", () => { files.create("package.json", { version: "1.2.3" }); - let bump = chaiExec("--prerelease"); + let cli = bump("--prerelease"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.2.4-beta.0\n` ); @@ -72,12 +72,12 @@ describe.skip("bump --prerelease", () => { it("should reset the prerelease version", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let bump = chaiExec("--prerelease"); + let cli = bump("--prerelease"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.2.3-beta.5\n` ); @@ -87,12 +87,12 @@ describe.skip("bump --prerelease", () => { it("should honor the --preid flag", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let bump = chaiExec("--prerelease --preid alpha"); + let cli = bump("--prerelease --preid alpha"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.2.3-alpha.0\n` ); diff --git a/test/specs/release.spec.js b/test/specs/release.spec.js index 5aa2863..060c733 100644 --- a/test/specs/release.spec.js +++ b/test/specs/release.spec.js @@ -1,19 +1,19 @@ "use strict"; -const { check, files } = require("../utils"); -const { chaiExec, expect } = require("../utils/chai"); +const { check, files, bump } = require("../utils"); +const { expect } = require("chai"); describe.skip("bump [release]", () => { it("should increment an all-zero version number", () => { files.create("package.json", { version: "0.0.0" }); - let bump = chaiExec("major"); + let cli = bump("major"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 1.0.0\n` ); @@ -23,12 +23,12 @@ describe.skip("bump [release]", () => { it("should reset the minor and patch", () => { files.create("package.json", { version: "1.2.3" }); - let bump = chaiExec("--major"); + let cli = bump("--major"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 2.0.0\n` ); @@ -38,12 +38,12 @@ describe.skip("bump [release]", () => { it("should reset the prerelease version", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let bump = chaiExec("--major"); + let cli = bump("--major"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 2.0.0\n` ); @@ -53,12 +53,12 @@ describe.skip("bump [release]", () => { it("should not be affected by the --preid flag", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let bump = chaiExec("--major --preid alpha"); + let cli = bump("--major --preid alpha"); - expect(bump).to.have.stderr(""); - expect(bump).to.have.exitCode(0); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); - bump.should.have.stdout( + expect(cli).to.have.stdout( `${check} Updated package.json to 2.0.0\n` ); @@ -68,12 +68,12 @@ describe.skip("bump [release]", () => { it("should error if there's no current version number", () => { files.create("package.json", {}); - let bump = chaiExec("major"); + let cli = bump("major"); - expect(bump).to.have.stdout(""); - expect(bump).to.have.exitCode(2); + expect(cli).to.have.stdout(""); + expect(cli).to.have.exitCode(2); - bump.should.have.stderr( + expect(cli).to.have.stderr( "Unable to determine the current version number. Checked package.json, package-lock.json.\n" ); @@ -83,12 +83,12 @@ describe.skip("bump [release]", () => { it("should print a more detailed error if DEBUG is set", () => { files.create("package.json", { version: "" }); - let bump = chaiExec("major", { env: { DEBUG: "true" }}); + let cli = bump("major", { env: { DEBUG: "true" }}); - expect(bump).to.have.stdout(""); - expect(bump).to.have.exitCode(2); + expect(cli).to.have.stdout(""); + expect(cli).to.have.exitCode(2); - bump.should.have.stderr.that.matches( + expect(cli).to.have.stderr.that.matches( /^Error: Unable to determine the current version number. Checked package.json, package-lock.json.\n\s+at \w+/ ); diff --git a/test/utils/chai.js b/test/utils/bump.js similarity index 75% rename from test/utils/chai.js rename to test/utils/bump.js index 7217d47..0a96360 100644 --- a/test/utils/chai.js +++ b/test/utils/bump.js @@ -3,13 +3,7 @@ const chai = require("chai"); const chaiExec = require("chai-exec"); -module.exports = { - chaiExec, - expect: chai.expect, -}; - chai.use(chaiExec); -chai.should(); chaiExec.defaults = { command: "node", @@ -18,3 +12,5 @@ chaiExec.defaults = { cwd: "test/.tmp", }, }; + +module.exports = chaiExec; diff --git a/test/utils/index.js b/test/utils/index.js index 914d8ce..16fff1a 100644 --- a/test/utils/index.js +++ b/test/utils/index.js @@ -1,6 +1,7 @@ "use strict"; module.exports = { + bump: require("./bump"), check: require("./check"), files: require("./files"), fixtures: require("./fixtures"), From 8ae1816396ba2fe17f04707c64cd322f469dad58 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sat, 9 Mar 2019 10:30:42 -0600 Subject: [PATCH 089/106] Separated the `files` property into `updatedFiles` and `skippedFiles`. Added a "file skipped" event. --- src/cli/index.ts | 10 +++++++--- src/git.ts | 4 ++-- src/operation.ts | 25 ++++++++++--------------- src/types/version-bump-progress.ts | 1 + src/types/version-bump-results.ts | 9 +++++++-- src/update-files.ts | 8 +++++++- test/specs/api.spec.js | 11 +++++++---- 7 files changed, 41 insertions(+), 27 deletions(-) diff --git a/src/cli/index.ts b/src/cli/index.ts index 26de893..bc804ce 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -1,5 +1,5 @@ // tslint:disable: no-console -import { success } from "log-symbols"; +import { info, success } from "log-symbols"; import { manifest } from "../manifest"; import { ProgressEvent, VersionBumpProgress } from "../types/version-bump-progress"; import { versionBump } from "../version-bump"; @@ -44,11 +44,15 @@ export async function main(args: string[]): Promise { } } -function progress({ event, files, newVersion }: VersionBumpProgress): void { +function progress({ event, updatedFiles, skippedFiles, newVersion }: VersionBumpProgress): void { // tslint:disable-next-line: switch-default switch (event) { case ProgressEvent.FileUpdated: - console.log(success, `Updated ${files.pop()} to ${newVersion}`); + console.log(success, `Updated ${updatedFiles.pop()} to ${newVersion}`); + break; + + case ProgressEvent.FileSkipped: + console.log(info, `${skippedFiles.pop()} did not need to be updated`); break; case ProgressEvent.GitCommit: diff --git a/src/git.ts b/src/git.ts index 0a6e1fd..9a77054 100644 --- a/src/git.ts +++ b/src/git.ts @@ -11,7 +11,7 @@ export async function gitCommit(operation: Operation): Promise { } let { all, noVerify, message } = operation.options.commit; - let { files, newVersion } = operation.state; + let { updatedFiles, newVersion } = operation.state; let args = []; if (all) { @@ -30,7 +30,7 @@ export async function gitCommit(operation: Operation): Promise { // Append the file names last, as variadic arguments if (!all) { - args = args.concat(files); + args = args.concat(updatedFiles); } await ezSpawn.async("git", ["commit", ...args]); diff --git a/src/operation.ts b/src/operation.ts index f7c647a..5edd4dd 100644 --- a/src/operation.ts +++ b/src/operation.ts @@ -13,7 +13,8 @@ interface OperationState { newVersion: string; commitMessage: string; tagName: string; - files: string[]; + updatedFiles: string[]; + skippedFiles: string[]; } interface UpdateOperationState extends Partial { @@ -39,7 +40,8 @@ export class Operation { newVersion: "", commitMessage: "", tagName: "", - files: [], + updatedFiles: [], + skippedFiles: [], }; /** @@ -55,7 +57,8 @@ export class Operation { newVersion: state.newVersion, commit: options.commit ? state.commitMessage : false, tag: options.tag ? state.tagName : false, - files: state.files.slice(), + updatedFiles: state.updatedFiles.slice(), + skippedFiles: state.skippedFiles.slice(), }; } @@ -86,21 +89,13 @@ export class Operation { /** * Updates the operation state and results, and reports the updated progress to the user. */ - public update(state: UpdateOperationState): this { - if (state.files) { - // Concatenate the two `files` arrays, rather than overwriting - state.files = this.state.files.concat(state.files); - } - + public update({ event, ...newState }: UpdateOperationState): this { // Update the operation state - Object.assign(this.state, state); + Object.assign(this.state, newState); - if (state.event && this._progress) { + if (event && this._progress) { // Report the progress to the user - this._progress({ - event: state.event, - ...this.results - }); + this._progress({ event, ...this.results }); } return this; diff --git a/src/types/version-bump-progress.ts b/src/types/version-bump-progress.ts index 7d93882..0846501 100644 --- a/src/types/version-bump-progress.ts +++ b/src/types/version-bump-progress.ts @@ -5,6 +5,7 @@ import { VersionBumpResults } from "./version-bump-results"; */ export const enum ProgressEvent { FileUpdated = "file updated", + FileSkipped = "file skipped", GitCommit = "git commit", GitTag = "git tag", GitPush = "git push", diff --git a/src/types/version-bump-results.ts b/src/types/version-bump-results.ts index b345707..78391dd 100644 --- a/src/types/version-bump-results.ts +++ b/src/types/version-bump-results.ts @@ -34,7 +34,12 @@ export interface VersionBumpResults { tag: string | false; /** - * The files that were updated. + * The files that were actually modified. */ - files: string[]; + updatedFiles: string[]; + + /** + * The files that were not updated because they did not contain the old version number. + */ + skippedFiles: string[]; } diff --git a/src/update-files.ts b/src/update-files.ts index 8b2805e..92bf38b 100644 --- a/src/update-files.ts +++ b/src/update-files.ts @@ -16,7 +16,13 @@ export async function updateFiles(operation: Operation): Promise { if (modified) { operation.update({ event: ProgressEvent.FileUpdated, - files: [relPath], + updatedFiles: operation.state.updatedFiles.concat(relPath), + }); + } + else { + operation.update({ + event: ProgressEvent.FileSkipped, + skippedFiles: operation.state.skippedFiles.concat(relPath), }); } } diff --git a/test/specs/api.spec.js b/test/specs/api.spec.js index 3822dbc..0ec3dc1 100644 --- a/test/specs/api.spec.js +++ b/test/specs/api.spec.js @@ -26,7 +26,8 @@ describe("versionBup() API", () => { newVersion: "2.34.567", commit: false, tag: false, - files: ["package.json"], + updatedFiles: ["package.json"], + skippedFiles: [], }); // The package.json file should have been updated @@ -51,7 +52,8 @@ describe("versionBup() API", () => { newVersion: "1.1.0", commit: false, tag: false, - files: ["package.json"], + updatedFiles: ["package.json"], + skippedFiles: [], }); // The package.json file should have been updated @@ -81,7 +83,7 @@ describe("versionBup() API", () => { files: [ "random-file.json", "**/*.md", - ] + ], }); expect(results).to.deep.equal({ @@ -90,11 +92,12 @@ describe("versionBup() API", () => { newVersion: "1.1.0-test.1", commit: "A test of the upcoming v1.1.0-test.1", tag: "1.1.0-test.1", - files: [ + updatedFiles: [ "random-file.json", "README.md", "subdir/deep/changelog.md" ], + skippedFiles: [], }); // The CWD should not have changed From 94659f90564299e4fe61e9cc0a42a9305526c5f7 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sat, 9 Mar 2019 10:39:32 -0600 Subject: [PATCH 090/106] Increased test timeouts to allow for spawning a child process on slow environments like CI/CD --- .mocharc.yml | 2 +- test/specs/cli.spec.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.mocharc.yml b/.mocharc.yml index 93dfdb4..75f19b5 100644 --- a/.mocharc.yml +++ b/.mocharc.yml @@ -8,6 +8,6 @@ spec: - test/specs/**/*.spec.js bail: true -timeout: 6000 +timeout: 10000 retries: 2 recursive: true diff --git a/test/specs/cli.spec.js b/test/specs/cli.spec.js index cf9583a..0a45920 100644 --- a/test/specs/cli.spec.js +++ b/test/specs/cli.spec.js @@ -6,13 +6,12 @@ const manifest = require("../../package.json"); describe("bump", () => { - it("should run without any arguments", function () { + it("should run without any arguments", () => { // Create a dummy package.json, otherwise an error will occur files.create("package.json", { version: "1.0.0" }); // Run the CLI without any arguments. // It will prompt the user and wait forever, so add a timeout. - this.timeout(Math.max(10000, this.timeout())); let cli = bump("", { timeout: 6000 }); // It should have prompted for input From 435fafb3041d6e63c4f3d6e6c04c7f0043a7c054 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sun, 10 Mar 2019 07:46:35 -0500 Subject: [PATCH 091/106] Return files in a predictable order --- src/normalize-options.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/normalize-options.ts b/src/normalize-options.ts index 47e5dd3..ac95c69 100644 --- a/src/normalize-options.ts +++ b/src/normalize-options.ts @@ -168,5 +168,6 @@ async function strictGlobMatch(file: string, options: object): Promise } } - return matches; + // Return files in a predictable order + return matches.sort(); } From b7c9bd2271e9133a999199c85b68cfe12d3ec3fc Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sun, 10 Mar 2019 07:46:55 -0500 Subject: [PATCH 092/106] Fleshed-out the mock script file to be more realistic --- test/fixtures/files/script2.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/fixtures/files/script2.js b/test/fixtures/files/script2.js index 480490a..7f3fdba 100644 --- a/test/fixtures/files/script2.js +++ b/test/fixtures/files/script2.js @@ -1,4 +1,11 @@ -"use strict"; +/* eslint strict:off */ +(function () { + "use strict"; -// This file should not get updated because version 3.2.1 -// and v8.9.10 don't match the old version number + // This file should not get updated because + // version 3.2.1 and v8.9.10 don't match the old version number + let version = "3.2.1"; + let someNumbers = "8.9.10"; + return version + someNumbers; + +}()); From e2e3894f140c8d57a7708a023c64b9dbaebe0207 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sun, 10 Mar 2019 07:47:22 -0500 Subject: [PATCH 093/106] Expose the "check" symbol and the "info" symbol --- test/utils/check.js | 8 -------- test/utils/index.js | 3 ++- test/utils/symbols.js | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 9 deletions(-) delete mode 100644 test/utils/check.js create mode 100644 test/utils/symbols.js diff --git a/test/utils/check.js b/test/utils/check.js deleted file mode 100644 index c404193..0000000 --- a/test/utils/check.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; - -const stripAnsi = require("strip-ansi"); -const logSymbols = require("log-symbols"); - -// Export the check symbol (✔ on Mac/Linux, √ on Windows) -// with the ANSI color sequences removed -module.exports = stripAnsi(logSymbols.success); diff --git a/test/utils/index.js b/test/utils/index.js index 16fff1a..681161a 100644 --- a/test/utils/index.js +++ b/test/utils/index.js @@ -2,7 +2,8 @@ module.exports = { bump: require("./bump"), - check: require("./check"), + check: require("./symbols").check, + info: require("./symbols").info, files: require("./files"), fixtures: require("./fixtures"), mocks: require("./mocks"), diff --git a/test/utils/symbols.js b/test/utils/symbols.js new file mode 100644 index 0000000..0d7873c --- /dev/null +++ b/test/utils/symbols.js @@ -0,0 +1,18 @@ +"use strict"; + +const stripAnsi = require("strip-ansi"); +const logSymbols = require("log-symbols"); + +module.exports = { + /** + * The check symbol (✔ on Mac/Linux, √ on Windows) + * with the ANSI color sequences removed + */ + check: stripAnsi(logSymbols.success), + + /** + * The check symbol (ℹ on Mac/Linux, i on Windows) + * with the ANSI color sequences removed + */ + info: stripAnsi(logSymbols.info), +}; From 1b682668677c4fa482d2f8a16cf8778ea4fb0f79 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sun, 10 Mar 2019 07:48:03 -0500 Subject: [PATCH 094/106] Updated all file tests for v5.0 --- test/specs/files.spec.js | 126 +++++++++++++++++++++++---------------- 1 file changed, 74 insertions(+), 52 deletions(-) diff --git a/test/specs/files.spec.js b/test/specs/files.spec.js index bd3d46a..0278d32 100644 --- a/test/specs/files.spec.js +++ b/test/specs/files.spec.js @@ -1,9 +1,9 @@ "use strict"; -const { check, files, fixtures, bump } = require("../utils"); +const { check, info, files, fixtures, bump } = require("../utils"); const { expect } = require("chai"); -describe.skip("bump [files...]", () => { +describe("bump [files...]", () => { it("should update the package.json and package-lock.json by default", () => { files.create("package.json", { version: "1.2.3" }); @@ -19,26 +19,61 @@ describe.skip("bump [files...]", () => { `${check} Updated package-lock.json to 2.0.0\n` ); - expect(files.json("package.json").version).to.equal("2.0.0"); - expect(files.json("package-lock.json").version).to.equal("2.0.0"); + expect(files.json("package.json")).to.deep.equal({ version: "2.0.0" }); + expect(files.json("package-lock.json")).to.deep.equal({ version: "2.0.0" }); + }); + + it("should not update package-lock.json if package.json is explicitly specified", () => { + files.create("package.json", { version: "1.2.3" }); + files.create("package-lock.json", { version: "1.2.3" }); + + let cli = bump("major package.json"); + + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); + + expect(cli).to.have.stdout( + `${check} Updated package.json to 2.0.0\n` + ); + + expect(files.json("package.json")).to.deep.equal({ version: "2.0.0" }); + expect(files.json("package-lock.json")).to.deep.equal({ version: "1.2.3" }); }); it("should not update package.json if package-lock.json is explicitly specified", () => { files.create("package.json", { version: "1.2.3" }); files.create("package-lock.json", { version: "1.2.3" }); - let cli = bump("major"); + let cli = bump("major package-lock.json"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 2.0.0\n` + `${check} Updated package-lock.json to 2.0.0\n` ); - expect(files.json("package.json").version).to.equal("2.0.0"); - expect(files.json("package-lock.json").version).to.equal("2.0.0"); + expect(files.json("package.json")).to.deep.equal({ version: "1.2.3" }); + expect(files.json("package-lock.json")).to.deep.equal({ version: "2.0.0" }); + }); + + it("should not update package.json or package-lock.json if another file is explicitly specified", () => { + files.create("package.json", { version: "1.2.3" }); + files.create("package-lock.json", { version: "1.2.3" }); + files.create("bower.json", { version: "1.2.3" }); + + let cli = bump("major bower.json"); + + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); + + expect(cli).to.have.stdout( + `${check} Updated bower.json to 2.0.0\n` + ); + + expect(files.json("package.json")).to.deep.equal({ version: "1.2.3" }); + expect(files.json("package-lock.json")).to.deep.equal({ version: "1.2.3" }); + expect(files.json("bower.json")).to.deep.equal({ version: "2.0.0" }); }); it("should replace the version number in non-manifest files", () => { @@ -58,15 +93,21 @@ describe.skip("bump [files...]", () => { expect(cli).to.have.stdout( `${check} Updated LICENSE to 2.0.0\n` + `${check} Updated README.md to 2.0.0\n` + - `${check} Updated script1.js to 2.0.0\n` + `${check} Updated script1.js to 2.0.0\n` + + `${info} script2.js did not need to be updated\n` + + `${check} Updated subdir/deep/script1.js to 2.0.0\n` + + `${info} subdir/deep/script2.js did not need to be updated\n` ); - expect(files.json("package.json").version).to.equal("2.0.0"); + expect(files.json("package.json")).to.deep.equal({ version: "1.2.3" }); expect(files.text("LICENSE")).to.match(/MyApp v2.0.0 Copyright/); expect(files.text("README.md")).to.match(/version 2.0.0 and v2.0.0 should both get updated/); - expect(files.text("script1.js")).to.match(/make sure v2.0.0 gets replaced correctly/); - expect(files.text("script1.js")).to.match(/let version = "2.0.0";/); + expect(files.text("script1.js")).to.match(/make sure v2.0.0 gets replaced/); expect(files.text("script1.js")).to.match(/let version = "2.0.0";/); + expect(files.text("script2.js")).to.match(/version 3.2.1 and v8.9.10 don't match the old version number/); + expect(files.text("subdir/deep/script1.js")).to.match(/make sure v2.0.0 gets replaced/); + expect(files.text("subdir/deep/script1.js")).to.match(/let version = "2.0.0";/); + expect(files.text("subdir/deep/script2.js")).to.match(/version 3.2.1 and v8.9.10 don't match the old version number/); }); it("should not replace other version fields in manifest files", () => { @@ -83,13 +124,12 @@ describe.skip("bump [files...]", () => { `${check} Updated package-lock.json to 2.0.0\n` ); - expect(files.text("README.md")).to.match(/version 5.6.7 and v8.9.10 should not be changed/); - expect(files.text("script2.js")).to.match(/version 3.2.1 and v8.9.10 don't match the old version number/); + expect(files.json("package.json")).to.deep.equal({ version: "2.0.0", notTheVersion: "1.2.3" }); + expect(files.json("package-lock.json")).to.deep.equal({ version: "2.0.0", notTheVersion: "1.2.3" }); }); it("should not replace other version numbers in non-manifest files", () => { files.create("package.json", { version: "1.2.3" }); - files.create("package-lock.json", { version: "1.2.3" }); files.create("LICENSE", fixtures.license); files.create("README.md", fixtures.readme); files.create("script1.js", fixtures.script1); @@ -101,12 +141,13 @@ describe.skip("bump [files...]", () => { expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 2.0.0\n` + + `${check} Updated LICENSE to 2.0.0\n` + `${check} Updated README.md to 2.0.0\n` + `${check} Updated script1.js to 2.0.0\n` + - `${check} Updated LICENSE to 2.0.0\n` + `${info} script2.js did not need to be updated\n` ); + expect(files.text("LICENSE")).to.match(/MyApp v2.0.0 Copyright/); expect(files.text("README.md")).to.match(/version 5.6.7 and v8.9.10 should not be changed/); expect(files.text("script2.js")).to.match(/version 3.2.1 and v8.9.10 don't match the old version number/); }); @@ -124,61 +165,42 @@ describe.skip("bump [files...]", () => { expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 5.0.0\n` + `${info} LICENSE did not need to be updated\n` + + `${info} README.md did not need to be updated\n` + + `${info} script1.js did not need to be updated\n` + + `${info} script2.js did not need to be updated\n` ); - expect(files.json("package.json").version).to.equal("5.0.0"); + expect(files.json("package.json")).to.deep.equal({ version: "4.5.6" }); expect(files.text("LICENSE")).to.match(/MyApp v1.2.3 Copyright/); expect(files.text("README.md")).to.match(/version 5.6.7 and v8.9.10 should not be changed/); expect(files.text("README.md")).to.match(/version 1.2.3 and v1.2.3 should both get updated/); - expect(files.text("script1.js")).to.match(/make sure v1.2.3 gets replaced correctly/); + expect(files.text("script1.js")).to.match(/make sure v1.2.3 gets replaced/); expect(files.text("script1.js")).to.match(/let version = "1.2.3";/); expect(files.text("script1.js")).to.match(/let version = "1.2.3";/); expect(files.text("script2.js")).to.match(/version 3.2.1 and v8.9.10 don't match the old version number/); }); it("should error if an explicitly-specified file doesn't exist", () => { - files.create("package.json", { version: "4.5.6" }); - - let cli = bump("major LICENSE README.* *.js"); + files.create("package.json", { version: "1.2.3" }); - expect(cli).to.have.stderr(""); - expect(cli).to.have.exitCode(0); + let cli = bump("major README.md"); - expect(cli).to.have.stdout( - `${check} Updated package.json to 5.0.0\n` - ); + expect(cli).to.have.stderr("Could not find file: README.md.\n"); + expect(cli).to.have.exitCode(1); - expect(files.json("package.json").version).to.equal("5.0.0"); - expect(files.text("LICENSE")).to.match(/MyApp v1.2.3 Copyright/); - expect(files.text("README.md")).to.match(/version 5.6.7 and v8.9.10 should not be changed/); - expect(files.text("README.md")).to.match(/version 1.2.3 and v1.2.3 should both get updated/); - expect(files.text("script1.js")).to.match(/make sure v1.2.3 gets replaced correctly/); - expect(files.text("script1.js")).to.match(/let version = "1.2.3";/); - expect(files.text("script1.js")).to.match(/let version = "1.2.3";/); - expect(files.text("script2.js")).to.match(/version 3.2.1 and v8.9.10 don't match the old version number/); + expect(files.json("package.json")).to.deep.equal({ version: "1.2.3" }); }); it("should error if a glob pattern doesn't match any files", () => { - files.create("package.json", { version: "4.5.6" }); + files.create("package.json", { version: "1.2.3" }); - let cli = bump("major README.* *.js"); + let cli = bump("major **/*.js"); - expect(cli).to.have.stderr(""); - expect(cli).to.have.exitCode(0); + expect(cli).to.have.stderr('Could not find any files matching "**/*.js".\n'); + expect(cli).to.have.exitCode(1); - expect(cli).to.have.stdout( - `${check} Updated package.json to 5.0.0\n` - ); - - expect(files.json("package.json").version).to.equal("5.0.0"); - expect(files.text("LICENSE")).to.match(/MyApp v1.2.3 Copyright/); - expect(files.text("README.md")).to.match(/version 5.6.7 and v8.9.10 should not be changed/); - expect(files.text("README.md")).to.match(/version 1.2.3 and v1.2.3 should both get updated/); - expect(files.text("script1.js")).to.match(/make sure v1.2.3 gets replaced correctly/); - expect(files.text("script1.js")).to.match(/let version = "1.2.3";/); - expect(files.text("script1.js")).to.match(/let version = "1.2.3";/); - expect(files.text("script2.js")).to.match(/version 3.2.1 and v8.9.10 don't match the old version number/); + expect(files.json("package.json")).to.deep.equal({ version: "1.2.3" }); }); }); From 665eec421530625b78f7435ac91d6d84dba9b17b Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sun, 10 Mar 2019 09:34:20 -0500 Subject: [PATCH 095/106] Use `__dirname` instead of relying on the CWD, since this file is used by mocks --- test/utils/files.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/utils/files.js b/test/utils/files.js index ba70694..57a86c3 100644 --- a/test/utils/files.js +++ b/test/utils/files.js @@ -4,7 +4,7 @@ const fs = require("fs"); const path = require("path"); const mkdirp = require("mkdirp"); -const tempDir = path.resolve("test", ".tmp"); +const tempDir = path.resolve(__dirname, "..", ".tmp"); const files = module.exports = { /** From 535ddae684f88bc3627de20fac0245bb2e5815d7 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sun, 10 Mar 2019 09:34:43 -0500 Subject: [PATCH 096/106] Increase the "slow" threshhold for tests --- .mocharc.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.mocharc.yml b/.mocharc.yml index 75f19b5..6b9e4c4 100644 --- a/.mocharc.yml +++ b/.mocharc.yml @@ -9,5 +9,6 @@ spec: bail: true timeout: 10000 +slow: 2000 retries: 2 recursive: true From e710f2f2f2a14d17b8c22ec78c78c78afcea165c Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sun, 10 Mar 2019 09:34:53 -0500 Subject: [PATCH 097/106] Updated all the "git commit" tests for v5.0 --- test/specs/git-commit.spec.js | 80 ++++++++++++++++++++++++++++------- 1 file changed, 64 insertions(+), 16 deletions(-) diff --git a/test/specs/git-commit.spec.js b/test/specs/git-commit.spec.js index aa9f89d..00ac2cf 100644 --- a/test/specs/git-commit.spec.js +++ b/test/specs/git-commit.spec.js @@ -3,12 +3,28 @@ const { check, files, mocks, bump } = require("../utils"); const { expect } = require("chai"); -describe.skip("bump --commit", () => { +describe("bump --commit", () => { + + it("should not commit by default", () => { + files.create("package.json", { version: "1.0.0" }); + + let cli = bump("major"); + + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); + + expect(cli).to.have.stdout( + `${check} Updated package.json to 2.0.0\n` + ); + + let git = mocks.git(); + expect(git.length).to.equal(0); + }); it("should commit the manifest file to git", () => { files.create("package.json", { version: "1.0.0" }); - let cli = bump("--major --commit"); + let cli = bump("major --commit"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); @@ -20,8 +36,7 @@ describe.skip("bump --commit", () => { let git = mocks.git(); expect(git.length).to.equal(1); - - expect(git[0].cmd).to.equal('git commit package.json -m "release v2.0.0"'); + expect(git[0]).to.equal('git commit --message "release v2.0.0" package.json'); }); it("should commit multiple manifest files to git", () => { @@ -29,28 +44,27 @@ describe.skip("bump --commit", () => { files.create("bower.json", { version: "1.0.0" }); files.create("component.json", { version: "1.0.0" }); - let cli = bump("--minor --commit"); + let cli = bump("minor *.json --commit"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 1.1.0\n` + `${check} Updated bower.json to 1.1.0\n` + `${check} Updated component.json to 1.1.0\n` + + `${check} Updated package.json to 1.1.0\n` + `${check} Git commit\n` ); let git = mocks.git(); expect(git.length).to.equal(1); - - expect(git[0].cmd).to.equal('git commit package.json bower.json component.json -m "release v1.1.0"'); + expect(git[0]).to.equal('git commit --message "release v1.1.0" bower.json component.json package.json'); }); it("should commit all files to git", () => { files.create("package.json", { version: "1.0.0" }); - let cli = bump("--minor --commit --all"); + let cli = bump("minor --commit --all"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); @@ -62,14 +76,13 @@ describe.skip("bump --commit", () => { let git = mocks.git(); expect(git.length).to.equal(1); - - expect(git[0].cmd).to.equal('git commit -a -m "release v1.1.0"'); + expect(git[0]).to.equal('git commit --all --message "release v1.1.0"'); }); it("should commit without running pre-commit hooks", () => { files.create("package.json", { version: "1.0.0" }); - let cli = bump("--minor --commit --all --no-verify"); + let cli = bump("minor --commit --all --no-verify"); expect(cli.stderr).to.be.empty; expect(cli).to.have.exitCode(0); @@ -81,14 +94,49 @@ describe.skip("bump --commit", () => { let git = mocks.git(); expect(git.length).to.equal(1); + expect(git[0]).to.equal('git commit --all --no-verify --message "release v1.1.0"'); + }); + + it("should append the version number to the commit message", () => { + files.create("package.json", { version: "1.0.0" }); + + let cli = bump('patch --all --commit "this is release v"'); + + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); + + expect(cli).to.have.stdout( + `${check} Updated package.json to 1.0.1\n` + + `${check} Git commit\n` + ); + + let git = mocks.git(); + expect(git.length).to.equal(1); + expect(git[0]).to.equal('git commit --all --message "this is release v1.0.1"'); + }); + + it("should replace version number placeholders in the commit message", () => { + files.create("package.json", { version: "1.0.0" }); - expect(git[0].cmd).to.equal('git commit --no-verify -a -m "release v1.1.0"'); + let cli = bump('patch --all --commit "Releasing v%s. This is release v%s."'); + + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); + + expect(cli).to.have.stdout( + `${check} Updated package.json to 1.0.1\n` + + `${check} Git commit\n` + ); + + let git = mocks.git(); + expect(git.length).to.equal(1); + expect(git[0]).to.equal('git commit --all --message "Releasing v1.0.1. This is release v1.0.1."'); }); - it("should commit the manifest files to git with a message", () => { + it("should accept an empty commit message", () => { files.create("package.json", { version: "1.0.0" }); - let cli = bump("--patch --all --commit my-message"); + let cli = bump(["patch", "--all", "--commit", ""]); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); @@ -101,7 +149,7 @@ describe.skip("bump --commit", () => { let git = mocks.git(); expect(git.length).to.equal(1); - expect(git[0].cmd).to.equal('git commit -a -m "v1.0.1 my-message"'); + expect(git[0]).to.equal("git commit --all --message 1.0.1"); }); }); From 30114ff8562c880220c82de59815a11ee5b5a96a Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sun, 10 Mar 2019 09:57:56 -0500 Subject: [PATCH 098/106] Updated all the "git push" tests for v5.0 --- test/specs/git-push.spec.js | 63 +++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 13 deletions(-) diff --git a/test/specs/git-push.spec.js b/test/specs/git-push.spec.js index c6ee4d0..c5d9a4a 100644 --- a/test/specs/git-push.spec.js +++ b/test/specs/git-push.spec.js @@ -3,12 +3,49 @@ const { check, files, mocks, bump } = require("../utils"); const { expect } = require("chai"); -describe.skip("bump --push", () => { +describe("bump --push", () => { + + it("should not push by default", () => { + files.create("package.json", { version: "1.0.0" }); + + let cli = bump("major"); + + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); + + expect(cli).to.have.stdout( + `${check} Updated package.json to 2.0.0\n` + ); + + let git = mocks.git(); + expect(git.length).to.equal(0); + }); + + it("should not push by default, even if --commit or --tag is used", () => { + files.create("package.json", { version: "1.0.0" }); + + let cli = bump("major --commit --tag"); + + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); + + expect(cli).to.have.stdout( + `${check} Updated package.json to 2.0.0\n` + + `${check} Git commit\n` + + `${check} Git tag\n` + ); + + let git = mocks.git(); + expect(git.length).to.equal(2); + + expect(git[0]).to.equal('git commit --message "release v2.0.0" package.json'); + expect(git[1]).to.equal('git tag --annotate --message "release v2.0.0" v2.0.0'); + }); it("should commit and push to git", () => { files.create("package.json", { version: "1.0.0" }); - let cli = bump("--major --push"); + let cli = bump("major --push"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); @@ -22,14 +59,14 @@ describe.skip("bump --push", () => { let git = mocks.git(); expect(git.length).to.equal(2); - expect(git[0].cmd).to.equal('git commit package.json -m "release v2.0.0"'); - expect(git[1].cmd).to.equal("git push"); + expect(git[0]).to.equal('git commit --message "release v2.0.0" package.json'); + expect(git[1]).to.equal("git push"); }); it("should push all files", () => { files.create("package.json", { version: "1.0.0" }); - let cli = bump("--minor --push --all"); + let cli = bump("minor --push --all"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); @@ -43,20 +80,20 @@ describe.skip("bump --push", () => { let git = mocks.git(); expect(git.length).to.equal(2); - expect(git[0].cmd).to.equal('git commit -a -m "release v1.1.0"'); - expect(git[1].cmd).to.equal("git push"); + expect(git[0]).to.equal('git commit --all --message "release v1.1.0"'); + expect(git[1]).to.equal("git push"); }); it("should push git tags", () => { files.create("package.json", { version: "1.0.0" }); - let cli = bump("--premajor --tag --push"); + let cli = bump("premajor --tag --push"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 2.0.0-beta.0\n` + + `${check} Updated package.json to 2.0.0-beta.1\n` + `${check} Git commit\n` + `${check} Git tag\n` + `${check} Git push\n` @@ -65,9 +102,9 @@ describe.skip("bump --push", () => { let git = mocks.git(); expect(git.length).to.equal(4); - expect(git[0].cmd).to.equal('git commit package.json -m "release v2.0.0-beta.0"'); - expect(git[1].cmd).to.equal("git tag -a v2.0.0-beta.0 -m 2.0.0-beta.0"); - expect(git[2].cmd).to.equal("git push"); - expect(git[3].cmd).to.equal("git push --tags"); + expect(git[0]).to.equal('git commit --message "release v2.0.0-beta.1" package.json'); + expect(git[1]).to.equal('git tag --annotate --message "release v2.0.0-beta.1" v2.0.0-beta.1'); + expect(git[2]).to.equal("git push"); + expect(git[3]).to.equal("git push --tags"); }); }); From 277d3887830b9826e9935bc1549295c5cc5bad11 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sun, 10 Mar 2019 10:08:03 -0500 Subject: [PATCH 099/106] Updated all the "git tag" tests for v5.0 --- test/specs/git-tag.spec.js | 68 ++++++++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 17 deletions(-) diff --git a/test/specs/git-tag.spec.js b/test/specs/git-tag.spec.js index cb88827..04db4a4 100644 --- a/test/specs/git-tag.spec.js +++ b/test/specs/git-tag.spec.js @@ -3,12 +3,46 @@ const { check, files, mocks, bump } = require("../utils"); const { expect } = require("chai"); -describe.skip("bump --tag", () => { +describe("bump --tag", () => { + + it("should not tag by default", () => { + files.create("package.json", { version: "1.0.0" }); + + let cli = bump("major"); + + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); + + expect(cli).to.have.stdout( + `${check} Updated package.json to 2.0.0\n` + ); + + let git = mocks.git(); + expect(git.length).to.equal(0); + }); + + it("should not tag by default, even if --commit is used", () => { + files.create("package.json", { version: "1.0.0" }); + + let cli = bump("major --commit"); + + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); + + expect(cli).to.have.stdout( + `${check} Updated package.json to 2.0.0\n` + + `${check} Git commit\n` + ); + + let git = mocks.git(); + expect(git.length).to.equal(1); + expect(git[0]).to.equal('git commit --message "release v2.0.0" package.json'); + }); it("should add a git tag", () => { files.create("package.json", { version: "1.0.0" }); - let cli = bump("--major --commit --tag"); + let cli = bump("major --commit --tag"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); @@ -22,14 +56,14 @@ describe.skip("bump --tag", () => { let git = mocks.git(); expect(git.length).to.equal(2); - expect(git[0].cmd).to.equal('git commit package.json -m "release v2.0.0"'); - expect(git[1].cmd).to.equal("git tag -a v2.0.0 -m 2.0.0"); + expect(git[0]).to.equal('git commit --message "release v2.0.0" package.json'); + expect(git[1]).to.equal('git tag --annotate --message "release v2.0.0" v2.0.0'); }); it("should add a git tag, even if --commit is not specified", () => { files.create("package.json", { version: "1.0.0" }); - let cli = bump("--minor --tag"); + let cli = bump("minor --tag"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); @@ -43,14 +77,14 @@ describe.skip("bump --tag", () => { let git = mocks.git(); expect(git.length).to.equal(2); - expect(git[0].cmd).to.equal('git commit package.json -m "release v1.1.0"'); - expect(git[1].cmd).to.equal("git tag -a v1.1.0 -m 1.1.0"); + expect(git[0]).to.equal('git commit --message "release v1.1.0" package.json'); + expect(git[1]).to.equal('git tag --annotate --message "release v1.1.0" v1.1.0'); }); it("should tag all files", () => { files.create("package.json", { version: "1.0.0" }); - let cli = bump("--patch --tag --all"); + let cli = bump("patch --tag --all"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); @@ -64,22 +98,22 @@ describe.skip("bump --tag", () => { let git = mocks.git(); expect(git.length).to.equal(2); - expect(git[0].cmd).to.equal('git commit -a -m "release v1.0.1"'); - expect(git[1].cmd).to.equal("git tag -a v1.0.1 -m 1.0.1"); + expect(git[0]).to.equal('git commit --all --message "release v1.0.1"'); + expect(git[1]).to.equal('git tag --annotate --message "release v1.0.1" v1.0.1'); }); it("should push git tags", () => { files.create("package.json", { version: "1.0.0" }); files.create("bower.json", { version: "1.0.0" }); - let cli = bump("--premajor --tag --push"); + let cli = bump("premajor --tag --push *.json"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 2.0.0-beta.0\n` + - `${check} Updated bower.json to 2.0.0-beta.0\n` + + `${check} Updated bower.json to 2.0.0-beta.1\n` + + `${check} Updated package.json to 2.0.0-beta.1\n` + `${check} Git commit\n` + `${check} Git tag\n` + `${check} Git push\n` @@ -88,9 +122,9 @@ describe.skip("bump --tag", () => { let git = mocks.git(); expect(git.length).to.equal(4); - expect(git[0].cmd).to.equal('git commit package.json bower.json -m "release v2.0.0-beta.0"'); - expect(git[1].cmd).to.equal("git tag -a v2.0.0-beta.0 -m 2.0.0-beta.0"); - expect(git[2].cmd).to.equal("git push"); - expect(git[3].cmd).to.equal("git push --tags"); + expect(git[0]).to.equal('git commit --message "release v2.0.0-beta.1" bower.json package.json'); + expect(git[1]).to.equal('git tag --annotate --message "release v2.0.0-beta.1" v2.0.0-beta.1'); + expect(git[2]).to.equal("git push"); + expect(git[3]).to.equal("git push --tags"); }); }); From 59dae4fad9697acd4b1eab076e94db91bf0fc0f9 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sun, 10 Mar 2019 10:27:38 -0500 Subject: [PATCH 100/106] Updated tests for v5.0 --- test/specs/minor.spec.js | 61 ++++++++++----------------- test/specs/patch.spec.js | 61 ++++++++++----------------- test/specs/premajor.spec.js | 77 ++++++++++++++--------------------- test/specs/preminor.spec.js | 77 ++++++++++++++--------------------- test/specs/prepatch.spec.js | 77 ++++++++++++++--------------------- test/specs/prerelease.spec.js | 73 +++++++++++++-------------------- 6 files changed, 162 insertions(+), 264 deletions(-) diff --git a/test/specs/minor.spec.js b/test/specs/minor.spec.js index bd6554b..7b393b4 100644 --- a/test/specs/minor.spec.js +++ b/test/specs/minor.spec.js @@ -3,46 +3,12 @@ const { check, files, bump } = require("../utils"); const { expect } = require("chai"); -describe.skip("bump --minor", () => { - it("should not increment a non-existent version number", () => { - files.create("package.json", {}); - files.create("bower.json", { name: "my-app" }); - - let cli = bump("--minor"); - - expect(cli).to.have.stderr(""); - expect(cli).to.have.stdout(""); - expect(cli).to.have.exitCode(0); - - expect(files.json("package.json")).to.deep.equal({}); - expect(files.json("bower.json")).to.deep.equal({ name: "my-app" }); - }); - - it("should treat empty version numbers as 0.0.0", () => { - files.create("package.json", { version: "" }); - files.create("bower.json", { version: null }); - files.create("component.json", { version: 0 }); - - let cli = bump("--minor"); - - expect(cli).to.have.stderr(""); - expect(cli).to.have.exitCode(0); - - expect(cli).to.have.stdout( - `${check} Updated package.json to 0.1.0\n` + - `${check} Updated bower.json to 0.1.0\n` + - `${check} Updated component.json to 0.1.0\n` - ); - - expect(files.json("package.json")).to.deep.equal({ version: "0.1.0" }); - expect(files.json("bower.json")).to.deep.equal({ version: "0.1.0" }); - expect(files.json("component.json")).to.deep.equal({ version: "0.1.0" }); - }); +describe("bump minor", () => { it("should increment an all-zero version number", () => { files.create("package.json", { version: "0.0.0" }); - let cli = bump("--minor"); + let cli = bump("minor"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); @@ -57,7 +23,7 @@ describe.skip("bump --minor", () => { it("should reset the patch", () => { files.create("package.json", { version: "1.2.3" }); - let cli = bump("--minor"); + let cli = bump("minor"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); @@ -72,7 +38,7 @@ describe.skip("bump --minor", () => { it("should reset the prerelease version", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let cli = bump("--minor"); + let cli = bump("minor"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); @@ -87,7 +53,7 @@ describe.skip("bump --minor", () => { it("should not be affected by the --preid flag", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let cli = bump("--minor --preid alpha"); + let cli = bump("minor --preid alpha"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); @@ -98,4 +64,21 @@ describe.skip("bump --minor", () => { expect(files.json("package.json")).to.deep.equal({ version: "1.3.0" }); }); + + it("should error if there is no existing version number", () => { + files.create("package.json", { name: "my-app" }); + files.create("bower.json", { version: "" }); + files.create("component.json", { version: 0 }); + + let cli = bump("minor *.json"); + + expect(cli).to.have.stdout(""); + expect(cli).to.have.stderr("Unable to determine the current version number. Checked bower.json, component.json, package.json.\n"); + expect(cli).to.have.exitCode(1); + + expect(files.json("package.json")).to.deep.equal({ name: "my-app" }); + expect(files.json("bower.json")).to.deep.equal({ version: "" }); + expect(files.json("component.json")).to.deep.equal({ version: 0 }); + }); + }); diff --git a/test/specs/patch.spec.js b/test/specs/patch.spec.js index eebb0a7..566302e 100644 --- a/test/specs/patch.spec.js +++ b/test/specs/patch.spec.js @@ -3,46 +3,12 @@ const { check, files, bump } = require("../utils"); const { expect } = require("chai"); -describe.skip("bump --patch", () => { - it("should not increment a non-existent version number", () => { - files.create("package.json", {}); - files.create("bower.json", { name: "my-app" }); - - let cli = bump("--patch"); - - expect(cli).to.have.stderr(""); - expect(cli).to.have.stdout(""); - expect(cli).to.have.exitCode(0); - - expect(files.json("package.json")).to.deep.equal({}); - expect(files.json("bower.json")).to.deep.equal({ name: "my-app" }); - }); - - it("should treat empty version numbers as 0.0.0", () => { - files.create("package.json", { version: "" }); - files.create("bower.json", { version: null }); - files.create("component.json", { version: 0 }); - - let cli = bump("--patch"); - - expect(cli).to.have.stderr(""); - expect(cli).to.have.exitCode(0); - - expect(cli).to.have.stdout( - `${check} Updated package.json to 0.0.1\n` + - `${check} Updated bower.json to 0.0.1\n` + - `${check} Updated component.json to 0.0.1\n` - ); - - expect(files.json("package.json")).to.deep.equal({ version: "0.0.1" }); - expect(files.json("bower.json")).to.deep.equal({ version: "0.0.1" }); - expect(files.json("component.json")).to.deep.equal({ version: "0.0.1" }); - }); +describe("bump patch", () => { it("should increment an all-zero version number", () => { files.create("package.json", { version: "0.0.0" }); - let cli = bump("--patch"); + let cli = bump("patch"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); @@ -57,7 +23,7 @@ describe.skip("bump --patch", () => { it("should increment the patch", () => { files.create("package.json", { version: "1.2.3" }); - let cli = bump("--patch"); + let cli = bump("patch"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); @@ -72,7 +38,7 @@ describe.skip("bump --patch", () => { it("should reset the prerelease version", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let cli = bump("--patch"); + let cli = bump("patch"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); @@ -87,7 +53,7 @@ describe.skip("bump --patch", () => { it("should not be affected by the --preid flag", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let cli = bump("--patch --preid alpha"); + let cli = bump("patch --preid alpha"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); @@ -98,4 +64,21 @@ describe.skip("bump --patch", () => { expect(files.json("package.json")).to.deep.equal({ version: "1.2.3" }); }); + + it("should error if there is no existing version number", () => { + files.create("package.json", { name: "my-app" }); + files.create("bower.json", { version: "" }); + files.create("component.json", { version: 0 }); + + let cli = bump("patch *.json"); + + expect(cli).to.have.stdout(""); + expect(cli).to.have.stderr("Unable to determine the current version number. Checked bower.json, component.json, package.json.\n"); + expect(cli).to.have.exitCode(1); + + expect(files.json("package.json")).to.deep.equal({ name: "my-app" }); + expect(files.json("bower.json")).to.deep.equal({ version: "" }); + expect(files.json("component.json")).to.deep.equal({ version: 0 }); + }); + }); diff --git a/test/specs/premajor.spec.js b/test/specs/premajor.spec.js index 7aa06da..e6d3a88 100644 --- a/test/specs/premajor.spec.js +++ b/test/specs/premajor.spec.js @@ -3,99 +3,82 @@ const { check, files, bump } = require("../utils"); const { expect } = require("chai"); -describe.skip("bump --premajor", () => { - it("should not increment a non-existent version number", () => { - files.create("package.json", {}); - files.create("bower.json", { name: "my-app" }); - - let cli = bump("--premajor"); - - expect(cli).to.have.stderr(""); - expect(cli).to.have.stdout(""); - expect(cli).to.have.exitCode(0); - - expect(files.json("package.json")).to.deep.equal({}); - expect(files.json("bower.json")).to.deep.equal({ name: "my-app" }); - }); - - it("should treat empty version numbers as 0.0.0", () => { - files.create("package.json", { version: "" }); - files.create("bower.json", { version: null }); - files.create("component.json", { version: 0 }); - - let cli = bump("--premajor"); - - expect(cli).to.have.stderr(""); - expect(cli).to.have.exitCode(0); - - expect(cli).to.have.stdout( - `${check} Updated package.json to 1.0.0-beta.0\n` + - `${check} Updated bower.json to 1.0.0-beta.0\n` + - `${check} Updated component.json to 1.0.0-beta.0\n` - ); - - expect(files.json("package.json")).to.deep.equal({ version: "1.0.0-beta.0" }); - expect(files.json("bower.json")).to.deep.equal({ version: "1.0.0-beta.0" }); - expect(files.json("component.json")).to.deep.equal({ version: "1.0.0-beta.0" }); - }); +describe("bump premajor", () => { it("should increment an all-zero version number", () => { files.create("package.json", { version: "0.0.0" }); - let cli = bump("--premajor"); + let cli = bump("premajor"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 1.0.0-beta.0\n` + `${check} Updated package.json to 1.0.0-beta.1\n` ); - expect(files.json("package.json")).to.deep.equal({ version: "1.0.0-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.0.0-beta.1" }); }); it("should reset the minor and patch", () => { files.create("package.json", { version: "1.2.3" }); - let cli = bump("--premajor"); + let cli = bump("premajor"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 2.0.0-beta.0\n` + `${check} Updated package.json to 2.0.0-beta.1\n` ); - expect(files.json("package.json")).to.deep.equal({ version: "2.0.0-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "2.0.0-beta.1" }); }); it("should reset the prerelease version", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let cli = bump("--premajor"); + let cli = bump("premajor"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 2.0.0-beta.0\n` + `${check} Updated package.json to 2.0.0-beta.1\n` ); - expect(files.json("package.json")).to.deep.equal({ version: "2.0.0-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "2.0.0-beta.1" }); }); it("should honor the --preid flag", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let cli = bump("--premajor --preid alpha"); + let cli = bump("premajor --preid alpha"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 2.0.0-alpha.0\n` + `${check} Updated package.json to 2.0.0-alpha.1\n` ); - expect(files.json("package.json")).to.deep.equal({ version: "2.0.0-alpha.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "2.0.0-alpha.1" }); }); + + it("should error if there is no existing version number", () => { + files.create("package.json", { name: "my-app" }); + files.create("bower.json", { version: "" }); + files.create("component.json", { version: 0 }); + + let cli = bump("premajor *.json"); + + expect(cli).to.have.stdout(""); + expect(cli).to.have.stderr("Unable to determine the current version number. Checked bower.json, component.json, package.json.\n"); + expect(cli).to.have.exitCode(1); + + expect(files.json("package.json")).to.deep.equal({ name: "my-app" }); + expect(files.json("bower.json")).to.deep.equal({ version: "" }); + expect(files.json("component.json")).to.deep.equal({ version: 0 }); + }); + }); diff --git a/test/specs/preminor.spec.js b/test/specs/preminor.spec.js index f4c4d81..65df293 100644 --- a/test/specs/preminor.spec.js +++ b/test/specs/preminor.spec.js @@ -3,99 +3,82 @@ const { check, files, bump } = require("../utils"); const { expect } = require("chai"); -describe.skip("bump --preminor", () => { - it("should not increment a non-existent version number", () => { - files.create("package.json", {}); - files.create("bower.json", { name: "my-app" }); - - let cli = bump("--preminor"); - - expect(cli).to.have.stderr(""); - expect(cli).to.have.stdout(""); - expect(cli).to.have.exitCode(0); - - expect(files.json("package.json")).to.deep.equal({}); - expect(files.json("bower.json")).to.deep.equal({ name: "my-app" }); - }); - - it("should treat empty version numbers as 0.0.0", () => { - files.create("package.json", { version: "" }); - files.create("bower.json", { version: null }); - files.create("component.json", { version: 0 }); - - let cli = bump("--preminor"); - - expect(cli).to.have.stderr(""); - expect(cli).to.have.exitCode(0); - - expect(cli).to.have.stdout( - `${check} Updated package.json to 0.1.0-beta.0\n` + - `${check} Updated bower.json to 0.1.0-beta.0\n` + - `${check} Updated component.json to 0.1.0-beta.0\n` - ); - - expect(files.json("package.json")).to.deep.equal({ version: "0.1.0-beta.0" }); - expect(files.json("bower.json")).to.deep.equal({ version: "0.1.0-beta.0" }); - expect(files.json("component.json")).to.deep.equal({ version: "0.1.0-beta.0" }); - }); +describe("bump preminor", () => { it("should increment an all-zero version number", () => { files.create("package.json", { version: "0.0.0" }); - let cli = bump("--preminor"); + let cli = bump("preminor"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 0.1.0-beta.0\n` + `${check} Updated package.json to 0.1.0-beta.1\n` ); - expect(files.json("package.json")).to.deep.equal({ version: "0.1.0-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "0.1.0-beta.1" }); }); it("should reset the minor and patch", () => { files.create("package.json", { version: "1.2.3" }); - let cli = bump("--preminor"); + let cli = bump("preminor"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 1.3.0-beta.0\n` + `${check} Updated package.json to 1.3.0-beta.1\n` ); - expect(files.json("package.json")).to.deep.equal({ version: "1.3.0-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.3.0-beta.1" }); }); it("should reset the prerelease version", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let cli = bump("--preminor"); + let cli = bump("preminor"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 1.3.0-beta.0\n` + `${check} Updated package.json to 1.3.0-beta.1\n` ); - expect(files.json("package.json")).to.deep.equal({ version: "1.3.0-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.3.0-beta.1" }); }); it("should honor the --preid flag", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let cli = bump("--preminor --preid alpha"); + let cli = bump("preminor --preid alpha"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 1.3.0-alpha.0\n` + `${check} Updated package.json to 1.3.0-alpha.1\n` ); - expect(files.json("package.json")).to.deep.equal({ version: "1.3.0-alpha.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.3.0-alpha.1" }); }); + + it("should error if there is no existing version number", () => { + files.create("package.json", { name: "my-app" }); + files.create("bower.json", { version: "" }); + files.create("component.json", { version: 0 }); + + let cli = bump("preminor *.json"); + + expect(cli).to.have.stdout(""); + expect(cli).to.have.stderr("Unable to determine the current version number. Checked bower.json, component.json, package.json.\n"); + expect(cli).to.have.exitCode(1); + + expect(files.json("package.json")).to.deep.equal({ name: "my-app" }); + expect(files.json("bower.json")).to.deep.equal({ version: "" }); + expect(files.json("component.json")).to.deep.equal({ version: 0 }); + }); + }); diff --git a/test/specs/prepatch.spec.js b/test/specs/prepatch.spec.js index e591316..c801a78 100644 --- a/test/specs/prepatch.spec.js +++ b/test/specs/prepatch.spec.js @@ -3,99 +3,82 @@ const { check, files, bump } = require("../utils"); const { expect } = require("chai"); -describe.skip("bump --prepatch", () => { - it("should not increment a non-existent version number", () => { - files.create("package.json", {}); - files.create("bower.json", { name: "my-app" }); - - let cli = bump("--prepatch"); - - expect(cli).to.have.stderr(""); - expect(cli).to.have.stdout(""); - expect(cli).to.have.exitCode(0); - - expect(files.json("package.json")).to.deep.equal({}); - expect(files.json("bower.json")).to.deep.equal({ name: "my-app" }); - }); - - it("should treat empty version numbers as 0.0.0", () => { - files.create("package.json", { version: "" }); - files.create("bower.json", { version: null }); - files.create("component.json", { version: 0 }); - - let cli = bump("--prepatch"); - - expect(cli).to.have.stderr(""); - expect(cli).to.have.exitCode(0); - - expect(cli).to.have.stdout( - `${check} Updated package.json to 0.0.1-beta.0\n` + - `${check} Updated bower.json to 0.0.1-beta.0\n` + - `${check} Updated component.json to 0.0.1-beta.0\n` - ); - - expect(files.json("package.json")).to.deep.equal({ version: "0.0.1-beta.0" }); - expect(files.json("bower.json")).to.deep.equal({ version: "0.0.1-beta.0" }); - expect(files.json("component.json")).to.deep.equal({ version: "0.0.1-beta.0" }); - }); +describe("bump prepatch", () => { it("should increment an all-zero version number", () => { files.create("package.json", { version: "0.0.0" }); - let cli = bump("--prepatch"); + let cli = bump("prepatch"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 0.0.1-beta.0\n` + `${check} Updated package.json to 0.0.1-beta.1\n` ); - expect(files.json("package.json")).to.deep.equal({ version: "0.0.1-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "0.0.1-beta.1" }); }); it("should reset the minor and patch", () => { files.create("package.json", { version: "1.2.3" }); - let cli = bump("--prepatch"); + let cli = bump("prepatch"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 1.2.4-beta.0\n` + `${check} Updated package.json to 1.2.4-beta.1\n` ); - expect(files.json("package.json")).to.deep.equal({ version: "1.2.4-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.2.4-beta.1" }); }); it("should reset the prerelease version", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let cli = bump("--prepatch"); + let cli = bump("prepatch"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 1.2.4-beta.0\n` + `${check} Updated package.json to 1.2.4-beta.1\n` ); - expect(files.json("package.json")).to.deep.equal({ version: "1.2.4-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.2.4-beta.1" }); }); it("should honor the --preid flag", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let cli = bump("--prepatch --preid alpha"); + let cli = bump("prepatch --preid alpha"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 1.2.4-alpha.0\n` + `${check} Updated package.json to 1.2.4-alpha.1\n` ); - expect(files.json("package.json")).to.deep.equal({ version: "1.2.4-alpha.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.2.4-alpha.1" }); }); + + it("should error if there is no existing version number", () => { + files.create("package.json", { name: "my-app" }); + files.create("bower.json", { version: "" }); + files.create("component.json", { version: 0 }); + + let cli = bump("prepatch *.json"); + + expect(cli).to.have.stdout(""); + expect(cli).to.have.stderr("Unable to determine the current version number. Checked bower.json, component.json, package.json.\n"); + expect(cli).to.have.exitCode(1); + + expect(files.json("package.json")).to.deep.equal({ name: "my-app" }); + expect(files.json("bower.json")).to.deep.equal({ version: "" }); + expect(files.json("component.json")).to.deep.equal({ version: 0 }); + }); + }); diff --git a/test/specs/prerelease.spec.js b/test/specs/prerelease.spec.js index b64f8ab..fce20fa 100644 --- a/test/specs/prerelease.spec.js +++ b/test/specs/prerelease.spec.js @@ -3,76 +3,42 @@ const { check, files, bump } = require("../utils"); const { expect } = require("chai"); -describe.skip("bump --prerelease", () => { - it("should not increment a non-existent version number", () => { - files.create("package.json", {}); - files.create("bower.json", { name: "my-app" }); - - let cli = bump("--prerelease"); - - expect(cli).to.have.stderr(""); - expect(cli).to.have.stdout(""); - expect(cli).to.have.exitCode(0); - - expect(files.json("package.json")).to.deep.equal({}); - expect(files.json("bower.json")).to.deep.equal({ name: "my-app" }); - }); - - it("should treat empty version numbers as 0.0.0", () => { - files.create("package.json", { version: "" }); - files.create("bower.json", { version: null }); - files.create("component.json", { version: 0 }); - - let cli = bump("--prerelease"); - - expect(cli).to.have.stderr(""); - expect(cli).to.have.exitCode(0); - - expect(cli).to.have.stdout( - `${check} Updated package.json to 0.0.1-beta.0\n` + - `${check} Updated bower.json to 0.0.1-beta.0\n` + - `${check} Updated component.json to 0.0.1-beta.0\n` - ); - - expect(files.json("package.json")).to.deep.equal({ version: "0.0.1-beta.0" }); - expect(files.json("bower.json")).to.deep.equal({ version: "0.0.1-beta.0" }); - expect(files.json("component.json")).to.deep.equal({ version: "0.0.1-beta.0" }); - }); +describe("bump prerelease", () => { it("should increment an all-zero version number", () => { files.create("package.json", { version: "0.0.0" }); - let cli = bump("--prerelease"); + let cli = bump("prerelease"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 0.0.1-beta.0\n` + `${check} Updated package.json to 0.0.1-beta.1\n` ); - expect(files.json("package.json")).to.deep.equal({ version: "0.0.1-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "0.0.1-beta.1" }); }); it("should reset the minor and patch", () => { files.create("package.json", { version: "1.2.3" }); - let cli = bump("--prerelease"); + let cli = bump("prerelease"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 1.2.4-beta.0\n` + `${check} Updated package.json to 1.2.4-beta.1\n` ); - expect(files.json("package.json")).to.deep.equal({ version: "1.2.4-beta.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.2.4-beta.1" }); }); it("should reset the prerelease version", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let cli = bump("--prerelease"); + let cli = bump("prerelease"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); @@ -87,15 +53,32 @@ describe.skip("bump --prerelease", () => { it("should honor the --preid flag", () => { files.create("package.json", { version: "1.2.3-beta.4" }); - let cli = bump("--prerelease --preid alpha"); + let cli = bump("prerelease --preid alpha"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 1.2.3-alpha.0\n` + `${check} Updated package.json to 1.2.3-alpha.1\n` ); - expect(files.json("package.json")).to.deep.equal({ version: "1.2.3-alpha.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "1.2.3-alpha.1" }); }); + + it("should error if there is no existing version number", () => { + files.create("package.json", { name: "my-app" }); + files.create("bower.json", { version: "" }); + files.create("component.json", { version: 0 }); + + let cli = bump("prerelease *.json"); + + expect(cli).to.have.stdout(""); + expect(cli).to.have.stderr("Unable to determine the current version number. Checked bower.json, component.json, package.json.\n"); + expect(cli).to.have.exitCode(1); + + expect(files.json("package.json")).to.deep.equal({ name: "my-app" }); + expect(files.json("bower.json")).to.deep.equal({ version: "" }); + expect(files.json("component.json")).to.deep.equal({ version: 0 }); + }); + }); From 5fe5e0a0ae3ff11ddd3d1722c8000ecfe083fd51 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sun, 10 Mar 2019 16:29:06 -0500 Subject: [PATCH 101/106] Added a test for the DEBUG flag --- test/specs/cli.spec.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/specs/cli.spec.js b/test/specs/cli.spec.js index 0a45920..da146dc 100644 --- a/test/specs/cli.spec.js +++ b/test/specs/cli.spec.js @@ -47,6 +47,21 @@ describe("bump", () => { expect(cli.stderr).to.contain(manifest.description); }); + it("should print a more detailed error if DEBUG is set", () => { + files.create("package.json", { version: "" }); + + let cli = bump("major", { env: { DEBUG: "true" }}); + + expect(cli).to.have.stdout(""); + expect(cli).to.have.exitCode(1); + + expect(cli).to.have.stderr.that.matches( + /^Error: Unable to determine the current version number. Checked package.json.\n\s+at \w+/ + ); + + expect(files.json("package.json")).to.deep.equal({ version: "" }); + }); + describe("bump --help", () => { it("should show usage text", () => { let cli = bump("--help"); From 5fd01a9d75393f872fd632e84eaaf51502143400 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sun, 10 Mar 2019 16:29:38 -0500 Subject: [PATCH 102/106] Added tests for "bump #.#.#" --- test/specs/release.spec.js | 126 ++++++++++++++++++++++++++----------- 1 file changed, 90 insertions(+), 36 deletions(-) diff --git a/test/specs/release.spec.js b/test/specs/release.spec.js index 060c733..8588b82 100644 --- a/test/specs/release.spec.js +++ b/test/specs/release.spec.js @@ -3,96 +3,150 @@ const { check, files, bump } = require("../utils"); const { expect } = require("chai"); -describe.skip("bump [release]", () => { +describe("bump [version]", () => { - it("should increment an all-zero version number", () => { - files.create("package.json", { version: "0.0.0" }); + it("should accept an #.#.# version number", () => { + files.create("package.json", { version: "1.0.0" }); - let cli = bump("major"); + let cli = bump("123.45.678"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 1.0.0\n` + `${check} Updated package.json to 123.45.678\n` ); - expect(files.json("package.json")).to.deep.equal({ version: "1.0.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "123.45.678" }); }); - it("should reset the minor and patch", () => { - files.create("package.json", { version: "1.2.3" }); + it("should accept an #.#.# version number that's all zeroes", () => { + files.create("package.json", { version: "1.0.0" }); - let cli = bump("--major"); + let cli = bump("0.0.0"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 2.0.0\n` + `${check} Updated package.json to 0.0.0\n` ); - expect(files.json("package.json")).to.deep.equal({ version: "2.0.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "0.0.0" }); }); - it("should reset the prerelease version", () => { - files.create("package.json", { version: "1.2.3-beta.4" }); + it("should accept an #.#.#-X version number", () => { + files.create("package.json", { version: "1.0.0" }); - let cli = bump("--major"); + let cli = bump("123.45.678-beta"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 2.0.0\n` + `${check} Updated package.json to 123.45.678-beta\n` ); - expect(files.json("package.json")).to.deep.equal({ version: "2.0.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "123.45.678-beta" }); }); - it("should not be affected by the --preid flag", () => { - files.create("package.json", { version: "1.2.3-beta.4" }); + it("should accept an #.#.#-# version number", () => { + files.create("package.json", { version: "1.0.0" }); - let cli = bump("--major --preid alpha"); + let cli = bump("123.45.678-910"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 2.0.0\n` + `${check} Updated package.json to 123.45.678-910\n` ); - expect(files.json("package.json")).to.deep.equal({ version: "2.0.0" }); + expect(files.json("package.json")).to.deep.equal({ version: "123.45.678-910" }); }); - it("should error if there's no current version number", () => { - files.create("package.json", {}); + it("should accept an #.#.#-X.# version number", () => { + files.create("package.json", { version: "1.0.0" }); - let cli = bump("major"); + let cli = bump("123.45.678-beta.910"); - expect(cli).to.have.stdout(""); - expect(cli).to.have.exitCode(2); + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); + + expect(cli).to.have.stdout( + `${check} Updated package.json to 123.45.678-beta.910\n` + ); + + expect(files.json("package.json")).to.deep.equal({ version: "123.45.678-beta.910" }); + }); + + it("should accept an #.#.#-#.# version number", () => { + files.create("package.json", { version: "1.0.0" }); + + let cli = bump("123.45.678-987.654"); + + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); + + expect(cli).to.have.stdout( + `${check} Updated package.json to 123.45.678-987.654\n` + ); + + expect(files.json("package.json")).to.deep.equal({ version: "123.45.678-987.654" }); + }); + + it("should accept an #.#.#-X.X version number", () => { + files.create("package.json", { version: "1.0.0" }); + + let cli = bump("123.45.678-alpha.beta"); - expect(cli).to.have.stderr( - "Unable to determine the current version number. Checked package.json, package-lock.json.\n" + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); + + expect(cli).to.have.stdout( + `${check} Updated package.json to 123.45.678-alpha.beta\n` ); - expect(files.json("package.json")).to.deep.equal({}); + expect(files.json("package.json")).to.deep.equal({ version: "123.45.678-alpha.beta" }); }); - it("should print a more detailed error if DEBUG is set", () => { + it("should not be affected by the --preid flag", () => { + files.create("package.json", { version: "1.0.0" }); + + let cli = bump("1.2.3-beta.1 --preid alpha"); + + expect(cli).to.have.stderr(""); + expect(cli).to.have.exitCode(0); + + expect(cli).to.have.stdout( + `${check} Updated package.json to 1.2.3-beta.1\n` + ); + + expect(files.json("package.json")).to.deep.equal({ version: "1.2.3-beta.1" }); + }); + + it("should error if there's no current version number", () => { files.create("package.json", { version: "" }); - let cli = bump("major", { env: { DEBUG: "true" }}); + let cli = bump("1.2.3"); expect(cli).to.have.stdout(""); - expect(cli).to.have.exitCode(2); + expect(cli).to.have.exitCode(1); + expect(cli).to.have.stderr("Unable to determine the current version number. Checked package.json.\n"); - expect(cli).to.have.stderr.that.matches( - /^Error: Unable to determine the current version number. Checked package.json, package-lock.json.\n\s+at \w+/ - ); + expect(files.json("package.json")).to.deep.equal({ version: "" }); + }); - expect(files.json("package.json")).to.deep.equal({}); + it("should error on an X.X.X version number", () => { + files.create("package.json", { version: "1.0.0" }); + + let cli = bump("A.B.C"); + + expect(cli).to.have.stdout(""); + expect(cli).to.have.stderr("Could not find file: A.B.C.\n"); + expect(cli).to.have.exitCode(1); + + expect(files.json("package.json")).to.deep.equal({ version: "1.0.0" }); }); }); From 6c04fd7a186d82c08090f02107fa4eb4c14781ed Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sun, 10 Mar 2019 18:17:01 -0500 Subject: [PATCH 103/106] Updated dependencies --- package-lock.json | 796 ++++++++++++++++++++++------------------------ package.json | 20 +- 2 files changed, 385 insertions(+), 431 deletions(-) diff --git a/package-lock.json b/package-lock.json index 86f4093..71ce085 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,12 +14,12 @@ } }, "@babel/generator": { - "version": "7.3.3", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.3.3.tgz", - "integrity": "sha512-aEADYwRRZjJyMnKN7llGIlircxTCofm3dtV5pmY6ob18MSIuipHpA2yZWkPlycwu5HJcx/pADS3zssd8eY7/6A==", + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.3.4.tgz", + "integrity": "sha512-8EXhHRFqlVVWXPezBW5keTiQi/rJMQTg/Y9uVCEZ0CAF3PKtCCaVRnp64Ii1ujhkoDhhF1fVsImoN4yJ2uz4Wg==", "dev": true, "requires": { - "@babel/types": "^7.3.3", + "@babel/types": "^7.3.4", "jsesc": "^2.5.1", "lodash": "^4.17.11", "source-map": "^0.5.0", @@ -67,9 +67,9 @@ } }, "@babel/parser": { - "version": "7.3.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.3.3.tgz", - "integrity": "sha512-xsH1CJoln2r74hR+y7cg2B5JCPaTh+Hd+EbBRk9nWGSNspuo6krjhX0Om6RnRQuIvFq8wVXCLKH3kwKDYhanSg==", + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.3.4.tgz", + "integrity": "sha512-tXZCqWtlOOP4wgCp6RjRvLmfuhnqTLy9VHwRochJBCP2nDm27JnnuFEnXFASVyQNHk36jD1tAammsCEEqgscIQ==", "dev": true }, "@babel/template": { @@ -84,26 +84,43 @@ } }, "@babel/traverse": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.2.3.tgz", - "integrity": "sha512-Z31oUD/fJvEWVR0lNZtfgvVt512ForCTNKYcJBGbPb1QZfve4WGH8Wsy7+Mev33/45fhP/hwQtvgusNdcCMgSw==", + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.3.4.tgz", + "integrity": "sha512-TvTHKp6471OYEcE/91uWmhR6PrrYywQntCHSaZ8CM8Vmp+pjAusal4nGB2WCCQd0rvI7nOMKn9GnbcvTUz3/ZQ==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "@babel/generator": "^7.2.2", + "@babel/generator": "^7.3.4", "@babel/helper-function-name": "^7.1.0", "@babel/helper-split-export-declaration": "^7.0.0", - "@babel/parser": "^7.2.3", - "@babel/types": "^7.2.2", + "@babel/parser": "^7.3.4", + "@babel/types": "^7.3.4", "debug": "^4.1.0", "globals": "^11.1.0", - "lodash": "^4.17.10" + "lodash": "^4.17.11" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } } }, "@babel/types": { - "version": "7.3.3", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.3.3.tgz", - "integrity": "sha512-2tACZ80Wg09UnPg5uGAOUvvInaqLk3l/IAhQzlxLQOIXacr6bMsra5SH6AWw/hIDRCSbCdHP2KzSOD+cT7TzMQ==", + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.3.4.tgz", + "integrity": "sha512-WEkp8MsLftM7O/ty580wAmZzN1nDmCACc5+jFzUt+GUFNNIi3LdRlueYz0YIlmJhlZx1QYDMZL5vdWCL0fNjFQ==", "dev": true, "requires": { "esutils": "^2.0.2", @@ -158,16 +175,14 @@ "dev": true }, "@types/events": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@types/events/-/events-1.2.0.tgz", - "integrity": "sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA==", - "dev": true + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", + "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==" }, "@types/glob": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", - "dev": true, "requires": { "@types/events": "*", "@types/minimatch": "*", @@ -175,19 +190,18 @@ } }, "@types/globby": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@types/globby/-/globby-8.0.0.tgz", - "integrity": "sha512-xDtsX5tlctxJzvg29r/LN12z30oJpoFP9cE8eJ8nY5cbSvN0c0RdRHrVlEq4LRh362Sd+JsqxJ3QWw0Wnyto8w==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/@types/globby/-/globby-9.1.0.tgz", + "integrity": "sha512-9du/HCA71EBz7syHRnM4Q/u4Fbx3SyN/Uu+4Of9lyPX4A6Xi+A8VMxvx8j5/CMTfrae2Zwdwg0fAaKvKXfRbAw==", "dev": true, "requires": { - "@types/glob": "*", - "fast-glob": "^2.0.2" + "globby": "*" } }, "@types/inquirer": { - "version": "0.0.43", - "resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-0.0.43.tgz", - "integrity": "sha512-xgyfKZVMFqE8aIKy1xfFVsX2MxyXUNgjgmbF6dRbR3sL+ZM5K4ka/9L4mmTwX8eTeVYtduyXu0gUVwVJa1HbNw==", + "version": "0.0.44", + "resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-0.0.44.tgz", + "integrity": "sha512-ugbhy1yBtCz5iTWYF+AGRS/UcMcWicdyHhxl9VaeFYc3ueg0CCssthQLB3rIcIOeGtfG6WPEvHdLu/IjKYfefg==", "dev": true, "requires": { "@types/rx": "*", @@ -203,8 +217,7 @@ "@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", - "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", - "dev": true + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" }, "@types/mocha": { "version": "5.2.6", @@ -213,14 +226,13 @@ "dev": true }, "@types/node": { - "version": "11.9.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-11.9.5.tgz", - "integrity": "sha512-vVjM0SVzgaOUpflq4GYBvCpozes8OgIIS5gVXVka+OfK3hvnkC1i93U8WiY2OtNE4XUWyyy/86Kf6e0IHTQw1Q==", - "dev": true + "version": "11.11.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-11.11.0.tgz", + "integrity": "sha512-D5Rt+HXgEywr3RQJcGlZUCTCx1qVbCZpVk3/tOOA6spLNZdGm8BU+zRgdRYDoF1pO3RuXLxADzMrF903JlQXqg==" }, "@types/rx": { "version": "4.1.1", - "resolved": "http://registry.npmjs.org/@types/rx/-/rx-4.1.1.tgz", + "resolved": "https://registry.npmjs.org/@types/rx/-/rx-4.1.1.tgz", "integrity": "sha1-WY/JSla67ZdfGUV04PVy/Y5iekg=", "dev": true, "requires": { @@ -360,9 +372,9 @@ } }, "acorn": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.1.0.tgz", - "integrity": "sha512-MW/FjM+IvU9CgBzjO3UIPCE2pyEwUsoFl+VGdczOPEdxfGFjuKny/gN54mOuX7Qxmb9Rg9MCn2oKiSUeW+pjrw==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.1.1.tgz", + "integrity": "sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA==", "dev": true }, "acorn-jsx": { @@ -372,9 +384,9 @@ "dev": true }, "ajv": { - "version": "6.9.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.9.2.tgz", - "integrity": "sha512-4UFy0/LgDo7Oa/+wOAlj44tp9K78u38E5/359eSrqEp1Z5PdVfimCcs7SluXMP755RUQu6d2b4AvF0R1C9RZjg==", + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.0.tgz", + "integrity": "sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg==", "dev": true, "requires": { "fast-deep-equal": "^2.0.1", @@ -637,26 +649,11 @@ "lodash": "^4.17.4" }, "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, "globals": { "version": "9.18.0", "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", "dev": true - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true } } }, @@ -679,9 +676,9 @@ "dev": true }, "balanced-match": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz", - "integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=" + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "base": { "version": "0.11.2", @@ -755,14 +752,22 @@ "string-width": "^2.0.0", "term-size": "^1.2.0", "widest-line": "^2.0.0" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + } } }, "brace-expansion": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz", - "integrity": "sha1-Pv/DxQ4ABTH7cg6v+A8K6O8jz1k=", + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "requires": { - "balanced-match": "^0.4.1", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, @@ -895,9 +900,9 @@ "dev": true }, "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.2.0.tgz", + "integrity": "sha512-IXFsBS2pC+X0j0N/GE7Dm7j3bsEBp+oTpb7F50dwEVX7rf3IgwO9XatnegTsDtniKCUtEJH4fSU6Asw7uoVLfQ==", "dev": true }, "camelcase-keys": { @@ -954,9 +959,9 @@ } }, "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "requires": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", @@ -1022,9 +1027,9 @@ "dev": true }, "cli-width": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.1.0.tgz", - "integrity": "sha1-sjTKIJsp72b8UY2bmNWEewDt8Ao=" + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=" }, "cliui": { "version": "4.1.0", @@ -1139,9 +1144,9 @@ "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=" }, "core-js": { - "version": "2.5.7", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", - "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==", + "version": "2.6.5", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.5.tgz", + "integrity": "sha512-klh/kDpwX8hryYL14M9w/xei6vrv6sE8gTHDG7/T/+SEovB/G4ejwcfE/CBzO6Edsu+OETZMZ3wcX/EjUkrl5A==", "dev": true }, "core-util-is": { @@ -1220,12 +1225,11 @@ } }, "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "requires": { - "ms": "^2.1.1" + "ms": "2.0.0" } }, "decamelize": { @@ -1307,22 +1311,22 @@ } }, "del": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz", - "integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/del/-/del-4.0.0.tgz", + "integrity": "sha512-/BnSJ+SuZyLu7xMn48kZY0nMXDi+5KNmR4g8n21Wivsl8+B9njV6/5kcTNE9juSprp0zRWBU28JuHUq0FqK1Nw==", "dev": true, "requires": { "globby": "^6.1.0", - "is-path-cwd": "^1.0.0", - "is-path-in-cwd": "^1.0.0", - "p-map": "^1.1.1", - "pify": "^3.0.0", - "rimraf": "^2.2.8" + "is-path-cwd": "^2.0.0", + "is-path-in-cwd": "^2.0.0", + "p-map": "^2.0.0", + "pify": "^4.0.1", + "rimraf": "^2.6.2" }, "dependencies": { "globby": { "version": "6.1.0", - "resolved": "http://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", "dev": true, "requires": { @@ -1335,7 +1339,7 @@ "dependencies": { "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -1374,6 +1378,12 @@ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "dev": true }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, "cliui": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", @@ -1387,7 +1397,7 @@ "dependencies": { "string-width": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { @@ -1424,6 +1434,12 @@ "strip-eof": "^1.0.0" } }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, "invert-kv": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", @@ -1470,7 +1486,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -1555,16 +1571,6 @@ "integrity": "sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw==", "requires": { "path-type": "^3.0.0" - }, - "dependencies": { - "path-type": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", - "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", - "requires": { - "pify": "^3.0.0" - } - } } }, "doctrine": { @@ -1671,9 +1677,9 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "eslint": { - "version": "5.14.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.14.1.tgz", - "integrity": "sha512-CyUMbmsjxedx8B0mr79mNOqetvkbij/zrXnFeK2zc3pGRn3/tibjiNAv/3UxFEyfMDjh+ZqTrJrEGBFiGfD5Og==", + "version": "5.15.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.15.1.tgz", + "integrity": "sha512-NTcm6vQ+PTgN3UBsALw5BMhgO6i5EpIjQF/Xb5tIh3sk9QhrFafujUOczGz4J24JBlzWclSB9Vmx8d+9Z6bFCg==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -1682,7 +1688,7 @@ "cross-spawn": "^6.0.5", "debug": "^4.0.1", "doctrine": "^3.0.0", - "eslint-scope": "^4.0.0", + "eslint-scope": "^4.0.2", "eslint-utils": "^1.3.1", "eslint-visitor-keys": "^1.0.0", "espree": "^5.0.1", @@ -1714,6 +1720,21 @@ "text-table": "^0.2.0" }, "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, "strip-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", @@ -1732,9 +1753,9 @@ "dev": true }, "eslint-scope": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", - "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.2.tgz", + "integrity": "sha512-5q1+B/ogmHl8+paxtOKx38Z8LtWkVGuNt3+GQNErqwLl6ViNp/gdJGMCjZNxZ8j/VYjDNZ2Fo+eQc1TAVPIzbg==", "dev": true, "requires": { "esrecurse": "^4.1.0", @@ -1801,33 +1822,18 @@ "dev": true }, "execa": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.2.2.tgz", - "integrity": "sha1-4urUcsLDGq1vc/GslW7vReEjIMs=", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", "dev": true, "requires": { - "cross-spawn-async": "^2.1.1", - "npm-run-path": "^1.0.0", - "object-assign": "^4.0.1", - "path-key": "^1.0.0", + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", "strip-eof": "^1.0.0" - }, - "dependencies": { - "npm-run-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-1.0.0.tgz", - "integrity": "sha1-9cMr9ZX+ga6Sfa7FLoL4sACsPI8=", - "dev": true, - "requires": { - "path-key": "^1.0.0" - } - }, - "path-key": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-1.0.0.tgz", - "integrity": "sha1-XVPVeAGWRsDWiADbThRua9wqx68=", - "dev": true - } } }, "exit-hook": { @@ -1850,14 +1856,6 @@ "to-regex": "^3.0.1" }, "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, "define-property": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", @@ -1873,11 +1871,6 @@ "requires": { "is-extendable": "^0.1.0" } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" } } }, @@ -1991,9 +1984,9 @@ "dev": true }, "ez-spawn": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ez-spawn/-/ez-spawn-2.1.1.tgz", - "integrity": "sha512-fAi+/2QwSAQsUDqkSX+3P6NRsnOZUnCpHlH9zNf6CPFnXpGIiyQO+3w31nykHosMSldwrTubX9ijeSOXA+l5vA==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ez-spawn/-/ez-spawn-2.1.2.tgz", + "integrity": "sha512-QUmwE8VjkZIUdac0KTkAL+3h2/YgjyHLJ6Nl76IGsQELhBV8QORv6BKm8yJQZD7cv62d9kUpZfSOwX5ebQn0Gg==", "requires": { "call-me-maybe": "^1.0.1", "cross-spawn": "^6.0.5", @@ -2008,10 +2001,9 @@ "dev": true }, "fast-glob": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.4.tgz", - "integrity": "sha512-FjK2nCGI/McyzgNtTESqaWP3trPvHyRyoyY70hxjc3oKPNmDe8taohLZpoVKoUjW85tbU5txaYUZCNtVzygl1g==", - "dev": true, + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.6.tgz", + "integrity": "sha512-0BvMaZc1k9F+MeWWMe8pL6YltFzZYcJsYU7D4JyDA6PAczaXvxqQQ/z+mDF7/4Mw01DeUc+i3CTKajnkANkV4w==", "requires": { "@mrmlnc/readdir-enhanced": "^2.2.1", "@nodelib/fs.stat": "^1.1.2", @@ -2138,17 +2130,6 @@ "flatted": "^2.0.0", "rimraf": "2.6.3", "write": "1.0.3" - }, - "dependencies": { - "rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - } } }, "flatted": { @@ -2223,10 +2204,13 @@ "dev": true }, "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", - "dev": true + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } }, "get-value": { "version": "2.0.6", @@ -2243,9 +2227,9 @@ } }, "giturl": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/giturl/-/giturl-1.0.0.tgz", - "integrity": "sha1-lzKoHp4lxFeiLw4socnFHbu1Ml8=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/giturl/-/giturl-1.0.1.tgz", + "integrity": "sha512-wQourBdI13n8tbjcZTDl6k+ZrCRMU6p9vfp9jknZq+zfWc8xXNztpZFM4XkPHVzHcMSUZxEMYYKZjIGkPlei6Q==", "dev": true }, "glob": { @@ -2325,10 +2309,11 @@ "dev": true }, "globby": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-9.0.0.tgz", - "integrity": "sha512-q0qiO/p1w/yJ0hk8V9x1UXlgsXUxlGd0AHUOXZVXBO6aznDtpx7M8D1kBrCAItoPm+4l8r6ATXV1JpjY2SBQOw==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-9.1.0.tgz", + "integrity": "sha512-VtYjhHr7ncls724Of5W6Kaahz0ag7dB4G62/2HsN+xEKG6SrPzM1AJMerGxQTwJGnN9reeyxdvXbuZYpfssCvg==", "requires": { + "@types/glob": "^7.1.1", "array-union": "^1.0.2", "dir-glob": "^2.2.1", "fast-glob": "^2.2.6", @@ -2336,26 +2321,6 @@ "ignore": "^4.0.3", "pify": "^4.0.1", "slash": "^2.0.0" - }, - "dependencies": { - "fast-glob": { - "version": "2.2.6", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.6.tgz", - "integrity": "sha512-0BvMaZc1k9F+MeWWMe8pL6YltFzZYcJsYU7D4JyDA6PAczaXvxqQQ/z+mDF7/4Mw01DeUc+i3CTKajnkANkV4w==", - "requires": { - "@mrmlnc/readdir-enhanced": "^2.2.1", - "@nodelib/fs.stat": "^1.1.2", - "glob-parent": "^3.1.0", - "is-glob": "^4.0.0", - "merge2": "^1.2.3", - "micromatch": "^3.1.10" - } - }, - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" - } } }, "got": { @@ -2375,12 +2340,20 @@ "timed-out": "^4.0.0", "unzip-response": "^2.0.1", "url-parse-lax": "^1.0.0" + }, + "dependencies": { + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + } } }, "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "version": "4.1.15", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", + "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==", "dev": true }, "growl": { @@ -2434,8 +2407,7 @@ "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" }, "has-symbols": { "version": "1.0.0", @@ -2498,9 +2470,9 @@ } }, "homedir-polyfill": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz", - "integrity": "sha1-TCu8inWJmP7r9e1oWA921GdotLw=", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", + "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", "dev": true, "requires": { "parse-passwd": "^1.0.0" @@ -2605,18 +2577,6 @@ "string-width": "^2.1.0", "strip-ansi": "^5.0.0", "through": "^2.3.6" - }, - "dependencies": { - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - } } }, "interpret": { @@ -2642,7 +2602,7 @@ }, "is-accessor-descriptor": { "version": "0.1.6", - "resolved": "http://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "requires": { "kind-of": "^3.0.2" @@ -2669,15 +2629,6 @@ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" }, - "is-builtin-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", - "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", - "dev": true, - "requires": { - "builtin-modules": "^1.0.0" - } - }, "is-callable": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", @@ -2695,7 +2646,7 @@ }, "is-data-descriptor": { "version": "0.1.4", - "resolved": "http://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "requires": { "kind-of": "^3.0.2" @@ -2813,24 +2764,24 @@ "dev": true }, "is-path-cwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", - "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.0.0.tgz", + "integrity": "sha512-m5dHHzpOXEiv18JEORttBO64UgTEypx99vCxQLjbBvGhOJxnTNglYoFXxwo6AbsQb79sqqycQEHv2hWkHZAijA==", "dev": true }, "is-path-in-cwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz", - "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-2.0.0.tgz", + "integrity": "sha512-6Vz5Gc9s/sDA3JBVu0FzWufm8xaBsqy1zn8Q6gmvGP6nSDMw78aS4poBNeatWjaRpTpxxLn1WOndAiOlk+qY8A==", "dev": true, "requires": { "is-path-inside": "^1.0.0" } }, "is-path-inside": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.0.tgz", - "integrity": "sha1-/AbloWg/vaE95mev9xe7wQpI838=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", + "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", "dev": true, "requires": { "path-is-inside": "^1.0.1" @@ -2951,9 +2902,9 @@ "dev": true }, "js-yaml": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", - "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", + "version": "3.12.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.2.tgz", + "integrity": "sha512-QHn/Lh/7HhZ/Twc7vJYQTkjuCa0kaCcDcjK5Zlk2rvnUpy7DxMJ23+Jc2dcyvltwQVg1nygAVlB2oRDFHoRS5Q==", "dev": true, "requires": { "argparse": "^1.0.7", @@ -3095,14 +3046,6 @@ "requires": { "p-locate": "^3.0.0", "path-exists": "^3.0.0" - }, - "dependencies": { - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - } } }, "lodash": { @@ -3161,9 +3104,9 @@ "dev": true }, "lru-cache": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz", - "integrity": "sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==", + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", "dev": true, "requires": { "pseudomap": "^1.0.2", @@ -3177,6 +3120,14 @@ "dev": true, "requires": { "pify": "^3.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } } }, "map-age-cleaner": { @@ -3259,6 +3210,15 @@ "strip-bom": "^2.0.0" } }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "^2.0.0" + } + }, "path-type": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", @@ -3349,9 +3309,9 @@ } }, "mimic-fn": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", - "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==" }, "minimatch": { "version": "3.0.4", @@ -3363,7 +3323,7 @@ }, "minimist": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true }, @@ -3404,9 +3364,9 @@ } }, "mocha": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.0.1.tgz", - "integrity": "sha512-tQzCxWqxSD6Oyg5r7Ptbev0yAMD8p+Vfh4snPFuiUsWqYj0eVYTDT2DkEY307FTj0WRlIWN9rWMMAUzRmijgVQ==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.0.2.tgz", + "integrity": "sha512-RtTJsmmToGyeTznSOMoM6TPEk1A84FQaHIciKrRqARZx+B5ccJ5tXlmJzEKGBxZdqk9UjpRsesZTUkZmR5YnuQ==", "dev": true, "requires": { "ansi-colors": "3.2.3", @@ -3443,6 +3403,22 @@ "ms": "^2.1.1" } }, + "js-yaml": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", + "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, "supports-color": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", @@ -3451,15 +3427,6 @@ "requires": { "has-flag": "^3.0.0" } - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } } } }, @@ -3474,10 +3441,9 @@ } }, "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "mute-stream": { "version": "0.0.7", @@ -3509,14 +3475,14 @@ "dev": true }, "nice-try": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.4.tgz", - "integrity": "sha512-2NpiFHqC87y/zFke0fC0spBXL3bBsoh/p5H1EFhshxjCR5+0g2d6BiXbUFz9v1sAcxsk2htp2eQnNIci2dIYcA==" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" }, "node-emoji": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.8.1.tgz", - "integrity": "sha512-+ktMAh1Jwas+TnGodfCfjUbJKoANqPaJFN0z0iqh41eqD8dvguNzcitVSBSVK1pidz0AqGbLKcoVuVLRVZ/aVg==", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.10.0.tgz", + "integrity": "sha512-Yt3384If5H6BYGVHiHwTL+99OzJKHhgp82S8/dktEK73T26BazdgZ4JZh92xSVtGNJvz9UbXdNAc5hcrXV42vw==", "dev": true, "requires": { "lodash.toarray": "^4.4.0" @@ -3532,13 +3498,13 @@ } }, "normalize-package-data": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", "dev": true, "requires": { "hosted-git-info": "^2.1.4", - "is-builtin-module": "^1.0.0", + "resolve": "^1.10.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" } @@ -3626,6 +3592,19 @@ "restore-cursor": "^1.0.1" } }, + "execa": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.2.2.tgz", + "integrity": "sha1-4urUcsLDGq1vc/GslW7vReEjIMs=", + "dev": true, + "requires": { + "cross-spawn-async": "^2.1.1", + "npm-run-path": "^1.0.0", + "object-assign": "^4.0.1", + "path-key": "^1.0.0", + "strip-eof": "^1.0.0" + } + }, "figures": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", @@ -3693,12 +3672,36 @@ "number-is-nan": "^1.0.0" } }, + "npm-run-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-1.0.0.tgz", + "integrity": "sha1-9cMr9ZX+ga6Sfa7FLoL4sACsPI8=", + "dev": true, + "requires": { + "path-key": "^1.0.0" + } + }, "onetime": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", "dev": true }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "^2.0.0" + } + }, + "path-key": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-1.0.0.tgz", + "integrity": "sha1-XVPVeAGWRsDWiADbThRua9wqx68=", + "dev": true + }, "pify": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", @@ -5003,32 +5006,6 @@ "execa": "^1.0.0", "lcid": "^2.0.0", "mem": "^4.0.0" - }, - "dependencies": { - "execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - } } }, "os-tmpdir": { @@ -5055,9 +5032,9 @@ "dev": true }, "p-limit": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.1.0.tgz", - "integrity": "sha512-NhURkNcrVB+8hNfLuysU8enY5xn2KXphsHBaC2YmRNTZRc7RWusw6apSpdEj3jo4CMb6W9nrF6tTnsJsJeyu6g==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", + "integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==", "dev": true, "requires": { "p-try": "^2.0.0" @@ -5073,9 +5050,9 @@ } }, "p-map": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", - "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-2.0.0.tgz", + "integrity": "sha512-GO107XdrSUmtHxVoi60qc9tUl/KkNKm+X2CF4P9amalpGxv5YqVPJNfSb0wcA+syCopkZvYYIzW8OVTQW59x/w==", "dev": true }, "p-try": { @@ -5131,13 +5108,10 @@ "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=" }, "path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", - "dev": true, - "requires": { - "pinkie-promise": "^2.0.0" - } + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true }, "path-is-absolute": { "version": "1.0.1", @@ -5162,19 +5136,17 @@ "dev": true }, "path-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", - "dev": true, + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", "requires": { - "pify": "^2.0.0" + "pify": "^3.0.0" }, "dependencies": { "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" } } }, @@ -5191,9 +5163,9 @@ "dev": true }, "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" }, "pinkie": { "version": "2.0.4", @@ -5228,6 +5200,15 @@ "path-exists": "^2.0.0", "pinkie-promise": "^2.0.0" } + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "^2.0.0" + } } } }, @@ -5244,14 +5225,6 @@ "requires": { "path-exists": "^3.0.0", "which-pm": "^1.0.1" - }, - "dependencies": { - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - } } }, "prelude-ls": { @@ -5327,6 +5300,23 @@ "load-json-file": "^2.0.0", "normalize-package-data": "^2.3.2", "path-type": "^2.0.0" + }, + "dependencies": { + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true, + "requires": { + "pify": "^2.0.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } } }, "read-pkg-up": { @@ -5381,12 +5371,6 @@ "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", "dev": true - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true } } }, @@ -5593,12 +5577,12 @@ "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==" }, "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", "dev": true, "requires": { - "glob": "^7.0.5" + "glob": "^7.1.3" } }, "run-async": { @@ -5631,7 +5615,7 @@ }, "safe-regex": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "requires": { "ret": "~0.1.10" @@ -5754,14 +5738,6 @@ "use": "^3.1.0" }, "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, "define-property": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", @@ -5777,11 +5753,6 @@ "requires": { "is-extendable": "^0.1.0" } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" } } }, @@ -5872,9 +5843,9 @@ "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=" }, "spdx-correct": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.1.tgz", - "integrity": "sha512-hxSPZbRZvSDuOvADntOElzJpenIR7wXJkuoUcUtS0erbgt2fgeaoPIYretfKpslMhfFDY4k0MZ2F5CUzhBsSvQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", + "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", "dev": true, "requires": { "spdx-expression-parse": "^3.0.0", @@ -5882,9 +5853,9 @@ } }, "spdx-exceptions": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz", - "integrity": "sha512-4K1NsmrlCU1JJgUrtgEeTVyfx8VaYea9J9LvARxhbHtVtohPs/gFGG5yy49beySjlIMhhXZ4QqujIZEfS4l6Cg==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", "dev": true }, "spdx-expression-parse": { @@ -5898,9 +5869,9 @@ } }, "spdx-license-ids": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.1.tgz", - "integrity": "sha512-TfOfPcYGBB5sDuPn3deByxPhmfegAhpDYKSOXZQN81Oyrrif8ZCodOLzK3AesELnCx03kikhyDwh0pfvvQvF8w==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.3.tgz", + "integrity": "sha512-uBIcIl3Ih6Phe3XHK1NqboJLdGfwr1UN3k6wSD1dZpmPsIkb8AGNbZYJ1fOBk834+Gxy8rpfDxrS6XLEMZMY2g==", "dev": true }, "split-string": { @@ -5984,17 +5955,17 @@ } }, "strip-ansi": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.0.0.tgz", - "integrity": "sha512-Uu7gQyZI7J7gn5qLn1Np3G9vcYGTVqB+lFTytnDJv83dd8T22aGH451P3jueT2/QemInJDfxHB5Tde5OzgG1Ow==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.1.0.tgz", + "integrity": "sha512-TjxrkPONqO2Z8QDCpeE2j6n0M6EwxzyDgzEeGp+FbdvaJAt//ClYi6W5my+3ROlC/hZX2KACUwDfK49Ka5eDvg==", "requires": { - "ansi-regex": "^4.0.0" + "ansi-regex": "^4.1.0" }, "dependencies": { "ansi-regex": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.0.0.tgz", - "integrity": "sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w==" + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" } } }, @@ -6031,13 +6002,6 @@ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "requires": { "has-flag": "^3.0.0" - }, - "dependencies": { - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" - } } }, "table": { @@ -6053,14 +6017,14 @@ }, "dependencies": { "string-width": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.0.0.tgz", - "integrity": "sha512-rr8CUxBbvOZDUvc5lNIJ+OC1nPVpz+Siw9VBtUjB9b6jZehZLFt0JMCZzShFHIsI8cbhm0EsNIfWJMFV3cu3Ew==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "requires": { "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.0.0" + "strip-ansi": "^5.1.0" } } } @@ -6099,6 +6063,12 @@ "signal-exit": "^3.0.0", "strip-eof": "^1.0.0" } + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true } } }, @@ -6222,9 +6192,9 @@ "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==" }, "tslint": { - "version": "5.13.0", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.13.0.tgz", - "integrity": "sha512-ECOOQRxXCYnUUePG5h/+Z1Zouobk3KFpIHA9aKBB/nnMxs97S1JJPDGt5J4cGm1y9U9VmVlfboOxA8n1kSNzGw==", + "version": "5.13.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.13.1.tgz", + "integrity": "sha512-fplQqb2miLbcPhyHoMV4FU9PtNRbgmm/zI5d3SZwwmJQM6V0eodju+hplpyfhLWpmwrDNfNYU57uYRb8s0zZoQ==", "dev": true, "requires": { "babel-code-frame": "^6.22.0", @@ -6243,9 +6213,9 @@ } }, "tslint-modular": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/tslint-modular/-/tslint-modular-1.2.0.tgz", - "integrity": "sha512-ymSGIiD3VxcZOHLxjP+wpd2h0SFqPLApBNdR33bzDueWsk99qSiznVyYOqR4SCLWqu5HTgGulPDNbUVD3xc1gQ==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/tslint-modular/-/tslint-modular-1.3.0.tgz", + "integrity": "sha512-n0e24FkNEtZLezreRs1QDO4IOA1ybhkhORy8hw3Rmaz/zt815BjKNMtPcwTDm5YWeskdWiI6d3cKfGzndOOpiA==", "dev": true }, "tsutils": { @@ -6509,9 +6479,9 @@ "dev": true }, "which": { - "version": "1.2.14", - "resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz", - "integrity": "sha1-mofEN48D6CfOyvGs31bHNsAcFOU=", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "requires": { "isexe": "^2.0.0" } @@ -6530,14 +6500,6 @@ "requires": { "load-yaml-file": "^0.1.0", "path-exists": "^3.0.0" - }, - "dependencies": { - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - } } }, "wide-align": { @@ -6550,9 +6512,9 @@ } }, "widest-line": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-2.0.0.tgz", - "integrity": "sha1-AUKk6KJD+IgsAjOqDgKBqnYVInM=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-2.0.1.tgz", + "integrity": "sha512-Ba5m9/Fa4Xt9eb2ELXt77JxVDV8w7qQrH0zS/TWSJdLyAwQjWoOzpzj5lwVftDz6n/EOu3tNACS84v509qwnJA==", "dev": true, "requires": { "string-width": "^2.1.1" @@ -6626,9 +6588,9 @@ } }, "write-file-atomic": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", - "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.2.tgz", + "integrity": "sha512-s0b6vB3xIVRLWywa6X9TOMA7k9zio0TMOsl9ZnDkliA/cfJlpHXAscj0gbHVJiTdIuAYpIyqS5GW91fqm6gG5g==", "dev": true, "requires": { "graceful-fs": "^4.1.11", @@ -6688,14 +6650,6 @@ "requires": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" - }, - "dependencies": { - "camelcase": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.0.0.tgz", - "integrity": "sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==", - "dev": true - } } }, "yargs-unparser": { diff --git a/package.json b/package.json index 24855ad..fa7f354 100644 --- a/package.json +++ b/package.json @@ -51,26 +51,26 @@ "@types/command-line-args": "^5.0.0", "@types/detect-indent": "^5.0.0", "@types/detect-newline": "^2.1.0", - "@types/globby": "^8.0.0", - "@types/inquirer": "0.0.43", + "@types/globby": "^9.1.0", + "@types/inquirer": "0.0.44", "@types/log-symbols": "^2.0.0", "@types/mocha": "^5.2.6", - "@types/node": "^11.9.5", + "@types/node": "^11.11.0", "@types/semver": "^5.5.0", "chai": "^4.2.0", "chai-exec": "^1.1.1", "coveralls": "^3.0.3", - "del": "^3.0.0", - "eslint": "^5.14.1", + "del": "^4.0.0", + "eslint": "^5.15.1", "eslint-config-modular": "^7.0.0", "mkdirp": "^0.5.1", - "mocha": "^6.0.1", + "mocha": "^6.0.2", "npm-check": "^5.9.0", "nyc": "^13.3.0", "shx": "^0.3.2", - "strip-ansi": "^5.0.0", - "tslint": "^5.13.0", - "tslint-modular": "^1.2.0", + "strip-ansi": "^5.1.0", + "tslint": "^5.13.1", + "tslint-modular": "^1.3.0", "typescript": "^3.3.3333", "typescript-tslint-plugin": "^0.3.1" }, @@ -79,7 +79,7 @@ "detect-indent": "^5.0.0", "detect-newline": "^2.1.0", "ez-spawn": "^2.1.1", - "globby": "^9.0.0", + "globby": "^9.1.0", "inquirer": "^6.2.2", "log-symbols": "^2.2.0", "semver": "^5.6.0" From d9d7c8fc14949ff8ae2f23ba17494c50884e33dd Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sun, 10 Mar 2019 18:17:31 -0500 Subject: [PATCH 104/106] The type definitions for globby have changed --- src/normalize-options.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/normalize-options.ts b/src/normalize-options.ts index ac95c69..acc2bb6 100644 --- a/src/normalize-options.ts +++ b/src/normalize-options.ts @@ -1,4 +1,4 @@ -import * as globby from "globby"; +import globby, { hasMagic } from "globby"; import { isReleaseType, ReleaseType } from "./release-type"; import { VersionBumpOptions } from "./types/version-bump-options"; @@ -160,7 +160,7 @@ async function strictGlobMatch(file: string, options: object): Promise let matches = await globby(file, options); if (matches.length === 0) { - if (globby.hasMagic(file)) { + if (hasMagic(file)) { throw new Error(`Could not find any files matching "${file}".`); } else { From cd925b019a361e385e574137201471f8d31afbc6 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sun, 10 Mar 2019 18:18:21 -0500 Subject: [PATCH 105/106] Added support for npm "preversion", "version", and "postversion" scripts --- src/cli/index.ts | 6 +++++- src/operation.ts | 7 +++--- src/run-npm-script.ts | 34 ++++++++++++++++++++++++++++++ src/types/version-bump-progress.ts | 13 ++++++++++++ src/version-bump.ts | 15 ++++++++++++- 5 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 src/run-npm-script.ts diff --git a/src/cli/index.ts b/src/cli/index.ts index bc804ce..de092f4 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -44,7 +44,7 @@ export async function main(args: string[]): Promise { } } -function progress({ event, updatedFiles, skippedFiles, newVersion }: VersionBumpProgress): void { +function progress({ event, script, updatedFiles, skippedFiles, newVersion }: VersionBumpProgress): void { // tslint:disable-next-line: switch-default switch (event) { case ProgressEvent.FileUpdated: @@ -66,6 +66,10 @@ function progress({ event, updatedFiles, skippedFiles, newVersion }: VersionBump case ProgressEvent.GitPush: console.log(success, "Git push"); break; + + case ProgressEvent.NpmScript: + console.log(success, `Npm run ${script}`); + break; } } diff --git a/src/operation.ts b/src/operation.ts index 5edd4dd..fd10fe8 100644 --- a/src/operation.ts +++ b/src/operation.ts @@ -1,7 +1,7 @@ import { NormalizedOptions, normalizeOptions } from "./normalize-options"; import { ReleaseType } from "./release-type"; import { VersionBumpOptions } from "./types/version-bump-options"; -import { ProgressEvent, VersionBumpProgress } from "./types/version-bump-progress"; +import { NpmScript, ProgressEvent, VersionBumpProgress } from "./types/version-bump-progress"; import { VersionBumpResults } from "./types/version-bump-results"; type ProgressCallback = (progress: VersionBumpProgress) => void; @@ -19,6 +19,7 @@ interface OperationState { interface UpdateOperationState extends Partial { event?: ProgressEvent; + script?: NpmScript; } /** @@ -89,13 +90,13 @@ export class Operation { /** * Updates the operation state and results, and reports the updated progress to the user. */ - public update({ event, ...newState }: UpdateOperationState): this { + public update({ event, script, ...newState }: UpdateOperationState): this { // Update the operation state Object.assign(this.state, newState); if (event && this._progress) { // Report the progress to the user - this._progress({ event, ...this.results }); + this._progress({ event, script, ...this.results }); } return this; diff --git a/src/run-npm-script.ts b/src/run-npm-script.ts new file mode 100644 index 0000000..aa62924 --- /dev/null +++ b/src/run-npm-script.ts @@ -0,0 +1,34 @@ +import * as ezSpawn from "ez-spawn"; +import { readJsonFile } from "./fs"; +import { isManifest, Manifest } from "./manifest"; +import { Operation } from "./operation"; +import { NpmScript, ProgressEvent } from "./types/version-bump-progress"; + +/** + * Runs the specified NPM script in the package.json file. + */ +export async function runNpmScript(script: NpmScript, operation: Operation): Promise { + let { cwd } = operation.options; + + let { data: manifest } = await readJsonFile("package.json", cwd); + + if (isManifest(manifest) && hasScript(manifest, script)) { + await ezSpawn.async("npm", ["run", script, "--silent"], { stdio: "inherit" }); + operation.update({ event: ProgressEvent.NpmScript, script }); + } + + return operation; +} + +/** + * Determines whether the specified NPM script exists in the given manifest. + */ +function hasScript(manifest: Manifest, script: NpmScript): boolean { + let scripts = manifest.scripts as Record | undefined; + + if (scripts && typeof scripts === "object") { + return Boolean(scripts[script]); + } + + return false; +} diff --git a/src/types/version-bump-progress.ts b/src/types/version-bump-progress.ts index 0846501..edfeecf 100644 --- a/src/types/version-bump-progress.ts +++ b/src/types/version-bump-progress.ts @@ -9,6 +9,18 @@ export const enum ProgressEvent { GitCommit = "git commit", GitTag = "git tag", GitPush = "git push", + NpmScript = "npm script", +} + +/** + * The NPM version scripts + * + * @see https://docs.npmjs.com/cli/version.html + */ +export const enum NpmScript { + PreVersion = "preversion", + Version = "version", + PostVersion = "postversion", } /** @@ -16,4 +28,5 @@ export const enum ProgressEvent { */ export interface VersionBumpProgress extends VersionBumpResults { event: ProgressEvent; + script?: NpmScript; } diff --git a/src/version-bump.ts b/src/version-bump.ts index bf9f0d2..4c049e5 100644 --- a/src/version-bump.ts +++ b/src/version-bump.ts @@ -2,7 +2,9 @@ import { getNewVersion } from "./get-new-version"; import { getOldVersion } from "./get-old-version"; import { gitCommit, gitPush, gitTag } from "./git"; import { Operation } from "./operation"; +import { runNpmScript } from "./run-npm-script"; import { VersionBumpOptions } from "./types/version-bump-options"; +import { NpmScript } from "./types/version-bump-progress"; import { VersionBumpResults } from "./types/version-bump-results"; import { updateFiles } from "./update-files"; @@ -46,12 +48,23 @@ export async function versionBump(arg: VersionBumpOptions | string = {}): Promis await getOldVersion(operation); await getNewVersion(operation); + // Run npm preversion script, if any + await runNpmScript(NpmScript.PreVersion, operation); + // Update the version number in all files await updateFiles(operation); - // Git commit, tag, push (if enabled) + // Run npm version script, if any + await runNpmScript(NpmScript.Version, operation); + + // Git commit and tag, if enabled await gitCommit(operation); await gitTag(operation); + + // Run npm postversion script, if any + await runNpmScript(NpmScript.PostVersion, operation); + + // Push the git commit and tag, if enabled await gitPush(operation); return operation.results; From 2ed54c64c985cba10167429c971ee78058f0b6a5 Mon Sep 17 00:00:00 2001 From: James Messinger Date: Sun, 10 Mar 2019 18:40:00 -0500 Subject: [PATCH 106/106] Updated all the "npm hooks" tests for v5.0 --- test/specs/npm.spec.js | 46 ++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/test/specs/npm.spec.js b/test/specs/npm.spec.js index d905dc1..3caf84c 100644 --- a/test/specs/npm.spec.js +++ b/test/specs/npm.spec.js @@ -3,10 +3,10 @@ const { check, files, mocks, bump } = require("../utils"); const { expect } = require("chai"); -describe.skip("npm version hooks", () => { +describe("npm version hooks", () => { + if (process.platform === "win32" && process.env.CI) { - // Spawning NPM fails on Windows due to a bug in NYC (actually in its dependency, spawn-wrap) - // So skip these tests until this bug is fixed: https://github.com/istanbuljs/nyc/issues/760 + // Spawning NPM fails on Windows due to a bug in NYC return; } @@ -18,19 +18,20 @@ describe.skip("npm version hooks", () => { }, }); - let cli = bump("--major"); + let cli = bump("major"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( + `${check} Npm run preversion\n` + `${check} Updated package.json to 2.0.0\n` ); - let npm = mocks.npm(); + let npm = mocks.npmDetails(); expect(npm.length).to.equal(1); - expect(npm[0].cmd).to.equal("npm run preversion"); + expect(npm[0].cmd).to.equal("npm run preversion --silent"); expect(npm[0].version).to.equal("1.0.0"); }); @@ -42,19 +43,20 @@ describe.skip("npm version hooks", () => { }, }); - let cli = bump("--major"); + let cli = bump("major"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 2.0.0\n` + `${check} Updated package.json to 2.0.0\n` + + `${check} Npm run version\n` ); - let npm = mocks.npm(); + let npm = mocks.npmDetails(); expect(npm.length).to.equal(1); - expect(npm[0].cmd).to.equal("npm run version"); + expect(npm[0].cmd).to.equal("npm run version --silent"); expect(npm[0].version).to.equal("2.0.0"); }); @@ -66,19 +68,20 @@ describe.skip("npm version hooks", () => { }, }); - let cli = bump("--major"); + let cli = bump("major"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( - `${check} Updated package.json to 2.0.0\n` + `${check} Updated package.json to 2.0.0\n` + + `${check} Npm run postversion\n` ); - let npm = mocks.npm(); + let npm = mocks.npmDetails(); expect(npm.length).to.equal(1); - expect(npm[0].cmd).to.equal("npm run postversion"); + expect(npm[0].cmd).to.equal("npm run postversion --silent"); expect(npm[0].version).to.equal("2.0.0"); }); @@ -92,15 +95,18 @@ describe.skip("npm version hooks", () => { }, }); - let cli = bump("--major --commit --tag --push"); + let cli = bump("major --commit --tag --push"); expect(cli).to.have.stderr(""); expect(cli).to.have.exitCode(0); expect(cli).to.have.stdout( + `${check} Npm run preversion\n` + `${check} Updated package.json to 2.0.0\n` + + `${check} Npm run version\n` + `${check} Git commit\n` + `${check} Git tag\n` + + `${check} Npm run postversion\n` + `${check} Git push\n` ); @@ -108,23 +114,23 @@ describe.skip("npm version hooks", () => { expect(bin.length).to.equal(7); // The preversion script runs before anything - expect(bin[0].cmd).to.equal("npm run preversion"); + expect(bin[0].cmd).to.equal("npm run preversion --silent"); expect(bin[0].version).to.equal("1.0.0"); // The version script runs after the version has been updated, - expect(bin[1].cmd).to.equal("npm run version"); + expect(bin[1].cmd).to.equal("npm run version --silent"); expect(bin[1].version).to.equal("2.0.0"); // Git commit happens after the version has been updated - expect(bin[2].cmd).to.equal('git commit package.json -m "release v2.0.0"'); + expect(bin[2].cmd).to.equal('git commit --message "release v2.0.0" package.json'); expect(bin[2].version).to.equal("2.0.0"); // Git tag happens after the version has been updated - expect(bin[3].cmd).to.equal("git tag -a v2.0.0 -m 2.0.0"); + expect(bin[3].cmd).to.equal('git tag --annotate --message "release v2.0.0" v2.0.0'); expect(bin[3].version).to.equal("2.0.0"); // The postversion script runs AFTER "git commit" and "git tag", but BEFORE "git push" - expect(bin[4].cmd).to.equal("npm run postversion"); + expect(bin[4].cmd).to.equal("npm run postversion --silent"); expect(bin[4].version).to.equal("2.0.0"); // Git push happens after everything else