From a7c9b8a078302cf1f6a1a70c24ab6f46e0520e28 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 16 Jun 2020 20:41:14 +0200 Subject: [PATCH 1/5] packages/cli: added backend:build --- packages/cli/src/commands/backend/build.ts | 23 ++++++++++++++++++++++ packages/cli/src/index.ts | 5 +++++ 2 files changed, 28 insertions(+) create mode 100644 packages/cli/src/commands/backend/build.ts diff --git a/packages/cli/src/commands/backend/build.ts b/packages/cli/src/commands/backend/build.ts new file mode 100644 index 0000000000..a9cdc51fa9 --- /dev/null +++ b/packages/cli/src/commands/backend/build.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 { buildPackage, Output } from '../../lib/packager'; + +export default async () => { + await buildPackage({ + outputs: new Set([Output.cjs, Output.types]), + }); +}; diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index ea71dc6485..a8b6250a20 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -41,6 +41,11 @@ const main = (argv: string[]) => { .option('--check', 'Enable type checking and linting') .action(lazyAction(() => import('./commands/app/serve'), 'default')); + program + .command('backend:build') + .description('Build a backend plugin') + .action(lazyAction(() => import('./commands/backend/build'), 'default')); + program .command('backend:dev') .description('Start local development server with HMR for the backend') From 76fd9f9401331114852cb42a14c9b3d7581760ad Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 16 Jun 2020 19:16:02 +0200 Subject: [PATCH 2/5] packages,plugins: use backend:build for all backend packages + publish config and no tsconfig --- packages/backend-common/package.json | 9 ++-- packages/backend-common/tsconfig.json | 14 ------- packages/backend/package.json | 16 ++------ packages/backend/tsconfig.json | 15 ------- plugins/auth-backend/package.json | 17 ++++---- plugins/auth-backend/tsconfig.json | 15 ------- plugins/catalog-backend/package.json | 18 ++++---- plugins/catalog-backend/tsconfig.json | 16 -------- plugins/identity-backend/package.json | 17 ++++---- plugins/identity-backend/tsconfig.json | 15 ------- plugins/scaffolder-backend/package.json | 8 +++- plugins/scaffolder-backend/tsconfig.json | 16 -------- plugins/sentry-backend/package.json | 17 ++++---- plugins/sentry-backend/tsconfig.json | 15 ------- yarn.lock | 52 +----------------------- 15 files changed, 53 insertions(+), 207 deletions(-) delete mode 100644 packages/backend-common/tsconfig.json delete mode 100644 packages/backend/tsconfig.json delete mode 100644 plugins/auth-backend/tsconfig.json delete mode 100644 plugins/catalog-backend/tsconfig.json delete mode 100644 plugins/identity-backend/tsconfig.json delete mode 100644 plugins/scaffolder-backend/tsconfig.json delete mode 100644 plugins/sentry-backend/tsconfig.json diff --git a/packages/backend-common/package.json b/packages/backend-common/package.json index 9b92540488..e18029ed8c 100644 --- a/packages/backend-common/package.json +++ b/packages/backend-common/package.json @@ -6,7 +6,9 @@ "types": "src/index.ts", "private": false, "publishConfig": { - "access": "public" + "access": "public", + "main": "dist/index.cjs.js", + "types": "dist/index.d.ts" }, "homepage": "https://backstage.io", "repository": { @@ -19,7 +21,7 @@ ], "license": "Apache-2.0", "scripts": { - "build": "backstage-cli build-cache -- tsc", + "build": "backstage-cli build --outputs cjs,types", "lint": "backstage-cli lint", "test": "backstage-cli test", "prepack": "backstage-cli prepack", @@ -50,8 +52,7 @@ "http-errors": "^1.7.3", "jest": "^26.0.1", "jest-fetch-mock": "^3.0.3", - "supertest": "^4.0.2", - "typescript": "^3.9.2" + "supertest": "^4.0.2" }, "files": [ "dist" diff --git a/packages/backend-common/tsconfig.json b/packages/backend-common/tsconfig.json deleted file mode 100644 index 2e645bef0b..0000000000 --- a/packages/backend-common/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "include": ["src"], - "compilerOptions": { - "outDir": "dist", - "incremental": true, - "sourceMap": true, - "declaration": true, - "strict": true, - "target": "ES2019", - "module": "commonjs", - "esModuleInterop": true, - "types": ["node", "jest", "webpack-env"] - } -} diff --git a/packages/backend/package.json b/packages/backend/package.json index 9079c3d503..7e9dbb71a7 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -1,7 +1,7 @@ { "name": "example-backend", "version": "0.1.1-alpha.8", - "main": "dist", + "main": "dist/index.cjs.js", "types": "src/index.ts", "private": true, "license": "Apache-2.0", @@ -9,7 +9,7 @@ "node": ">=12" }, "scripts": { - "build": "tsc", + "build": "backstage-cli backend:build", "start": "backstage-cli backend:dev", "lint": "backstage-cli lint", "test": "backstage-cli test", @@ -24,7 +24,6 @@ "@backstage/plugin-identity-backend": "^0.1.1-alpha.8", "@backstage/plugin-scaffolder-backend": "^0.1.1-alpha.8", "@backstage/plugin-sentry-backend": "^0.1.1-alpha.8", - "esm": "^3.2.25", "express": "^4.17.1", "knex": "^0.21.1", "sqlite3": "^4.2.0", @@ -34,15 +33,6 @@ "@backstage/cli": "^0.1.1-alpha.8", "@types/express": "^4.17.6", "@types/express-serve-static-core": "^4.17.5", - "@types/helmet": "^0.0.47", - "jest": "^26.0.1", - "tsc-watch": "^4.2.3", - "typescript": "^3.9.2" - }, - "nodemonConfig": { - "watch": [ - "./dist", - "node_modules/@backstage*" - ] + "@types/helmet": "^0.0.47" } } diff --git a/packages/backend/tsconfig.json b/packages/backend/tsconfig.json deleted file mode 100644 index 269b22607c..0000000000 --- a/packages/backend/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "include": ["src"], - "compilerOptions": { - "outDir": "dist", - "incremental": true, - "sourceMap": true, - "declaration": true, - "strict": true, - "target": "es2019", - "module": "commonjs", - "esModuleInterop": true, - "lib": ["es2019", "dom"], - "types": ["node", "jest", "webpack-env"] - } -} diff --git a/plugins/auth-backend/package.json b/plugins/auth-backend/package.json index 5eff22126d..69e4a99acc 100644 --- a/plugins/auth-backend/package.json +++ b/plugins/auth-backend/package.json @@ -5,9 +5,14 @@ "types": "src/index.ts", "license": "Apache-2.0", "private": true, + "publishConfig": { + "access": "public", + "main": "dist/index.cjs.js", + "types": "dist/index.d.ts" + }, "scripts": { - "start": "tsc-watch --onFirstSuccess \"cross-env NODE_ENV=development nodemon dist/run.js\"", - "build": "tsc", + "start": "backstage-cli backend:dev", + "build": "backstage-cli backend:build", "lint": "backstage-cli lint", "test": "backstage-cli test", "prepack": "backstage-cli prepack", @@ -42,13 +47,9 @@ "@backstage/cli": "^0.1.1-alpha.8", "@types/body-parser": "^1.19.0", "@types/passport-saml": "^1.1.2", - "jest-fetch-mock": "^3.0.3", - "tsc-watch": "^4.2.3" + "jest-fetch-mock": "^3.0.3" }, "files": [ "dist" - ], - "nodemonConfig": { - "watch": "./dist" - } + ] } diff --git a/plugins/auth-backend/tsconfig.json b/plugins/auth-backend/tsconfig.json deleted file mode 100644 index 6f1acf8dce..0000000000 --- a/plugins/auth-backend/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "include": ["src"], - "compilerOptions": { - "outDir": "dist", - "incremental": true, - "sourceMap": true, - "declaration": true, - "strict": true, - "target": "es2019", - "module": "commonjs", - "esModuleInterop": true, - "lib": ["es2019"], - "types": ["node", "jest", "webpack-env"] - } -} diff --git a/plugins/catalog-backend/package.json b/plugins/catalog-backend/package.json index e8b43de86a..a350ab4454 100644 --- a/plugins/catalog-backend/package.json +++ b/plugins/catalog-backend/package.json @@ -5,9 +5,14 @@ "types": "src/index.ts", "license": "Apache-2.0", "private": true, + "publishConfig": { + "access": "public", + "main": "dist/index.cjs.js", + "types": "dist/index.d.ts" + }, "scripts": { - "start": "backstage-cli watch-deps --build -- tsc-watch --onFirstSuccess \\\"cross-env NODE_ENV=development nodemon -r esm dist/run.js\\\"", - "build": "tsc", + "start": "backstage-cli backend:dev", + "build": "backstage-cli backend:build", "lint": "backstage-cli lint", "test": "backstage-cli test", "prepack": "backstage-cli prepack", @@ -18,7 +23,6 @@ "dependencies": { "@backstage/backend-common": "^0.1.1-alpha.8", "@backstage/catalog-model": "^0.1.1-alpha.8", - "esm": "^3.2.25", "express": "^4.17.1", "express-promise-router": "^3.0.3", "fs-extra": "^9.0.0", @@ -41,14 +45,10 @@ "@types/uuid": "^8.0.0", "@types/yup": "^0.28.2", "jest-fetch-mock": "^3.0.3", - "supertest": "^4.0.2", - "tsc-watch": "^4.2.3" + "supertest": "^4.0.2" }, "files": [ "dist", "migrations" - ], - "nodemonConfig": { - "watch": "./dist" - } + ] } diff --git a/plugins/catalog-backend/tsconfig.json b/plugins/catalog-backend/tsconfig.json deleted file mode 100644 index 9ca38dca27..0000000000 --- a/plugins/catalog-backend/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "include": ["src"], - "compilerOptions": { - "outDir": "dist", - "incremental": true, - "sourceMap": true, - "declaration": true, - "strict": true, - "target": "es2019", - "module": "commonjs", - "esModuleInterop": true, - "allowJs": true, - "lib": ["es2019"], - "types": ["node", "jest", "webpack-env"] - } -} diff --git a/plugins/identity-backend/package.json b/plugins/identity-backend/package.json index ae7526daa2..862fb273d2 100644 --- a/plugins/identity-backend/package.json +++ b/plugins/identity-backend/package.json @@ -5,9 +5,14 @@ "types": "src/index.ts", "license": "Apache-2.0", "private": true, + "publishConfig": { + "access": "public", + "main": "dist/index.cjs.js", + "types": "dist/index.d.ts" + }, "scripts": { - "start": "tsc-watch --onFirstSuccess \"cross-env NODE_ENV=development nodemon dist/run.js\"", - "build": "tsc", + "start": "backstage-cli backend:dev", + "build": "backstage-cli backend:build", "lint": "backstage-cli lint", "test": "backstage-cli test", "prepack": "backstage-cli prepack", @@ -28,13 +33,9 @@ }, "devDependencies": { "@backstage/cli": "^0.1.1-alpha.8", - "jest-fetch-mock": "^3.0.3", - "tsc-watch": "^4.2.3" + "jest-fetch-mock": "^3.0.3" }, "files": [ "dist" - ], - "nodemonConfig": { - "watch": "./dist" - } + ] } diff --git a/plugins/identity-backend/tsconfig.json b/plugins/identity-backend/tsconfig.json deleted file mode 100644 index 6f1acf8dce..0000000000 --- a/plugins/identity-backend/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "include": ["src"], - "compilerOptions": { - "outDir": "dist", - "incremental": true, - "sourceMap": true, - "declaration": true, - "strict": true, - "target": "es2019", - "module": "commonjs", - "esModuleInterop": true, - "lib": ["es2019"], - "types": ["node", "jest", "webpack-env"] - } -} diff --git a/plugins/scaffolder-backend/package.json b/plugins/scaffolder-backend/package.json index 2408471229..3d8d95164e 100644 --- a/plugins/scaffolder-backend/package.json +++ b/plugins/scaffolder-backend/package.json @@ -5,8 +5,14 @@ "types": "src/index.ts", "license": "Apache-2.0", "private": true, + "publishConfig": { + "access": "public", + "main": "dist/index.cjs.js", + "types": "dist/index.d.ts" + }, "scripts": { - "build": "tsc", + "start": "backstage-cli backend:dev", + "build": "backstage-cli backend:build", "lint": "backstage-cli lint", "test": "backstage-cli test", "prepack": "backstage-cli prepack", diff --git a/plugins/scaffolder-backend/tsconfig.json b/plugins/scaffolder-backend/tsconfig.json deleted file mode 100644 index 9ca38dca27..0000000000 --- a/plugins/scaffolder-backend/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "include": ["src"], - "compilerOptions": { - "outDir": "dist", - "incremental": true, - "sourceMap": true, - "declaration": true, - "strict": true, - "target": "es2019", - "module": "commonjs", - "esModuleInterop": true, - "allowJs": true, - "lib": ["es2019"], - "types": ["node", "jest", "webpack-env"] - } -} diff --git a/plugins/sentry-backend/package.json b/plugins/sentry-backend/package.json index 03846ea5a9..8652ecda7c 100644 --- a/plugins/sentry-backend/package.json +++ b/plugins/sentry-backend/package.json @@ -5,9 +5,14 @@ "types": "src/index.ts", "license": "Apache-2.0", "private": true, + "publishConfig": { + "access": "public", + "main": "dist/index.cjs.js", + "types": "dist/index.d.ts" + }, "scripts": { - "start": "tsc-watch --onFirstSuccess \"cross-env NODE_ENV=development nodemon dist/run.js\"", - "build": "tsc", + "start": "backstage-cli backend:dev", + "build": "backstage-cli backend:build", "lint": "backstage-cli lint", "test": "backstage-cli test", "prepack": "backstage-cli prepack", @@ -29,13 +34,9 @@ }, "devDependencies": { "@backstage/cli": "^0.1.1-alpha.8", - "jest-fetch-mock": "^3.0.3", - "tsc-watch": "^4.2.3" + "jest-fetch-mock": "^3.0.3" }, "files": [ "dist" - ], - "nodemonConfig": { - "watch": "./dist" - } + ] } diff --git a/plugins/sentry-backend/tsconfig.json b/plugins/sentry-backend/tsconfig.json deleted file mode 100644 index 6f1acf8dce..0000000000 --- a/plugins/sentry-backend/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "include": ["src"], - "compilerOptions": { - "outDir": "dist", - "incremental": true, - "sourceMap": true, - "declaration": true, - "strict": true, - "target": "es2019", - "module": "commonjs", - "esModuleInterop": true, - "lib": ["es2019"], - "types": ["node", "jest", "webpack-env"] - } -} diff --git a/yarn.lock b/yarn.lock index 2afeb2eb37..3848453d65 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6848,15 +6848,6 @@ cross-spawn@7.0.1: shebang-command "^2.0.0" which "^2.0.1" -cross-spawn@^5.1.0: - version "5.1.0" - resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" - integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk= - dependencies: - lru-cache "^4.0.1" - shebang-command "^1.2.0" - which "^1.2.9" - cross-spawn@^7.0.0, cross-spawn@^7.0.1, cross-spawn@^7.0.2: version "7.0.3" resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" @@ -12555,14 +12546,6 @@ lowlight@~1.11.0: fault "^1.0.2" highlight.js "~9.13.0" -lru-cache@^4.0.1: - version "4.1.5" - resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" - integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== - dependencies: - pseudomap "^1.0.2" - yallist "^2.1.2" - lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" @@ -13330,11 +13313,6 @@ nocache@2.1.0: resolved "https://registry.npmjs.org/nocache/-/nocache-2.1.0.tgz#120c9ffec43b5729b1d5de88cd71aa75a0ba491f" integrity sha512-0L9FvHG3nfnnmaEQPjT9xhfN4ISk0A8/2j4M37Np4mcDesJjHgEUfgPhdCyZuFI954tjokaIj/A3NdpFNdEh4Q== -node-cleanup@^2.1.2: - version "2.1.2" - resolved "https://registry.npmjs.org/node-cleanup/-/node-cleanup-2.1.2.tgz#7ac19abd297e09a7f72a71545d951b517e4dde2c" - integrity sha1-esGavSl+Caf3KnFUXZUbUX5N3iw= - node-dir@^0.1.10: version "0.1.17" resolved "https://registry.npmjs.org/node-dir/-/node-dir-0.1.17.tgz#5f5665d93351335caabef8f1c554516cf5f1e4e5" @@ -15176,18 +15154,13 @@ prr@~1.0.1: resolved "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" integrity sha1-0/wRS6BplaRexok/SEzrHXj19HY= -ps-tree@1.2.0, ps-tree@^1.2.0: +ps-tree@1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/ps-tree/-/ps-tree-1.2.0.tgz#5e7425b89508736cdd4f2224d028f7bb3f722ebd" integrity sha512-0VnamPPYHl4uaU/nSFeZZpR21QAWRz+sRv4iW9+v/GS/J5U5iZB5BNN6J0RMoOvdx2gWM2+ZFMIm58q24e4UYA== dependencies: event-stream "=3.3.4" -pseudomap@^1.0.2: - version "1.0.2" - resolved "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" - integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= - psl@^1.1.28: version "1.8.0" resolved "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24" @@ -17430,11 +17403,6 @@ string-argv@0.3.1: resolved "https://registry.npmjs.org/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da" integrity sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg== -string-argv@^0.1.1: - version "0.1.2" - resolved "https://registry.npmjs.org/string-argv/-/string-argv-0.1.2.tgz#c5b7bc03fb2b11983ba3a72333dd0559e77e4738" - integrity sha512-mBqPGEOMNJKXRo7z0keX0wlAhbBAjilUdPW13nN0PecVryZxdHIeM7TqbsSUA7VYuS00HGC6mojP7DlQzfa9ZA== - string-hash@^1.1.1: version "1.1.3" resolved "https://registry.npmjs.org/string-hash/-/string-hash-1.1.3.tgz#e8aafc0ac1855b4666929ed7dd1275df5d6c811b" @@ -18333,17 +18301,6 @@ ts-pnp@^1.1.2: resolved "https://registry.npmjs.org/ts-pnp/-/ts-pnp-1.1.6.tgz#389a24396d425a0d3162e96d2b4638900fdc289a" integrity sha512-CrG5GqAAzMT7144Cl+UIFP7mz/iIhiy+xQ6GGcnjTezhALT02uPMRw7tgDSESgB5MsfKt55+GPWw4ir1kVtMIQ== -tsc-watch@^4.2.3: - version "4.2.8" - resolved "https://registry.npmjs.org/tsc-watch/-/tsc-watch-4.2.8.tgz#cb8639bf507738dfa64590504f539a2f525d3a7b" - integrity sha512-EtWdmVZYFxTxSHqtmpowtvC/son28Hgl3qxYnD6sy+uGQXsWYDQxwmL8EneWca2kzAIYNZq3CGrUdK1jjbL4Vw== - dependencies: - cross-spawn "^5.1.0" - node-cleanup "^2.1.2" - ps-tree "^1.2.0" - string-argv "^0.1.1" - strip-ansi "^4.0.0" - tsconfig-paths@^3.9.0: version "3.9.0" resolved "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz#098547a6c4448807e8fcb8eae081064ee9a3c90b" @@ -18462,7 +18419,7 @@ typedarray@^0.0.6: resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@^3.9.2, typescript@^3.9.3: +typescript@^3.9.3: version "3.9.5" resolved "https://registry.npmjs.org/typescript/-/typescript-3.9.5.tgz#586f0dba300cde8be52dd1ac4f7e1009c1b13f36" integrity sha512-hSAifV3k+i6lEoCJ2k6R2Z/rp/H3+8sdmcn5NrS3/3kE7+RyZXm9aqvxWqjEXHAd8b0pShatpcdMTvEdvAJltQ== @@ -19510,11 +19467,6 @@ y18n@^4.0.0: resolved "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== -yallist@^2.1.2: - version "2.1.2" - resolved "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" - integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= - yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: version "3.1.1" resolved "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" From 6c25e612791934f13fe13ad9efaf48d749ec4b13 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Wed, 17 Jun 2020 09:41:13 +0200 Subject: [PATCH 3/5] packages/backend-common: move express and cors types to deps --- packages/backend-common/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend-common/package.json b/packages/backend-common/package.json index e18029ed8c..c265a7f489 100644 --- a/packages/backend-common/package.json +++ b/packages/backend-common/package.json @@ -29,6 +29,8 @@ "clean": "backstage-cli clean" }, "dependencies": { + "@types/cors": "^2.8.6", + "@types/express": "^4.17.6", "compression": "^1.7.4", "cors": "^2.8.5", "express": "^4.17.1", @@ -40,8 +42,6 @@ "devDependencies": { "@backstage/cli": "^0.1.1-alpha.8", "@types/compression": "^1.7.0", - "@types/cors": "^2.8.6", - "@types/express": "^4.17.6", "@types/http-errors": "^1.6.3", "@types/morgan": "^1.9.0", "@types/stoppable": "^1.1.0", From 947c7524688e47b8bbd9f625f3ce305a42a5658d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20=C3=85lund?= Date: Wed, 17 Jun 2020 09:54:52 +0200 Subject: [PATCH 4/5] Add Welcome msgs to catalog (#1306) * Add Welcome msgs to catalog * Fix importing of greetings * Fix broken test --- plugins/catalog/package.json | 1 + .../components/CatalogPage/CatalogLayout.tsx | 46 ++++++ .../CatalogPage/CatalogPage.test.tsx | 2 +- .../components/CatalogPage/CatalogPage.tsx | 13 +- .../utils/locales/goodAfternoon.locales.json | 134 ++++++++++++++++++ .../utils/locales/goodEvening.locales.json | 100 +++++++++++++ .../utils/locales/goodMorning.locales.json | 64 +++++++++ .../components/CatalogPage/utils/timeUtil.js | 72 ++++++++++ .../CatalogPage/utils/timeUtil.test.js | 44 ++++++ yarn.lock | 2 +- 10 files changed, 466 insertions(+), 12 deletions(-) create mode 100644 plugins/catalog/src/components/CatalogPage/CatalogLayout.tsx create mode 100644 plugins/catalog/src/components/CatalogPage/utils/locales/goodAfternoon.locales.json create mode 100644 plugins/catalog/src/components/CatalogPage/utils/locales/goodEvening.locales.json create mode 100644 plugins/catalog/src/components/CatalogPage/utils/locales/goodMorning.locales.json create mode 100644 plugins/catalog/src/components/CatalogPage/utils/timeUtil.js create mode 100644 plugins/catalog/src/components/CatalogPage/utils/timeUtil.test.js diff --git a/plugins/catalog/package.json b/plugins/catalog/package.json index eb8672bc42..d7329e4b2f 100644 --- a/plugins/catalog/package.json +++ b/plugins/catalog/package.json @@ -30,6 +30,7 @@ "@material-ui/core": "^4.9.1", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.45", + "moment": "^2.26.0", "react": "^16.13.1", "react-dom": "^16.13.1", "react-router": "^6.0.0-alpha.5", diff --git a/plugins/catalog/src/components/CatalogPage/CatalogLayout.tsx b/plugins/catalog/src/components/CatalogPage/CatalogLayout.tsx new file mode 100644 index 0000000000..9eccf81818 --- /dev/null +++ b/plugins/catalog/src/components/CatalogPage/CatalogLayout.tsx @@ -0,0 +1,46 @@ +/* + * 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 { Header, HomepageTimer, Page, pageTheme } from '@backstage/core'; +import { getTimeBasedGreeting } from './utils/timeUtil'; + +const CatalogLayout: FC<{}> = props => { + const { children } = props; + // const profile = useProfile(); + const profile = { givenName: 'friend' }; + const greeting = getTimeBasedGreeting(); + + return ( + +
+ +
+ {children} +
+ ); +}; + +export default CatalogLayout; diff --git a/plugins/catalog/src/components/CatalogPage/CatalogPage.test.tsx b/plugins/catalog/src/components/CatalogPage/CatalogPage.test.tsx index 7601031699..2e1989323c 100644 --- a/plugins/catalog/src/components/CatalogPage/CatalogPage.test.tsx +++ b/plugins/catalog/src/components/CatalogPage/CatalogPage.test.tsx @@ -64,7 +64,7 @@ describe('CatalogPage', () => { ), ); expect( - await rendered.findByText('Keep track of your software'), + await rendered.findByText('Backstage Service Catalog'), ).toBeInTheDocument(); }); }); diff --git a/plugins/catalog/src/components/CatalogPage/CatalogPage.tsx b/plugins/catalog/src/components/CatalogPage/CatalogPage.tsx index c8074b1cc9..3ba63188c1 100644 --- a/plugins/catalog/src/components/CatalogPage/CatalogPage.tsx +++ b/plugins/catalog/src/components/CatalogPage/CatalogPage.tsx @@ -19,14 +19,11 @@ import { Content, ContentHeader, DismissableBanner, - Header, HeaderTabs, - HomepageTimer, - Page, - pageTheme, SupportButton, useApi, } from '@backstage/core'; +import CatalogLayout from './CatalogLayout'; import { rootRoute as scaffolderRootRoute } from '@backstage/plugin-scaffolder'; import { Button, Link, makeStyles, Typography } from '@material-ui/core'; import Edit from '@material-ui/icons/Edit'; @@ -155,10 +152,7 @@ export const CatalogPage: FC<{}> = () => { ]; return ( - -
- -
+ = () => { } id="catalog_page_welcome_banner" /> - + + + + + ); +}; + +export default TemplateCard;