chore: migrate remaining gulp build TS task to nx#33710
Open
GoodDayForSurf wants to merge 19 commits into
Open
chore: migrate remaining gulp build TS task to nx#33710GoodDayForSurf wants to merge 19 commits into
GoodDayForSurf wants to merge 19 commits into
Conversation
…m/DevExpress/DevExtreme into chore/migrate-devextreme-to-nx-TS
Contributor
There was a problem hiding this comment.
Pull request overview
This PR completes the migration of DevExtreme TypeScript declaration build/validation steps from the legacy gulp pipeline to Nx by introducing a dedicated check-declarations executor and wiring new Nx targets/scripts to replace gulp ts / gulp validate-ts behavior.
Changes:
- Added
devextreme-nx-infra-plugin:check-declarationsexecutor (modes:jquery,bundle,modules,public-modules) with Jest E2E coverage. - Updated
packages/devextremeNx targets and npm scripts to run declaration build + validation via Nx instead of gulp, and removed the old gulpts.jstask implementation. - Adjusted
dts-moduleslicense header application to exclude specific output subfolders.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/nx-infra-plugin/src/executors/dts-modules/dts-modules.impl.ts | Excludes bundles/, dist/, license/ from module license header stamping. |
| packages/nx-infra-plugin/src/executors/check-declarations/schema.ts | Adds TS schema typing for the new executor options. |
| packages/nx-infra-plugin/src/executors/check-declarations/schema.json | Adds Nx JSON schema for check-declarations executor configuration. |
| packages/nx-infra-plugin/src/executors/check-declarations/executor.ts | Registers executor entrypoint + re-exports helper functions. |
| packages/nx-infra-plugin/src/executors/check-declarations/executor.e2e.spec.ts | Adds Jest E2E tests for the new executor + content builders. |
| packages/nx-infra-plugin/src/executors/check-declarations/declaration-check-content.ts | Implements generated TS entry content for jquery and public-modules checks. |
| packages/nx-infra-plugin/src/executors/check-declarations/check-declarations.impl.ts | Implements the new declaration type-checking executor. |
| packages/nx-infra-plugin/executors.json | Registers the new check-declarations executor in the plugin catalog. |
| packages/nx-infra-plugin/AGENTS.md | Documents the new executor as a shared cross-executor concern. |
| packages/devextreme/project.json | Adds Nx targets (verify:*, validate:ts, build:declarations) to replace gulp TS tasks. |
| packages/devextreme/package.json | Switches validate-ts script to run the new Nx target. |
| packages/devextreme/gulpfile.js | Re-routes gulp ts to the Nx build:declarations target and removes gulp TS task import. |
| packages/devextreme/build/gulp/ts.js | Removes the legacy gulp implementation for TS declaration build/check tasks. |
| packages/devextreme/build/gulp/npm.js | Updates npm gulp pipeline to invoke Nx d.ts build steps and drops the old public-modules check from gulp. |
Comment on lines
+55
to
+74
| export function resolveTypeScript( | ||
| projectRoot: string, | ||
| typescriptModule?: string, | ||
| ): typeof import('typescript') { | ||
| const candidates = typescriptModule | ||
| ? [ | ||
| path.isAbsolute(typescriptModule) | ||
| ? typescriptModule | ||
| : path.resolve(projectRoot, typescriptModule), | ||
| ] | ||
| : [ | ||
| path.join(projectRoot, 'node_modules', 'typescript-min'), | ||
| path.join(projectRoot, 'node_modules', 'typescript'), | ||
| ]; | ||
|
|
||
| for (const candidate of candidates) { | ||
| try { | ||
| const resolved = fs.existsSync(path.join(candidate, 'package.json')) | ||
| ? candidate | ||
| : require.resolve(candidate, { paths: [projectRoot] }); |
Comment on lines
+814
to
+825
| "verify:ts-jquery": { | ||
| "executor": "devextreme-nx-infra-plugin:check-declarations", | ||
| "options": { | ||
| "mode": "jquery", | ||
| "typescriptModule": "typescript-min" | ||
| }, | ||
| "inputs": [ | ||
| "{projectRoot}/ts/dx.all.d.ts", | ||
| "{projectRoot}/ts/aliases.d.ts", | ||
| "{projectRoot}/build/gulp/modules_metadata.json" | ||
| ] | ||
| }, |
| }, | ||
| "tsBundleFile": { | ||
| "type": "string", | ||
| "description": "Source bundle .d.ts for jquery check (relative to project root)." |
Comment on lines
+796
to
+797
| "{projectRoot}/js/**/*.d.ts", | ||
| "{projectRoot}/build/gulp/modules_metadata.json" |
Comment on lines
+55
to
+68
| export function resolveTypeScript( | ||
| projectRoot: string, | ||
| typescriptModule?: string, | ||
| ): typeof import('typescript') { | ||
| const candidates = typescriptModule | ||
| ? [ | ||
| path.isAbsolute(typescriptModule) | ||
| ? typescriptModule | ||
| : path.resolve(projectRoot, typescriptModule), | ||
| ] | ||
| : [ | ||
| path.join(projectRoot, 'node_modules', 'typescript-min'), | ||
| path.join(projectRoot, 'node_modules', 'typescript'), | ||
| ]; |
Comment on lines
+71
to
+72
| gulp.task('ts', shell.task('pnpm nx run devextreme:build:declarations')); | ||
|
|
Comment on lines
836
to
857
| "build:declarations": { | ||
| "executor": "nx:run-commands", | ||
| "options": { | ||
| "command": "gulp ts", | ||
| "cwd": "{projectRoot}" | ||
| "commands": [ | ||
| "pnpm nx run devextreme:copy:ts-vendor", | ||
| "pnpm nx run devextreme:build:npm:dts-bundle", | ||
| "pnpm nx run devextreme:verify:ts-jquery", | ||
| "pnpm nx run devextreme:verify:ts-bundle" | ||
| ], | ||
| "parallel": false | ||
| }, | ||
| "inputs": [ | ||
| "{projectRoot}/ts/**/*.d.ts", | ||
| "{projectRoot}/build/gulp/ts.js" | ||
| "{projectRoot}/ts/vendor/**/*", | ||
| "{projectRoot}/build/gulp/modules_metadata.json", | ||
| "{projectRoot}/build/gulp/license-header.txt" | ||
| ], | ||
| "outputs": [ | ||
| "{projectRoot}/artifacts/ts" | ||
| "{projectRoot}/artifacts/ts", | ||
| "{projectRoot}/artifacts/ts/dx.all.d.ts", | ||
| "{projectRoot}/artifacts/npm/devextreme/bundles/dx.all.d.ts" | ||
| ] |
Comment on lines
+55
to
+82
| export function resolveTypeScript( | ||
| projectRoot: string, | ||
| typescriptModule?: string, | ||
| ): typeof import('typescript') { | ||
| const candidates = typescriptModule | ||
| ? [ | ||
| path.isAbsolute(typescriptModule) | ||
| ? typescriptModule | ||
| : path.resolve(projectRoot, typescriptModule), | ||
| ] | ||
| : [ | ||
| path.join(projectRoot, 'node_modules', 'typescript-min'), | ||
| path.join(projectRoot, 'node_modules', 'typescript'), | ||
| ]; | ||
|
|
||
| for (const candidate of candidates) { | ||
| try { | ||
| const resolved = fs.existsSync(path.join(candidate, 'package.json')) | ||
| ? candidate | ||
| : require.resolve(candidate, { paths: [projectRoot] }); | ||
| return require(resolved); | ||
| } catch { | ||
| // try next candidate | ||
| } | ||
| } | ||
|
|
||
| return require('typescript'); | ||
| } |
Comment on lines
+208
to
+223
| case 'jquery': { | ||
| const modules = await loadModulesMetadata(resolved.modulesMetadataPath); | ||
| const content = buildJqueryCheckContent(resolved.tsBundleFile, modules); | ||
| const entryPath = await writeCheckEntryFile( | ||
| path.join(projectRoot, resolved.entryOutputDir), | ||
| 'globals.ts', | ||
| content, | ||
| ); | ||
| await runTypeCheckWithTemporaryEntry(entryPath, () => | ||
| runDeclarationsTypeCheck({ | ||
| projectRoot, | ||
| rootNames: [entryPath], | ||
| typescriptModule: resolved.typescriptModule, | ||
| compilerOptions: resolved.extraCompilerOptions, | ||
| }), | ||
| ); |
| }); | ||
| }); | ||
|
|
||
| const PLUGIN_TYPESCRIPT = path.join(__dirname, '..', '..', '..', 'node_modules', 'typescript'); |
Comment on lines
+814
to
+825
| "verify:ts-jquery": { | ||
| "executor": "devextreme-nx-infra-plugin:check-declarations", | ||
| "options": { | ||
| "mode": "jquery", | ||
| "typescriptModule": "typescript-min" | ||
| }, | ||
| "inputs": [ | ||
| "{projectRoot}/ts/dx.all.d.ts", | ||
| "{projectRoot}/ts/aliases.d.ts", | ||
| "{projectRoot}/build/gulp/modules_metadata.json" | ||
| ] | ||
| }, |
fix path resolve
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.