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
23 changes: 17 additions & 6 deletions .github/scripts/create-changeset-from-pr.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ if (!prTitle) {
}

if (!['add-changeset', 'add-changeset-major'].includes(labelName)) {
console.log(`Skipping changeset creation because label ${labelName || 'unknown'} was not handled.`);
console.log(
`Skipping changeset creation because label ${labelName || 'unknown'} was not handled.`,
);
process.exit(0);
}

Expand All @@ -32,7 +34,11 @@ if (labelName === 'add-changeset-major') {
releaseType = 'major';
} else if (/^(feat|feature)(\([^)]+\))?!?:/i.test(message)) {
releaseType = 'minor';
} else if (/^(fix|perf|refactor|build|ci|chore|docs|style|test|revert)(\([^)]+\))?!?:/i.test(message)) {
} else if (
/^(fix|perf|refactor|build|ci|chore|docs|style|test|revert)(\([^)]+\))?!?:/i.test(
message,
)
) {
releaseType = 'patch';
} else if (/\bbreaking change\b|!:/i.test(message)) {
releaseType = 'major';
Expand All @@ -42,17 +48,22 @@ const fileName = `pr-${prNumber}.md`;
const filePath = path.join(changesetDir, fileName);

const existingFiles = await readdir(changesetDir);

await Promise.all(
existingFiles
.filter((name) => name.startsWith(`pr-${prNumber}`) && name.endsWith('.md'))
.map((name) => rm(path.join(changesetDir, name), { force: true }))
.map((name) => rm(path.join(changesetDir, name), { force: true })),
);

const packages = ["react-docgen", "react-docgen-cli"];
const frontmatter = packages.map((pkg) => `"${pkg}": ${releaseType}`).join('\n');
const packages = ['react-docgen', 'react-docgen-cli'];
const frontmatter = packages
.map((pkg) => `"${pkg}": ${releaseType}`)
.join('\n');
const content = `---\n${frontmatter}\n---\n\n${prTitle}\n`;

await mkdir(changesetDir, { recursive: true });
await writeFile(filePath, content, 'utf8');

console.log(`Created changeset ${path.relative(repoRoot, filePath)} with release type ${releaseType}.`);
console.log(
`Created changeset ${path.relative(repoRoot, filePath)} with release type ${releaseType}.`,
);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"execa": "9.6.1",
"globals": "17.7.0",
"nx": "23.1.0",
"prettier": "3.8.4",
"prettier": "3.9.5",
"prettier-plugin-tailwindcss": "0.8.1",
"rimraf": "6.1.3",
"tempy": "3.2.0",
Expand Down
6 changes: 1 addition & 5 deletions packages/react-docgen/src/Documentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,7 @@ export interface ObjectSignatureType<
}

export type TypeDescriptor<T = FunctionSignatureType> =
| ElementsType<T>
| LiteralType
| ObjectSignatureType<T>
| SimpleType
| T;
ElementsType<T> | LiteralType | ObjectSignatureType<T> | SimpleType | T;

export interface PropDescriptor {
type?: PropTypeDescriptor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ function getDocblockFromComponent(path: NodePath): string | null {

if (path.isClassDeclaration() || path.isClassExpression()) {
const decorators = path.get('decorators') as
| Array<NodePath<Decorator>>
| null
| undefined;
Array<NodePath<Decorator>> | null | undefined;

// If we have a class declaration or expression, then the comment might be
// attached to the last decorator instead as trailing comment.
Expand Down
4 changes: 1 addition & 3 deletions packages/react-docgen/src/utils/ts-types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import type {
} from '@babel/types';

type BindingNode =
| TSEnumDeclaration
| TSInterfaceDeclaration
| TSTypeAliasDeclaration;
TSEnumDeclaration | TSInterfaceDeclaration | TSTypeAliasDeclaration;

type TypeKind = 'alias' | 'enum' | 'interface';

Expand Down
22 changes: 11 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading