02f951aa7d
- Fixes: - `cli/runNopeBackend`: Fixing parameter `preventVarifiedNames` no works correctly. # 1.3.14 - Fixes: - `helpers/ui/helpers.nodejs`: Adding the option `upload-ui` - `helpers/ui/helpers.nodejs`: Adding the option `upload-ui` # 1.4.0 - Modified: - asyncified all ui-related services. - Adapted ui-defintion of functions: - `autoGenBySchema` Helper to enable auto generating a configuration - `requiresProviderForRendering` Flag to indicate, that rendering the service configuration requires a provider itself. This for instance is the case, if some needs to be called. - `types/ui/editor/IServiceEditPage.ts`: Asnycify the Calls - `types/ui/editor/render.callbacks.ts`: Asnycify the Calls # 1.4.1 - Modified: - loading all files related to `*.functions.js` - Adapted the following files to implement that behavior: - `getCentralDecoratedContainer` in `lib\decorators\container.ts` -> now provides services as Map - `exportFunctionAsNopeService` in `lib\decorators\functionDecorators.ts` to work with the map. - `loadFunctions` in `lib\loader\loadPackages.ts` to match the interface of `loadPackages` and add the functions to the package-loader. - added the function `addDecoratedElements` in the package-loader and the interface.
130 lines
3.2 KiB
TypeScript
130 lines
3.2 KiB
TypeScript
/**
|
|
* @author Martin Karkowski
|
|
* @email m.karkowski@zema.de
|
|
* @desc [description]
|
|
*/
|
|
|
|
import {
|
|
readInWriteUiFileArgs,
|
|
writeUiFile,
|
|
main as uploadUi,
|
|
} from "../ui/helpers.nodejs";
|
|
import { createService } from "./createService";
|
|
import { generateDefaultConfig } from "./generateDefaultConfig";
|
|
import { generateDefaultPackageConfig } from "./generateDefaultPackageConfig";
|
|
import { generateFolderStructure } from "./generateFolderStructure";
|
|
import { repl } from "./repl";
|
|
import { main as runMain } from "./runNopeBackend";
|
|
|
|
/**
|
|
* Main Function.
|
|
*
|
|
* @export
|
|
*/
|
|
export async function main() {
|
|
const args: {
|
|
mode:
|
|
| "run"
|
|
| "init"
|
|
| "none"
|
|
| "conf"
|
|
| "help"
|
|
| "service"
|
|
| "repl"
|
|
| "scan-ui"
|
|
| "upload-ui";
|
|
params: string[];
|
|
} = {
|
|
mode: (process.argv[2] as any) || "none",
|
|
params: process.argv.slice(3),
|
|
};
|
|
|
|
const additionalArg: any = {
|
|
help: "Command to run the backend",
|
|
name: args.mode,
|
|
type: "str",
|
|
};
|
|
|
|
const showLog = () => {
|
|
console.log(`NoPE - Command Line Interface.
|
|
|
|
Please select the option you want. Therefore add one of the following options:
|
|
\x1b[4mhelp\x1b[0m Show this help.
|
|
\x1b[4mrun\x1b[0m Start a NoPE-Backend.
|
|
\x1b[4minit\x1b[0m Initialize a new project. This project is empty.
|
|
\x1b[4mconf\x1b[0m Trys to update the configuration file.
|
|
\x1b[4mscan-ui\x1b[0m Scans and extracts the provided uis.
|
|
\x1b[4mupload-ui\x1b[0m Uploads the determined ui-file
|
|
\x1b[4mservice\x1b[0m Generate Helper Files to provide services
|
|
\x1b[4mrepl\x1b[0m Opens an interactive console.
|
|
|
|
Have fun using NoPE :)
|
|
|
|
*-*,
|
|
,*\\\/|\`| \\
|
|
\\' | |'| *,
|
|
\\ \`| | |/ )
|
|
| |'| , /
|
|
|'| |, /
|
|
___|_|_|_|___
|
|
[_____________]
|
|
| |
|
|
| This is |
|
|
| NoPE! |
|
|
| Sometimes |
|
|
| itchy! |
|
|
|___________|
|
|
|
|
`);
|
|
};
|
|
|
|
switch (args.mode) {
|
|
default:
|
|
showLog();
|
|
break;
|
|
case "help":
|
|
showLog();
|
|
break;
|
|
case "none":
|
|
showLog();
|
|
break;
|
|
case "run":
|
|
additionalArg.help = "Command to run the backend";
|
|
await runMain([additionalArg]);
|
|
break;
|
|
case "init":
|
|
additionalArg.help = "Command to run init";
|
|
await generateFolderStructure([additionalArg]);
|
|
await generateDefaultConfig([additionalArg]);
|
|
await generateDefaultPackageConfig([additionalArg]);
|
|
break;
|
|
case "conf":
|
|
additionalArg.help = "Command to generate the Config of the backend";
|
|
await generateDefaultPackageConfig([additionalArg]);
|
|
break;
|
|
case "service":
|
|
additionalArg.help = "Command to generate the Service Files";
|
|
await createService([additionalArg]);
|
|
break;
|
|
case "repl":
|
|
await repl([additionalArg]);
|
|
break;
|
|
case "scan-ui":
|
|
additionalArg.help =
|
|
"Command to readin the UI-Files and store them in a config";
|
|
await writeUiFile(readInWriteUiFileArgs([additionalArg]));
|
|
break;
|
|
case "upload-ui":
|
|
additionalArg.help = "to upload the determined ui-config.";
|
|
await uploadUi([additionalArg]);
|
|
break;
|
|
}
|
|
}
|
|
|
|
export default main;
|
|
|
|
// If requested As Main => Perform the Operation.
|
|
if (require.main === module) {
|
|
main().catch((e) => console.error(e));
|
|
}
|