Hybrid to Light Module plugin
A plugin for Magnolia CLI to convert hybrid light modules to light modules that can be modified on the file system.
| Package name | 
 | 
| Repository link | |
| Latest version | |
| Changelog link | 
Installing
The plugin doesn’t come pre-installed with Magnolia CLI.
You must add it to the mgnl.config.js project file.
| The plugin is installed automatically by the Jumpstart plugin if it is defined in a project template. | 
With add-plugin
Run the following command in the project folder.
npm run mgnl -- add-plugin @magnolia/cli-hybrid-to-lm-plugin| Windows users using PowerShell must enclose the two consecutive hyphens (  | 
The command automatically downloads, installs, and registers the plugin in mgnl.config.js.
To confirm that the plugin has been successfully installed, run:
npm run mgnl -- hybrid-to-lm --helpManually
- 
Run the following command in the project folder. npm install @magnolia/cli-hybrid-to-lm-plugin
- 
Modify the mgnl.config.jsfile accordingly.import HybridToLmPlugin from "@magnolia/cli-hybrid-to-lm-plugin"; export default { plugins: [ new HybridToLmPlugin() ] };
- 
To confirm that the plugin has been successfully installed, run: npm run mgnl -- hybrid-to-lm --help
Usage
Options
| Form (short and long) | Description | 
|---|---|
| 
 
 | Specify the JAR module to extract light modules from. | 
| 
 
 | Specify the light modules to extract from the JAR. Multiple  | 
| 
 
 | Path to a JSON configuration file containing JAR modules and light modules mapping. | 
| 
 
 | Displays the version. | 
| 
 
 | Displays help information. | 
Configurable Properties in mgnl.config.js
Examples
In the following examples, assume that the mgnl.config.js file looks like this:
import HybridToLmPlugin from "@magnolia/cli-hybrid-to-lm-plugin";
export default {
  plugins: [
    new HybridToLmPlugin({
      jarModules: {
        'magnolia-password-manager-app': ['password-manager-app'],
        'magnolia-dam-app': ['dam-app-core'],
        'magnolia-graphql-core': ['graphql-core']
      },
      configPath: 'path/to/config.json'
    })
  ]
};For more information, see Configuring plugins.
Extract a specific light module from a JAR
npm run mgnl -- hybrid-to-lm -j magnolia-dam-app -l dam-app-core| Windows users using PowerShell must enclose the two consecutive hyphens (  | 
This command extracts the 'dam-app-core' module from the 'magnolia-dam-app' JAR file.
Extract multiple light modules from a JAR
npm run mgnl -- hybrid-to-lm -j magnolia-graphql-core -l graphql-core graphql-appThis command extracts both 'graphql-core' and 'graphql-app' modules from the 'magnolia-graphql-core' JAR file.
Use a configuration file
npm run mgnl -- hybrid-to-lm -p /path/to/my-config.jsonThis command uses a configuration file to extract multiple modules from multiple JARs. Example configuration file:
{
  "jarModules": {
    "magnolia-password-manager-app": ["password-manager-app"],
    "magnolia-dam-app": ["dam-app-core"],
    "magnolia-graphql-core": ["graphql-core"]
  }
}The -p can also be a remote resource via a URL:
npm run mgnl -- hybrid-to-lm -p https://example.com/my-config.jsonHandling Existing Light Modules
When a light module already exists, the plugin will prompt you to confirm if you want to overwrite it:
Light module 'password-manager-app' already exists at /path/to/light-modules/password-manager-app. Do you want to overwrite it? (y/N)You can choose to overwrite the existing module or skip it.