-
Notifications
You must be signed in to change notification settings - Fork 667
chore(devextreme): migrate build:vectormap target to nx executors
#33368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
chaosmirage
wants to merge
9
commits into
26_1
Choose a base branch
from
chore/migrate-devextreme-to-nx-part-7
base: 26_1
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
56a8383
feat(nx-infra-plugin): add vectormap build executor
chaosmirage 41f39c1
feat(nx-infra-plugin): add compress executor for minify/beautify
chaosmirage a8c483a
chore(devextreme): migrate `build:vectormap` target to nx executors
chaosmirage b2f422c
chore(devextreme): use the `build:vectormap` target in `all:build` wo…
chaosmirage fa1cc1b
docs: update copilot instructions
chaosmirage e6e34ae
fix(nx-infra-plugin): address PR review comments
chaosmirage 4dee522
feat(nx-infra-plugin): add strip-only mode
chaosmirage 6502e7d
chore: align with PR #33364
chaosmirage d66ee19
chore: address remaining PR review feedback
chaosmirage File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
104 changes: 104 additions & 0 deletions
104
packages/nx-infra-plugin/src/executors/compress/executor.e2e.spec.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| import * as fs from 'fs'; | ||
| import * as path from 'path'; | ||
| import executor from './executor'; | ||
| import { CompressExecutorSchema } from './schema'; | ||
| import { createTempDir, cleanupTempDir, createMockContext } from '../../utils/test-utils'; | ||
| import { writeFileText, readFileText } from '../../utils'; | ||
|
|
||
| const LICENSE_HEADER = `/*! | ||
| * DevExtreme (test.js) | ||
| * Version: 99.0.0 | ||
| */ | ||
| `; | ||
|
|
||
| const SAMPLE_CODE = `${LICENSE_HEADER}"use strict"; | ||
|
|
||
| function hello(name) { | ||
| //#DEBUG | ||
| console.log("debug only"); | ||
| //#ENDDEBUG | ||
| var unused = 42; | ||
| return "Hello, " + name; | ||
| } | ||
|
|
||
| exports.hello = hello; | ||
| `; | ||
|
|
||
| describe('CompressExecutor E2E', () => { | ||
| let tempDir: string; | ||
| let context = createMockContext(); | ||
| let projectDir: string; | ||
|
|
||
| beforeEach(async () => { | ||
| tempDir = createTempDir('nx-compress-e2e-'); | ||
| context = createMockContext({ root: tempDir }); | ||
| projectDir = path.join(tempDir, 'packages', 'test-lib'); | ||
| fs.mkdirSync(projectDir, { recursive: true }); | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| cleanupTempDir(tempDir); | ||
| }); | ||
|
|
||
| it('should minify and strip debug blocks', async () => { | ||
| const filePath = path.join(projectDir, 'test.js'); | ||
| await writeFileText(filePath, SAMPLE_CODE); | ||
|
|
||
| const options: CompressExecutorSchema = { | ||
| files: ['./test.js'], | ||
| mode: 'minify', | ||
| removeDebug: true, | ||
| }; | ||
|
|
||
| const result = await executor(options, context); | ||
| expect(result.success).toBe(true); | ||
|
|
||
| const output = await readFileText(filePath); | ||
|
|
||
| expect(output).toContain('/*!'); | ||
| expect(output).toContain('DevExtreme'); | ||
|
|
||
| expect(output).not.toContain('debug only'); | ||
| expect(output).not.toContain('#DEBUG'); | ||
|
|
||
| expect(output.length).toBeLessThan(SAMPLE_CODE.length); | ||
| }); | ||
|
|
||
| it('should minify but keep debug blocks', async () => { | ||
| const filePath = path.join(projectDir, 'test.js'); | ||
| await writeFileText(filePath, SAMPLE_CODE); | ||
|
|
||
| const options: CompressExecutorSchema = { | ||
| files: ['./test.js'], | ||
| mode: 'minify', | ||
| }; | ||
|
|
||
| const result = await executor(options, context); | ||
| expect(result.success).toBe(true); | ||
|
|
||
| const output = await readFileText(filePath); | ||
|
|
||
| expect(output).toContain('debug only'); | ||
| }); | ||
|
|
||
| it('should beautify with selective compression and preserve license comments', async () => { | ||
| const filePath = path.join(projectDir, 'test.js'); | ||
| await writeFileText(filePath, SAMPLE_CODE); | ||
|
|
||
| const options: CompressExecutorSchema = { | ||
| files: ['./test.js'], | ||
| mode: 'beautify', | ||
| }; | ||
|
|
||
| const result = await executor(options, context); | ||
| expect(result.success).toBe(true); | ||
|
|
||
| const output = await readFileText(filePath); | ||
|
|
||
| expect(output).toContain('/*!'); | ||
|
|
||
| expect(output.split('\n').length).toBeGreaterThan(5); | ||
|
|
||
| expect(output).not.toContain('unused'); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.