Skip to content

Commit be8abde

Browse files
committed
Fix lint and remove shelljs (replaced with cross-spawn)
1 parent 8b620aa commit be8abde

4 files changed

Lines changed: 37 additions & 24 deletions

File tree

lib/resolver.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22
const path = require('path');
33
const fs = require('fs');
4-
const os = require('os');
54
const _ = require('lodash');
65
const globby = require('globby');
76
const debug = require('debug')('yeoman:environment');
@@ -146,9 +145,9 @@ resolver.getNpmPaths = function () {
146145
// Yarn has a command to get the directory of global modules:
147146
// $ yarn global dir
148147
// > '.../global\n'
149-
const testYarn = spawn.sync('yarn', ['global', 'dir'], { encoding: 'utf8' });
148+
const testYarn = spawn.sync('yarn', ['global', 'dir'], {encoding: 'utf8'});
150149
if (!testYarn.error) {
151-
paths.push(path.resolve(testYarn.stdout.strip(), '../link/');
150+
paths.push(path.resolve(testYarn.stdout.trim(), '../link/'));
152151
}
153152

154153
// Adds support for generator resolving when yeoman-generator has been linked

package-lock.json

Lines changed: 30 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
"mocha": "^5.1.1",
5555
"nsp": "^3.2.1",
5656
"nyc": "^11.7.3",
57-
"shelljs": "^0.8.2",
5857
"sinon": "^5.0.7",
5958
"sinon-test": "^2.1.3",
6059
"xo": "^0.18.1",

test/resolver.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
const fs = require('fs');
33
const path = require('path');
44
const assert = require('assert');
5-
const shell = require('shelljs');
5+
const spawn = require('cross-spawn');
66
const Environment = require('../lib/environment');
77

88
const globalLookupTest = process.env.NODE_PATH ? it : xit;
@@ -17,9 +17,9 @@ describe('Environment Resolver', function () {
1717
before(function () {
1818
this.projectRoot = path.join(__dirname, 'fixtures/lookup-project');
1919
process.chdir(this.projectRoot);
20-
shell.exec('npm install --no-package-lock', {silent: true});
21-
shell.exec('npm install generator-jquery --no-package-lock', {silent: true});
22-
shell.exec('npm install -g generator-dummytest generator-dummy --no-package-lock', {silent: true});
20+
spawn.sync('npm', ['install', '--no-package-lock']);
21+
spawn.sync('npm', ['install', 'generator-jquery', '--no-package-lock']);
22+
spawn.sync('npm', ['install', '-g', 'generator-dummytest', 'generator-dummy', '--no-package-lock']);
2323

2424
fs.symlinkSync(
2525
path.resolve('../generator-extend'),
@@ -87,7 +87,7 @@ describe('Environment Resolver', function () {
8787
before(function () {
8888
this.projectSubRoot = path.join(this.projectRoot, 'subdir');
8989
process.chdir(this.projectSubRoot);
90-
shell.exec('npm install --no-package-lock', {silent: true});
90+
spawn.sync('npm', ['install', '--no-package-lock']);
9191
});
9292

9393
beforeEach(function () {

0 commit comments

Comments
 (0)