Browse Source

fixed npm i for client

master
anish 3 years ago
parent
commit
de8916fbe1
2 changed files with 33 additions and 13 deletions
  1. 31
    7
      index.js
  2. 2
    6
      package.json

+ 31
- 7
index.js View File

} }


var getPullCmd = (repo, branch) => { var getPullCmd = (repo, branch) => {
// console.log(useGitPull)var getPullCmd = (repo, branch) => {
// console.log(useGitPull) // console.log(useGitPull)


if(branch) { if(branch) {
return pullCmd return pullCmd
} }


// var getPullCmd = (repo, branch) => {
// var pullCmd = [gitbash
// , ['-c', 'branch=`git rev-parse --abbrev-ref HEAD`;for i in `git remote`; do git pull $i $branch; done;']
// , { cwd: instanceroot + '/' + repo, title: 'pull all origins for ' + repo }]
// // var pullCmd = ['pullall', [], { cwd : repo }]
// if (useGitPull) pullCmd = ['git', ['pull'], {
// inherit: true, shell: true,
// cwd: instanceroot + '/' + repo
// // , env: process.env
// , runas: processedArgs.runas
// , title: `git pull ${repo}`
// }]
// return pullCmd
// }

var performPull = (repo, branch) => { var performPull = (repo, branch) => {
if (existsSync(instanceroot + '/' + repo)) { if (existsSync(instanceroot + '/' + repo)) {
var branchprint = branch ? ' branch :' + branch : ''; var branchprint = branch ? ' branch :' + branch : '';
console.log('pulling ' + instanceroot + '/' + repo + branchprint ) console.log('pulling ' + instanceroot + '/' + repo + branchprint )
return nodeShellExec.apply(null, getPullCmd(repo, branch)).then(() => { return nodeShellExec.apply(null, getPullCmd(repo, branch)).then(() => {
if (__isElevated) {
if (__isElevated) {
fs.writeFileSync('run.log', ', ' + JSON.stringify({ repo, success: true }), { 'flag': 'a+' }) fs.writeFileSync('run.log', ', ' + JSON.stringify({ repo, success: true }), { 'flag': 'a+' })
} }
else statuslog.statuslog(null, repo) else statuslog.statuslog(null, repo)
gitRepos = gitRepos.concat(elevatedRunasRepos); gitRepos = gitRepos.concat(elevatedRunasRepos);


// gitRepos = [ // gitRepos = [
// 'bbhverse', 'serververse', 'elixir-server',
// // 'bbhverse', 'serververse', 'elixir-server',
// // 'clientverse',
// 'client' // 'client'
// ]; // ];
var rmtasks = [] var rmtasks = []
var repotasks = [] var repotasks = []
var env = Object.assign({}, process.env)
delete env.NODE_ENV
gitRepos.forEach(repo => { gitRepos.forEach(repo => {


rmtasks.push( rmtasks.push(
var p = nodeShellExec('npm', ['i', '--force'], { var p = nodeShellExec('npm', ['i', '--force'], {
inherit: true, shell: true inherit: true, shell: true
, cwd: instanceroot + '/' + repo , cwd: instanceroot + '/' + repo
, env: process.env
, env
, title: `npm i for ${repo}` , title: `npm i for ${repo}`
}).then(Tasq.then).catch(Tasq.catch)
}).then(Tasq.then).catch(Tasq.catch)
return p; return p;
}) })
} }
}) })




// PB : TODO -- npm i for client is for some reason not complete so bower doesn't get installed !!!
// PB : NOTE -- npm i for client does not complete when NODE_ENV=production
// therefore bower doesn't get installed !!! which then fails installing the bower dependenciew !!!
// We work around this by running npm i for client without any NODE_ENV which probably defualts to development.
// PB : TODO -- Investigate why NODE_ENF has an impact on npm i !??
// Second time try also doesnt work. // Second time try also doesnt work.
// repotasks.push( // repotasks.push(
// () => { // () => {
// var env = Object.assign({}, process.env)
// delete env.NODE_ENV
// console.log(`--------------------second time npm i for client--------------------`) // console.log(`--------------------second time npm i for client--------------------`)
// return nodeShellExec(`"${gitbash}"`, ['-c', '"npm i"'], {
// return nodeShellExec(`"${gitbash}"`, ['-c', '"npm i --force"'], {
// // return nodeShellExec('npm', ['i --force'], { // // return nodeShellExec('npm', ['i --force'], {
// inherit: true, shell: true // inherit: true, shell: true
// , cwd: instanceroot + '/' + 'client' // , cwd: instanceroot + '/' + 'client'
// , env: process.env
// , env
// , title: `npm i for client` // , title: `npm i for client`
// }).then(Tasq.then).catch(Tasq.catch) // }).then(Tasq.then).catch(Tasq.catch)
// }) // })

+ 2
- 6
package.json View File

"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build-commented": "rollup index.js --format cjs --file elxr.js", "build-commented": "rollup index.js --format cjs --file elxr.js",
"build": "rollup -c",
"index": "SET FORCE_COLOR=true && node index"
"build": "rollup -c"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"bbhverse": "git+http://git.bbh/chess/bbhverse",
"global-this": "git+http://git.bbh/chess/global-this",
"moment": "^2.27.0",
"crossfilter2": "^1.5.4",
"bbhverse": "file:../bbhverse",
"chalk": "^4.1.0", "chalk": "^4.1.0",
"glob": "^7.1.2", "glob": "^7.1.2",
"tree-kill": "^1.2.2" "tree-kill": "^1.2.2"

Loading…
Cancel
Save