Przeglądaj źródła

Added npm link

production
guest 3 lat temu
rodzic
commit
6ae75f1544
2 zmienionych plików z 75 dodań i 1 usunięć
  1. 1
    1
      bin/elxr
  2. 74
    0
      index.js

+ 1
- 1
bin/elxr Wyświetl plik

@@ -7,7 +7,7 @@ console.dir(process.argv.slice(2))

const child = spawn(
(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(
// 'C:\\Program Files\\Git\\bin\\sh.exe'

+ 74
- 0
index.js Wyświetl plik

@@ -39,6 +39,23 @@ var getCredentials = function(){
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 BUILD_VERSION = '[VI]Version: {version} - built on {date}[/VI]';
const runtimestamp = (new Date()).getTime();
@@ -2053,6 +2070,62 @@ var cmds = {
, noprerequisites : true
, 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(){
@@ -2090,6 +2163,7 @@ var elxrcmd = (function(){

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

var interpretrun = function(){


Ładowanie…
Anuluj
Zapisz