Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: template #29

Merged
merged 2 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 43 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,56 @@
"name": "Start PackagePacker",
"program": "${workspaceRoot}/node_modules/yo/lib/cli.js",
"args": [
"${workspaceRoot}/generator-iot/generators/packagePacker/index.js",
"${workspaceRoot}/generators/packagePacker/index.js",
"-a=C:/cmf/repos/Product/IoMT/dependencies/IoTNodeAddons",
"-d",
"-o=."
],
"cwd": "C:/cmf/repos/Product/IoMT/src/driver-fileraw",
"outFiles": [],
"outputCapture": "std"
},
{
"type": "node",
"request": "launch",
"name": "Create Task Library",
"program": "${workspaceRoot}/node_modules/yo/lib/cli.js",
"args": [
"${workspaceRoot}/generators/tasksLibrary/index.js"
],
"cwd": "C:/cmf/repos/DS/BBraunBaseline/Features/Cmf.Custom.Baseline/Cmf.Custom.Baseline.IoT/Cmf.Custom.Baseline.IoT.Packages/src/",
"outFiles": [],
"outputCapture": "std",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
},
{
"type": "node",
"request": "launch",
"name": "Create Task",
"program": "${workspaceRoot}/node_modules/yo/lib/cli.js",
"args": [
"${workspaceRoot}/generators/task/index.js"
],
"cwd": "C:/cmf/repos/DS/BBraunBaseline/Features/Cmf.Custom.Baseline/Cmf.Custom.Baseline.IoT/Cmf.Custom.Baseline.IoT.Packages/src/controller-engine-custom-tasks",
"outFiles": [],
"outputCapture": "std",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
},
{
"type": "node",
"request": "launch",
"name": "Create Converter",
"program": "${workspaceRoot}/node_modules/yo/lib/cli.js",
"args": [
"${workspaceRoot}/generators/converter/index.js"
],
"cwd": "C:/cmf/repos/DS/BBraunBaseline/Features/Cmf.Custom.Baseline/Cmf.Custom.Baseline.IoT/Cmf.Custom.Baseline.IoT.Packages/src/controller-engine-custom-tasks",
"outFiles": [],
"outputCapture": "std",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
}
]
}
3 changes: 1 addition & 2 deletions generators/converter/templates/src/converter.converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ export class <%= className %>Converter implements Converter.ConverterInstance<<%

