feat(inspector): export current filters and settings as a config file#186
Merged
Conversation
Add a "Save as config file" button to the settings panel that opens a dialog with the generated node-modules-inspector.config.ts source for the current filters and settings, with copy and download actions.
commit: |
Preserve the existing config's other fields (name, publint, excludes) and set defaultFilters/defaultSettings from the current UI state.
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
Adds a Save as config file button at the end of the settings panel. It opens a dialog showing the generated
node-modules-inspector.config.tssource that captures the current filters and settings as defaults, with Copy and Download actions.This lets users persist a view they've configured in the UI (excludes, module filters, badge/display settings, etc.) into a project config file so it becomes the default on the next run.
Details
panel/SettingsConfigDialog.vue— centered modal (styled to match the existingUiDrawer) with a code block, a Copy button (VueUseuseClipboard), and a Download button (Blob + object URL, saved asnode-modules-inspector.config.ts).utils/config.ts—generateConfigFile()diffs the current filters/settings against the hard schema defaults so the exported config reproduces the current view exactly regardless of any existing config file. Transient navigation state (search,focus,why,compareA,compareB) is omitted, and only non-default keys are emitted underdefaultFilters/defaultSettings. A small serializer produces clean, antfu-style output.state/settings.ts— extracted the inline defaults into an exportedSETTINGS_DEFAULTso they can be diffed against.Example output:
```ts
import { defineConfig } from 'node-modules-inspector'
export default defineConfig({
defaultFilters: {
excludes: [
'webpack',
],
},
defaultSettings: {
moduleTypeSimple: true,
},
})
```
Lint and typecheck pass.
This PR was created with the help of an agent.