From e55156766b4c5aaab8fee32e3765e33a1433768f Mon Sep 17 00:00:00 2001 From: Omer Farooq <17722640+o-farooq@users.noreply.github.com> Date: Sat, 19 Sep 2020 16:42:48 +1200 Subject: [PATCH 1/9] create-app: fix missing .gitignore file when scaffolded --- .../templates/default-app/{.gitignore => .gitignore.hbs} | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) rename packages/create-app/templates/default-app/{.gitignore => .gitignore.hbs} (96%) diff --git a/packages/create-app/templates/default-app/.gitignore b/packages/create-app/templates/default-app/.gitignore.hbs similarity index 96% rename from packages/create-app/templates/default-app/.gitignore rename to packages/create-app/templates/default-app/.gitignore.hbs index 4f9065c60b..5f5cc739f4 100644 --- a/packages/create-app/templates/default-app/.gitignore +++ b/packages/create-app/templates/default-app/.gitignore.hbs @@ -1,4 +1,3 @@ - # Logs logs *.log @@ -31,4 +30,4 @@ dist-types site # Local configuration files -*.local.yaml +*.local.yaml \ No newline at end of file From 525aabeb4769fb34c639eccb2bfdf036067e49ae Mon Sep 17 00:00:00 2001 From: Sebastian Qvarfordt Date: Mon, 21 Sep 2020 15:33:53 +0200 Subject: [PATCH 2/9] Added toggled option for allowing longpath in windows through nodegit --- plugins/techdocs-backend/src/helpers.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/techdocs-backend/src/helpers.ts b/plugins/techdocs-backend/src/helpers.ts index 14f4d490ba..670c9f0970 100644 --- a/plugins/techdocs-backend/src/helpers.ts +++ b/plugins/techdocs-backend/src/helpers.ts @@ -17,7 +17,7 @@ import os from 'os'; import path from 'path'; import parseGitUrl from 'git-url-parse'; -import { Clone, Repository } from 'nodegit'; +import NodeGit, { Clone, Repository } from 'nodegit'; import fs from 'fs-extra'; // @ts-ignore import defaultBranch from 'default-branch'; @@ -26,6 +26,9 @@ import { InputError } from '@backstage/backend-common'; import { RemoteProtocol } from './techdocs/stages/prepare/types'; import { Logger } from 'winston'; +// @ts-ignore +NodeGit.Libgit2.opts(28, 1); + export type ParsedLocationAnnotation = { type: RemoteProtocol; target: string; From b80a8333239a02cd708123c44e39348537374d5c Mon Sep 17 00:00:00 2001 From: Sebastian Qvarfordt Date: Mon, 21 Sep 2020 16:51:46 +0200 Subject: [PATCH 3/9] comment to explain option --- plugins/techdocs-backend/src/helpers.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/techdocs-backend/src/helpers.ts b/plugins/techdocs-backend/src/helpers.ts index 670c9f0970..8acd836cad 100644 --- a/plugins/techdocs-backend/src/helpers.ts +++ b/plugins/techdocs-backend/src/helpers.ts @@ -26,6 +26,7 @@ import { InputError } from '@backstage/backend-common'; import { RemoteProtocol } from './techdocs/stages/prepare/types'; import { Logger } from 'winston'; +// Enables core.longpaths on windows to prevent crashing when checking out repos with long foldernames and/or deep nesting // @ts-ignore NodeGit.Libgit2.opts(28, 1); From 959e2e9866c356b73d19a9ff5083b5a66b42c1e5 Mon Sep 17 00:00:00 2001 From: Emma Indal Date: Mon, 21 Sep 2020 18:03:13 +0200 Subject: [PATCH 4/9] TechDocs: adjust mkdocs extensions (#2516) * fix(techdocs-core): adjust mkdocs extensions * fix(techdocs-core): formatting * fix(techdocs-core): bump version) * move highlight configs to extension * delete extension from mkdocs yaml * formatting * fix(docs): add links to plugins and extensions in docs * prettier * fix(techdocs-core): use pymdownx extensions v.7.1 to allow legacy_tab_classes config * fix(techdocs-core): delete unused import * update changelog * added superfences to list of extensions * prettier --- .../mock-docs/docs/index.md | 40 +++++++++++- .../techdocs-core/README.md | 64 +++++++++++++++++++ .../techdocs-core/requirements.txt | 2 +- .../techdocs-container/techdocs-core/setup.py | 54 ++++++++-------- .../techdocs-core/src/core.py | 30 ++++----- 5 files changed, 142 insertions(+), 48 deletions(-) diff --git a/packages/techdocs-container/mock-docs/docs/index.md b/packages/techdocs-container/mock-docs/docs/index.md index 2586b86cfb..3c323d6fc1 100644 --- a/packages/techdocs-container/mock-docs/docs/index.md +++ b/packages/techdocs-container/mock-docs/docs/index.md @@ -3,10 +3,9 @@ !!! test Testing somethin +Abbreviations: Some text about MOCDOC -\*[MOCDOC]: Mock Documentation - This is a paragraph. {: #test_id .test_class } @@ -61,3 +60,40 @@ digraph G { ``` :bulb: + +=== "JavaScript" + + ```javascript + import { test } from 'something'; + + const addThingToThing = (a, b) a + b; + ``` + +=== "Java" + + ```java + public void function() { + test(); + } + ``` + +```java tab="java" + public void function() { + test(); + } +``` + +```java tab="java 2" + public void function() { + test(); + } +``` + +```javascript +import { test } from 'something'; + +const addThingToThing = (a, b) a + b; +``` + + +*[MOCDOC]: Mock Documentation diff --git a/packages/techdocs-container/techdocs-core/README.md b/packages/techdocs-container/techdocs-core/README.md index 36f1437a54..49b9fce4e4 100644 --- a/packages/techdocs-container/techdocs-core/README.md +++ b/packages/techdocs-container/techdocs-core/README.md @@ -48,8 +48,72 @@ python -m black src/ **Note:** This will write to all Python files in `src/` with the formatted code. If you would like to only check to see if it passes, simply append the `--check` flag. +## MkDocs plugins and extensions + +The TechDocs Core MkDocs plugin comes with a set of extensions and plugins that mkdocs supports. Below you can find a list of all extensions and plugins that are included in the +TechDocs Core plugin: + +Plugins: + +- [search](https://www.mkdocs.org/user-guide/configuration/#search) +- [mkdocs-monorepo-plugin](https://github.com/spotify/mkdocs-monorepo-plugin) + +Extensions: + +- [admonition](https://squidfunk.github.io/mkdocs-material/reference/admonitions/#admonitions) +- [toc](https://python-markdown.github.io/extensions/toc/) +- [pymdown](https://facelessuser.github.io/pymdown-extensions/) + - caret + - critic + - details + - emoji + - superfences + - inlinehilite + - magiclink + - mark + - smartsymobls + - highlight + - extra + - tabbed + - tasklist + - tilde +- [markdown_inline_graphviz](https://pypi.org/project/markdown-inline-graphviz/) +- [plantuml_markdown](https://pypi.org/project/plantuml-markdown/) + ## Changelog +### 0.0.8 + +- Superfences and Codehilite doesn't work very well together (squidfunk/mkdocs-material#1604) so therefore the codehilite extension is replaced by pymdownx.highlight + +* Uses pymdownx extensions v.7.1 instead of 8.0.0 to allow legacy_tab_classes config. This makes the techdocs core plugin compatible with the usage of tabs for grouping markdown with the following syntax: + +```` + ```java tab="java 2" + public void function() { + .... + } + ``` +```` + +as well as the new + +```` + === "Java" + + ```java + public void function() { + .... + } + ``` +```` + +The pymdownx extension will be bumped too 8.0.0 in the near future. + +- pymdownx.tabbed is added to support tabs to group markdown content, such as codeblocks. + +- "PyMdown Extensions includes three extensions that are meant to replace their counterpart in the default Python Markdown extensions." Therefore some extensions has been taken away in this version that comes by default from pymdownx.extra which is added now (https://facelessuser.github.io/pymdown-extensions/usage_notes/#incompatible-extensions) + ### 0.0.7 - Fix an issue with configuration of emoji support diff --git a/packages/techdocs-container/techdocs-core/requirements.txt b/packages/techdocs-container/techdocs-core/requirements.txt index 36daaab4d7..75546fa992 100644 --- a/packages/techdocs-container/techdocs-core/requirements.txt +++ b/packages/techdocs-container/techdocs-core/requirements.txt @@ -7,7 +7,7 @@ mkdocs-monorepo-plugin==0.4.5 plantuml-markdown==3.1.2 markdown_inline_graphviz_extension==1.1 pygments==2.6.1 -pymdown-extensions==8.0.0 +pymdown-extensions==7.1 # The linter using for Python # Note: This requires Python 3.6+ to run, but can format Python 2 code too. diff --git a/packages/techdocs-container/techdocs-core/setup.py b/packages/techdocs-container/techdocs-core/setup.py index 3e3fa47caa..e5a8206150 100644 --- a/packages/techdocs-container/techdocs-core/setup.py +++ b/packages/techdocs-container/techdocs-core/setup.py @@ -17,38 +17,34 @@ from setuptools import setup, find_packages setup( - name='mkdocs-techdocs-core', - version='0.0.7', - description='A Mkdocs package that contains TechDocs defaults', - long_description='', - keywords='mkdocs', - url='https://github.com/spotify/backstage', - author='TechDocs Core', - author_email='pulp-fiction@spotify.com', - license='Apache-2.0', - python_requires='>=3.7', + name="mkdocs-techdocs-core", + version="0.0.8", + description="A Mkdocs package that contains TechDocs defaults", + long_description="", + keywords="mkdocs", + url="https://github.com/spotify/backstage", + author="TechDocs Core", + author_email="pulp-fiction@spotify.com", + license="Apache-2.0", + python_requires=">=3.7", install_requires=[ - 'mkdocs>=1.1.2', - 'mkdocs-material==5.3.2', - 'mkdocs-monorepo-plugin==0.4.5', - 'plantuml-markdown==3.1.2', - 'markdown_inline_graphviz_extension==1.1', - 'pygments==2.6.1', - 'pymdown-extensions==8.0.0' + "mkdocs>=1.1.2", + "mkdocs-material==5.3.2", + "mkdocs-monorepo-plugin==0.4.5", + "plantuml-markdown==3.1.2", + "markdown_inline_graphviz_extension==1.1", + "pygments==2.6.1", + "pymdown-extensions==7.1", ], classifiers=[ - 'Development Status :: 1 - Planning', - 'Intended Audience :: Developers', - 'Intended Audience :: Information Technology', - 'License :: OSI Approved :: Apache Software License', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3.7' + "Development Status :: 1 - Planning", + "Intended Audience :: Developers", + "Intended Audience :: Information Technology", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.7", ], packages=find_packages(), - entry_points={ - 'mkdocs.plugins': [ - 'techdocs-core = src.core:TechDocsCore' - ] - } + entry_points={"mkdocs.plugins": ["techdocs-core = src.core:TechDocsCore"]}, ) diff --git a/packages/techdocs-container/techdocs-core/src/core.py b/packages/techdocs-container/techdocs-core/src/core.py index 69e39d401b..ed1eb7c6f6 100644 --- a/packages/techdocs-container/techdocs-core/src/core.py +++ b/packages/techdocs-container/techdocs-core/src/core.py @@ -14,7 +14,7 @@ * limitations under the License. """ -from mkdocs.plugins import BasePlugin, PluginCollection +from mkdocs.plugins import BasePlugin from mkdocs.theme import Theme from mkdocs.contrib.search import SearchPlugin from mkdocs_monorepo_plugin.plugin import MonorepoPlugin @@ -54,25 +54,11 @@ class TechDocsCore(BasePlugin): # Markdown Extensions config["markdown_extensions"].append("admonition") - config["markdown_extensions"].append("abbr") - config["markdown_extensions"].append("attr_list") - config["markdown_extensions"].append("def_list") - config["markdown_extensions"].append("codehilite") - config["mdx_configs"]["codehilite"] = { - "linenums": True, - "guess_lang": False, - "pygments_style": "friendly", - } config["markdown_extensions"].append("toc") config["mdx_configs"]["toc"] = { "permalink": True, } - config["markdown_extensions"].append("footnotes") - config["markdown_extensions"].append("markdown.extensions.tables") - config["markdown_extensions"].append("pymdownx.betterem") - config["mdx_configs"]["pymdownx.betterem"] = { - "smart_enable": "all", - } + config["markdown_extensions"].append("pymdownx.caret") config["markdown_extensions"].append("pymdownx.critic") config["markdown_extensions"].append("pymdownx.details") @@ -83,6 +69,18 @@ class TechDocsCore(BasePlugin): config["markdown_extensions"].append("pymdownx.mark") config["markdown_extensions"].append("pymdownx.smartsymbols") config["markdown_extensions"].append("pymdownx.superfences") + config["mdx_configs"]["pymdownx.superfences"] = { + "legacy_tab_classes": True, + } + config["markdown_extensions"].append("pymdownx.highlight") + config["mdx_configs"]["pymdownx.highlight"] = { + "linenums": True, + } + config["markdown_extensions"].append("pymdownx.extra") + config["mdx_configs"]["pymdownx.betterem"] = { + "smart_enable": "all", + } + config["markdown_extensions"].append("pymdownx.tabbed") config["markdown_extensions"].append("pymdownx.tasklist") config["mdx_configs"]["pymdownx.tasklist"] = { "custom_checkbox": True, From 646407fcf4d8b1d307a90e0b52d284c3e4076db0 Mon Sep 17 00:00:00 2001 From: Emma Indal Date: Mon, 21 Sep 2020 18:21:41 +0200 Subject: [PATCH 5/9] Bump version of techdocs-core plugin in techdocs-container (#2539) --- packages/techdocs-container/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/techdocs-container/Dockerfile b/packages/techdocs-container/Dockerfile index e910935baf..b34fcbd861 100644 --- a/packages/techdocs-container/Dockerfile +++ b/packages/techdocs-container/Dockerfile @@ -18,7 +18,7 @@ FROM python:3.8-alpine RUN apk update && apk --no-cache add gcc musl-dev openjdk11-jdk curl graphviz ttf-dejavu fontconfig RUN curl -L http://sourceforge.net/projects/plantuml/files/plantuml.1.2020.16.jar/download > /opt/plantuml.jar -RUN pip install --upgrade pip && pip install mkdocs-techdocs-core==0.0.7 +RUN pip install --upgrade pip && pip install mkdocs-techdocs-core==0.0.8 # Create script to call plantuml.jar from a location in path From 10910841a25832cec620a780f1b222d241cd21be Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 21 Sep 2020 10:25:43 -0600 Subject: [PATCH 6/9] Fix identity typo --- .../src/components/CatalogFilter/CatalogFilter.test.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/catalog/src/components/CatalogFilter/CatalogFilter.test.tsx b/plugins/catalog/src/components/CatalogFilter/CatalogFilter.test.tsx index a98eec0875..bc23d61d9c 100644 --- a/plugins/catalog/src/components/CatalogFilter/CatalogFilter.test.tsx +++ b/plugins/catalog/src/components/CatalogFilter/CatalogFilter.test.tsx @@ -58,7 +58,7 @@ describe('Catalog Filter', () => { ] as Entity[]), }; - const indentityApi: Partial = { + const identityApi: Partial = { getUserId: () => 'tools@example.com', }; @@ -68,7 +68,7 @@ describe('Catalog Filter', () => { From b746ef2f3735f3e69ac787d1c469f23ed60b0d25 Mon Sep 17 00:00:00 2001 From: Adam Shurson Date: Mon, 21 Sep 2020 13:34:42 -0500 Subject: [PATCH 7/9] feature(component-registration): allow SCM specification --- .../RegisterComponentForm.tsx | 31 +++++++++++++++++-- .../RegisterComponentPage.tsx | 8 +++-- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.tsx b/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.tsx index 4090b2af9c..f98ff22a15 100644 --- a/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.tsx +++ b/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.tsx @@ -21,10 +21,13 @@ import { FormHelperText, LinearProgress, TextField, + Select, + MenuItem, + InputLabel, } from '@material-ui/core'; import { makeStyles } from '@material-ui/core/styles'; import React, { FC } from 'react'; -import { useForm } from 'react-hook-form'; +import { useForm, Controller } from 'react-hook-form'; import { ComponentIdValidators } from '../../util/validate'; const useStyles = makeStyles(theme => ({ @@ -44,7 +47,7 @@ export type Props = { }; const RegisterComponentForm: FC = ({ onSubmit, submitting }) => { - const { register, handleSubmit, errors, formState } = useForm({ + const { control, register, handleSubmit, errors, formState } = useForm({ mode: 'onChange', }); const classes = useStyles(); @@ -84,6 +87,30 @@ const RegisterComponentForm: FC = ({ onSubmit, submitting }) => { )} + + + SCM Detection + ( + + )} + /> +