Skip to content

Conversation

@almeidx
Copy link
Member

@almeidx almeidx commented Nov 8, 2025

  • Adapted the TypeScript template for native ts support on Node.js
  • Added the templates to the pnpm-workspace on this repository, to ease dependency management
    • This means the templates had to have unique and valid names, so I had to refactor the logic on the package a bit
  • Removed tamasfe.even-better-toml from the recommended dependencies, because it seems completely random?
  • Added pnpm-lock.yaml to .prettierignore

Depends on:

@vercel
Copy link

vercel bot commented Nov 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
discord-js Skipped Skipped Dec 9, 2025 0:33am
discord-js-guide Skipped Skipped Dec 9, 2025 0:33am

@almeidx almeidx force-pushed the feat/use-node-typescript branch 2 times, most recently from 4b42f76 to c2baa37 Compare November 8, 2025 23:06
@almeidx almeidx marked this pull request as draft November 8, 2025 23:14
@almeidx almeidx force-pushed the feat/use-node-typescript branch from c2baa37 to 37799b4 Compare November 12, 2025 10:14
@almeidx almeidx marked this pull request as ready for review November 12, 2025 10:18
@almeidx almeidx force-pushed the feat/use-node-typescript branch from 37799b4 to 8a726ca Compare November 12, 2025 10:23
Copilot AI review requested due to automatic review settings December 8, 2025 21:14
@almeidx almeidx force-pushed the feat/use-node-typescript branch from 8a726ca to 056306a Compare December 8, 2025 21:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes the TypeScript templates to leverage Node.js's native TypeScript execution, eliminating the need for a build step. The templates are also integrated into the pnpm workspace for better dependency management, requiring unique package names. Additionally, an unrelated VS Code extension recommendation has been removed, and pnpm-lock.yaml is now excluded from Prettier formatting.

  • Removed TypeScript transpilation requirement by using .ts file extensions directly and Node.js native TS execution
  • Added template projects to pnpm workspace with unique scoped package names
  • Simplified template file processing logic by removing dynamic file extension replacement

Reviewed changes

Copilot reviewed 31 out of 32 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pnpm-workspace.yaml Added template subdirectories to workspace for unified dependency management
pnpm-lock.yaml Added dependencies for newly workspace-managed template projects
packages/create-discord-bot/template/TypeScript/tsconfig.json Configured for native TS with noEmit, allowImportingTsExtensions, and erasableSyntaxOnly
packages/create-discord-bot/template/TypeScript/src/**/*.ts Updated imports to use explicit .ts extensions for native TS support
packages/create-discord-bot/template/TypeScript/package.json Changed scripts to execute .ts files directly with node --env-file; updated name to scoped package
packages/create-discord-bot/template/TypeScript/eslint.config.js Removed dist from ignored paths since no build output is generated
packages/create-discord-bot/template/TypeScript/.vscode/settings.json Changed placeholder from [REPLACE_ME] to [REPLACE_PACKAGE_MANAGER] for clarity
packages/create-discord-bot/template/TypeScript/.vscode/extensions.json Removed random tamasfe.even-better-toml extension recommendation
packages/create-discord-bot/template/TypeScript/.prettierignore Changed from ignoring dist to pnpm-lock.yaml
packages/create-discord-bot/template/JavaScript/package.json Updated name to scoped package for workspace compatibility
packages/create-discord-bot/template/JavaScript/.vscode/settings.json Changed placeholder to [REPLACE_PACKAGE_MANAGER]
packages/create-discord-bot/template/JavaScript/.vscode/extensions.json Removed tamasfe.even-better-toml extension
packages/create-discord-bot/template/JavaScript/.prettierignore Added to ignore pnpm-lock.yaml
packages/create-discord-bot/template/Deno/.vscode/settings.json Replaced [REPLACE_BOOL] placeholder with actual true value
packages/create-discord-bot/template/Bun/TypeScript/tsconfig.json Configured for native TS support (though with suboptimal module settings for Bun)
packages/create-discord-bot/template/Bun/TypeScript/src/index.ts Added minimal placeholder file
packages/create-discord-bot/template/Bun/TypeScript/package.json Updated with scoped name and scripts for direct .ts execution
packages/create-discord-bot/template/Bun/TypeScript/eslint.config.js Added new ESLint flat config for Bun TypeScript projects
packages/create-discord-bot/template/Bun/JavaScript/src/index.js Added minimal placeholder file
packages/create-discord-bot/template/Bun/JavaScript/package.json Updated with scoped name and .js execution scripts
packages/create-discord-bot/template/Bun/JavaScript/eslint.config.js Added new ESLint flat config for Bun JavaScript projects
packages/create-discord-bot/src/util/constants.ts Removed obsolete NODE_PACKAGE_MANAGERS constant
packages/create-discord-bot/src/helpers/packageManager.ts Changed PackageManager type to derive from array; removed isNodePackageManager helper
packages/create-discord-bot/src/create-discord-bot.ts Simplified file processing by removing glob-based extension replacement and using direct regex replacements
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@almeidx
Copy link
Member Author

