Ver código fonte

npm colors still doesnt work

pull/10/head
pb 1 ano atrás
pai
commit
f2c67379be
2 arquivos alterados com 24 adições e 9 exclusões
  1. 21
    7
      bin/elxr
  2. 3
    2
      index.js

+ 21
- 7
bin/elxr Ver arquivo

@@ -1,16 +1,30 @@
#!/usr/bin/env node

var ENV = Object.assign({}, process.env); // Shallow clone it.

// var env = Object.assign(ENV, process.env, {wd: process.cwd(), cwd: __dirname, FORCE_COLOR : 'true', NPM_CONFIG_COLOR : 'always' })
var env = Object.assign({}, process.env, {wd: process.cwd()
, FORCE_COLOR : 'true', NPM_CONFIG_COLOR : 'always'
})
// console.dir(env)

const spawn = require('child_process').spawn;
console.dir(process.argv.slice(2))
// console.dir(process.argv.slice(2))


let npmcmd = (process.platform === 'win32' ? 'npm.cmd' : 'npm')
let npmrun = (process.platform === 'win32' ? ['run', 'index', '--'] : ['run', 'index_linux', '--'])
let npmrun = (process.platform === 'win32' ? [ '--color=always', 'run', 'index', '--'] : ['run', 'index_linux', '--'])
// let npmcmd = 'node'
// let npmrun = (process.platform === 'win32' ? [ '../index', '--'] : ['run', 'index_linux', '--'])


const child = spawn(
npmcmd
, npmrun.concat(process.argv.slice(2)), { env : Object.assign({}, process.env, {wd: process.cwd()}), cwd: __dirname });
, npmrun.concat(process.argv.slice(2)), {
env, cwd: __dirname
, stdio: ['pipe', process.stdout, process.stderr],
inherit: true,
shell: true,
});

// const child = spawn(
// 'C:\\Program Files\\Git\\bin\\sh.exe'
@@ -22,9 +36,9 @@ const child = spawn(
// , ['../index.js', 'pull'], { env : ENV, cwd: __dirname });

process.stdin.pipe(child.stdin)
child.stdout.pipe(process.stdout)
child.stderr.pipe(process.stderr)
// process.stdin.pipe(child.stdin)
// child.stdout.pipe(process.stdout)
// child.stderr.pipe(process.stderr)




+ 3
- 2
index.js Ver arquivo

@@ -2,8 +2,8 @@
// {{!-- https://corporatefinanceinstitute.com/resources/knowledge/accounting/general-ledger-gl/ --}}

"use strict";
// console.log([ 'If this is colorized we have color output...' ])
// console.dir(process.env)
var __g = require('global-this');
var ENV = Object.assign({}, process.env); // Shallow clone so we can set values and reuse for reshelling spawns.
__g.env = ENV
@@ -15,6 +15,7 @@ var any = utils.any;
var Tasq = utils.Tasq
var statuslog = utils.Traq
var Traq = utils.Traq
console.error('EEEEEEEEEEEEEEEEEEEE')


var ENV = Object.assign({}, process.env); // Shallow clone so we can set values and reuse for reshelling spawns.

Carregando…
Cancelar
Salvar