Skip to content

feat: support for custom module name - #525

Merged
baptistegrimaud merged 1 commit into
mainfrom
ability-to-use-custom-name
Oct 8, 2025
Merged

baptistegrimaud merged 1 commit into
mainfrom
ability-to-use-custom-name

Conversation

@baptistegrimaud

@baptistegrimaud baptistegrimaud commented Oct 8, 2025 •

Copy link
Copy Markdown
Contributor

Description

Instead of using the name field of the package.json as the module name (Bundle-Name), support for a custom name under the jahia section.
The name field is restricted, see https://docs.npmjs.com/creating-a-package-json-file:

The "name" field contains your package's name and must be lowercase without any spaces. May contain hyphens, dots, and underscores.

When there is no such limitation on the custom Jahia one:

{
  "name": "my-module",
  ...
  "jahia": {
    "name": "Any name I want",
    ...
  }
}

NB: the symbolic name (Bundle-SymbolicName) remains based on the name field (for consistency with the Maven modules that use <artifactId>).

Tip

Documentation to guide the reviews: How to do a code review

@baptistegrimaud
baptistegrimaud force-pushed the ability-to-use-custom-name branch from 2e625cb to 64cdaaf Compare October 8, 2025 09:38
@baptistegrimaud
baptistegrimaud force-pushed the ability-to-use-custom-name branch from 64cdaaf to 5016f7a Compare October 8, 2025 09:40
@baptistegrimaud
baptistegrimaud marked this pull request as ready for review October 8, 2025 10:06
@baptistegrimaud
baptistegrimaud requested a review from a team as a code owner October 8, 2025 10:06
Copilot AI review requested due to automatic review settings October 8, 2025 10:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces support for custom module names in JavaScript modules by allowing developers to specify a name field in the jahia section of package.json, which will be used as the Bundle-Name instead of the restrictive npm package name.

Key changes:

  • Modified Java code to prioritize jahia.name over package name for Bundle-Name generation
  • Updated templates to include placeholder $MODULE in jahia.name field
  • Added test module example with custom name "JS Modules Engine Test Module"

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

File Description
JavascriptProtocolConnection.java Updated bundle name generation logic to use jahia.name when available
moduleTransformationTest.cy.ts Updated test expectations to reflect new custom module name format
package.json templates Added jahia.name field with $MODULE placeholder in all templates
jahia-test-module/package.json Added example custom name for testing purposes

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@baptistegrimaud
baptistegrimaud merged commit d974737 into main Oct 8, 2025
13 checks passed
@baptistegrimaud
baptistegrimaud deleted the ability-to-use-custom-name branch October 8, 2025 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants