Skip to content

Commit

Permalink
fix: auto-formatter bug with table dom
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianCataldo committed Jun 24, 2022
1 parent ce3dbef commit bcfad42
Showing 1 changed file with 35 additions and 37 deletions.
72 changes: 35 additions & 37 deletions components/LicensesReport/LicensesReport.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ export interface Props {
}
const props = Astro.props as Props;
if (props.useDevDependencies === undefined) {
props.useDevDependencies = true;
}
if (!props.depth) {
props.depth = 2;
}
if (!props.nameText) {
props.nameText = 'Package';
}
Expand All @@ -30,17 +36,6 @@ if (!props.licenseText) {
if (!props.linkText) {
props.linkText = 'URL';
}
if (!props.depth) {
props.depth = 2;
}
if (props.useDevDependencies === undefined) {
props.useDevDependencies = true;
}
const options = {
useDevDependencies: props.useDevDependencies,
depth: props.depth,
};
interface Licenses {
name?: string;
Expand All @@ -50,6 +45,11 @@ interface Licenses {
repository?: { url: string };
}
const options = {
useDevDependencies: props.useDevDependencies,
depth: props.depth,
};
const report =
(await licenser.reporter
.generate(options)
Expand All @@ -68,31 +68,29 @@ const report =
<th>{props.authorText}</th>
<th>{props.licenseText}</th>
<th>{props.linkText}</th>

<tbody>
{report.map((row) => (
<tr>
<td class="name">{row.name}</td>
<td class="author">
{typeof row.author === 'string'
? row.author
: row?.author?.name || '-'}
</td>
<td class="license">{row.license}</td>
<td>
<a
class="link is-external"
href={row.homepage || row.repository.url}
target="_blank"
rel="noopener nofollow"
>
{row.homepage || row.repository.url}
</a>
</td>
</tr>
))}
</tbody>


</thead>

<tbody>
{report.map((row) => (
<tr>
<td class="name">{row.name}</td>
<td class="author">
{typeof row.author === 'string'
? row.author
: row?.author?.name || '-'}
</td>
<td class="license">{row.license}</td>
<td>
<a
class="link is-external"
href={row.homepage || row.repository.url}
target="_blank"
rel="noopener nofollow"
>
{row.homepage || row.repository.url}
</a>
</td>
</tr>
))}
</tbody>
</table>

0 comments on commit bcfad42

Please sign in to comment.