-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat: add preserveConfigExtension
option
#232
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { mkdir, rm } from 'node:fs/promises' | ||
import { join, normalize } from 'node:path' | ||
import glob from 'fast-glob' | ||
import micromatch from 'micromatch' | ||
import { mkdir, rm } from 'node:fs/promises' | ||
import { join, normalize } from 'node:path' | ||
import { reporter } from 'vfile-reporter' | ||
|
||
import { assets } from './assets' | ||
|
@@ -241,14 +241,20 @@ export interface Options { | |
* @default false | ||
*/ | ||
strict?: boolean | ||
/** | ||
* If true, preserves the extension of the `velite.config` file in the output `index.d.ts` file. | ||
* Useful if `"moduleResolution": "NodeNext"` where extension-less files aren't supported. | ||
* @default false | ||
*/ | ||
preserveConfigExtension?: boolean | ||
} | ||
|
||
/** | ||
* Build contents | ||
* @param options build options | ||
*/ | ||
export const build = async (options: Options = {}): Promise<Record<string, unknown>> => { | ||
const { config: configFile, clean, logLevel, strict } = options | ||
const { config: configFile, clean, logLevel, strict, preserveConfigExtension = false } = options | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Action Required: Add Tests for The
Recommendation: 🔗 Analysis chainLGTM: The changes correctly implement the new option in the build function and pass it to the To ensure the Please review the results of these checks to ensure the option is fully implemented and tested. Also applies to: 281-281 Action Required: Update and Re-run Verification Scripts The previous verification scripts failed because Please execute these updated scripts to continue the verification process. Action Required: Further Verification Needed for The recent verification did not locate any instances of Please run these scripts to gather additional information on the usage and implementation of the 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify the implementation of preserveConfigExtension option
# Test 1: Check if outputEntry function signature has been updated
echo "Test 1: Checking outputEntry function signature"
rg --type typescript "function outputEntry.*preserveConfigExtension" src
# Test 2: Verify preserveConfigExtension is used in the output generation logic
echo "Test 2: Checking usage of preserveConfigExtension in output generation"
rg --type typescript "preserveConfigExtension.*\.js[\"']?" src
# Test 3: Ensure tests have been updated or added for the new option
echo "Test 3: Checking for updated or new tests"
rg --type typescript "test.*preserveConfigExtension" test
Length of output: 655 Script: #!/bin/bash
# Description: Verify the implementation of preserveConfigExtension option with corrected file types
# Test 1: Check if outputEntry function signature has been updated
echo "Test 1: Checking outputEntry function signature"
rg --type ts "function outputEntry.*preserveConfigExtension" src
# Test 2: Verify preserveConfigExtension is used in the output generation logic
echo "Test 2: Checking usage of preserveConfigExtension in output generation"
rg --type ts "preserveConfigExtension.*\.js['\"]?" src
# Test 3: Ensure tests have been updated or added for the new option
echo "Test 3: Checking for updated or new tests"
rg --type ts "test.*preserveConfigExtension" test
Length of output: 526 Script: #!/bin/bash
# Description: Comprehensive search for 'preserveConfigExtension' usage across the entire codebase
echo "Test 1: Searching for 'preserveConfigExtension' in all files"
rg "preserveConfigExtension" .
echo "Test 2: Searching for 'preserveConfigExtension' in non-TypeScript files"
rg "preserveConfigExtension" --type-not ts
echo "Test 3: Searching for any references or related configurations"
rg "preserveConfigExtension" src || rg "preserveConfigExtension" test
Length of output: 1901 |
||
|
||
logLevel != null && logger.set(logLevel) | ||
|
||
|
@@ -272,7 +278,7 @@ export const build = async (options: Options = {}): Promise<Record<string, unkno | |
await mkdir(output.data, { recursive: true }) | ||
await mkdir(output.assets, { recursive: true }) | ||
|
||
await outputEntry(output.data, configPath, collections) | ||
await outputEntry(output.data, configPath, collections, preserveConfigExtension) | ||
|
||
logger.log('initialized', begin) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (documentation): Consider adding an explicit type annotation for consistency
Other options in this interface, like
logLevel
, have explicit type annotations. Adding: boolean
here would maintain consistency.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the semicolon makes it inconsistent with the rest of the interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your feedback, we will generate fewer comments like this in the future according to the following instructions: