Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: yeoman/environment
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 972d2dfe84e997ea44644338b2f7f1f252110e23
Choose a base ref
...
head repository: yeoman/environment
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 21e9baa598974110f4bff079f243cdb41d81de37
Choose a head ref

Commits on May 1, 2016

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    b4fc012 View commit details

Commits on May 2, 2016

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    3043b31 View commit details
  2. Bump test dependencies

    SBoudrias committed May 2, 2016
    Copy the full SHA
    9dfd729 View commit details
  3. Always include our best-bet paths to find generators

    Hopefully will reduce issues with people having badly configured NODE_PATH
    SBoudrias committed May 2, 2016
    Copy the full SHA
    daa8dee View commit details
  4. 1.6.0

    SBoudrias committed May 2, 2016
    Copy the full SHA
    2b57f99 View commit details
  5. Downgrade untildify (#62)

    Untildify 3.0.0 breaks compatibility with 0.10 and 0.12. Downgrading to
    2.0.0 restores it.
    
    Fixes #61
    matthewp authored and SBoudrias committed May 2, 2016
    Copy the full SHA
    52300d3 View commit details
  6. 1.6.1

    SBoudrias committed May 2, 2016
    Copy the full SHA
    43e7b4f View commit details

Commits on May 3, 2016

  1. Add Node v6

    SBoudrias committed May 3, 2016
    Copy the full SHA
    0c8379f View commit details

Commits on May 18, 2016

  1. update coveralls badge

    sindresorhus committed May 18, 2016
    Copy the full SHA
    0d7a58b View commit details

Commits on Jul 6, 2016

  1. Copy the full SHA
    f946848 View commit details
  2. 1.6.2

    SBoudrias committed Jul 6, 2016
    Copy the full SHA
    4049e47 View commit details
  3. 1.6.3

    SBoudrias committed Jul 6, 2016
    Copy the full SHA
    b33bad1 View commit details

Commits on Sep 22, 2016

  1. Improved handling of win32 abs paths when executing a generator by pa…

    …th. (#69)
    
    * Improved handling of win32 absolute paths when executing a generator by path - useful for debugging of generators.
    Now it is possible to say:
    yo <generator> C:\path\to\dir\with\indexjs
    
    * Using two variables to preserve the original value passed to the Environment.prototype.get function (instead of overwriting conditionally).
    
    * Test that Environment.prototype.get handles Win32-type absolute paths correctly.
    
    * Improved the 'works with Windows' absolute paths' test-case.
    mykolav authored and SBoudrias committed Sep 22, 2016
    Copy the full SHA
    9b404b1 View commit details
  2. 1.6.4

    SBoudrias committed Sep 22, 2016
    Copy the full SHA
    73250da View commit details

Commits on Oct 7, 2016

  1. Improve error message when generator not found (#70)

    * Improve error message when generator not found
    
    Closes yeoman/yo#388
    
    * Updates formatting of error message
    
    * Improves error message
    mischah authored and SBoudrias committed Oct 7, 2016
    Copy the full SHA
    019af2d View commit details

Commits on Oct 9, 2016

  1. 1.6.5

    SBoudrias committed Oct 9, 2016
    Copy the full SHA
    e100d8a View commit details

Commits on Nov 11, 2016

  1. getNpmPaths default path for Mac OS (#72)

    Have a problem with lookup function on Mac OS.
    getNpmPaths is looking for generators in node_modules at
    '/usr/lib/node_modules' path, but also there is another path for
    node_modules on mac: '/usr/local/lib/node_modules'.
    anta-semenov authored and SBoudrias committed Nov 11, 2016
    Copy the full SHA
    3d809c7 View commit details

Commits on Nov 14, 2016

  1. 1.6.6

    SBoudrias committed Nov 14, 2016
    Copy the full SHA
    7354eaa View commit details

Commits on Feb 6, 2017

  1. Copy the full SHA
    11ac9d2 View commit details

Commits on Feb 11, 2017

  1. Update dependencies to enable Greenkeeper 🌴 (#77)

    * chore(package): update dependencies
    
    https://greenkeeper.io/
    
    * Update to latest yeoman-generator
    greenkeeper[bot] authored and SBoudrias committed Feb 11, 2017
    Copy the full SHA
    e9787d4 View commit details
  2. Copy the full SHA
    90b1628 View commit details

Commits on Mar 9, 2017

  1. ES2015ify

    sindresorhus committed Mar 9, 2017
    Copy the full SHA
    0a43ad1 View commit details
  2. Copy the full SHA
    1a478c5 View commit details

Commits on Apr 1, 2017

  1. Bump dependencies

    sindresorhus committed Apr 1, 2017
    Copy the full SHA
    414b8c0 View commit details

Commits on May 3, 2017

  1. Fix for issue yeoman/yo#518 (#81)

    * Fix for issue yeoman/yo#518
    
    * Removed unnecessary '@' filtering in regex
    
    * Processed review comments.
    rgroothuijsen authored and SBoudrias committed May 3, 2017
    Copy the full SHA
    cc008e5 View commit details

Commits on Jun 7, 2017

  1. 2.0.0

    SBoudrias committed Jun 7, 2017
    Copy the full SHA
    8efc379 View commit details

Commits on Jul 31, 2017

  1. search default system paths last (#85)

    jchip authored and SBoudrias committed Jul 31, 2017
    Copy the full SHA
    e924a99 View commit details
  2. 2.0.1

    SBoudrias committed Jul 31, 2017
    Copy the full SHA
    5092d40 View commit details

Commits on Aug 9, 2017

  1. Copy the full SHA
    3dd2286 View commit details
  2. 2.0.2

    SBoudrias committed Aug 9, 2017
    Copy the full SHA
    3922881 View commit details

Commits on Sep 2, 2017

  1. Copy the full SHA
    73637a6 View commit details
  2. 2.0.3

    SBoudrias committed Sep 2, 2017
    Copy the full SHA
    0ea7e54 View commit details

Commits on Sep 30, 2017

  1. Bump versions + Drop gulp

    SBoudrias committed Sep 30, 2017
    Copy the full SHA
    aca8527 View commit details
  2. 2.0.4

    SBoudrias committed Sep 30, 2017
    Copy the full SHA
    21e9baa View commit details
3 changes: 0 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -7,8 +7,5 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab
141 changes: 0 additions & 141 deletions .eslintrc

This file was deleted.

1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* text=auto
*.js text eol=lf
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
coverage
.nyc_output/
7 changes: 2 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
sudo: false
language: node_js
node_js:
- stable
- v5
- v4
- v0.10
- v0.12
- '6'
- '4'
before_script:
- export NODE_PATH="$NVM_PATH/../node_modules"
env:
8 changes: 4 additions & 4 deletions benchmark/env.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*global suite, bench */
/* global suite, bench */
'use strict';
var yeoman = require('..');
const yeoman = require('..');

suite('Environment', function () {
bench('#lookup()', function (done) {
suite('Environment', () => {
bench('#lookup()', done => {
yeoman.createEnv().lookup(done);
});
});
57 changes: 0 additions & 57 deletions gulpfile.js

This file was deleted.

122 changes: 67 additions & 55 deletions lib/adapter.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';

var inquirer = require('inquirer');
var diff = require('diff');
var chalk = require('chalk');
var logger = require('./util/log');
const _ = require('lodash');
const inquirer = require('inquirer');
const diff = require('diff');
const chalk = require('chalk');
const logger = require('./util/log');

/**
* `TerminalAdapter` is the default implementation of `Adapter`, an abstraction
@@ -13,66 +13,78 @@ var logger = require('./util/log');
*
* @constructor
*/
var TerminalAdapter = module.exports = function TerminalAdapter() {
this.prompt = inquirer.createPromptModule();
};
class TerminalAdapter {
constructor() {
this.promptModule = inquirer.createPromptModule();
}

TerminalAdapter.prototype._colorDiffAdded = chalk.black.bgGreen;
TerminalAdapter.prototype._colorDiffRemoved = chalk.bgRed;
TerminalAdapter.prototype._colorLines = function colorLines(name, str) {
return str.split('\n').map(function (str) {
return this['_colorDiff' + name](str);
}, this).join('\n');
};
get _colorDiffAdded() {
return chalk.black.bgGreen;
}

/**
* Prompt a user for one or more questions and pass
* the answer(s) to the provided callback.
*
* It shares its interface with `Base.prompt`
*
* (Defined inside the constructor to keep interfaces separated between
* instances)
*
* @param {Array} questions
* @param {Function} callback
*/
TerminalAdapter.prototype.prompt = function () {};
get _colorDiffRemoved() {
return chalk.bgRed;
}

/**
* Shows a color-based diff of two strings
*
* @param {string} actual
* @param {string} expected
*/
TerminalAdapter.prototype.diff = function _diff(actual, expected) {
var msg = diff.diffLines(actual, expected).map(function (str) {
if (str.added) {
return this._colorLines('Added', str.value);
}
_colorLines(name, str) {
return str.split('\n').map(line => this[`_colorDiff${name}`](line)).join('\n');
}

if (str.removed) {
return this._colorLines('Removed', str.value);
}
/**
* Prompt a user for one or more questions and pass
* the answer(s) to the provided callback.
*
* It shares its interface with `Base.prompt`
*
* (Defined inside the constructor to keep interfaces separated between
* instances)
*
* @param {Array} questions
* @param {Function} callback
*/
prompt(questions, cb) {
const promise = this.promptModule(questions);
promise.then(cb || _.noop);
return promise;
}

return str.value;
}, this).join('');
/**
* Shows a color-based diff of two strings
*
* @param {string} actual
* @param {string} expected
*/
diff(actual, expected) {
let msg = diff.diffLines(actual, expected).map(str => {
if (str.added) {
return this._colorLines('Added', str.value);
}

// legend
msg = '\n' +
this._colorDiffRemoved('removed') +
' ' +
this._colorDiffAdded('added') +
'\n\n' +
msg +
'\n';
if (str.removed) {
return this._colorLines('Removed', str.value);
}

console.log(msg);
return msg;
};
return str.value;
}).join('');

// Legend
msg = '\n' +
this._colorDiffRemoved('removed') +
' ' +
this._colorDiffAdded('added') +
'\n\n' +
msg +
'\n';

console.log(msg);
return msg;
}
}

/**
* Logging utility
* @type {env/log}
*/
TerminalAdapter.prototype.log = logger();

module.exports = TerminalAdapter;
Loading