Просмотр исходного кода

npm colors still doesnt work

master
pb 1 год назад
Родитель
Сommit
f2c67379be
2 измененных файлов: 24 добавлений и 9 удалений
  1. 21
    7
      bin/elxr
  2. 3
    2
      index.js

+ 21
- 7
bin/elxr Просмотреть файл

@@ -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 Просмотреть файл

@@ -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.

Загрузка…
Отмена
Сохранить