W-21523405 feat: Add TypeScript component generation with intelligent defaulting#877
Open
W-21523405 feat: Add TypeScript component generation with intelligent defaulting#877
Conversation
|
Thanks for the contribution! Unfortunately we can't verify the commit author(s): Shubham Goyal <s***@s***.com>. One possible solution is to add that email to your GitHub account. Alternatively you can change your commits to another email and force push the change. After getting your commits associated with your GitHub account, refresh the status of this Pull Request. |
5 tasks
wjhsf
reviewed
Mar 25, 2026
shugo111
added a commit
that referenced
this pull request
Mar 26, 2026
Address PR #877 review comments: - Fix naming convention: defaultLWCLanguage → defaultLwcLanguage (aligns with Salesforce camelCase convention like sfdcLoginUrl, sourceApiVersion) - Update flag documentation: - Add "Default is 'javascript'" to summary - Remove dist/ folder references (in-place compilation) - Fix deployment strategy: deploy .js files, exclude .ts files - Update intelligent defaulting to use correct field name Files changed: - component.ts: Fixed defaultLwcLanguage references - messages/project.md: Updated flag summary and description - messages/lightning.md: Fixed field name reference - README.md: Updated all documentation (4 locations) - Test files: Updated assertions to use correct field name Related: @W-21523405@
W-21523318 - Added --lwc-language flag with options: javascript, typescript - Added concise flag documentation in messages/project.md - Flag is optional and backward compatible - Validation ensures only valid values accepted
@W-21523380@ Add comprehensive NUT test suite for TypeScript project functionality covering all acceptance criteria: tsconfig.json with outDir: "dist" configuration, TypeScript dependencies in package.json, ESLint config using single @typescript-eslint/parser for both .js and .ts files, proper .forceignore/.gitignore exclusions for dist/ folder, and sfdx-project.json defaultLWCLanguage field. Includes backward compatibility tests confirming JavaScript projects remain unaffected when --lwc-language javascript is specified or flag is omitted. All 179 tests passing.
@W-21523390@ Add comprehensive documentation for TypeScript project creation covering architecture and usage patterns. Updates include TypeScript project generation examples, detailed explanation of dist/ folder strategy for local compilation vs. server-side type stripping, and enhanced CLI help text with flag descriptions. New "TypeScript Support for Lightning Web Components" section explains dual-mode approach: local type validation with npm run build (compiles to dist/) and server deployment of raw .ts files. Includes complete workflow example from project creation through deployment.
@W-21523405@ Add TypeScript template option to lightning component generation command, allowing developers to generate LWC components with .ts files instead of .js files. Component template generates TypeScript syntax with proper LWC decorators and type annotations. Test files are generated as .test.ts in __tests__/ folder. Updated CLI to accept --template typeScript flag and added example to help text. TypeScript template was already present in salesforcedx-templates repository, this change exposes it through the CLI command options.
@W-21523414@ Implement automatic template selection for Lightning Web Component generation based on project's defaultLWCLanguage preference in sfdx-project.json. When --template flag is not specified, CLI automatically selects TypeScript template for projects with "defaultLWCLanguage": "typescript" and JavaScript template for "defaultLWCLanguage": "javascript". Explicit --template flag always overrides project preference. Updated help text to document automatic template selection behavior. Only applies to LWC components, not Aura components.
@W-21523425@ Add comprehensive NUT test coverage for TypeScript Lightning Web Component generation including explicit template flag usage, automatic template selection based on project preference, and template override behavior. Tests verify .ts and .test.ts file creation, absence of .js files in TypeScript components, proper class naming conventions, and intelligent defaulting logic. Five new test cases cover: explicit TypeScript template generation, automatic TypeScript selection in TypeScript projects, automatic JavaScript selection in JavaScript projects, explicit template override in TypeScript projects, and proper PascalCase/camelCase naming. All 162 NUT tests passing.
Add lwc-language flag to template:generate:project command snapshot to resolve deprecation policy check failures.
- Fix help text from 'Defaults to javascript' to 'If not specified, the project uses JavaScript' - Add intelligent defaulting for LWC components based on sfdx-project.json defaultLWCLanguage - Use this.argv to detect explicit --template flag instead of relying on flag defaults - Add test coverage for TypeScript component generation and invalid lwc-language values
Address PR #877 review comments: - Fix naming convention: defaultLWCLanguage → defaultLwcLanguage (aligns with Salesforce camelCase convention like sfdcLoginUrl, sourceApiVersion) - Update flag documentation: - Add "Default is 'javascript'" to summary - Remove dist/ folder references (in-place compilation) - Fix deployment strategy: deploy .js files, exclude .ts files - Update intelligent defaulting to use correct field name Files changed: - component.ts: Fixed defaultLwcLanguage references - messages/project.md: Updated flag summary and description - messages/lightning.md: Fixed field name reference - README.md: Updated all documentation (4 locations) - Test files: Updated assertions to use correct field name Related: @W-21523405@
0c59fca to
aad95cd
Compare
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.
Summary
Enables TypeScript component generation with intelligent language detection - @W-21523405@
sfdx-project.jsondefaultLWCLanguage--template typescriptflag for explicit TypeScript component creationRelated Work Items
--template typescriptflag to component generate commandTest Plan
.tsextension in TypeScript projects--template typescriptflag overrideDependencies
IMPORTANT: This PR is built on top of #876 and must be merged AFTER #876.
Base PRs:
Note
Epic
Epic 2: CLI - Component Generation (Part of TypeScript for LWC initiative)