Skip to content

Commit

Permalink
fix: process only yaml files in toc
Browse files Browse the repository at this point in the history
  • Loading branch information
martyanovandrey committed Apr 2, 2024
1 parent b69e50b commit f72327c
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/steps/processAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {readFileSync} from 'fs';
import shell from 'shelljs';
import {join, resolve} from 'path';

import {ArgvService} from '../services';
import {ArgvService, TocService} from '../services';
import {checkPathExists, copyFiles, findAllValuesByKeys} from '../utils';

import {LINK_KEYS} from '@diplodoc/client/ssr';
Expand Down Expand Up @@ -60,7 +60,7 @@ function processAssetsHtmlRun({outputBundlePath}) {
}

function processAssetsMdRun({args, tmpOutputFolder}) {
const {allowCustomResources, resources} = ArgvService.getConfig();
const {input: inputFolderPath, allowCustomResources, resources} = ArgvService.getConfig();

const pathToConfig = args.config || join(args.input, YFM_CONFIG_FILENAME);
const pathToRedirects = join(args.input, REDIRECTS_FILENAME);
Expand All @@ -82,14 +82,16 @@ function processAssetsMdRun({args, tmpOutputFolder}) {
copyFiles(args.input, tmpOutputFolder, resourcePaths);
}

const yamlFiles: string[] = walkSync(args.input, {
globs: ['**/*.yaml'],
directories: false,
includeBasePath: true,
ignore: ['**/toc.yaml', resolve(pathToRedirects)],
});
const tocYamlFiles = TocService.getNavigationPaths().reduce((acc, file) => {
if(file.endsWith('.yaml')){

Check failure on line 86 in src/steps/processAssets.ts

View workflow job for this annotation

GitHub Actions / Verify Files

Replace `(file.endsWith('.yaml'))` with `·(file.endsWith('.yaml'))·`
const resolvedPathToFile = resolve(inputFolderPath, file);

acc.push(resolvedPathToFile);
}
return acc;
}, [])

Check failure on line 92 in src/steps/processAssets.ts

View workflow job for this annotation

GitHub Actions / Verify Files

Insert `;`

yamlFiles.forEach((yamlFile) => {
tocYamlFiles.forEach((yamlFile) => {
const content = load(readFileSync(yamlFile, 'utf8'));

if (!Object.prototype.hasOwnProperty.call(content, 'blocks')) {
Expand Down

0 comments on commit f72327c

Please sign in to comment.