Przeglądaj źródła

Elxr standalone + New cmd to clean

production
anish 3 lat temu
rodzic
commit
33ab94d904
2 zmienionych plików z 27 dodań i 14 usunięć
  1. 21
    12
      index.js
  2. 6
    2
      package.json

+ 21
- 12
index.js Wyświetl plik

@@ -36,6 +36,15 @@ var globSync = require('glob').sync;

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

const { readdir } = require("fs").promises

// Directory shallow walk and do perform on each dir.
const dirs = async (perform, path) => {
for (const dir of await readdir(path || process.cwd(), { withFileTypes: true })) {
if (dir.isDirectory()) perform(dir)
}
}

var getShellTask = (command, args, options) => {
options = options || {}
return () => {
@@ -204,7 +213,13 @@ var configPromise = null

// elxr cli operations
var op = {
'h': () => { console.log(elxr.info()); return '-h' }
'h': () => { console.log(elxr.help()); return '-h' }
, 'clean' : () => {
// delete all node_module folders and links.
var tasklist = [];
dirs( (repodir)=> tasklist.push(getShellTask('rm',['-rf', 'node_modules'], { cwd : instanceroot + '/' + repodir.name })()), instanceroot )
return Promise.all(tasklist)
}
, 'undefined': () => { return op.h(); }
, 'reset': () => {

@@ -471,14 +486,6 @@ var op = {
})
}

const { readdir } = require("fs").promises

const dirs = async (perform, path) => {
for (const dir of await readdir(path || process.cwd(), { withFileTypes: true })) {
if (dir.isDirectory()) perform(dir)
}
}

dirs(perform_git_seturl)
}
, 'add': (remotename, url, branch) => {
@@ -788,6 +795,8 @@ var op = {
})


// PB : TODO -- npm i for client is for some reason not complete so bower doesn't get installed !!!
// Second time try also doesnt work.
// repotasks.push(
// () => {
// console.log(`--------------------second time npm i for client--------------------`)
@@ -1432,7 +1441,7 @@ var detectInstance = function () {
// Built version.
// check if we have a elxr subfolder.
if (fs.existsSync(launchpath + '/..' + path.normalize('/elxr'))) {
// Probably in the right place.
// Probably in the right place.
root = path.normalize(launchpath + '/..');
}
else {
@@ -1611,8 +1620,8 @@ var maintask = () => {
}
catch (e) {
console.error(e)
console.error('No local instances found in current root = ' + selectedinstance.root);
console.log('We will create a new one with the instance and environment chosen...')
console.error('No local instances config found in current root = ' + selectedinstance.root);
console.log('A config will be createed with the instance and environment chosen...')
}
finally {

+ 6
- 2
package.json Wyświetl plik

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

Ładowanie…
Anuluj
Zapisz