Skip to content

W-21523376: feat: Add --lwc-language flag to project generate command#876

Merged
iowillhoit merged 11 commits intomainfrom
feat/typescript-project-generation
Mar 31, 2026
Merged

W-21523376: feat: Add --lwc-language flag to project generate command#876
iowillhoit merged 11 commits intomainfrom
feat/typescript-project-generation

Conversation

@shugo111
Copy link
Copy Markdown
Collaborator

@shugo111 shugo111 commented Mar 20, 2026

Summary

Enables TypeScript support in Salesforce CLI project generation - @W-21523376@

  • Add --lwc-language flag to sf template generate project command
  • Support for javascript and typescript language options
  • Integration with @salesforce/templates TypeScript templates
  • NUT tests for TypeScript project creation

Related Work Items

  • WI-004: Add --language flag to project generate command
  • WI-007: Implement project generator logic for TypeScript
  • WI-008: Add NUT tests for TypeScript project creation
  • WI-009: Update project generation documentation

Test Plan

  • sf template generate project --lwc-language typescript creates TS project
  • sf template generate project --lwc-language javascript creates JS project (default)
  • Invalid language values show helpful error messages
  • All NUT tests pass

Dependencies

Requires: forcedotcom/salesforcedx-templates#758

Note

⚠️ Snapshot files need to be updated for the new flag. This can be done by running the snapshot:compare command after merge or during review.

Epic

Epic 1: CLI - Project Generation (Part of TypeScript for LWC initiative)

@shugo111 shugo111 requested a review from a team as a code owner March 20, 2026 16:49
@salesforce-cla
Copy link
Copy Markdown

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.

@shugo111 shugo111 force-pushed the feat/typescript-project-generation branch from 71f802f to 428f387 Compare March 23, 2026 20:31
@shugo111 shugo111 changed the title feat: Add --lwc-language flag to project generate command W-21523376 feat: Add --lwc-language flag to project generate command Mar 24, 2026
@shugo111 shugo111 changed the title W-21523376 feat: Add --lwc-language flag to project generate command W-21523376: feat: Add --lwc-language flag to project generate command Mar 24, 2026
Comment thread messages/project.md Outdated
Comment thread src/commands/template/generate/project/index.ts
Comment thread src/commands/template/generate/project/index.ts Outdated
Shubham Goyal added 5 commits March 31, 2026 13:46
  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.
Add lwc-language flag to template:generate:project command snapshot
to resolve deprecation policy check failures.
@shugo111 shugo111 force-pushed the feat/typescript-project-generation branch from c0de0ba to 83e980d Compare March 31, 2026 08:59
Shubham Goyal added 4 commits March 31, 2026 14:50
- Clarify that TypeScript applies to LWC, not entire project
- Add explicit default: 'javascript' to lwc-language flag
Remove auto-generated command documentation bloat
- Remove dist/ folder references (architecture changed to erasableSyntaxOnly)
- Fix camelCase: defaultLWCLanguage -> defaultLwcLanguage
- Fix ESLint parser check: tsparser -> tseslint.parser
- Update test assertions to match actual generated files

Fixes 6 failing NUT tests in CI
…ly provided

The default flag value shouldn't add the field to sfdx-project.json.
Only add defaultLwcLanguage when user explicitly specifies --lwc-language.

Fixes failing NUT test: 'should create default project without TypeScript files when no flag specified'
Comment thread src/commands/template/generate/project/index.ts Outdated
Comment thread src/commands/template/generate/project/index.ts Outdated
Shubham Goyal and others added 2 commits April 1, 2026 00:35
Remove the default lwc-language value.
Set lwcLanguage only when users provide --lwc-language.

Made-with: Cursor
@iowillhoit iowillhoit merged commit 2ea6c99 into main Mar 31, 2026
15 checks passed
@iowillhoit iowillhoit deleted the feat/typescript-project-generation branch March 31, 2026 20:04
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.

5 participants