almeidx commented Dec 8, 2025

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Dec 8, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link

coderabbitai bot commented Dec 8, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Removed NODE_PACKAGE_MANAGERS and isNodePackageManager, derived PackageManager from PACKAGE_MANAGERS, simplified create-discord-bot file edits (direct read-and-replace), added Bun templates, concretized many template placeholders to .js/.ts/names, and switched loader index-file checks to use basename.

Changes

Cohort / File(s) Summary
Core logic
packages/create-discord-bot/src/create-discord-bot.ts, packages/create-discord-bot/src/helpers/packageManager.ts, packages/create-discord-bot/src/util/constants.ts
Removed glob-based batch updates; PackageManager type now derived from PACKAGE_MANAGERS; removed NODE_PACKAGE_MANAGERS and isNodePackageManager; simplified .vscode/settings.json and package.json edits to direct read-and-replace.
Workspace manifest
pnpm-workspace.yaml, package.json
Added workspace glob packages/create-discord-bot/template/**/* to include new templates.
Bun templates (new)
packages/create-discord-bot/template/Bun/...
packages/create-discord-bot/template/Bun/JavaScript/eslint.config.js, packages/create-discord-bot/template/Bun/JavaScript/package.json, packages/create-discord-bot/template/Bun/JavaScript/src/index.js, packages/create-discord-bot/template/Bun/TypeScript/eslint.config.js, packages/create-discord-bot/template/Bun/TypeScript/package.json, packages/create-discord-bot/template/Bun/TypeScript/src/index.ts, packages/create-discord-bot/template/Bun/TypeScript/tsconfig.json
Added Bun JS/TS templates: ESLint configs, package.json scripts using .js/.ts, minimal src files, and TypeScript tsconfig adjustments (allowImportingTsExtensions, noEmit/incremental changes).
JavaScript template edits
packages/create-discord-bot/template/JavaScript/package.json, packages/create-discord-bot/template/JavaScript/.vscode/settings.json, packages/create-discord-bot/template/JavaScript/.vscode/extensions.json, packages/create-discord-bot/template/JavaScript/.prettierignore
Set package name to @discordjs/template-javascript; replaced npm.packageManager placeholder with [REPLACE_PACKAGE_MANAGER]; removed tamasfe.even-better-toml recommendation; added pnpm-lock.yaml to .prettierignore.
TypeScript template edits
packages/create-discord-bot/template/TypeScript/...
packages/create-discord-bot/template/TypeScript/package.json, .../tsconfig.json, .../.prettierignore, .../.vscode/settings.json, .../.vscode/extensions.json, .../eslint.config.js, .../src/**
Set package name to @discordjs/template-typescript; replaced placeholder import extensions with explicit .ts; updated deploy/start scripts to use src/*.ts; adjusted tsconfig (allowImportingTsExtensions, noEmit/incremental, removed outDir); cleared ESLint ignores; replaced Prettier ignore from dist to pnpm-lock.yaml; removed toml recommendation.
Deno template edits
packages/create-discord-bot/template/Deno/.vscode/settings.json, packages/create-discord-bot/template/Deno/src/util/loaders.ts
Set deno.enable to true; changed loader skip check to use basename(file) === 'index.ts' for robustness.
Loader path checks (JS/TS/Deno)
packages/create-discord-bot/template/JavaScript/src/util/loaders.js, packages/create-discord-bot/template/TypeScript/src/util/loaders.ts, packages/create-discord-bot/template/Deno/src/util/loaders.ts
Use basename(file) instead of endsWith checks to detect and skip index.js/index.ts; narrowed glob patterns to explicit .ts where applicable; handle URL-based base paths.
Various template replacements
packages/create-discord-bot/template/*/package.json, packages/create-discord-bot/template/*/.vscode/settings.json, packages/create-discord-bot/template/*/.vscode/extensions.json, packages/create-discord-bot/template/*/.prettierignore
Replaced many placeholders ([REPLACE_ME], [REPLACE_IMPORT_EXT], [REPLACE_BOOL], npm.packageManager) with concrete names/extensions/values; removed a specific VSCode extension recommendation in multiple templates; updated Prettier ignores to include pnpm-lock.yaml.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify no remaining callers expect NODE_PACKAGE_MANAGERS or isNodePackageManager.
  • Confirm PackageManager derives the correct union from PACKAGE_MANAGERS and that imports/types compile.
  • Ensure all placeholder replacements were applied consistently across templates (extensions, names, booleans).
  • Review new Bun ESLint and tsconfig contents and template package scripts for correctness.
  • Check loader basename logic with URL/file path edge cases and glob patterns.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: use native node typescript' clearly relates to the main objective of adapting the TypeScript template for native TypeScript support on Node.js, which is the primary change in this changeset.
Description check ✅ Passed The description comprehensively covers the main changes: adapting TypeScript template for native ts support, adding templates to pnpm-workspace with name refactoring, removing an extension recommendation, and adding pnpm-lock.yaml to .prettierignore. It is fully related to the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/use-node-typescript

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (4)
packages/create-discord-bot/template/Bun/TypeScript/src/index.ts (1)

1-1: Placeholder file still lacks implementation.

This file contains only export {}; with no actual bot initialization code. As previously noted, this should either:

  1. Implement actual bot logic (similar to the Node.js TypeScript template)
  2. Include a comment explaining it's an intentional placeholder
  3. Be removed if not needed
packages/create-discord-bot/template/Bun/JavaScript/src/index.js (1)

1-1: Implement the bot entry point or provide meaningful placeholder.

This file serves as the main entry point for the Bun JavaScript template but contains only an empty console.log() statement. Users creating a bot from this template will receive a non-functional starting point with no guidance.

Consider either:

  1. Implementing actual bot initialization code (client setup, event handlers, etc.)
  2. Providing a meaningful placeholder with clear instructions: console.log('Bot starting...');
  3. Removing this template variant if it's not ready for release

Apply this diff as a minimal fix:

-console.log();
+console.log('Bun JavaScript template - implement your bot here');
packages/create-discord-bot/template/Bun/TypeScript/tsconfig.json (2)

9-10: Use Bundler module resolution for Bun runtime.

NodeNext module resolution is designed for Node.js. Bun has its own module resolution algorithm, and TypeScript's "Bundler" mode is specifically designed for bundlers and alternative runtimes like Bun. This mismatch may lead to incorrect type checking or module resolution issues.

Apply this diff:

-		"module": "NodeNext",
-		"moduleResolution": "NodeNext",
+		"module": "ESNext",
+		"moduleResolution": "Bundler",

5-8: Add erasableSyntaxOnly for native TypeScript execution.

The regular TypeScript template includes "erasableSyntaxOnly": true to ensure only type-erasable syntax is used when running TypeScript natively. This Bun TypeScript template should have the same option for consistency and to prevent runtime errors from non-erasable syntax.

Apply this diff:

 		"allowImportingTsExtensions": true,
+		"erasableSyntaxOnly": true,
 		"declaration": false,
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d0745af and 056306a.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (31)
  • packages/create-discord-bot/src/create-discord-bot.ts (2 hunks)
  • packages/create-discord-bot/src/helpers/packageManager.ts (1 hunks)
  • packages/create-discord-bot/src/util/constants.ts (0 hunks)
  • packages/create-discord-bot/template/Bun/JavaScript/eslint.config.js (1 hunks)
  • packages/create-discord-bot/template/Bun/JavaScript/package.json (1 hunks)
  • packages/create-discord-bot/template/Bun/JavaScript/src/index.js (1 hunks)
  • packages/create-discord-bot/template/Bun/TypeScript/eslint.config.js (1 hunks)
  • packages/create-discord-bot/template/Bun/TypeScript/package.json (1 hunks)
  • packages/create-discord-bot/template/Bun/TypeScript/src/index.ts (1 hunks)
  • packages/create-discord-bot/template/Bun/TypeScript/tsconfig.json (1 hunks)
  • packages/create-discord-bot/template/Deno/.vscode/settings.json (1 hunks)
  • packages/create-discord-bot/template/JavaScript/.prettierignore (1 hunks)
  • packages/create-discord-bot/template/JavaScript/.vscode/extensions.json (0 hunks)
  • packages/create-discord-bot/template/JavaScript/.vscode/settings.json (1 hunks)
  • packages/create-discord-bot/template/JavaScript/package.json (1 hunks)
  • packages/create-discord-bot/template/TypeScript/.prettierignore (1 hunks)
  • packages/create-discord-bot/template/TypeScript/.vscode/extensions.json (0 hunks)
  • packages/create-discord-bot/template/TypeScript/.vscode/settings.json (1 hunks)
  • packages/create-discord-bot/template/TypeScript/eslint.config.js (1 hunks)
  • packages/create-discord-bot/template/TypeScript/package.json (1 hunks)
  • packages/create-discord-bot/template/TypeScript/src/commands/index.ts (1 hunks)
  • packages/create-discord-bot/template/TypeScript/src/commands/ping.ts (1 hunks)
  • packages/create-discord-bot/template/TypeScript/src/commands/utility/user.ts (1 hunks)
  • packages/create-discord-bot/template/TypeScript/src/events/index.ts (1 hunks)
  • packages/create-discord-bot/template/TypeScript/src/events/interactionCreate.ts (1 hunks)
  • packages/create-discord-bot/template/TypeScript/src/events/ready.ts (1 hunks)
  • packages/create-discord-bot/template/TypeScript/src/index.ts (1 hunks)
  • packages/create-discord-bot/template/TypeScript/src/util/deploy.ts (1 hunks)
  • packages/create-discord-bot/template/TypeScript/src/util/loaders.ts (2 hunks)
  • packages/create-discord-bot/template/TypeScript/tsconfig.json (1 hunks)
  • pnpm-workspace.yaml (1 hunks)
💤 Files with no reviewable changes (3)
  • packages/create-discord-bot/template/JavaScript/.vscode/extensions.json
  • packages/create-discord-bot/src/util/constants.ts
  • packages/create-discord-bot/template/TypeScript/.vscode/extensions.json
🧰 Additional context used
🧬 Code graph analysis (4)
packages/create-discord-bot/template/Bun/JavaScript/eslint.config.js (2)
packages/create-discord-bot/template/Bun/TypeScript/eslint.config.js (1)
  • config (6-24)
packages/create-discord-bot/template/TypeScript/eslint.config.js (1)
  • config (6-24)
packages/create-discord-bot/template/TypeScript/src/util/loaders.ts (1)
packages/create-discord-bot/template/JavaScript/src/util/loaders.js (2)
  • basePath (37-37)
  • pattern (38-38)
packages/create-discord-bot/template/Bun/TypeScript/eslint.config.js (2)
packages/create-discord-bot/template/Bun/JavaScript/eslint.config.js (1)
  • config (5-19)
packages/create-discord-bot/template/TypeScript/eslint.config.js (1)
  • config (6-24)
packages/create-discord-bot/src/helpers/packageManager.ts (1)
packages/create-discord-bot/src/util/constants.ts (1)
  • PACKAGE_MANAGERS (14-14)
🔇 Additional comments (29)
packages/create-discord-bot/template/Deno/.vscode/settings.json (1)

11-11: ✓ Placeholder correctly replaced with concrete value.

The template placeholder [REPLACE_BOOL] is replaced with true, which appropriately enables Deno language support for this template variant. This aligns with the PR objective to remove placeholder configuration values across template files.

packages/create-discord-bot/template/JavaScript/.vscode/settings.json (1)

12-12: Clearer placeholder naming—looks good.

The change from [REPLACE_ME] to [REPLACE_PACKAGE_MANAGER] improves clarity on what this placeholder represents during template generation. The npm.packageManager VSCode setting applies universally across all package managers (npm, pnpm, yarn, bun), so this placeholder will be correctly replaced with the user's chosen package manager regardless of which one they select. This directly addresses the earlier concern about clarity.

packages/create-discord-bot/template/JavaScript/.prettierignore (1)

1-1: Aligns with PR objectives and follows best practices.

Excluding pnpm-lock.yaml from Prettier formatting is appropriate, as lock files should not be formatted by code formatters. This change is consistent with the TypeScript template's .prettierignore and follows standard practices.

pnpm-workspace.yaml (1)

4-4: Workspace pattern is correctly scoped.

The pattern packages/create-discord-bot/template/**/* appropriately includes all template subdirectories in the workspace, enabling proper dependency management as mentioned in the PR objectives. Using just **/* would incorrectly match the entire repository.

packages/create-discord-bot/template/TypeScript/.vscode/settings.json (1)

12-12: LGTM! Clearer placeholder naming.

The updated placeholder [REPLACE_PACKAGE_MANAGER] more clearly indicates what value should be substituted, improving the template's usability.

packages/create-discord-bot/template/TypeScript/src/commands/index.ts (1)

3-3: LGTM! Correct update for native TypeScript support.

The explicit .ts extension in the import path aligns with Node.js native TypeScript support and the allowImportingTsExtensions compiler option mentioned in the PR context.

packages/create-discord-bot/template/TypeScript/src/events/index.ts (1)

3-3: LGTM! Consistent with template-wide import updates.

The explicit .ts extension correctly supports native TypeScript module resolution, consistent with the changes across other template files.

packages/create-discord-bot/template/TypeScript/src/events/ready.ts (1)

2-2: LGTM! Import path correctly updated.

The explicit .ts extension aligns with native TypeScript support and is consistent with the import updates throughout the template.

packages/create-discord-bot/template/JavaScript/package.json (1)

3-3: LGTM! Necessary for workspace integration.

The scoped package name @discordjs/template-javascript is required for the templates to function properly within the pnpm workspace, as mentioned in the PR objectives. This aligns with the naming convention used across other templates in this PR.

packages/create-discord-bot/template/TypeScript/.prettierignore (1)

1-1: No action required - the change is correct.

The TypeScript template uses "noEmit": true in tsconfig.json, meaning TypeScript only performs type-checking without emitting any JavaScript output. No build artifacts are generated to dist/, so removing dist/* from the ignore list is appropriate. The build script runs tsc solely for validation, not compilation.

packages/create-discord-bot/template/TypeScript/eslint.config.js (1)

8-8: LGTM!

The empty ignores array is appropriate since native TypeScript execution eliminates the dist/ output directory.

packages/create-discord-bot/template/Bun/TypeScript/eslint.config.js (1)

1-26: LGTM!

The configuration is consistent with the TypeScript template's ESLint setup, which aids maintainability. The empty ignores array aligns with the no-transpilation approach.

packages/create-discord-bot/template/TypeScript/src/util/loaders.ts (1)

4-6: LGTM!

The explicit .ts extension imports align with the native TypeScript execution model configured in tsconfig.json.

packages/create-discord-bot/template/TypeScript/src/index.ts (1)

4-4: LGTM!

The explicit .ts extension import is consistent with the native TypeScript configuration and removes the need for placeholder-based file extension replacement.

packages/create-discord-bot/template/TypeScript/tsconfig.json (1)

4-14: Configuration correctly supports Node.js native TypeScript.

The tsconfig settings align with Node's --experimental-strip-types feature:

  • erasableSyntaxOnly (TS 5.8+) restricts syntax to only type constructs that can be stripped at runtime
  • allowImportingTsExtensions + noEmit enables .ts imports without transpilation
  • incremental: false and removal of outDir are appropriate since no compiled output is generated

Template uses TypeScript ~5.9.3, which fully supports all these options.

packages/create-discord-bot/template/TypeScript/src/events/interactionCreate.ts (1)

3-4: LGTM: Import paths updated for native TypeScript support.

The explicit .ts extensions in import paths correctly support native TypeScript execution in Node.js, replacing the previous placeholder-based approach.

packages/create-discord-bot/template/TypeScript/src/commands/utility/user.ts (1)

1-1: LGTM: Import path updated consistently.

The explicit .ts extension aligns with the native TypeScript support pattern applied across the template.

packages/create-discord-bot/template/TypeScript/src/util/deploy.ts (1)

5-5: LGTM: Import path updated for native TypeScript.

The explicit .ts extension is consistent with the native TypeScript support refactor.

packages/create-discord-bot/template/TypeScript/src/commands/ping.ts (1)

1-1: LGTM: Import path updated consistently.

The explicit .ts extension follows the established pattern for native TypeScript support.

packages/create-discord-bot/src/create-discord-bot.ts (2)

80-81: Simplified package.json mutation is correct.

The direct regex replacement for the package name is cleaner and more maintainable than the previous glob-based approach.


70-77: [rewritten comment]
[classification tag]

packages/create-discord-bot/template/Bun/JavaScript/eslint.config.js (1)

1-21: LGTM: ESLint configuration is appropriate for JavaScript template.

The configuration correctly combines common, node, and prettier presets without TypeScript-specific options. Disabling JSDoc rules is consistent with other templates in this repository.

packages/create-discord-bot/template/TypeScript/package.json (2)

3-3: Template package name looks consistent and workspace-friendly

Using "@discordjs/template-typescript" is clear, scoped, and should satisfy workspace uniqueness and publish constraints.


10-12: Scripts correctly target TypeScript entrypoints

Pointing deploy and start at src/**/*.ts aligns this template with the native TS setup and removes the previous dist/JS coupling. This should also simplify the mental model for users running the generated bot.

