Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/better-melons-win.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@stephansama/auto-readme": patch
"create-stephansama-example": patch
"@stephansama/eslint-config": patch
---

updated auto readme default heading implementation
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,33 @@ All packages are packaged underneath the `@stephansama` scope (for example: `@st

### 🏭 workspace

| 🏷️ Name | Version | 📥 Downloads | 📝 Description |
| ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| [ai-commit-msg](core/ai-commit-msg/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Fai-commit-msg?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/ai-commit-msg?labelColor=211F1F) | generate commit messages using ai |
| [alfred-kaomoji](core/alfred-kaomoji/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Falfred-kaomoji?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/alfred-kaomoji?labelColor=211F1F) | Alfred Kaomoji Picker |
| [astro-iconify-svgmap](core/astro-iconify-svgmap/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Fastro-iconify-svgmap?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/astro-iconify-svgmap?labelColor=211F1F) | Astro integration for generating iconify svgmaps for ssg sites |
| [auto-readme](core/auto-readme/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Fauto-readme?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/auto-readme?labelColor=211F1F) | Generate lists and tables for your README automagically based on your repository and comments |
| [catppuccin-jsonresume-theme](core/catppuccin-jsonresume-theme/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Fcatppuccin-jsonresume-theme?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/catppuccin-jsonresume-theme?labelColor=211F1F) | theme for resume cli website |
| [catppuccin-opml](core/catppuccin-opml/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Fcatppuccin-opml?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/catppuccin-opml?labelColor=211F1F) | Catppuccin styled opml stylesheet |
| [catppuccin-rss](core/catppuccin-rss/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Fcatppuccin-rss?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/catppuccin-rss?labelColor=211F1F) | Catppuccin x Pretty-feed-v3 |
| [catppuccin-typedoc](core/catppuccin-typedoc/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Fcatppuccin-typedoc?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/catppuccin-typedoc?labelColor=211F1F) | Catppuccin css variable theme for typedoc |
| [catppuccin-xsl](core/catppuccin-xsl/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Fcatppuccin-xsl?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/catppuccin-xsl?labelColor=211F1F) | Catppuccin styles for various xsl formats |
| [eslint-config](core/eslint-config/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Feslint-config?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/eslint-config?labelColor=211F1F) | stephansama eslint configuration for multiple use cases |
| [create-stephansama-example](core/example/README.md) | ![npm version image](https://img.shields.io/npm/v/create-stephansama-example?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/create-stephansama-example?labelColor=211F1F) | Download an example from the @stephansama/packages examples |
| [find-makefile-targets](core/find-makefile-targets/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Ffind-makefile-targets?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/find-makefile-targets?labelColor=211F1F) | Find makefile targets used to pipe into fzf |
| [github-env](core/github-env/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Fgithub-env?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/github-env?labelColor=211F1F) | \[Deprecated] Additional environment variable types for GitHub CI |
| [multipublish](core/multipublish/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Fmultipublish?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/multipublish?labelColor=211F1F) | Publish packages to multiple providers easily |
| [prettier-plugin-handlebars](core/prettier-plugin-handlebars/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Fprettier-plugin-handlebars?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/prettier-plugin-handlebars?labelColor=211F1F) | Prettier plugin that automatically assigns the default parser for various handlebars files |
| [remark-asciinema](core/remark-asciinema/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Fremark-asciinema?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/remark-asciinema?labelColor=211F1F) | A remark plugin that transforms Asciinema links into embedded players or screenshots. |
| [single-file](core/single-file/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Fsingle-file?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/single-file?labelColor=211F1F) | create a single html file from a website url |
| [svelte-social-share-links](core/svelte-social-share-links/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Fsvelte-social-share-links?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/svelte-social-share-links?labelColor=211F1F) | Svelte/Web component to share the current url with various social media providers |
| [typed-env](core/typed-env/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Ftyped-env?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/typed-env?labelColor=211F1F) | standard schema compatible environment validator |
| [typed-events](core/typed-events/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Ftyped-events?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/typed-events?labelColor=211F1F) | Typed events store using standard schema |
| [typed-nocodb-api](core/typed-nocodb-api/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Ftyped-nocodb-api?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/typed-nocodb-api?labelColor=211F1F) | Typed API client for NocoDB using Zod |
| [typed-templates](core/typed-templates/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Ftyped-templates?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/typed-templates?labelColor=211F1F) | Use standard schema to validate and use handlebar template directories |
| [types-github-action-env](core/types-github-action-env/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Ftypes-github-action-env?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/types-github-action-env?labelColor=211F1F) | environment variable types for GitHub Action environment |
| [types-lhci](core/types-lhci/README.md) | ![npm version image](https://img.shields.io/npm/v/%40stephansama%2Ftypes-lhci?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F) | ![npm downloads](https://img.shields.io/npm/dw/@stephansama/types-lhci?labelColor=211F1F) | types for lhci configuration |

<!-- WORKSPACE end -->

<div align="center">
Expand Down
2 changes: 1 addition & 1 deletion core/auto-readme/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ _Object containing the following properties:_
| `enablePrettier` | Whether or not to use prettier to format the files | `boolean` | `true` |
| `enableToc` | generate table of contents for readmes | `boolean` | `false` |
| `enableUsage` | Whether or not to enable usage plugin | `boolean` | `false` |
| `headings` | List of headings for different table outputs | _Object with dynamic keys of type_ [Actions](#actions) _and values of type_ `Array<'default' \| 'description' \| 'devDependency' \| 'downloads' \| 'name' \| 'private' \| 'required' \| 'version'>` (_optional_) | `{}` |
| `headings` | List of headings for different table outputs | _Object with dynamic keys of type_ [Actions](#actions) _and values of type_ `Array<'default' \| 'description' \| 'devDependency' \| 'downloads' \| 'name' \| 'private' \| 'required' \| 'version'>` (_optional_) | `{"ACTION":["name","required","default","description"],"PKG":["name","version","devDependency"],"USAGE":[],"WORKSPACE":["name","version","downloads","description"],"ZOD":[]}` |
| `onlyReadmes` | Whether or not to only traverse readmes | `boolean` | `true` |
| `onlyShowPublicPackages` | Only show public packages in workspaces | `boolean` | `false` |
| `removeScope` | Remove common workspace scope | `string` | `''` |
Expand Down
3 changes: 1 addition & 2 deletions core/auto-readme/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ export const autoReadmeRemarkPlugin: Plugin<[Config, ActionData], Root> =
const headings =
(config.headings?.WORKSPACE?.length &&
config.headings?.WORKSPACE) ||
defaultTableHeadings.WORKSPACE! ||
[];
defaultTableHeadings.WORKSPACE!;
Comment on lines 100 to +102
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The logic for selecting headings is duplicated across different sections (ACTION, PKG, WORKSPACE). Consider refactoring this into a small helper function to improve maintainability and ensure consistency across all plugins.


if (comment && comment.format === "LIST") {
// throw new Error("List is currently not su")
Expand Down
5 changes: 4 additions & 1 deletion core/auto-readme/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ const templatesSchema = z.object({
});

export const defaultTemplates = templatesSchema.parse({});
export const defaultTableHeadings = tableHeadingsSchema.parse({});

// use undefined to generate default headings
// eslint-disable-next-line unicorn/no-useless-undefined
export const defaultTableHeadings = tableHeadingsSchema.parse(undefined);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

While tableHeadingsSchema.parse(undefined) correctly triggers the schema's default value, it's generally cleaner to define the default object as a separate constant and export it directly. This avoids the need for Zod parsing at the top level and the associated ESLint suppression.

const DEFAULT_TABLE_HEADINGS = {
	ACTION: ["name", "required", "default", "description"],
	PKG: ["name", "version", "devDependency"],
	USAGE: [],
	WORKSPACE: ["name", "version", "downloads", "description"],
	ZOD: [],
} as const;

export const defaultTableHeadings = DEFAULT_TABLE_HEADINGS;

const tableHeadingsSchema = z
	.record(actionsSchema, headingsSchema.array().optional())
	.default(DEFAULT_TABLE_HEADINGS)
	.meta({ description: "Table heading action configuration" });


const _configSchema = z.object({
affectedRegexes: z.array(z.string().trim()),
Expand Down
1 change: 1 addition & 0 deletions core/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"node": ">=24"
},
"publishConfig": {
"access": "public",
"provenance": true
}
}
6 changes: 6 additions & 0 deletions eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ export default await config({
"pnpm/json-enforce-catalog": "off",
},
},
{
files: [`core/example/${globs.PKG_JSON}`],
rules: {
"package-json/no-redundant-publishConfig": "off",
},
},
{
files: ["core/alfred-kaomoji/ci.js"],
rules: {
Expand Down
Loading