Effect-TS / effect

An ecosystem of tools to build robust applications in TypeScript
https://effect.website
MIT License
7.71k stars 245 forks source link

Add utility for generating JSDoc @example blocks #3994

Closed gcanti closed 22 hours ago

gcanti commented 1 day ago

This commit adds a new HTML utility file code2jsdoc-example.html to assist with writing JSDoc @example comments.

A simple web-based interface with two text areas:

Example Input:

import { Effect } from "effect"

console.log(Effect.runSyncExit(Effect.succeed(1)))
/*
Output:
{
  _id: "Exit",
  _tag: "Success",
  value: 1
}
*/

Output:

*
* @example
* import { Effect } from "effect"
* 
* console.log(Effect.runSyncExit(Effect.succeed(1)))
* // Output:
* // {
* //   _id: "Exit",
* //   _tag: "Success",
* //   value: 1
* // }
* 
changeset-bot[bot] commented 1 day ago

⚠️ No Changeset found

Latest commit: 765c1036e95e4942cea070fd782f5adf00ea9ac4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

IMax153 commented 1 day ago

To avoid cluttering the root dir, I suggest we put this into /scripts somewhere.