packages/create-discord-bot/src/helpers/packageManager.ts (1)

4-9: Good refactor: derive PackageManager from the shared tuple

Importing PACKAGE_MANAGERS as a type and defining PackageManager = (typeof PACKAGE_MANAGERS)[number] removes the manual string union and keeps the type automatically in sync with PACKAGE_MANAGERS in constants.ts. This reduces the risk of missing cases if new package managers are added.

packages/create-discord-bot/template/Bun/TypeScript/package.json (2)

3-3: Bun TypeScript template name is clear and consistent

"@discordjs/template-bun-typescript" matches the naming scheme of the other templates and clearly communicates the runtime + language combo.


8-11: Bun/TS scripts are wired correctly to .ts sources

The updated lint, deploy, format, and start scripts all target .ts files under src/, which matches the Bun/TypeScript template structure and the broader move to explicit TS entrypoints.

packages/create-discord-bot/template/Bun/JavaScript/package.json (2)

3-3: Bun JavaScript template name matches the new convention

"@discordjs/template-bun-javascript" is clear and consistent with the Bun/TypeScript and Node templates.


8-11: Bun/JS scripts correctly target .js files

Switching lint/format/deploy/start to use .js extensions and JS entrypoints under src/ brings this template in line with the new Bun/JavaScript layout and avoids the previous placeholder extension indirection.

