Files
medusa-store/docs-util/packages/docblock-generator/src/index.ts
Shahed Nasser 96629f1916 docs: change process for generating docblocks through actions (#6237)
This PR changes the original process of generating docblocks through actions. The process now is:

1. When a PR is merged for the branch `changeset-release/develop`, the docblock generator tool us used to generate docblocks for the changed files. The changed files are determined by retrieving all comments since the last release and the files in each of those commits.
2. If there are changes after using the docblock generator tool, a PR is opened in the branch `chore/generate-tsdocs`.
3. Once the `chore/generate-tsdocs` is merged, it triggers an action that generates the references for the docs. This changes the previous behaviour of generating references on a new release.

Both actions (that runs the docblock generator tool and that generates references for the docs) can also be triggered manually.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-01-29 08:05:14 +00:00

42 lines
1.2 KiB
JavaScript

#!/usr/bin/env node
import "dotenv/config"
import { Command } from "commander"
import run from "./commands/run.js"
import runGitChanges from "./commands/run-git-changes.js"
import runGitCommit from "./commands/run-git-commit.js"
import runRelease from "./commands/run-release.js"
const program = new Command()
program.name("docblock-generator").description("Generate TSDoc doc-blocks")
program
.command("run")
.description("Generate TSDoc doc-blocks for specified files.")
.argument("<files...>", "One or more TypeScript file or directory paths.")
.option(
"--dry-run",
"Whether to run the command without writing the changes."
)
.action(run)
program
.command("run:changes")
.description("Generate TSDoc doc-blocks for changed files in git.")
.action(runGitChanges)
program
.command("run:commit")
.description("Generate TSDoc doc-blocks for changed files in a commit.")
.argument("<commitSha>", "The SHA of a commit.")
.action(runGitCommit)
program
.command("run:release")
.description(
"Generate TSDoc doc-blocks for files part of the latest release. It will retrieve the files of commits between the latest two releases."
)
.action(runRelease)
program.parse()