// >>TODO: Add converter code
this._logger.error("The code for the converter was not yet developed");
throw new Error(">>TODO: Not implemented yet")
throw new Error(">>TODO: Not implemented yet");

}

}
2 changes: 1 addition & 1 deletion generators/driver/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class DriverConfig extends ConnectIoTGenerator {
private values: any = {
directory: "driver-sample",
packageName: "@criticalmanufacturing/connect-iot-driver-sample",
packageVersion: "10.2.0",
packageVersion: "1.0.0",
identifier: "Sample",
identifierCamel: "",
hasCommands: true
Expand Down
13 changes: 5 additions & 8 deletions generators/driver/templates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
"description": "",
"main": "src/index.js",
"scripts": {
"build": "tsc",
"lint": "eslint ./**/*.ts",
"build": "tsc && tsc -p test/unit/",
"watchPackage": "tsc --preserveWatchOutput -w",
"watchTests": "tsc -p test/unit --preserveWatchOutput -w",
"start": "npm run build -- -w | node node_modules/nodemon/bin/nodemon src/index.js --ignore test/",
"test": "node node_modules/mocha/bin/mocha test/**/*.test.js test/*.test.js --timeout 30000 --exit",
"cover": "node node_modules/istanbul/lib/cli cover node_modules/mocha/bin/_mocha test/**/*.test.js test/*.test.js",
"vs:buildAndTest": "npm run build && npm run vs:test",
"vs:test": "node node_modules/istanbul/lib/cli cover node_modules/mocha/bin/_mocha --report cobertura --report lcov test/*.js test/**/*.js -- --timeout 30000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=./test/test-results.xml",
"test": "npx mocha test/**/*.test.js --timeout 5000 --exit",
"build:test:cover": "npm run build && npm run test:cover",
"test:cover": "npx nyc -r cobertura -r lcov -r text-summary mocha test/*.test.js test/**/*.test.js -- --timeout 10000 --exit -R mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json",
"pretest": "npm run build",
"watch": "npm run build -- -w | node node_modules/mocha/bin/mocha --timeout 30000 --exit --reporter min -w test/*.test.js test/**/*.test.js",
"watch": "npm run build -- -w | npx mocha --timeout 10000 --exit --reporter min -w test/*.test.js test/**/*.test.js",
"postinstall": "if exist node_modules\\vinyl-fs\\node_modules\\graceful-fs ren node_modules\\vinyl-fs\\node_modules\\graceful-fs _graceful-fs_incompatible_with_node12"
},
"keywords": [
Expand Down
26 changes: 12 additions & 14 deletions generators/packagePacker/models/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export interface Library {
/** List of scopes (separated by comma “,”) this library depends on to be available. Leave empty (default) for no dependency which means, available for all scopes */
dependsOnScope?: Scope[];

/** List of protocol drivers (separated by comma “,”) this library is mandatory and will be selected without option to unselect. Example: “@criticalmanufacturing/connect-iot-driver-oib”. Leave empty (default) for none */
/** List of protocol drivers (separated by comma “,”) this library is mandatory and will be selected without option to unselect. Example: “@criticalmanufacturing/connect-iot-driver-oib”. Leave empty (default) for none */
mandatoryForProtocol?: string[];

/** List of scopes (separated by comma “,”) this library is mandatory and will be selected without option to unselect. Leave empty (default) for none */
Expand Down Expand Up @@ -100,7 +100,7 @@ export interface LibraryConverterParameter {
/** Default value serialized */
defaultValue: any;
/** List of possible values when the dataType is Enum */
enumValues?: string[] | {[label: string]: any}[];
enumValues?: string[] | { [label: string]: any }[];
}

export interface LibraryTask {
Expand All @@ -112,8 +112,6 @@ export interface LibraryTask {
// class: string;
/* Name of the icon if it was loaded as a font in the gui */
iconClass?: string;
/** Data of the SVG to draw the icon in the button and task (will be ignored if an IconClass is set) */
iconSVG?: string;
/** Flag indicating if this ask is to be related with a protocol scope */
isProtocol: boolean;
/** Flag indicating if this task is to be related in a controller scope. Note: It is possible for a task to be usable in both Controller and Protocol scope (Code, EntityInstance, etc) */
Expand All @@ -126,11 +124,11 @@ export interface LibraryTask {
dependsOnProtocol?: string[];
/** List of scopes (separated by comma “,”) this task depends on to be available. Leave empty (default) for no dependency which means, available for all scopes */
dependsOnScope?: Scope[];
inputs?: {[key: string]: string | TaskInputType};
outputs?: {[key: string]: string | TaskOutputType};
settings?: {[key: string]: SettingsTab};


inputs?: { [key: string]: string | TaskInputType };
outputs?: { [key: string]: string | TaskOutputType };
settings?: { [key: string]: SettingsTab };
}

export const LibraryTaskDefaults: LibraryTask = {
Expand All @@ -141,7 +139,7 @@ export const LibraryTaskDefaults: LibraryTask = {
lifecycle: TaskLifeCycle.Productive,
lifecycleMessage: "",
dependsOnProtocol: [],
dependsOnScope: [ Scope.ConnectIoT, Scope.FactoryAutomation, Scope.EnterpriseIntegration ],
dependsOnScope: [Scope.ConnectIoT, Scope.FactoryAutomation, Scope.EnterpriseIntegration],
};

export interface TaskInputType {
Expand Down Expand Up @@ -175,16 +173,16 @@ export interface SettingsSection {
export interface SettingsSetting {
/** Name of the setting */
name: string;
/** Text to display in the Gui, defaults to Name if not defined */
/** Text to display in the Gui, defaults to Name if not defined */
displayName?: string;
/** Key of the settings where the value will be stored. Must be unique within the entire set of settings in the task */
settingKey: string;
/** Data type of the field (used to render) */
/** Data type of the field (used to render) */
dataType: string;
/** Flag indicating if this setting must be filled */
isMandatory?: boolean;
/** List of possible values when the Type is Enum */
enumValues?: string[] | {[label: string]: any}[];
enumValues?: string[] | { [label: string]: any }[];
/** Text to display in the hint box when hoovered */
infoMessage?: string;
/** Value to use as default */
Expand All @@ -194,5 +192,5 @@ export interface SettingsSetting {
timerType != null && timerType !== “CronJob” */
condition?: string;
/** Extra settings to use to model the behavior of the field. These settings are different per control to use */
settings?: any;
settings?: any;
}
Loading