Merge branch 'master' into catalog-filter-accordion

Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
This commit is contained in:
Philipp Hugenroth
2021-07-19 21:07:58 +02:00
16 changed files with 223 additions and 121 deletions
+7 -2
View File
@@ -34,8 +34,6 @@ export interface CatalogApi {
location: AddLocationRequest,
options?: CatalogRequestOptions,
): Promise<AddLocationResponse>;
// Warning: (ae-forgotten-export) The symbol "CatalogRequestOptions" needs to be exported by the entry point index.d.ts
//
// (undocumented)
getEntities(
request?: CatalogEntitiesRequest,
@@ -138,6 +136,13 @@ export type CatalogListResponse<T> = {
items: T[];
};
// Warning: (ae-missing-release-tag) "CatalogRequestOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type CatalogRequestOptions = {
token?: string;
};
// Warning: (ae-missing-release-tag) "ENTITY_STATUS_CATALOG_PROCESSING_TYPE" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
@@ -20,5 +20,6 @@ export type {
CatalogApi,
CatalogEntitiesRequest,
CatalogListResponse,
CatalogRequestOptions,
} from './api';
export { ENTITY_STATUS_CATALOG_PROCESSING_TYPE } from './status';
@@ -0,0 +1,3 @@
site_name: Test site name
site_description: Test site description
docs_dir: docs/
@@ -47,6 +47,9 @@ const mkdocsYmlWithExtensions = fs.readFileSync(
const mkdocsYmlWithRepoUrl = fs.readFileSync(
resolvePath(__filename, '../__fixtures__/mkdocs_with_repo_url.yml'),
);
const mkdocsYmlWithValidDocDir = fs.readFileSync(
resolvePath(__filename, '../__fixtures__/mkdocs_valid_doc_dir.yml'),
);
const mkdocsYmlWithInvalidDocDir = fs.readFileSync(
resolvePath(__filename, '../__fixtures__/mkdocs_invalid_doc_dir.yml'),
);
@@ -336,6 +339,7 @@ describe('helpers', () => {
mockFs({
'/mkdocs.yml': mkdocsYml,
'/mkdocs_with_extensions.yml': mkdocsYmlWithExtensions,
'/mkdocs_valid_doc_dir.yml': mkdocsYmlWithValidDocDir,
'/mkdocs_invalid_doc_dir.yml': mkdocsYmlWithInvalidDocDir,
});
});
@@ -351,6 +355,12 @@ describe('helpers', () => {
).resolves.toBeUndefined();
});
it('should return true on when a valid docs_dir is present', async () => {
await expect(
validateMkdocsYaml(inputDir, '/mkdocs_valid_doc_dir.yml'),
).resolves.toBeUndefined();
});
it('should return false on absolute doc_dir path', async () => {
await expect(
validateMkdocsYaml(inputDir, '/mkdocs_invalid_doc_dir.yml'),
@@ -19,6 +19,7 @@ import { isChildPath } from '@backstage/backend-common';
import { spawn } from 'child_process';
import fs from 'fs-extra';
import yaml, { DEFAULT_SCHEMA, Type } from 'js-yaml';
import { resolve as resolvePath } from 'path';
import { PassThrough, Writable } from 'stream';
import { Logger } from 'winston';
import { ParsedLocationAnnotation } from '../../helpers';
@@ -178,7 +179,10 @@ export const validateMkdocsYaml = async (
schema: MKDOCS_SCHEMA,
});
if (mkdocsYml.docs_dir && !isChildPath(inputDir, mkdocsYml.docs_dir)) {
if (
mkdocsYml.docs_dir &&
!isChildPath(inputDir, resolvePath(inputDir, mkdocsYml.docs_dir))
) {
throw new Error(
`docs_dir configuration value in mkdocs can't be an absolute directory or start with ../ for security reasons.
Use relative paths instead which are resolved relative to your mkdocs.yml file location.`,