Skip to content

feat(inspector): export current filters and settings as a config file#186

Merged
antfu merged 5 commits into
antfu:mainfrom
antfubot:large-weeks-send
Jul 24, 2026
Merged

feat(inspector): export current filters and settings as a config file#186
antfu merged 5 commits into
antfu:mainfrom
antfubot:large-weeks-send

Conversation

@antfubot

Copy link
Copy Markdown
Contributor

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.ts source 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

  • New panel/SettingsConfigDialog.vue — centered modal (styled to match the existing UiDrawer) with a code block, a Copy button (VueUse useClipboard), and a Download button (Blob + object URL, saved as node-modules-inspector.config.ts).
  • New utils/config.tsgenerateConfigFile() 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 under defaultFilters / defaultSettings. A small serializer produces clean, antfu-style output.
  • state/settings.ts — extracted the inline defaults into an exported SETTINGS_DEFAULT so 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.

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.
@pkg-pr-new

pkg-pr-new Bot commented Jul 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/node-modules-inspector@186
npm i https://pkg.pr.new/node-modules-tools@186

commit: ec57f86

antfu and others added 4 commits July 24, 2026 16:18
Preserve the existing config's other fields (name, publint, excludes) and
set defaultFilters/defaultSettings from the current UI state.
@antfu
antfu merged commit 60b76db into antfu:main Jul 24, 2026
6 of 9 checks passed
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.

2 participants