Skip to content

Commit 9b33a55

Browse files
committed
Fix: Hide configuration-all from the website
Rel webhintio/hint#3097
1 parent 0012586 commit 9b33a55

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

helpers/update-site/documentation.js

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,20 @@ const resources = [
6565

6666
const documentationGlobbyPattern = `${constants.dirs.NODE_MODULES}/{hint,vscode-webhint,@hint/{${resources.join(',')}}-*}`;
6767

68+
/**
69+
* Filters files for packages we do not want to show up in the website.
70+
* @param {string[]} files The files to filter out
71+
*/
72+
const filterPackages = (files) => {
73+
const ignoredPackages = ['configuration-all'];
74+
75+
return files.filter((file) => {
76+
return !ignoredPackages.some((pkgToIgnore) => {
77+
return file.includes(pkgToIgnore);
78+
});
79+
});
80+
};
81+
6882
const trimAndUnquote = (string) => {
6983
return string.trim().replace(/^"|"$/, '');
7084
};
@@ -171,14 +185,16 @@ const getResourcesFiles = async () => {
171185
const imageFiles = [];
172186

173187
for (const resource of resources) {
174-
const images = await globby([`${documentationGlobbyPattern}/images/**/*`], { absolute: true });
188+
const allImages = await globby([`${documentationGlobbyPattern}/images/**/*`], { absolute: true });
189+
const images = filterPackages(allImages);
175190

176191
images.forEach((image) => {
177192
imageFiles.push(getImageItemFromResource(image, resource));
178193
});
179194
}
180195

181-
const docs = await globby([`${documentationGlobbyPattern}/{README.md,docs/*.md}`], { absolute: true });
196+
const allDocs = await globby([`${documentationGlobbyPattern}/{README.md,docs/*.md}`], { absolute: true });
197+
const docs = filterPackages(allDocs);
182198

183199
const promises = docs.map(async (doc) => {
184200
const { content, frontMatter } = await getExistingContent(doc);
@@ -728,9 +744,10 @@ const createHintCategories = (files) => {
728744

729745
const updateChangelog = async () => {
730746
/** All packages should be hoisted so no need to look inside `configuration-all` */
731-
const files = await globby([`${documentationGlobbyPattern}/CHANGELOG.md`]);
747+
const allChangelogs = await globby([`${documentationGlobbyPattern}/CHANGELOG.md`]);
748+
const changelogs = filterPackages(allChangelogs);
732749

733-
const changelog = await files.reduce(async (totalPromise, file) => {
750+
const changelog = await changelogs.reduce(async (totalPromise, file) => {
734751
const total = await totalPromise;
735752
const content = await readFile(file, 'utf8');
736753
let packageName = file.split('/').slice(-2, -1)[0];

0 commit comments

Comments
 (0)