Jean-Yves Didier

started to add tools for components management

This diff is collapsed. Click to expand it.
......@@ -150,6 +150,8 @@ let Context = function( ctx ) {
// TODO insert here component factories
for (p in module.default) {
if ( p === "__arcs__")
continue;
if (module.default.hasOwnProperty(p)) {
Context.currentContext.setFactory(p,module.default[p]);
}
......
/**
* This tool is intended to build a description of a repository of components
*/
import process from 'node:process';
import * as fs from 'node:fs';
import path from 'node:path';
/**
* possible arguments:
* - "-o" with output file
* - "-d" with input directory
* - "-h" or "--help" displays usage
*/
let outputFile = "repos.json";
let inputDir = ".";
const usage = function(idx) {
console.log(path.basename(process.argv[1])," [-o output_file] [-d component_dir] [-h]");
console.log("\toutput_file is the generated repository json file (by default 'repos.json')");
console.log("\tcomponent_dir is the directory storing components (by default '.')");
return 0;
};
const helpers = {
'-h' : usage,
'--help': usage,
'-o' : function(idx) {
outputFile = process.argv[idx+1];
return 1;
},
'-d' : function(idx) {
outputFile = process.argv[idx+1];
return 1;
}
};
for (let i=2; i<process.argv.length; i++) {
if (helpers.hasOwnProperty(process.argv[i])) {
let shift = helpers[process.argv[i]](i);
i+=shift;
}
}
/**
*
*
*
*/
const list= {};