-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6489c29
commit 4c00de8
Showing
5 changed files
with
91 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { createGitSourceControl } from "../../source-control/git.js"; | ||
import { NodechronusHost } from "../../utils/node-host.js"; | ||
import { createPnpmWorkspaceManager } from "../../workspace-manager/pnpm.js"; | ||
import { findChangeStatus } from "../../change/index.js"; | ||
import pc from "picocolors"; | ||
function log(...args: any[]) { | ||
// eslint-disable-next-line no-console | ||
console.log(...args); | ||
} | ||
export async function verifyChangeset(cwd: string): Promise<void> { | ||
const host = NodechronusHost; | ||
const pnpm = createPnpmWorkspaceManager(host); | ||
const workspace = await pnpm.load(cwd); | ||
const sourceControl = createGitSourceControl(workspace.path); | ||
const status = await findChangeStatus(host, sourceControl, workspace); | ||
|
||
const undocummentedPackages = [...status.packages.values()].filter((x) => x.changed && !x.documented); | ||
const documentedPackages = [...status.packages.values()].filter((x) => x.changed && x.documented); | ||
if (undocummentedPackages.length > 0) { | ||
log(`There is undocummented changes. Run ${pc.cyan("chronus add")} to add a changeset.`); | ||
log(""); | ||
log(pc.red(`The following packages have changes but are not documented.`)); | ||
for (const pkg of undocummentedPackages) { | ||
log(pc.red(` - ${pkg.package.name}`)); | ||
} | ||
log(""); | ||
log(pc.green("The following packages have already been documented:")); | ||
|
||
for (const pkg of documentedPackages) { | ||
log(pc.green(` - ${pkg.package.name}`)); | ||
} | ||
process.exit(1); | ||
} | ||
|
||
log(pc.green("All changed packages have been documented:")); | ||
for (const pkg of documentedPackages) { | ||
log(pc.green(` - ${pkg.package.name}`)); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.