Conversation
There was a problem hiding this comment.
Pull request overview
This PR migrates the CLI codebase to native ESM, aligning TypeScript output and runtime behavior with modern Node.js module semantics.
Changes:
- Switch
src/index.tsfrom CommonJSrequireusage to ESMimport, including JSON import attributes and ESM-safe module resolution (createRequire). - Update
package.jsonto mark the package as ESM ("type": "module") and move type packages intodevDependencies. - Adjust
tsconfig.jsonto include Node.js ambient types.
Reviewed changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tsconfig.json | Adds Node ambient types to improve TS type checking for Node globals/APIs. |
| src/index.ts | Converts module loading to ESM imports and removes require usage in favor of ESM-compatible patterns. |
| package.json | Declares ESM package type and reorganizes @types/* dependencies under devDependencies. |
| package-lock.json | Mirrors dependency reclassification and adds the newly declared @types/* dev dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| console.log(); | ||
| console.log(`Installing template: ${pc.green(template)}`); | ||
|
|
||
| const requireFromRoot = createRequire(`${root}/package.json`); |
There was a problem hiding this comment.
createRequire is being called with a path built via string concatenation (${root}/package.json). Since root comes from path.resolve() and may contain platform-specific separators (notably on Windows), using path.join(root, "package.json") (or a file URL via pathToFileURL) would make this more robust and consistent with the other path handling in this function.
| const requireFromRoot = createRequire(`${root}/package.json`); | |
| const requireFromRoot = createRequire(path.join(root, "package.json")); |
No description provided.