@vercel vercel bot temporarily deployed to Preview – discord-js-guide December 8, 2025 23:46 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js December 8, 2025 23:46 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js-guide December 9, 2025 00:28 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js December 9, 2025 00:28 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js December 9, 2025 00:33 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js-guide December 9, 2025 00:33 Inactive
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 05f5428 and 38d5290.

📒 Files selected for processing (1)
  • packages/create-discord-bot/template/TypeScript/tsconfig.json (1 hunks)

"moduleResolution": "NodeNext",
"incremental": false,
"module": "ESNext",
"moduleResolution": "Bundler",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# Find and display the TypeScript template's package.json
fd -t f 'package\.json' packages/create-discord-bot/template/TypeScript | head -1 | xargs cat

Repository: discordjs/discord.js

Length of output: 890


🏁 Script executed:

# Also check if there's a tsconfig.json to see all settings in context
cat packages/create-discord-bot/template/TypeScript/tsconfig.json

Repository: discordjs/discord.js

Length of output: 484


🌐 Web query:

Node.js 22.12.0 native TypeScript support

💡 Result:

Short answer: Node.js v22.12.0 includes experimental TypeScript "run‑time" support, but it is not unconditional native execution — you must enable it with CLI flags. Use --experimental-strip-types to strip erasable TS types, or --experimental-transform-types to also transform TypeScript-only syntax (enums/namespaces). The feature is experimental and has limitations (no tsconfig handling, requires explicit extensions, limited syntax support, disabled in node_modules by default). [1][2][3]

