From 198bf2d1a60a122ba5dc8152fd46782471d2f494 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Fri, 8 May 2020 17:18:36 +0200 Subject: [PATCH 1/3] plugins: applied diff for all plugins to enable plugin:serve --- plugins/explore/dev/index.tsx | 20 ++++++++++++++++++++ plugins/explore/package.json | 6 ++++-- plugins/explore/tsconfig.json | 2 +- plugins/inventory/dev/index.tsx | 20 ++++++++++++++++++++ plugins/inventory/package.json | 3 ++- plugins/inventory/tsconfig.json | 2 +- plugins/lighthouse/dev/index.tsx | 20 ++++++++++++++++++++ plugins/lighthouse/package.json | 6 ++++-- plugins/lighthouse/tsconfig.json | 2 +- plugins/scaffolder/dev/index.tsx | 20 ++++++++++++++++++++ plugins/scaffolder/package.json | 3 ++- plugins/scaffolder/tsconfig.json | 2 +- plugins/tech-radar/dev/index.tsx | 20 ++++++++++++++++++++ plugins/tech-radar/package.json | 6 ++++-- plugins/tech-radar/tsconfig.json | 2 +- plugins/welcome/dev/index.tsx | 20 ++++++++++++++++++++ plugins/welcome/package.json | 6 ++++-- plugins/welcome/tsconfig.json | 2 +- 18 files changed, 146 insertions(+), 16 deletions(-) create mode 100644 plugins/explore/dev/index.tsx create mode 100644 plugins/inventory/dev/index.tsx create mode 100644 plugins/lighthouse/dev/index.tsx create mode 100644 plugins/scaffolder/dev/index.tsx create mode 100644 plugins/tech-radar/dev/index.tsx create mode 100644 plugins/welcome/dev/index.tsx diff --git a/plugins/explore/dev/index.tsx b/plugins/explore/dev/index.tsx new file mode 100644 index 0000000000..812a5585d4 --- /dev/null +++ b/plugins/explore/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/explore/package.json b/plugins/explore/package.json index 9adbee7b0f..c7a377c589 100644 --- a/plugins/explore/package.json +++ b/plugins/explore/package.json @@ -10,7 +10,8 @@ "lint": "backstage-cli lint", "test": "backstage-cli test", "diff": "backstage-cli plugin:diff", - "clean": "backstage-cli clean" + "clean": "backstage-cli clean", + "start": "backstage-cli plugin:serve" }, "dependencies": { "@backstage/core": "^0.1.1-alpha.4", @@ -32,7 +33,8 @@ "@types/jest": "^24.0.0", "@types/node": "^12.0.0", "@types/testing-library__jest-dom": "^5.0.4", - "jest-fetch-mock": "^3.0.3" + "jest-fetch-mock": "^3.0.3", + "@backstage/dev-utils": "^0.1.1-alpha.4" }, "files": [ "dist" diff --git a/plugins/explore/tsconfig.json b/plugins/explore/tsconfig.json index 5a3931ffce..b663b01fa2 100644 --- a/plugins/explore/tsconfig.json +++ b/plugins/explore/tsconfig.json @@ -1,5 +1,5 @@ { "extends": "../../tsconfig.json", - "include": ["src"], + "include": ["src", "dev"], "compilerOptions": {} } diff --git a/plugins/inventory/dev/index.tsx b/plugins/inventory/dev/index.tsx new file mode 100644 index 0000000000..812a5585d4 --- /dev/null +++ b/plugins/inventory/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/inventory/package.json b/plugins/inventory/package.json index ae871eb0bf..c5221fba4c 100644 --- a/plugins/inventory/package.json +++ b/plugins/inventory/package.json @@ -31,7 +31,8 @@ "@types/jest": "^24.0.0", "@types/node": "^12.0.0", "@types/testing-library__jest-dom": "^5.0.4", - "jest-fetch-mock": "^3.0.3" + "jest-fetch-mock": "^3.0.3", + "@backstage/dev-utils": "^0.1.1-alpha.4" }, "files": [ "dist" diff --git a/plugins/inventory/tsconfig.json b/plugins/inventory/tsconfig.json index 5a3931ffce..b663b01fa2 100644 --- a/plugins/inventory/tsconfig.json +++ b/plugins/inventory/tsconfig.json @@ -1,5 +1,5 @@ { "extends": "../../tsconfig.json", - "include": ["src"], + "include": ["src", "dev"], "compilerOptions": {} } diff --git a/plugins/lighthouse/dev/index.tsx b/plugins/lighthouse/dev/index.tsx new file mode 100644 index 0000000000..812a5585d4 --- /dev/null +++ b/plugins/lighthouse/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/lighthouse/package.json b/plugins/lighthouse/package.json index 50ad4c758c..22073de3a1 100644 --- a/plugins/lighthouse/package.json +++ b/plugins/lighthouse/package.json @@ -10,7 +10,8 @@ "lint": "backstage-cli lint", "test": "backstage-cli test", "diff": "backstage-cli plugin:diff", - "clean": "backstage-cli clean" + "clean": "backstage-cli clean", + "start": "backstage-cli plugin:serve" }, "dependencies": { "@backstage/core": "^0.1.1-alpha.4", @@ -33,7 +34,8 @@ "@types/jest": "^24.0.0", "@types/node": "^12.0.0", "@types/testing-library__jest-dom": "^5.0.4", - "jest-fetch-mock": "^3.0.3" + "jest-fetch-mock": "^3.0.3", + "@backstage/dev-utils": "^0.1.1-alpha.4" }, "files": [ "dist" diff --git a/plugins/lighthouse/tsconfig.json b/plugins/lighthouse/tsconfig.json index 5a3931ffce..b663b01fa2 100644 --- a/plugins/lighthouse/tsconfig.json +++ b/plugins/lighthouse/tsconfig.json @@ -1,5 +1,5 @@ { "extends": "../../tsconfig.json", - "include": ["src"], + "include": ["src", "dev"], "compilerOptions": {} } diff --git a/plugins/scaffolder/dev/index.tsx b/plugins/scaffolder/dev/index.tsx new file mode 100644 index 0000000000..812a5585d4 --- /dev/null +++ b/plugins/scaffolder/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/scaffolder/package.json b/plugins/scaffolder/package.json index fe7db2762d..26b9fcdb17 100644 --- a/plugins/scaffolder/package.json +++ b/plugins/scaffolder/package.json @@ -31,7 +31,8 @@ "@types/jest": "^24.0.0", "@types/node": "^12.0.0", "@types/testing-library__jest-dom": "^5.0.4", - "jest-fetch-mock": "^3.0.3" + "jest-fetch-mock": "^3.0.3", + "@backstage/dev-utils": "^0.1.1-alpha.4" }, "files": [ "dist" diff --git a/plugins/scaffolder/tsconfig.json b/plugins/scaffolder/tsconfig.json index 5a3931ffce..b663b01fa2 100644 --- a/plugins/scaffolder/tsconfig.json +++ b/plugins/scaffolder/tsconfig.json @@ -1,5 +1,5 @@ { "extends": "../../tsconfig.json", - "include": ["src"], + "include": ["src", "dev"], "compilerOptions": {} } diff --git a/plugins/tech-radar/dev/index.tsx b/plugins/tech-radar/dev/index.tsx new file mode 100644 index 0000000000..812a5585d4 --- /dev/null +++ b/plugins/tech-radar/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/tech-radar/package.json b/plugins/tech-radar/package.json index ef1de13671..aaa3aaf7c2 100644 --- a/plugins/tech-radar/package.json +++ b/plugins/tech-radar/package.json @@ -10,7 +10,8 @@ "lint": "backstage-cli lint", "test": "backstage-cli test", "diff": "backstage-cli plugin:diff", - "clean": "backstage-cli clean" + "clean": "backstage-cli clean", + "start": "backstage-cli plugin:serve" }, "dependencies": { "@backstage/core": "^0.1.1-alpha.4", @@ -36,7 +37,8 @@ "@types/jest": "^24.0.0", "@types/node": "^12.0.0", "@types/testing-library__jest-dom": "^5.0.4", - "jest-fetch-mock": "^3.0.3" + "jest-fetch-mock": "^3.0.3", + "@backstage/dev-utils": "^0.1.1-alpha.4" }, "files": [ "dist" diff --git a/plugins/tech-radar/tsconfig.json b/plugins/tech-radar/tsconfig.json index 5a3931ffce..b663b01fa2 100644 --- a/plugins/tech-radar/tsconfig.json +++ b/plugins/tech-radar/tsconfig.json @@ -1,5 +1,5 @@ { "extends": "../../tsconfig.json", - "include": ["src"], + "include": ["src", "dev"], "compilerOptions": {} } diff --git a/plugins/welcome/dev/index.tsx b/plugins/welcome/dev/index.tsx new file mode 100644 index 0000000000..812a5585d4 --- /dev/null +++ b/plugins/welcome/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/welcome/package.json b/plugins/welcome/package.json index 47ff206342..4898d6b07d 100644 --- a/plugins/welcome/package.json +++ b/plugins/welcome/package.json @@ -10,7 +10,8 @@ "lint": "backstage-cli lint", "test": "backstage-cli test", "diff": "backstage-cli plugin:diff", - "clean": "backstage-cli clean" + "clean": "backstage-cli clean", + "start": "backstage-cli plugin:serve" }, "dependencies": { "@backstage/core": "^0.1.1-alpha.4", @@ -31,7 +32,8 @@ "@types/jest": "^24.0.0", "@types/node": "^12.0.0", "@types/testing-library__jest-dom": "^5.0.4", - "jest-fetch-mock": "^3.0.3" + "jest-fetch-mock": "^3.0.3", + "@backstage/dev-utils": "^0.1.1-alpha.4" }, "files": [ "dist" diff --git a/plugins/welcome/tsconfig.json b/plugins/welcome/tsconfig.json index 5a3931ffce..b663b01fa2 100644 --- a/plugins/welcome/tsconfig.json +++ b/plugins/welcome/tsconfig.json @@ -1,5 +1,5 @@ { "extends": "../../tsconfig.json", - "include": ["src"], + "include": ["src", "dev"], "compilerOptions": {} } From 81cb54d52b3ffb7f91371a5f43712e8b56b0c714 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Fri, 8 May 2020 18:53:04 +0200 Subject: [PATCH 2/3] plugins/lighthouse: add lighthouse api to dev env --- plugins/lighthouse/dev/index.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/lighthouse/dev/index.tsx b/plugins/lighthouse/dev/index.tsx index 812a5585d4..6496fb658a 100644 --- a/plugins/lighthouse/dev/index.tsx +++ b/plugins/lighthouse/dev/index.tsx @@ -16,5 +16,13 @@ import { createDevApp } from '@backstage/dev-utils'; import { plugin } from '../src/plugin'; +import { lighthouseApiRef, LighthouseRestApi } from '../src'; -createDevApp().registerPlugin(plugin).render(); +createDevApp() + .registerPlugin(plugin) + .registerApiFactory({ + implements: lighthouseApiRef, + deps: {}, + factory: () => new LighthouseRestApi('http://localhost:3003'), + }) + .render(); From 242427be7ba55c834cab93cefad1b84d99007b29 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Fri, 8 May 2020 18:53:32 +0200 Subject: [PATCH 3/3] plugins/tech-radar: add lighthouse api to dev env --- plugins/tech-radar/dev/index.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/tech-radar/dev/index.tsx b/plugins/tech-radar/dev/index.tsx index 812a5585d4..ac19b63a90 100644 --- a/plugins/tech-radar/dev/index.tsx +++ b/plugins/tech-radar/dev/index.tsx @@ -16,5 +16,13 @@ import { createDevApp } from '@backstage/dev-utils'; import { plugin } from '../src/plugin'; +import { techRadarApiRef, TechRadar } from '../src'; -createDevApp().registerPlugin(plugin).render(); +createDevApp() + .registerPlugin(plugin) + .registerApiFactory({ + implements: techRadarApiRef, + deps: {}, + factory: () => new TechRadar({ width: 1500, height: 800 }), + }) + .render();