@wincc-oa/create-ts-manager
v1.0.0
Published
Scaffolding tool for WinCC OA TypeScript managers
Maintainers
Readme
@wincc-oa/create-ts-manager
Scaffolding tool for creating TypeScript-based WinCC OA JavaScript managers.
Usage
Run from within a WinCC OA project directory tree:
npx @wincc-oa/create-ts-manager <managerName>This will:
- Create a directory
<managerName>in the current directory - Initialize a TypeScript project from WinCC OA template
- Locate the WinCC OA installation from the project's
config/configfile - Add
@types/winccoa-manageras a dev dependency - Run
npm install(unless--skip-installis passed)
Options
- Explicit name:
npx @wincc-oa/create-ts-manager my-manager— createsmy-manager/injavascript/ - Current directory:
npx @wincc-oa/create-ts-manager .— initializes the current directory (must be a subdirectory ofjavascript/) - Interactive:
npx @wincc-oa/create-ts-manager— prompts for a name - Skip install:
npx @wincc-oa/create-ts-manager my-manager --skip-install— skipsnpm installafter scaffolding
Important: run in the main project
This tool must be run from within a WinCC OA project that contains a
config/configfile, because it reads that file to locate the WinCC OA installation path. It will not work when run inside a sub-project, since sub-projects do not have their ownconfig/config.If you need the manager in a sub-project, run the scaffolding in the main project first and move the created directory to the sub-project afterwards.
Project structure
The scaffolded project has the following structure:
<managerName>/
src/
manager.ts TypeScript source code
dist/ Compiled JavaScript (created by tsc)
start.js Entry point for WinCC OA Console
package.json
tsconfig.json
eslint.config.mjs
.prettierrc
.gitignoreGetting started
After scaffolding:
cd <new manager directory>
npm run build # compile TypeScriptor
cd <new manager directory>
npm run watch # compile TypeScript in watch modeIn the WinCC OA Console, add a JavaScript Manager with command line:
<managerName>/start.jsSet start mode to manual and start the manager. Check the Log Viewer for the message "JavaScript Manager working".
Requirements
- Node.js >= 20
- Must be run from within a WinCC OA project directory tree (a directory that has a
config/configfile in its ancestry) - The WinCC OA installation must have the Environment for JavaScript installed (provides
winccoa-managerand@types/winccoa-manager)