How to run (examples)

  • node --experimental-strip-types ./index.ts (type annotations stripped at runtime). [2][3]
  • node --experimental-transform-types ./index.ts (transforms TS-only syntax; experimental). [3]

Sources

  • Node.js v22.12.0 release notes. [1]
  • Node.js v22.6.0 notes (introducing --experimental-strip-types). [2]
  • Red Hat / Node.js 22 release notes summarizing strip/transform flags and limitations. [3]

🏁 Script executed:

# Check if there's a loader configuration or setup file that might handle TypeScript
fd -t f -e 'mjs|cjs|json' packages/create-discord-bot/template/TypeScript --max-depth 1

Repository: discordjs/discord.js

Length of output: 557


🏁 Script executed:

# Check if there are any other files that might indicate how TS is supposed to run
fd . packages/create-discord-bot/template/TypeScript --type f

Repository: discordjs/discord.js

Length of output: 948


🏁 Script executed:

# Look for any mention of experimental-strip-types or tsx in the entire template directory or build setup
rg -i "experimental-strip-types|tsx|ts-node" packages/create-discord-bot/template/TypeScript/

Repository: discordjs/discord.js

Length of output: 202


🏁 Script executed:

# Check the git log for this file to see if there's recent context
cd packages/create-discord-bot/template/TypeScript && git log --oneline -10 tsconfig.json 2>/dev/null || echo "No git history available"

