nope/lib/cli/nope.ts

119 lines
2.9 KiB
TypeScript
Raw Normal View History

/**
* @author Martin Karkowski
* @email m.karkowski@zema.de
* @desc [description]
*/
# 1.2.0 - Added: - `lib/cli/nope` adding scan for ui service - `lib/decorators/container`: Main Container, holding all `methods` and `classes`. Use `getCentralDecoratedContainer()` to get this decorator. - `types/nope/nopePackage.interface` added `IClassDescription` which contains the class description used in the Package Description. - `logger/nopeLogger`: added methods: `enabledFor`, `enableFor`, `shouldLog` - `package.json`: installed types of `ace` text editor. - `ui/helpers.browser`: Created `convertInstanceRenderPage` and `IUiDefinition` - `ui/helpers.nodejs`: Added a Helper to write the Ui-File (`writeUiFile`) and parse its arguments (`readInwriteUiFileArgs`) - `ui/index.*`: Crated the corresponding exports. - Modified: - `lib/decorators/*` Adding the main `container` where every function, service method etc is added. All decorators now safe the decorated elements in the container. - `helpers/json`: Adding `BEGIN_STR` and `END_STR` for parsing functions as constants. - `logger/eventLogging`: simplify `useEventLogger` - `logger/index.browser`: Adating exports. - `loader/loadPackages`: Modifing `IPackageConfig` now extends Partial the `IPackageDescription` - `types/ui/editor/IEditPage`: adapting Type of `getData` to `T`->`any`. Adapting the return of `getPorts` (The Ports will be generated in the ui then) - `types/ui/editor/helpers.interface`: Adapting the `w2ui` and added `w2uiHelpers` and added `ace`. Rearanging `IRenderData` element. to compact the data. - `types/ui/editor/render.callbacks`: Rearange the Generic Type of `TRenderInstancePage` and Renaming `TCreatorPage` to `TInstanceManagerPage`. Adapting the `option` of `TInstanceManagerPage` regarding the `createInstance` and `instances` - `types/ui/editor/index`: Adapting the Exports. - `lib/index.browser`: Exporting `ui` elements - `lib/index.nodejs`: Exporting `ui` elements - `lib/types/index`: Exporting `ui` elements - Fixes: - `types/nope/nopeInstanceManager.interface`: Fixing Type of createInstance. Now the Type `I` extends `INopeModule` instead of being set to `IGenericNopeModule`
2022-07-02 09:30:10 +00:00
import { readInwriteUiFileArgs, writeUiFile } from "../ui/helpers.nodejs";
import { createService } from "./createService";
import { generateDefaultConfig } from "./generateDefaultConfig";
import { generateDefaultPackageConfig } from "./generateDefaultPackageConfig";
import { generateFolderStructure } from "./generateFolderStructure";
2022-01-17 14:39:48 +00:00
import { repl } from "./repl";
import run from "./runNopeBackend";
/**
* Main Function.
*
* @export
*/
export async function main() {
const args: {
# 1.2.0 - Added: - `lib/cli/nope` adding scan for ui service - `lib/decorators/container`: Main Container, holding all `methods` and `classes`. Use `getCentralDecoratedContainer()` to get this decorator. - `types/nope/nopePackage.interface` added `IClassDescription` which contains the class description used in the Package Description. - `logger/nopeLogger`: added methods: `enabledFor`, `enableFor`, `shouldLog` - `package.json`: installed types of `ace` text editor. - `ui/helpers.browser`: Created `convertInstanceRenderPage` and `IUiDefinition` - `ui/helpers.nodejs`: Added a Helper to write the Ui-File (`writeUiFile`) and parse its arguments (`readInwriteUiFileArgs`) - `ui/index.*`: Crated the corresponding exports. - Modified: - `lib/decorators/*` Adding the main `container` where every function, service method etc is added. All decorators now safe the decorated elements in the container. - `helpers/json`: Adding `BEGIN_STR` and `END_STR` for parsing functions as constants. - `logger/eventLogging`: simplify `useEventLogger` - `logger/index.browser`: Adating exports. - `loader/loadPackages`: Modifing `IPackageConfig` now extends Partial the `IPackageDescription` - `types/ui/editor/IEditPage`: adapting Type of `getData` to `T`->`any`. Adapting the return of `getPorts` (The Ports will be generated in the ui then) - `types/ui/editor/helpers.interface`: Adapting the `w2ui` and added `w2uiHelpers` and added `ace`. Rearanging `IRenderData` element. to compact the data. - `types/ui/editor/render.callbacks`: Rearange the Generic Type of `TRenderInstancePage` and Renaming `TCreatorPage` to `TInstanceManagerPage`. Adapting the `option` of `TInstanceManagerPage` regarding the `createInstance` and `instances` - `types/ui/editor/index`: Adapting the Exports. - `lib/index.browser`: Exporting `ui` elements - `lib/index.nodejs`: Exporting `ui` elements - `lib/types/index`: Exporting `ui` elements - Fixes: - `types/nope/nopeInstanceManager.interface`: Fixing Type of createInstance. Now the Type `I` extends `INopeModule` instead of being set to `IGenericNopeModule`
2022-07-02 09:30:10 +00:00
mode:
| "run"
| "init"
| "none"
| "conf"
| "help"
| "service"
| "repl"
| "scan-ui";
params: string[];
} = {
mode: (process.argv[2] as any) || "none",
2021-12-04 07:25:26 +00:00
params: process.argv.slice(3),
};
const additionalArg: any = {
help: "Command to run the backend",
2021-01-21 15:20:59 +00:00
name: args.mode,
type: "str",
};
const showLog = () => {
console.log(`NoPE - Command Line Interface.
2021-01-21 15:20:59 +00:00
Please select the option you want. Therefore add one of the following options:
2022-01-17 17:06:10 +00:00
\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.
# 1.2.0 - Added: - `lib/cli/nope` adding scan for ui service - `lib/decorators/container`: Main Container, holding all `methods` and `classes`. Use `getCentralDecoratedContainer()` to get this decorator. - `types/nope/nopePackage.interface` added `IClassDescription` which contains the class description used in the Package Description. - `logger/nopeLogger`: added methods: `enabledFor`, `enableFor`, `shouldLog` - `package.json`: installed types of `ace` text editor. - `ui/helpers.browser`: Created `convertInstanceRenderPage` and `IUiDefinition` - `ui/helpers.nodejs`: Added a Helper to write the Ui-File (`writeUiFile`) and parse its arguments (`readInwriteUiFileArgs`) - `ui/index.*`: Crated the corresponding exports. - Modified: - `lib/decorators/*` Adding the main `container` where every function, service method etc is added. All decorators now safe the decorated elements in the container. - `helpers/json`: Adding `BEGIN_STR` and `END_STR` for parsing functions as constants. - `logger/eventLogging`: simplify `useEventLogger` - `logger/index.browser`: Adating exports. - `loader/loadPackages`: Modifing `IPackageConfig` now extends Partial the `IPackageDescription` - `types/ui/editor/IEditPage`: adapting Type of `getData` to `T`->`any`. Adapting the return of `getPorts` (The Ports will be generated in the ui then) - `types/ui/editor/helpers.interface`: Adapting the `w2ui` and added `w2uiHelpers` and added `ace`. Rearanging `IRenderData` element. to compact the data. - `types/ui/editor/render.callbacks`: Rearange the Generic Type of `TRenderInstancePage` and Renaming `TCreatorPage` to `TInstanceManagerPage`. Adapting the `option` of `TInstanceManagerPage` regarding the `createInstance` and `instances` - `types/ui/editor/index`: Adapting the Exports. - `lib/index.browser`: Exporting `ui` elements - `lib/index.nodejs`: Exporting `ui` elements - `lib/types/index`: Exporting `ui` elements - Fixes: - `types/nope/nopeInstanceManager.interface`: Fixing Type of createInstance. Now the Type `I` extends `INopeModule` instead of being set to `IGenericNopeModule`
2022-07-02 09:30:10 +00:00
\x1b[4mconf\x1b[0m Trys to update the configuration file.
\x1b[4mscan-ui\x1b[0m Scans and extracts the provided uis.
2022-01-17 17:06:10 +00:00
\x1b[4mservice\x1b[0m Generate Helper Files to provide services
# 1.2.0 - Added: - `lib/cli/nope` adding scan for ui service - `lib/decorators/container`: Main Container, holding all `methods` and `classes`. Use `getCentralDecoratedContainer()` to get this decorator. - `types/nope/nopePackage.interface` added `IClassDescription` which contains the class description used in the Package Description. - `logger/nopeLogger`: added methods: `enabledFor`, `enableFor`, `shouldLog` - `package.json`: installed types of `ace` text editor. - `ui/helpers.browser`: Created `convertInstanceRenderPage` and `IUiDefinition` - `ui/helpers.nodejs`: Added a Helper to write the Ui-File (`writeUiFile`) and parse its arguments (`readInwriteUiFileArgs`) - `ui/index.*`: Crated the corresponding exports. - Modified: - `lib/decorators/*` Adding the main `container` where every function, service method etc is added. All decorators now safe the decorated elements in the container. - `helpers/json`: Adding `BEGIN_STR` and `END_STR` for parsing functions as constants. - `logger/eventLogging`: simplify `useEventLogger` - `logger/index.browser`: Adating exports. - `loader/loadPackages`: Modifing `IPackageConfig` now extends Partial the `IPackageDescription` - `types/ui/editor/IEditPage`: adapting Type of `getData` to `T`->`any`. Adapting the return of `getPorts` (The Ports will be generated in the ui then) - `types/ui/editor/helpers.interface`: Adapting the `w2ui` and added `w2uiHelpers` and added `ace`. Rearanging `IRenderData` element. to compact the data. - `types/ui/editor/render.callbacks`: Rearange the Generic Type of `TRenderInstancePage` and Renaming `TCreatorPage` to `TInstanceManagerPage`. Adapting the `option` of `TInstanceManagerPage` regarding the `createInstance` and `instances` - `types/ui/editor/index`: Adapting the Exports. - `lib/index.browser`: Exporting `ui` elements - `lib/index.nodejs`: Exporting `ui` elements - `lib/types/index`: Exporting `ui` elements - Fixes: - `types/nope/nopeInstanceManager.interface`: Fixing Type of createInstance. Now the Type `I` extends `INopeModule` instead of being set to `IGenericNopeModule`
2022-07-02 09:30:10 +00:00
\x1b[4mrepl\x1b[0m Opens an interactive console.
2021-01-21 15:20:59 +00:00
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":
2022-01-17 14:39:48 +00:00
await run([additionalArg]);
break;
case "init":
additionalArg.help = "Command to run init";
await generateFolderStructure([additionalArg]);
await generateDefaultConfig([additionalArg]);
await generateDefaultPackageConfig([additionalArg]);
break;
# 1.2.0 - Added: - `lib/cli/nope` adding scan for ui service - `lib/decorators/container`: Main Container, holding all `methods` and `classes`. Use `getCentralDecoratedContainer()` to get this decorator. - `types/nope/nopePackage.interface` added `IClassDescription` which contains the class description used in the Package Description. - `logger/nopeLogger`: added methods: `enabledFor`, `enableFor`, `shouldLog` - `package.json`: installed types of `ace` text editor. - `ui/helpers.browser`: Created `convertInstanceRenderPage` and `IUiDefinition` - `ui/helpers.nodejs`: Added a Helper to write the Ui-File (`writeUiFile`) and parse its arguments (`readInwriteUiFileArgs`) - `ui/index.*`: Crated the corresponding exports. - Modified: - `lib/decorators/*` Adding the main `container` where every function, service method etc is added. All decorators now safe the decorated elements in the container. - `helpers/json`: Adding `BEGIN_STR` and `END_STR` for parsing functions as constants. - `logger/eventLogging`: simplify `useEventLogger` - `logger/index.browser`: Adating exports. - `loader/loadPackages`: Modifing `IPackageConfig` now extends Partial the `IPackageDescription` - `types/ui/editor/IEditPage`: adapting Type of `getData` to `T`->`any`. Adapting the return of `getPorts` (The Ports will be generated in the ui then) - `types/ui/editor/helpers.interface`: Adapting the `w2ui` and added `w2uiHelpers` and added `ace`. Rearanging `IRenderData` element. to compact the data. - `types/ui/editor/render.callbacks`: Rearange the Generic Type of `TRenderInstancePage` and Renaming `TCreatorPage` to `TInstanceManagerPage`. Adapting the `option` of `TInstanceManagerPage` regarding the `createInstance` and `instances` - `types/ui/editor/index`: Adapting the Exports. - `lib/index.browser`: Exporting `ui` elements - `lib/index.nodejs`: Exporting `ui` elements - `lib/types/index`: Exporting `ui` elements - Fixes: - `types/nope/nopeInstanceManager.interface`: Fixing Type of createInstance. Now the Type `I` extends `INopeModule` instead of being set to `IGenericNopeModule`
2022-07-02 09:30:10 +00:00
case "conf":
additionalArg.help = "Command to generate the Config of the backend";
2021-01-21 15:20:59 +00:00
await generateDefaultPackageConfig([additionalArg]);
break;
case "service":
2021-12-04 07:25:26 +00:00
additionalArg.help = "Command to generate the Service Files";
await createService([additionalArg]);
break;
2022-01-17 14:39:48 +00:00
case "repl":
await repl([additionalArg]);
break;
# 1.2.0 - Added: - `lib/cli/nope` adding scan for ui service - `lib/decorators/container`: Main Container, holding all `methods` and `classes`. Use `getCentralDecoratedContainer()` to get this decorator. - `types/nope/nopePackage.interface` added `IClassDescription` which contains the class description used in the Package Description. - `logger/nopeLogger`: added methods: `enabledFor`, `enableFor`, `shouldLog` - `package.json`: installed types of `ace` text editor. - `ui/helpers.browser`: Created `convertInstanceRenderPage` and `IUiDefinition` - `ui/helpers.nodejs`: Added a Helper to write the Ui-File (`writeUiFile`) and parse its arguments (`readInwriteUiFileArgs`) - `ui/index.*`: Crated the corresponding exports. - Modified: - `lib/decorators/*` Adding the main `container` where every function, service method etc is added. All decorators now safe the decorated elements in the container. - `helpers/json`: Adding `BEGIN_STR` and `END_STR` for parsing functions as constants. - `logger/eventLogging`: simplify `useEventLogger` - `logger/index.browser`: Adating exports. - `loader/loadPackages`: Modifing `IPackageConfig` now extends Partial the `IPackageDescription` - `types/ui/editor/IEditPage`: adapting Type of `getData` to `T`->`any`. Adapting the return of `getPorts` (The Ports will be generated in the ui then) - `types/ui/editor/helpers.interface`: Adapting the `w2ui` and added `w2uiHelpers` and added `ace`. Rearanging `IRenderData` element. to compact the data. - `types/ui/editor/render.callbacks`: Rearange the Generic Type of `TRenderInstancePage` and Renaming `TCreatorPage` to `TInstanceManagerPage`. Adapting the `option` of `TInstanceManagerPage` regarding the `createInstance` and `instances` - `types/ui/editor/index`: Adapting the Exports. - `lib/index.browser`: Exporting `ui` elements - `lib/index.nodejs`: Exporting `ui` elements - `lib/types/index`: Exporting `ui` elements - Fixes: - `types/nope/nopeInstanceManager.interface`: Fixing Type of createInstance. Now the Type `I` extends `INopeModule` instead of being set to `IGenericNopeModule`
2022-07-02 09:30:10 +00:00
case "scan-ui":
additionalArg.help =
"Command to readin the UI-Files and store them in a config";
await writeUiFile(readInwriteUiFileArgs([additionalArg]));
break;
}
}
export default main;
// If requested As Main => Perform the Operation.
if (require.main === module) {
main().catch((e) => console.error(e));
}