Browse Source

Added npm link

production
guest 2 years ago
parent
commit
6ae75f1544
2 changed files with 75 additions and 1 deletions
  1. 1
    1
      bin/elxr
  2. 74
    0
      index.js

+ 1
- 1
bin/elxr View File



const child = spawn( const child = spawn(
(process.platform === 'win32' ? 'npm.cmd' : 'npm') (process.platform === 'win32' ? 'npm.cmd' : 'npm')
, ['run', 'index', '--'].concat(process.argv.slice(2)), { cwd: __dirname });
, ['run', 'index', '--'].concat(process.argv.slice(2)), { env : Object.assign({}, process.env, {wd: process.cwd()}), cwd: __dirname });


// const child = spawn( // const child = spawn(
// 'C:\\Program Files\\Git\\bin\\sh.exe' // 'C:\\Program Files\\Git\\bin\\sh.exe'

+ 74
- 0
index.js View File

return getCredentials(); return getCredentials();
} }


function getCurrentFolder(){
var tasks = [
// () => {
// // Use junctions to avoid npm package issues
// var p = nodeShellExec('cd').then((result)=>{
// console.dir(result)
// }).catch((e) => { console.error(e) })
// return p;
// }
()=>{
return Promise.resolve(process.cwd())
}
];

return any(tasks);
}

const __ALIAS__STAMP__ = '9e7bebe0-1f57-11ec-8f88-778ffeea9d1b' const __ALIAS__STAMP__ = '9e7bebe0-1f57-11ec-8f88-778ffeea9d1b'
const BUILD_VERSION = '[VI]Version: {version} - built on {date}[/VI]'; const BUILD_VERSION = '[VI]Version: {version} - built on {date}[/VI]';
const runtimestamp = (new Date()).getTime(); const runtimestamp = (new Date()).getTime();
, noprerequisites : true , noprerequisites : true
, getPossiblePrompts(){ return {} } , getPossiblePrompts(){ return {} }
} }
, 'link' : {
'cmd' : 'link'
// , cmdFn : function( sourecpath, filename, dir ){
// var afterTargetPath = (dir)=>{
// console.dir(dir);

// // var tasks = [
// // () => {
// // // Use junctions to avoid npm package issues
// // var p = nodeShellExec('mklink', ['/J', filename, sourecpath], {
// // inherit: true, shell: true
// // , cwd : dir || instanceroot
// // , env: process.env
// // }).catch((e) => { console.error(e) })
// // return p;
// // }
// // ];

// }
// // console.dir(process.env)
// if(!dir) getCurrentFolder().then(afterTargetPath);
// else afterTargetPath(dir)

// }
, cmdFn : function( cmdopts ){
// sourecpathandfile should include name of file name
targetfilename = cmdopts.targetfilename || processedArgs._[1]
// console.log(processedArgs)
if(!targetfilename) Promise.reject('error no file provided for linking')
targetdir = cmdopts.targetdir || process.env.wd
sourecpathandfile = cmdopts.sourecpathandfile || path.normalize(`../../node_modules/chess-server-lib/common/models/${targetfilename}`)

var tasks = [
() => {
// Use junctions to avoid npm package issues
var p = nodeShellExec('mklink', [path.normalize(`${targetdir + '/' + targetfilename}`), sourecpathandfile], {
inherit: true, shell: true
, cwd : targetdir
, env: process.env
}).catch((e) => { console.error(e) })
return p;
}
];
if (__isElevated) {
return any(tasks).then(() => {
fs.writeFileSync('run.done', 'success')
}).catch(() => {
fs.writeFileSync('run.done', 'error')
})
}
else return op['runas']()
}
, noprerequisites : true
, privileged : true
}
} }


var elxrcmd = (function(){ var elxrcmd = (function(){


elxrcmd.create(cmds['users']) elxrcmd.create(cmds['users'])
elxrcmd.create(cmds['g']) elxrcmd.create(cmds['g'])
elxrcmd.create(cmds['link'])


var interpretrun = function(){ var interpretrun = function(){



Loading…
Cancel
Save