Commit db83eb16 authored by Jerome Cambon's avatar Jerome Cambon
Browse files

Now a real CLI : cwb

parent 74baa2f7
This diff is collapsed.
{
"name": "poc-widget-builder",
"name": "custom-widget-builder",
"version": "0.0.1",
"description": "",
"author": "poc-widget-builder",
"description": "Bonitasoft UI Designer: Custom Widget Builder",
"main": "build/src/starter.js",
"license": "GPLv2",
"scripts": {
"typescript-compile": "tsc --build tsconfig.json",
......@@ -21,6 +21,10 @@
"jest": "^26.6.3",
"ts-jest": "^26.5.4"
},
"bin": {
"cwb": "./build/src/starter.js",
"custom-widget-builder": "./build/src/starter.js"
},
"jest": {
"verbose": true,
"roots": [
......
#!/usr/bin/env node
/*
* Copyright © 2021 Bonitasoft S.A.
* Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble
......@@ -16,17 +18,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import {CustomWidgetBuilder} from "./CustomWidgetBuilder";
let wcFile;
let outputDir;
for (let param of process.argv) {
if (param.startsWith("wcFile")) {
wcFile = getParameter(param);
}
let params = process.argv.slice(2);
let wcFile = params[0];
if (!wcFile) {
usage();
process.exit(1);
}
let outputDir = ".";
for (let param of params) {
if (param.startsWith("outputDir")) {
outputDir = getParameter(param);
}
......@@ -38,3 +39,7 @@ new CustomWidgetBuilder().generatePropertiesFile(wcFile, outputDir);
function getParameter(param: string): any {
return param.substr(param.indexOf('=') + 1);
}
function usage() {
console.log("Usage: cwb <web component source file> [outputDir=<directory>]");
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment