-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write Webpack loader for readme.md #4320
Comments
Docs: https://webpack.js.org/contribute/writing-a-loader/#guidelines Probably the export default function (source) {
const list = /* extract feature list from `source` */
return `
export const featureList = ${JSON.stringify(list)}
export const featureMetas = ${JSON.stringify(etc…)}
`;
} The difference with the current extraction code is that that looks for each specific feature by name, while this loader should just detect and parse all lines that include a feature name/description/screenshot. |
The problem however is that this will no longer cause the build to fail since the build no longer looks for specific features in the file. Suggestions welcome. Edit: found a solution: Move this check to GHA #4493 |
This would allow us to switch to esbuild instead 😃 It also has a loader-like feature: https://esbuild.github.io/plugins/#load-callbacks But it would additionally need a custom solution for |
I actually prefer the old way of specifying feature meta. For single source of truth we can generate the README via a script, which is a lot more easier to deal with. Apparent downsides would be duplicate README template content and you will have to remember to generate it whenever you update the info... |
Is it?
|
Not am I asking to revert the whole efforts of parsing info from README, I just thought this separation feels unnatural for me, and exotic for casual contributors. |
Not sure what's exotic about writing documentation in Markdown. If anything, following some specific (parseable) format in a JS comment is exotic. The only exotic part is importing the magic variable
We might also just use Parcel since it takes |
I think we’re parsing readme.md the wrong way. Instead of asking webpack to replace magic variables we parse and handle manually, we should be able to write
import featuresInfo from './readme.md'
and have a loader parse and keep track of the file as part of the dependency graph (as originally discussed in #3678)We still need to “parse” refined-GitHub.ts to get the list of active features, but maybe there’s a solution to that too (separately)
The text was updated successfully, but these errors were encountered: