-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fe1c534
Showing
9 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"node": true, | ||
"esnext": true, | ||
"bitwise": true, | ||
"curly": true, | ||
"eqeqeq": true, | ||
"eqnull": true, | ||
"immed": true, | ||
"latedef": true, | ||
"newcap": true, | ||
"noarg": true, | ||
"undef": true, | ||
"strict": false, | ||
"trailing": true, | ||
"smarttabs": true, | ||
"indent": 2, | ||
"white": true, | ||
"quotmark": "single", | ||
"laxbreak": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
language: node_js | ||
node_js: | ||
- '0.10' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
|
||
require('./doctor').run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
'use strict'; | ||
|
||
var path = require('path'); | ||
var chalk = require('chalk'); | ||
var shell = require('shelljs'); | ||
|
||
var doctor = module.exports = { | ||
errors: [], | ||
|
||
run: function () { | ||
this.checkNodePath(); | ||
this.logErrors(); | ||
}, | ||
|
||
logErrors: function () { | ||
if (!this.errors.length) { | ||
console.log(chalk.green('[Yeoman Doctor] Everything looks all right!')); | ||
console.log(); | ||
return; | ||
} | ||
|
||
console.log(chalk.red('[Yeoman Doctor] Uh oh, I found potential errors on your machine\n---------------\n')); | ||
this.errors.forEach(function (errMsg) { | ||
console.log('[' + chalk.red('Error') + '] ' + errMsg); | ||
console.log(); | ||
}); | ||
}, | ||
|
||
checkNodePath: function () { | ||
if (!process.env.NODE_PATH) { | ||
return; | ||
} | ||
|
||
var nodePaths = process.env.NODE_PATH.split(path.delimiter).map(path.normalize); | ||
var npmRoot = shell.exec('npm -g root', { silent: true }).output; | ||
|
||
npmRoot = path.normalize(npmRoot.trim()); | ||
|
||
if (nodePaths.indexOf(npmRoot) < 0) { | ||
this.nodePathMismatch({ | ||
nodePaths: nodePaths, | ||
npmRoot: npmRoot | ||
}); | ||
} | ||
}, | ||
|
||
nodePathMismatch: function (val) { | ||
var output = ''; | ||
output += 'npm root value is not in your NODE_PATH\n'; | ||
output += ' [' + chalk.cyan('info') + ']\n'; | ||
output += [ | ||
' NODE_PATH = ' + val.nodePaths.join(path.delimiter), | ||
' npm root = ' + val.npmRoot | ||
].join('\n'); | ||
output += '\n\n [' + chalk.cyan('Fix') + '] Append the npm root value to your NODE_PATH variable\n'; | ||
|
||
if (process.platform === 'win32') { | ||
output += [ | ||
' If you\'re using cmd.exe, run this command to fix the issue:', | ||
' setx NODE_PATH "%NODE_PATH%;' + val.npmRoot + '"', | ||
' Then restart your command line. Otherwise, you can setup NODE_PATH manually:', | ||
' https://github.com/sindresorhus/guides/blob/master/set-environment-variables.md#windows' | ||
].join('\n'); | ||
} else { | ||
output += [ | ||
' Add this line to your .bashrc', | ||
' export NODE_PATH=$NODE_PATH:' + val.npmRoot, | ||
' Or run this command', | ||
' echo "export NODE_PATH=$NODE_PATH:' + val.npmRoot + '" >> ~/.bashrc && source ~/.bashrc' | ||
].join('\n'); | ||
} | ||
|
||
this.errors.push(output); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "yeoman-doctor", | ||
"version": "0.0.0", | ||
"description": "Script to detect potential issues who'd break Yeoman on a user machine", | ||
"license": "BSD", | ||
"main": "doctor.js", | ||
"bin": { | ||
"yodoctor": "cli.js" | ||
}, | ||
"author": "The Yeoman Team", | ||
"repository": "yeoman/doctor", | ||
"engines": { | ||
"node": ">=0.10.0", | ||
"npm": ">=1.4.3" | ||
}, | ||
"scripts": { | ||
"test": "jshint doctor.js" | ||
}, | ||
"files": [ | ||
"doctor.js", | ||
"cli.js" | ||
], | ||
"keywords": [ | ||
"yeoman" | ||
], | ||
"dependencies": { | ||
"chalk": "^0.5.1", | ||
"shelljs": "^0.3.0" | ||
}, | ||
"devDependencies": { | ||
"jshint": "^2.5.6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Yeoman Doctor [![Build Status](https://travis-ci.org/yeoman/doctor.svg?branch=master)](https://travis-ci.org/yeoman/doctor) | ||
|
||
|
||
|
||
## Usage | ||
|
||
Use as part of yo | ||
|
||
``` | ||
yo doctor | ||
``` | ||
|
||
If installed globally on your machine, you can also call `yodoctor` | ||
|
||
## License | ||
|
||
[BSD license](http://opensource.org/licenses/bsd-license.php) and copyright Google. |