From 609eea997ac9134f02b2b0370d580a1a287cf45a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Mon, 22 Jun 2020 10:38:07 +0200 Subject: [PATCH 1/5] chore(backend-common): just tweaked the structure of useHotMemoize --- packages/backend-common/src/hot.ts | 62 +++++++++++++----------------- 1 file changed, 26 insertions(+), 36 deletions(-) diff --git a/packages/backend-common/src/hot.ts b/packages/backend-common/src/hot.ts index bd6454c537..c725096c75 100644 --- a/packages/backend-common/src/hot.ts +++ b/packages/backend-common/src/hot.ts @@ -72,63 +72,53 @@ export function useHotCleanup(_module: NodeModule, cancelEffect: () => void) { } } +const CURRENT_HOT_MEMOIZE_INDEX_KEY = 'backstage.io/hmr-memoize-key'; + /** - * This function allows devs to preserve - * some value between hot-reloads. - * Useful for stateful parts of the backend + * Memoizes a generated value across hot-module reloads. This is useful for + * stateful parts of the backend, e.g. to retain a database. + * * @example * ```ts * const db = useHotMemoize(module, () => createDB(dbParams)); * ``` - * @param _module Reference to the current module where you invoke the fn - * @param valueFactory Fn that returns the value you want to memoize + * * @warning Don't use inside conditionals or loops, * same rules as for hooks apply (https://reactjs.org/docs/hooks-rules.html) + * + * @param _module Reference to the current module where you invoke the fn + * @param valueFactory Fn that returns the value you want to memoize */ export function useHotMemoize( _module: NodeModule, valueFactory: () => T, ): T { - const CURRENT_HOT_MEMOIZE_INDEX_KEY = 'backstage.io/hmr-memoize-key'; - if (!_module.hot) { - // Just return value straight away return valueFactory(); } - if (_module.hot && typeof _module.hot.data === 'undefined') { - // First run, init the module data + // When starting blank, reset the counter + if (!_module.hot.data?.[CURRENT_HOT_MEMOIZE_INDEX_KEY]) { + for (const ancestor of findAllAncestors(_module)) { + ancestor.hot?.addDisposeHandler(data => { + data[CURRENT_HOT_MEMOIZE_INDEX_KEY] = 1; + }); + } + _module.hot.data = { - [CURRENT_HOT_MEMOIZE_INDEX_KEY]: 0, + ..._module.hot.data, + [CURRENT_HOT_MEMOIZE_INDEX_KEY]: 1, }; } - // Let's store data per module based on the order of the code invocation - const index = _module.hot.data[CURRENT_HOT_MEMOIZE_INDEX_KEY]; - // Increasing the counter after each call - _module.hot.data[CURRENT_HOT_MEMOIZE_INDEX_KEY] += 1; + // Store data per module, based on the order of the code invocation + const index = _module.hot.data[CURRENT_HOT_MEMOIZE_INDEX_KEY]++; + const value = _module.hot.data[index] ?? valueFactory(); - const prevValue = _module.hot.data[index]; - const createDisposeHandler = (value: any) => (data: { - [key: number]: any; - [indexKey: string]: number; - }) => { - // Preserving the value through the HMR process + // Always add a handler that, upon a HMR event, reinstates the value. + _module.hot.addDisposeHandler(data => { data[index] = value; - // Decreasing the counter after each handler - data[CURRENT_HOT_MEMOIZE_INDEX_KEY] = - // First hot update is still different, need to populate the data - typeof data[CURRENT_HOT_MEMOIZE_INDEX_KEY] === 'undefined' - ? _module.hot!.data[CURRENT_HOT_MEMOIZE_INDEX_KEY] - 1 - : data[CURRENT_HOT_MEMOIZE_INDEX_KEY] - 1; - }; + }); - if (prevValue) { - _module.hot!.addDisposeHandler(createDisposeHandler(prevValue)); - return prevValue; - } - - const newValue = valueFactory(); - _module.hot.addDisposeHandler(createDisposeHandler(newValue)); - return newValue; + return value; } From 179444ef83b2a53cb52cb1ea84e0316c821c76c0 Mon Sep 17 00:00:00 2001 From: Bilawal Hameed Date: Mon, 22 Jun 2020 13:42:42 +0200 Subject: [PATCH 2/5] feat(techdocs): yarn create-plugin --- .github/CODEOWNERS | 3 +- packages/app/package.json | 1 + packages/app/src/plugins.ts | 1 + plugins/techdocs/.eslintrc.js | 3 + plugins/techdocs/README.md | 13 +++ plugins/techdocs/dev/index.tsx | 20 ++++ plugins/techdocs/package.json | 47 ++++++++ .../ExampleComponent.test.tsx | 34 ++++++ .../ExampleComponent/ExampleComponent.tsx | 57 +++++++++ .../src/components/ExampleComponent/index.ts | 17 +++ .../ExampleFetchComponent.test.tsx | 28 +++++ .../ExampleFetchComponent.tsx | 108 ++++++++++++++++++ .../components/ExampleFetchComponent/index.ts | 17 +++ plugins/techdocs/src/index.ts | 17 +++ plugins/techdocs/src/plugin.test.ts | 23 ++++ plugins/techdocs/src/plugin.ts | 45 ++++++++ plugins/techdocs/src/setupTests.ts | 18 +++ 17 files changed, 451 insertions(+), 1 deletion(-) create mode 100644 plugins/techdocs/.eslintrc.js create mode 100644 plugins/techdocs/README.md create mode 100644 plugins/techdocs/dev/index.tsx create mode 100644 plugins/techdocs/package.json create mode 100644 plugins/techdocs/src/components/ExampleComponent/ExampleComponent.test.tsx create mode 100644 plugins/techdocs/src/components/ExampleComponent/ExampleComponent.tsx create mode 100644 plugins/techdocs/src/components/ExampleComponent/index.ts create mode 100644 plugins/techdocs/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx create mode 100644 plugins/techdocs/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx create mode 100644 plugins/techdocs/src/components/ExampleFetchComponent/index.ts create mode 100644 plugins/techdocs/src/index.ts create mode 100644 plugins/techdocs/src/plugin.test.ts create mode 100644 plugins/techdocs/src/plugin.ts create mode 100644 plugins/techdocs/src/setupTests.ts diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 35d354fefc..c549a61d9a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -4,4 +4,5 @@ # The last matching pattern takes precedence. # https://help.github.com/articles/about-codeowners/ -* @spotify/backstage-core +* @spotify/backstage-core +/plugins/techdocs @spotify/pulp-fiction diff --git a/packages/app/package.json b/packages/app/package.json index 1c643b437d..6b872156d6 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -14,6 +14,7 @@ "@backstage/plugin-scaffolder": "^0.1.1-alpha.9", "@backstage/plugin-sentry": "^0.1.1-alpha.9", "@backstage/plugin-tech-radar": "^0.1.1-alpha.9", + "@backstage/plugin-techdocs": "^0.1.1-alpha.9", "@backstage/plugin-welcome": "^0.1.1-alpha.9", "@backstage/test-utils": "^0.1.1-alpha.9", "@backstage/theme": "^0.1.1-alpha.9", diff --git a/packages/app/src/plugins.ts b/packages/app/src/plugins.ts index a6485835f7..00a3478577 100644 --- a/packages/app/src/plugins.ts +++ b/packages/app/src/plugins.ts @@ -23,3 +23,4 @@ export { plugin as Circleci } from '@backstage/plugin-circleci'; export { plugin as RegisterComponent } from '@backstage/plugin-register-component'; export { plugin as Sentry } from '@backstage/plugin-sentry'; export { plugin as GitopsProfiles } from '@backstage/plugin-gitops-profiles'; +export { plugin as Techdocs } from '@backstage/plugin-techdocs'; diff --git a/plugins/techdocs/.eslintrc.js b/plugins/techdocs/.eslintrc.js new file mode 100644 index 0000000000..13573efa9c --- /dev/null +++ b/plugins/techdocs/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + extends: [require.resolve('@backstage/cli/config/eslint')], +}; diff --git a/plugins/techdocs/README.md b/plugins/techdocs/README.md new file mode 100644 index 0000000000..ec78a6dbc2 --- /dev/null +++ b/plugins/techdocs/README.md @@ -0,0 +1,13 @@ +# techdocs + +Welcome to the techdocs plugin! + +_This plugin was created through the Backstage CLI_ + +## Getting started + +Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn start` in the root directory, and then navigating to [/techdocs](http://localhost:3000/techdocs). + +You can also serve the plugin in isolation by running `yarn start` in the plugin directory. +This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads. +It is only meant for local development, and the setup for it can be found inside the [/dev](/dev) directory. diff --git a/plugins/techdocs/dev/index.tsx b/plugins/techdocs/dev/index.tsx new file mode 100644 index 0000000000..812a5585d4 --- /dev/null +++ b/plugins/techdocs/dev/index.tsx @@ -0,0 +1,20 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { createDevApp } from '@backstage/dev-utils'; +import { plugin } from '../src/plugin'; + +createDevApp().registerPlugin(plugin).render(); diff --git a/plugins/techdocs/package.json b/plugins/techdocs/package.json new file mode 100644 index 0000000000..58588e562d --- /dev/null +++ b/plugins/techdocs/package.json @@ -0,0 +1,47 @@ +{ + "name": "@backstage/plugin-techdocs", + "version": "0.1.1-alpha.9", + "main": "src/index.ts", + "types": "src/index.ts", + "license": "Apache-2.0", + "private": true, + "publishConfig": { + "access": "public", + "main": "dist/index.esm.js", + "types": "dist/index.d.ts" + }, + "scripts": { + "build": "backstage-cli plugin:build", + "start": "backstage-cli plugin:serve", + "lint": "backstage-cli lint", + "test": "backstage-cli test", + "diff": "backstage-cli plugin:diff", + "prepack": "backstage-cli prepack", + "postpack": "backstage-cli postpack", + "clean": "backstage-cli clean" + }, + "dependencies": { + "@backstage/core": "^0.1.1-alpha.9", + "@backstage/theme": "^0.1.1-alpha.9", + "@material-ui/core": "^4.9.1", + "@material-ui/icons": "^4.9.1", + "@material-ui/lab": "4.0.0-alpha.45", + "react": "^16.13.1", + "react-dom": "^16.13.1", + "react-use": "^14.2.0" + }, + "devDependencies": { + "@backstage/cli": "^0.1.1-alpha.9", + "@backstage/dev-utils": "^0.1.1-alpha.9", + "@testing-library/jest-dom": "^5.7.0", + "@testing-library/react": "^9.3.2", + "@testing-library/user-event": "^10.2.4", + "@types/jest": "^25.2.2", + "@types/node": "^12.0.0", + "@types/testing-library__jest-dom": "^5.0.4", + "jest-fetch-mock": "^3.0.3" + }, + "files": [ + "dist/**/*.{js,d.ts}" + ] +} diff --git a/plugins/techdocs/src/components/ExampleComponent/ExampleComponent.test.tsx b/plugins/techdocs/src/components/ExampleComponent/ExampleComponent.test.tsx new file mode 100644 index 0000000000..e4d760526e --- /dev/null +++ b/plugins/techdocs/src/components/ExampleComponent/ExampleComponent.test.tsx @@ -0,0 +1,34 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import React from 'react'; +import { render } from '@testing-library/react'; +import mockFetch from 'jest-fetch-mock'; +import ExampleComponent from './ExampleComponent'; +import { ThemeProvider } from '@material-ui/core'; +import { lightTheme } from '@backstage/theme'; + +describe('ExampleComponent', () => { + it('should render', () => { + mockFetch.mockResponse(() => new Promise(() => {})); + const rendered = render( + + + , + ); + expect(rendered.getByText('Welcome to techdocs!')).toBeInTheDocument(); + }); +}); diff --git a/plugins/techdocs/src/components/ExampleComponent/ExampleComponent.tsx b/plugins/techdocs/src/components/ExampleComponent/ExampleComponent.tsx new file mode 100644 index 0000000000..2ab29604ee --- /dev/null +++ b/plugins/techdocs/src/components/ExampleComponent/ExampleComponent.tsx @@ -0,0 +1,57 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import React, { FC } from 'react'; +import { Typography, Grid } from '@material-ui/core'; +import { + InfoCard, + Header, + Page, + pageTheme, + Content, + ContentHeader, + HeaderLabel, + SupportButton, +} from '@backstage/core'; +import ExampleFetchComponent from '../ExampleFetchComponent'; + +const ExampleComponent: FC<{}> = () => ( + +
+ + +
+ + + A description of your plugin goes here. + + + + + + All content should be wrapped in a card like this. + + + + + + + + +
+); + +export default ExampleComponent; diff --git a/plugins/techdocs/src/components/ExampleComponent/index.ts b/plugins/techdocs/src/components/ExampleComponent/index.ts new file mode 100644 index 0000000000..e785d45082 --- /dev/null +++ b/plugins/techdocs/src/components/ExampleComponent/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { default } from './ExampleComponent'; diff --git a/plugins/techdocs/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx b/plugins/techdocs/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx new file mode 100644 index 0000000000..7fecdc6f11 --- /dev/null +++ b/plugins/techdocs/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx @@ -0,0 +1,28 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import React from 'react'; +import { render } from '@testing-library/react'; +import mockFetch from 'jest-fetch-mock'; +import ExampleFetchComponent from './ExampleFetchComponent'; + +describe('ExampleFetchComponent', () => { + it('should render', async () => { + mockFetch.mockResponse(() => new Promise(() => {})); + const rendered = render(); + expect(await rendered.findByTestId('progress')).toBeInTheDocument(); + }); +}); diff --git a/plugins/techdocs/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx b/plugins/techdocs/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx new file mode 100644 index 0000000000..c2139befec --- /dev/null +++ b/plugins/techdocs/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx @@ -0,0 +1,108 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import React, { FC } from 'react'; +import { makeStyles } from '@material-ui/core/styles'; +import { Table, TableColumn, Progress } from '@backstage/core'; +import Alert from '@material-ui/lab/Alert'; +import { useAsync } from 'react-use'; + +const useStyles = makeStyles({ + avatar: { + height: 32, + width: 32, + borderRadius: '50%', + }, +}); + +type User = { + gender: string; // "male" + name: { + title: string; // "Mr", + first: string; // "Duane", + last: string; // "Reed" + }; + location: object; // {street: {number: 5060, name: "Hickory Creek Dr"}, city: "Albany", state: "New South Wales",…} + email: string; // "duane.reed@example.com" + login: object; // {uuid: "4b785022-9a23-4ab9-8a23-cb3fb43969a9", username: "blackdog796", password: "patch",…} + dob: object; // {date: "1983-06-22T12:30:23.016Z", age: 37} + registered: object; // {date: "2006-06-13T18:48:28.037Z", age: 14} + phone: string; // "07-2154-5651" + cell: string; // "0405-592-879" + id: { + name: string; // "TFN", + value: string; // "796260432" + }; + picture: { medium: string }; // {medium: "https://randomuser.me/api/portraits/men/95.jpg",…} + nat: string; // "AU" +}; + +type DenseTableProps = { + users: User[]; +}; + +export const DenseTable: FC = ({ users }) => { + const classes = useStyles(); + + const columns: TableColumn[] = [ + { title: 'Avatar', field: 'avatar' }, + { title: 'Name', field: 'name' }, + { title: 'Email', field: 'email' }, + { title: 'Nationality', field: 'nationality' }, + ]; + + const data = users.map(user => { + return { + avatar: ( + {user.name.first} + ), + name: `${user.name.first} ${user.name.last}`, + email: user.email, + nationality: user.nat, + }; + }); + + return ( + + ); +}; + +const ExampleFetchComponent: FC<{}> = () => { + const { value, loading, error } = useAsync(async (): Promise => { + const response = await fetch('https://randomuser.me/api/?results=20'); + const data = await response.json(); + return data.results; + }, []); + + if (loading) { + return ; + } else if (error) { + return {error.message}; + } + + return ; +}; + +export default ExampleFetchComponent; diff --git a/plugins/techdocs/src/components/ExampleFetchComponent/index.ts b/plugins/techdocs/src/components/ExampleFetchComponent/index.ts new file mode 100644 index 0000000000..28482f9fe1 --- /dev/null +++ b/plugins/techdocs/src/components/ExampleFetchComponent/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { default } from './ExampleFetchComponent'; diff --git a/plugins/techdocs/src/index.ts b/plugins/techdocs/src/index.ts new file mode 100644 index 0000000000..3a0a0fe2d3 --- /dev/null +++ b/plugins/techdocs/src/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { plugin } from './plugin'; diff --git a/plugins/techdocs/src/plugin.test.ts b/plugins/techdocs/src/plugin.test.ts new file mode 100644 index 0000000000..e750be9ac3 --- /dev/null +++ b/plugins/techdocs/src/plugin.test.ts @@ -0,0 +1,23 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { plugin } from './plugin'; + +describe('techdocs', () => { + it('should export plugin', () => { + expect(plugin).toBeDefined(); + }); +}); diff --git a/plugins/techdocs/src/plugin.ts b/plugins/techdocs/src/plugin.ts new file mode 100644 index 0000000000..29f9f8b085 --- /dev/null +++ b/plugins/techdocs/src/plugin.ts @@ -0,0 +1,45 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { createPlugin, createRouteRef } from '@backstage/core'; +import ExampleComponent from './components/ExampleComponent'; + +export const rootRouteRef = createRouteRef({ + path: '/techdocs', + title: 'techdocs', +}); + +export const plugin = createPlugin({ + id: 'techdocs', + register({ router }) { + router.addRoute(rootRouteRef, ExampleComponent); + }, +}); diff --git a/plugins/techdocs/src/setupTests.ts b/plugins/techdocs/src/setupTests.ts new file mode 100644 index 0000000000..e34bc46f4b --- /dev/null +++ b/plugins/techdocs/src/setupTests.ts @@ -0,0 +1,18 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import '@testing-library/jest-dom'; +require('jest-fetch-mock').enableMocks(); From b3c56655fdbc40395e9b947ee025fcd2a6f98b83 Mon Sep 17 00:00:00 2001 From: Bilawal Hameed Date: Mon, 22 Jun 2020 13:50:51 +0200 Subject: [PATCH 3/5] fix: rename pulp-fiction to techdocs-core --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c549a61d9a..fbb99eec31 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -5,4 +5,4 @@ # https://help.github.com/articles/about-codeowners/ * @spotify/backstage-core -/plugins/techdocs @spotify/pulp-fiction +/plugins/techdocs @spotify/techdocs-core From 3234dbbd8e9b750f57412eb0f540cc032180b115 Mon Sep 17 00:00:00 2001 From: Bilawal Hameed Date: Mon, 22 Jun 2020 13:52:39 +0200 Subject: [PATCH 4/5] fix: Techdocs to TechDocs --- packages/app/src/plugins.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/app/src/plugins.ts b/packages/app/src/plugins.ts index 00a3478577..05373d7d96 100644 --- a/packages/app/src/plugins.ts +++ b/packages/app/src/plugins.ts @@ -23,4 +23,4 @@ export { plugin as Circleci } from '@backstage/plugin-circleci'; export { plugin as RegisterComponent } from '@backstage/plugin-register-component'; export { plugin as Sentry } from '@backstage/plugin-sentry'; export { plugin as GitopsProfiles } from '@backstage/plugin-gitops-profiles'; -export { plugin as Techdocs } from '@backstage/plugin-techdocs'; +export { plugin as TechDocs } from '@backstage/plugin-techdocs'; From f9a5522c7d7ba254d483d5b6e99fbc48292a265c Mon Sep 17 00:00:00 2001 From: Bilawal Hameed Date: Mon, 22 Jun 2020 13:58:18 +0200 Subject: [PATCH 5/5] fix: update readme with work-in-progress status --- plugins/techdocs/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/techdocs/README.md b/plugins/techdocs/README.md index ec78a6dbc2..f25ffda3b2 100644 --- a/plugins/techdocs/README.md +++ b/plugins/techdocs/README.md @@ -1,8 +1,8 @@ -# techdocs +# TechDocs Plugin -Welcome to the techdocs plugin! +Welcome to the TechDocs plugin - Spotify's docs-like-code approach built directly into [Backstage](https://backstage.io). Watch [a video of our approach on YouTube](https://www.youtube.com/watch?v=uFGCaZmA6d4) to learn more. -_This plugin was created through the Backstage CLI_ +**WIP: This plugin is a work in progress. It is not ready for use yet. Follow our progress on [the Backstage Discord](https://discord.gg/MUpMjP2) under #docs-like-code or on [our GitHub Milestone](https://github.com/spotify/backstage/milestone/15).** ## Getting started