License: Add new licensing mechanism#33206
License: Add new licensing mechanism#33206ajivanyandev wants to merge 50 commits intoDevExpress:26_1from
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new DevExtreme licensing mechanism, adding a devextreme-license CLI and bundler plugin support to inject a generated license key into DevExtreme’s internal config during builds. It also adds a new LCP (product-only) key validation path and updates license warning/reporting behavior.
Changes:
- Add
devextreme-licenseCLI + supporting Node-side license key discovery/conversion utilities (LCX → LCP). - Add an
unplugin-based bundler plugin to replace a license-key placeholder inm_configat build time. - Add LCP key parsing/validation logic (product-kind bit flags, expiration checks) and update license warnings/tests.
Reviewed changes
Copilot reviewed 26 out of 28 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Locks unplugin@3.0.0 and related dependency snapshot updates. |
| packages/devextreme/package.json | Adds unplugin dependency and registers devextreme-license as an npm binary. |
| packages/devextreme/license/messages.js | Adds CLI/plugin message templates for licensing guidance. |
| packages/devextreme/license/dx-lcx-2-lcp.js | Implements LCX → LCP conversion + LCP parsing helpers (Node-side). |
| packages/devextreme/license/dx-get-lcx.js | Adds environment/file-based LCX key discovery logic (Node-side). |
| packages/devextreme/license/devextreme-license.js | Adds devextreme-license CLI for generating/printing an LCP key and updating .gitignore. |
| packages/devextreme/license/devextreme-license-plugin.js | Adds unplugin plugin to patch m_config license placeholder during bundling. |
| packages/devextreme/license/devextreme-license-plugin.d.ts | Type declaration for the bundler plugin export. |
| packages/devextreme/js/__internal/core/m_config.ts | Adds licenseKey default placeholder in global config. |
| packages/devextreme/js/__internal/core/license/types.ts | Extends token/error types and adds exported error token constants + warning metadata types. |
| packages/devextreme/js/__internal/core/license/rsa_bigint.ts | Refactors RSA bigint helpers to reuse bigIntFromBytes. |
| packages/devextreme/js/__internal/core/license/license_warnings.ts | Adds centralized console warning templates + logger for license warning types. |
| packages/devextreme/js/__internal/core/license/license_validation.ts | Switches parsing to LCP validation path and changes warning/logging behavior. |
| packages/devextreme/js/__internal/core/license/license_validation.test.ts | Updates tests to assert new warning behavior and adds placeholder coverage. |
| packages/devextreme/js/__internal/core/license/lcp_key_validation/utils.ts | Adds shared helpers for LCP parsing (RSA XML parsing, bit flags, tick conversion, signature verify). |
| packages/devextreme/js/__internal/core/license/lcp_key_validation/types.ts | Defines product-kind bit flags for DevExpress products. |
| packages/devextreme/js/__internal/core/license/lcp_key_validation/product_info.ts | Adds product info model helpers and bitwise product checks. |
| packages/devextreme/js/__internal/core/license/lcp_key_validation/license_payload.test.ts | Adds payload-level tests for product-kind / version behavior. |
| packages/devextreme/js/__internal/core/license/lcp_key_validation/license_info.ts | Adds license info helpers (validity, expiration, latest DevExtreme version). |
| packages/devextreme/js/__internal/core/license/lcp_key_validation/lcp_key_validator.ts | Implements LCP parsing/verification into internal Token representation. |
| packages/devextreme/js/__internal/core/license/lcp_key_validation/lcp_key_validation.test.ts | Adds LCP validator tests (including signature bypass harness). |
| packages/devextreme/js/__internal/core/license/lcp_key_validation/const.ts | Adds LCP constants (signature prefix, decode map, RSA key XML). |
| packages/devextreme/js/__internal/core/license/key.ts | Removes internal-usage ID constant (legacy/internal token behavior). |
| packages/devextreme/js/__internal/core/license/const.ts | Consolidates licensing constants (links, placeholder, formatting values). |
| packages/devextreme/js/__internal/core/license/byte_utils.ts | Adds bigIntFromBytes utility function. |
| packages/devextreme/eslint.config.mjs | Adds license/* to ignore list. |
| packages/devextreme/build/npm-bin/devextreme-license.js | Adds npm bin wrapper to execute the CLI from the distributed package. |
| packages/devextreme/build/gulp/npm.js | Ensures license/** is copied into the npm distribution. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
packages/devextreme/js/__internal/core/license/license_validation.ts
Outdated
Show resolved
Hide resolved
packages/devextreme/js/__internal/core/license/lcp_key_validation/lcp_key_validation.test.ts
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Arman Jivanyan <arman.jivanyan@devexpress.com>
|
|
||
| function fail(msg) { | ||
| process.stderr.write(msg.endsWith('\n') ? msg : msg + '\n'); | ||
| process.exit(0); |
There was a problem hiding this comment.
fail() exits with status code 0 even for fatal CLI errors (unknown args, refusing to overwrite existing output file, etc.). This makes scripts/CI treat failures as success and can leave a stale or missing license key output unnoticed. Please exit with a non-zero code (e.g., 1) for error conditions, and keep 0 only for successful runs.
| process.exit(0); | |
| process.exit(1); |
| else if(a === '--force') out.force = true; | ||
| else if(a === '--cwd') { | ||
| const next = args[i + 1]; | ||
| if(!next || next.startsWith('-')) { |
There was a problem hiding this comment.
--cwd parsing will consume the next argument even if it's another flag (e.g., --cwd --force results in cwd='--force'). Consider mirroring the --out handling: validate that a path argument exists and doesn’t start with -, otherwise warn or fail.
There was a problem hiding this comment.
@copilot apply changes based on this feedback
No description provided.