npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@criticalmanufacturing/generator-iot

v10.2.12

Published

Connect IoT Scaffolding

Downloads

261

Readme

Connect IoT Yeoman Generator

Generator Versioning

Starting from 7.2.0, each combination of Critical Manufacturing MES version (Major + Minor) will have a dedicated generator to make it easier to keep compatibility.

For versions 7.2.0, 7.2.1, 7.2.2, ..., 7.2.*, use the tag 72x to install and update the generators npm i -g @criticalmanufacturing/generator-iot@72x

For versions 8.0.0, 8.0.1, 8.0.2, ..., 8.0.*, use the tag 80x to install and update the generators npm i -g @criticalmanufacturing/generator-iot@80x

Each version will have it's own dedicated branch

https://github.com/criticalmanufacturing/generator-iot/tree/72x

https://github.com/criticalmanufacturing/generator-iot/tree/80x ...

generator-iot is a set of scaffolding templates that enable CMF customization teams, partners and customers to easily start a new task, converter or protocol driver within Critical Manufacturing MES Equipment Integration module (Connect IoT).

Getting Started

Make sure Yeoman is also installed globally. If not:

npm i -g [email protected]

To start using this generator, it is advisable to have it installed globally (-g setting in NPM).

npm i -g @criticalmanufacturing/generator-iot@102x

Note Starting from 7.2.0, each combination of Critical Manufacturing MES version (Major + Minor) will have a dedicated generator to make it easier to keep compatibility.

For versions 7.2.0, 7.2.1, 7.2.2, ..., 7.2.*, use the tag 72x (npm i -g @criticalmanufacturing/generator-iot@72x)

For versions 8.0.0, 8.0.1, 8.0.2, ..., 8.0.*, use the tag 80x (npm i -g @criticalmanufacturing/generator-iot@80x)

Apps

To see at any time, the list of available apps, open a terminal window and run:

yo @criticalmanufacturing/iot

There are different types of questions that will be displayed interactively. Some will request for a simple text, others a confirmation (Yes or No), a selection of one option out of many or event a multiple choice.

For both multiple and single choice, use the cursor (Up/Down) to move between the choices and use the Space bar to select/unselect.

All questions are considered answered when the Enter key is pressed.

tasksLibrary

Use this app to create a new custom library package structure help you getting started. Of course, you still need to implement the tasks and converters (there are also apps to help you)

In a terminal window with the path where the entire package directory will be created, run:

yo @criticalmanufacturing/iot:tasksLibrary

Answer all questions and a new directory with the package skeleton will be available and ready for you to implement the tasks and/or converters.

task

To create a new task, make sure you have a terminal window open on the path of the root directory of the library package that will contain the new task (must be the same path where the package.json file is located), and run:

yo @criticalmanufacturing/iot:task

Answer all questions and the task will be created on the src/tasks directory of the package. The code generated is the skeleton on the task (base structure), so you have to implement the logic before it is usable.

converter

To create a new converter, make sure you have a terminal window open on the path of the root directory of the library package that will contain the new converter (must be the same path where the package.json file is located), and run:

yo @criticalmanufacturing/iot:converter

Answer all questions and the converter will be created on the src/converters directory of the package. The code generated is the skeleton on the converter (base structure), so you have to implement the logic before it is usable. -->

driver

The driver is the implementation of a protocol.

This app creates an entire new package with all the code necessary to be used by Connect IoT. Of course, you still need to implement the entire logic.

In a terminal window with the path where the entire package directory will be created, run:

yo @criticalmanufacturing/iot:driver

Answer all questions and a new directory with the protocol driver will be available and ready for you to implement the communication logic.

packagePacker

It is not desirable to have Internet services (NPM, GitHub, etc) as a dependency for the packages that would run on a production environment.

To bypass such dependency, we provide a tool that will pack all the package dependencies from a development environment into a ready-to-be-used package.

The steps this tool executes in background are somehow complicated, but, in a nutshell, it will statically analyze all the dependencies of the package and subsequent dependencies and merge everything into a single index.js file. Some other dependencies, like configurations, certificates, node addons (*.node) are also added into the resulting package, however, to keep everything in a clean state, some post-processing steps are needed and this tool supports them up to some extent.

In a terminal window run:

yo @criticalmanufacturing/iot:packagePacker --help

The following parameters can be supplied:

| Parameter | Type | Default | Description | | ------------- | --------- | ------------------------ | ------------------------------------------------------------ | | i, input | String | ${cwd} | Location of the package to pack (directory where the package.json is located) | | o, output | String | | (optional) When defined, it is the directory where the .tgz package file will be placed | | t, temp | String | ${cwd}\__TEMP__ | Temporary directory where the processed files will be placed | | c, config | String | ${cwd}\packConfig.json | Location where the file with the post-processing instructions is located | | a, addons | String | | Location where the binary addons (\*.node) are located. Required to prepare a package that is cross-platform, cross-architecture and supporting multiple Node versions.Note: Due to the complexity of this option, the usage is not described in this documentation and requires some support from our company | | d, debug | Boolean | false | Activate the debug mode. This mode will not delete the temporary directory allowing the user to properly define the post-processing directives | | v, version | String | | Flag that allows to override the version defined in the package.json into an user-defined value |

Configuration file structure

The configuration is a .json file that identifies the type of package and declare post-packing actions to perform to organize, clean and possibly, fix some issues with the result structure.

{
    "type": "<Package Type>",
    "postActions": [
        { "type": "<ActionType>", "parameter1": "value1", "parameter2": "value2", "...": "..." },
        { "type": "<ActionType>", "parameter1": "value1", "parameter2": "value2", "...": "..." }
    ]
}

Possible Package Types:

| Type | Description | | -------------- | ------------------------------------------------------------ | | TasksPackage | Represents a package used to contain Tasks and Converters. The result package will be ready for runtime (no internet dependencies) and for design-time (all .js, .html, .css, etc) required by the GUI but not required for the runtime. | | Component | Represents a package that is only used for runtime (driver, etc) |

Possible Post Actions:

| Structure | Description | Example | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | | DeleteFile(source) | Deletes the file source | { "type": "DeleteFile", "source": "${Temp}/completion.sh.hbs" } | | DeleteDirectory(source) | Deletes the directory source | { "type": "DeleteDirectory", "source": "${Temp}/locales" } | | CopyDirectory(source, destination) | Copies the entire directory structure from source into destination | { "type": "CopyDirectory", "source": "font", "destination": "${Temp}/font" } | | CopyFile(file, source, destination) | Copy the file file located in the directory source into the directory destination | { "type": "CopyFile", "source": "${Source}/certificates/default.pem", "destination": "${Temp}/examples" } | | MoveFile(file, source, destination) | Moves the file file located in the directory source into the directory destination | { "type": "MoveFile", "file": "client_selfsigned_cert_2048.pem", "source": "${Temp}", "destination": "${Temp}/certificates" }`` | | `ReplaceText`(`source`, `search`, `replace`, `isRegularExpression`) | In the file `source`, tried to find all occurrences of `search` and replaces them with `replace`. If `isRegularExpression` the search is expected to be a valid regular expression.<br />*Note: Make sure the `replaced` value is not captured again by the `search` value, otherwise, the process will enter into an infinite loop.* | { "type": "ReplaceText", "source": "${Temp}/index.js", "search":""client_selfsigned_cert_2048.pem"", "replace": ""/../certificates/client_selfsigned_cert_2048.pem"" }```{ "type": "ReplaceText", "source": "${Temp}/index.js", "search":"__webpack_require__\\(\\d*\\)\\('HID-hidraw.node'\\)", "replace": "require(__webpack_require__.ab + \"/../lib/hid-hidraw.node\")", "isRegularExpression": true } |

Some tokens can be used in the Post Actions to be replaced according to the environment/command line arguments:

| Token | Description | | ---------------- | --------------------------------------------- | | ${Source} | Source location (argument i, input) | | ${Destination} | Destination location (argument o, output) | | ${Temp} | Temporary location (argument t, temp) | | ${Addons} | Addons location (argument a, addons) |

Development tips

If you are extending this package, it is easier to have it linked locally. Run the following command from the root directory of the package: npm link

Version History

History is maintained in the Github page

https://github.com/criticalmanufacturing/generator-iot/releases