-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate deprecations tables from Sass API
- Loading branch information
Showing
4 changed files
with
69 additions
and
76 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{%- if deprecations.size == 0 -%} | ||
<p>There are no {{status}} deprecations in the latest version of Dart Sass.</p> | ||
{%- else -%} | ||
<p>The following deprecation IDs can be passed to this option:</p> | ||
|
||
<table style="width:100%"> | ||
<thead> | ||
<tr style="text-align: left"> | ||
<th>ID</th> | ||
{%- if status == "active" -%}<th>Version</th>{%- endif -%} | ||
<th>Description</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{%- for deprecation in deprecations -%} | ||
<tr> | ||
<td> | ||
{%- if deprecation.hasWebpage -%} | ||
<a href="/documentation/breaking-changes/{{deprecation.id}}"> | ||
{%- endif -%} | ||
<code>{{deprecation.id}}</code> | ||
{%-if deprecation.hasWebpage -%}</a>{%- endif -%} | ||
</td> | ||
{%- if status == "active" -%} | ||
<td>{{deprecation.deprecatedIn}}</td> | ||
{%- endif -%} | ||
<td>{{deprecation.description}}</td> | ||
</tr> | ||
{%- endfor -%} | ||
</tbody> | ||
</table> | ||
{%- endif -%} | ||
|
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,30 @@ | ||
import fs from 'node:fs'; | ||
import sass from 'sass'; | ||
|
||
import {liquidEngine} from '../engines'; | ||
|
||
/** | ||
* Renders a table of deprecations with the given status. | ||
*/ | ||
export default async function deprecations( | ||
_: string, | ||
status: 'active' | 'future' | ||
) { | ||
const deprecations = []; | ||
for (const [id, deprecation] of Object.entries(sass.deprecations)) { | ||
if (deprecation.status === status) { | ||
deprecations.push({ | ||
id: id, | ||
deprecatedIn: deprecation.deprecatedIn, | ||
description: deprecation.description, | ||
hasWebpage: fs.existsSync( | ||
`source/documentation/breaking-changes/${id}.md` | ||
), | ||
}); | ||
} | ||
} | ||
return liquidEngine.renderFile('deprecations', { | ||
deprecations, | ||
status, | ||
}); | ||
} |
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