Skip to content

Commit 26486d2

Browse files
buchslavajthoms1
authored andcommitted
fix(cli): npm install under windows (#1539)
Closes#1445
1 parent 58cfd8a commit 26486d2

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

‎lib/cli.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ var Logging = IonicAppLib.logging;
1818
varlog=Logging.logger;
1919
varQ=require('q');
2020
varhelpUtil=require('./utils/help');
21+
varEOL=require('os').EOL;
2122

2223
Cli.ALL_TASKS=Tasks;
2324
Cli.IONIC_DASH='https://apps.ionic.io';
@@ -268,7 +269,7 @@ Cli.loadGulpfile = function loadGulpfile() {
268269
varnames=['gulpfile.js','Gulpfile.js'];
269270
for(vari=0,ii=names.length;i<ii;i+=1){
270271
try{
271-
require(path.resolve(process.cwd()+'/'+names[i]));
272+
require(path.resolve(process.cwd(),names[i]));
272273
log.verbose('Gulpfile found');
273274
returntrue;
274275
}catch(e){
@@ -331,7 +332,7 @@ Cli.runNpmHook = function runNpmHook(hook) {
331332
});
332333
spawned.stdout.pipe(process.stdout);
333334
spawned.stdout.on('data',function(data){
334-
vardataLines=data.toString().split('\n');
335+
vardataLines=data.toString().split(EOL);
335336
for(vari=0;i<dataLines.length;i++){
336337
if(dataLines[i].length){
337338
if(dataLines[i].indexOf('watch ready')>-1){
@@ -360,7 +361,7 @@ Cli.loadNpmScripts = function loadNpmScripts() {
360361
varfileName='package.json';
361362

362363
try{
363-
varpackageFile=require(path.resolve(process.cwd()+'/'+fileName));
364+
varpackageFile=require(path.resolve(process.cwd(),fileName));
364365
log.verbose('Package.json found scripts:',packageFile.scripts);
365366
returnpackageFile.scripts;
366367
}catch(e){

‎lib/utils/help.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
varIonicAppLib=require('ionic-app-lib');
44
varlog=IonicAppLib.logging.logger;
5+
varEOL=require('os').EOL;
56
require('colors');
67

78
/**
@@ -173,7 +174,7 @@ function printTaskDetails(d) {
173174
}
174175
w((indent+' '+arg+' ').bold);
175176

176-
varargDescs=d.args[arg].split('\n');
177+
varargDescs=d.args[arg].split(EOL);
177178
varargIndent=indent+' ';
178179

179180
for(x=0;x<arg.length+1;x+=1){
@@ -218,9 +219,9 @@ function printTaskDetails(d) {
218219
varoptDescs;
219220

220221
if(typeoftaskOpt=='string'){
221-
optDescs=taskOpt.split('\n');
222+
optDescs=taskOpt.split(EOL);
222223
}else{
223-
optDescs=taskOpt.title.split('\n');
224+
optDescs=taskOpt.title.split(EOL);
224225
}
225226
for(x=0;x<optDescs.length;x+=1){
226227
if(x===0){

‎spec/utils/templates.spec.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ var rewire = require('rewire');
55
vartemplateUtils=rewire('../../lib/utils/templates');
66
varIonicAppLib=require('ionic-app-lib');
77
varlog=IonicAppLib.logging.logger;
8+
varEOL=require('os').EOL;
89

910
describe('listTemplates method',function(){
1011
it('should should call fetchStarterTemplates pull out templates/sort and send to list',function(done){
@@ -148,7 +149,7 @@ describe('list function', function() {
148149
varlist=templateUtils.__get__('list');
149150

150151
list(templates);
151-
expect(log.info.calls[0].args).toEqual(['\n']);
152+
expect(log.info.calls[0].args).toEqual([EOL]);
152153
expect(log.info.calls[1].args[0]).toMatch('a-template');// Use match because of colors
153154
expect(log.info.calls[1].args[1]).toEqual('...........');
154155
expect(log.info.calls[1].args[2]).toEqual(templates[0].description);

0 commit comments

Comments
 (0)