Repository: discordjs/discord.js

Length of output: 129


🏁 Script executed:

# Check if there's a README or documentation that explains how to use the template
fd -t f 'README|readme|SETUP|setup' packages/create-discord-bot/template/TypeScript/

Repository: discordjs/discord.js

Length of output: 46


🏁 Script executed:

# Check actual imports in the source files to see if .ts extensions are used
head -20 packages/create-discord-bot/template/TypeScript/src/index.ts
head -20 packages/create-discord-bot/template/TypeScript/src/util/loaders.ts

Repository: discordjs/discord.js

Length of output: 1490


Change moduleResolution: "Bundler" to "node" or "nodeNext".

The "Bundler" strategy is for bundlers (esbuild, webpack, Vite), not Node.js module resolution. Since this template uses Node.js 22.12.0's experimental TypeScript support (indicated by erasableSyntaxOnly: true, allowImportingTsExtensions: true, and .ts extension imports), use "node" or "nodeNext" instead.

Additionally, the scripts in package.json need the --experimental-strip-types flag to execute .ts files:

"start": "node --experimental-strip-types --env-file=.env src/index.ts",
"deploy": "node --experimental-strip-types --env-file=.env src/util/deploy.ts"

Without this flag, the template will not work as-is.

🤖 Prompt for AI Agents
In packages/create-discord-bot/template/TypeScript/tsconfig.json around line 11,
moduleResolution is set to "Bundler" which is incorrect for Node.js runtime;
change it to "node" or "nodeNext" to match Node 22.12+ experimental TypeScript
behavior, and update package.json start/deploy scripts to include the Node flag
--experimental-strip-types (e.g., node --experimental-strip-types
--env-file=.env src/index.ts and node --experimental-strip-types --env-file=.env
src/util/deploy.ts) so .ts files run correctly.

@iCrawl iCrawl merged commit ec3ef7b into main Dec 9, 2025
9 checks passed
@iCrawl iCrawl deleted the feat/use-node-typescript branch December 9, 2025 02:22
@github-project-automation github-project-automation bot moved this from Todo to Done in discord.js Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants