Skip to content

Commit

Permalink
fix(app): isGlobal npm context test
Browse files Browse the repository at this point in the history
  • Loading branch information
vogloblinsky committed Nov 11, 2016
1 parent d014f8e commit 3ddc9ce
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"fs-extra": "^1.0.0",
"gulp-util": "^3.0.7",
"handlebars": "^4.0.5",
"is-global-exec": "^0.1.3",
"live-server": "^1.1.0",
"lodash": "^4.16.6",
"marked": "^0.3.6",
Expand Down
2 changes: 1 addition & 1 deletion src/app/engines/ngd.engine.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as path from 'path';
import * as Shelljs from 'shelljs';

import { isGlobal } from '../../utilities';
const isGlobal: any = require('is-global-exec');

export class NgdEngine {
constructor() {
Expand Down
19 changes: 0 additions & 19 deletions src/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,6 @@ export function getNewLineCharacter(options: ts.CompilerOptions): string {
return carriageReturnLineFeed;
}

export function isGlobal() {
var isGlobal = false;

if (process.platform === "win32"){
var paths = process.env.Path.split (";");
for (var i=0; i<paths.length; i++){
if (paths[i].indexOf ("npm") !== -1 &&
process.mainModule.filename.indexOf (paths[i]) !== -1){
isGlobal = true;
break;
}
}
}else{
isGlobal = process.env._ !== process.execPath;
}

return isGlobal;
}

export function detectIndent(str, count, indent?): string {
let stripIndent = function(str: string) {
const match = str.match(/^[ \t]*(?=\S)/gm);
Expand Down

0 comments on commit 3ddc9ce

Please sign in to comment.