sindresorhus/refined-github

Do you want to work on this issue?

You can request for a bounty in order to promote it!

Write Webpack loader for readme.md #4320

fregante posted onGitHub

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 https://github.com/sindresorhus/refined-github/pull/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)


Docs: https://webpack.js.org/contribute/writing-a-loader/#guidelines

Probably the /build/readme.loader.ts file will look something like:

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.

posted by fregante almost 4 years ago

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 https://github.com/sindresorhus/refined-github/issues/4493

posted by fregante almost 4 years ago

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests