From 1e48d8cbde8ca05459dbd14895289b33d43ad85e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Fri, 17 Sep 2021 13:50:43 +0200 Subject: [PATCH 1/2] just some playing around with depcheck MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- packages/catalog-client/package.json | 2 -- packages/catalog-model/package.json | 2 -- plugins/catalog-backend-module-ldap/package.json | 4 +--- plugins/catalog-backend/package.json | 3 --- plugins/catalog-graph/package.json | 6 +----- plugins/catalog-graphql/package.json | 7 +------ plugins/catalog-import/package.json | 4 ---- plugins/catalog-react/package.json | 5 ----- plugins/catalog/package.json | 12 +----------- yarn.lock | 2 +- 10 files changed, 5 insertions(+), 42 deletions(-) diff --git a/packages/catalog-client/package.json b/packages/catalog-client/package.json index 8520164f91..42b0be8030 100644 --- a/packages/catalog-client/package.json +++ b/packages/catalog-client/package.json @@ -31,13 +31,11 @@ }, "dependencies": { "@backstage/catalog-model": "^0.9.3", - "@backstage/config": "^0.1.10", "@backstage/errors": "^0.1.2", "cross-fetch": "^3.0.6" }, "devDependencies": { "@backstage/cli": "^0.7.13", - "@types/jest": "^26.0.7", "msw": "^0.29.0" }, "files": [ diff --git a/packages/catalog-model/package.json b/packages/catalog-model/package.json index 0bea531816..3c986b3292 100644 --- a/packages/catalog-model/package.json +++ b/packages/catalog-model/package.json @@ -42,8 +42,6 @@ }, "devDependencies": { "@backstage/cli": "^0.7.13", - "@types/express": "^4.17.6", - "@types/jest": "^26.0.7", "@types/lodash": "^4.14.151", "yaml": "^1.9.2" }, diff --git a/plugins/catalog-backend-module-ldap/package.json b/plugins/catalog-backend-module-ldap/package.json index a51c0ceceb..f2e6facc3f 100644 --- a/plugins/catalog-backend-module-ldap/package.json +++ b/plugins/catalog-backend-module-ldap/package.json @@ -39,9 +39,7 @@ }, "devDependencies": { "@backstage/cli": "^0.7.13", - "@backstage/test-utils": "^0.1.16", - "@types/lodash": "^4.14.151", - "msw": "^0.29.0" + "@types/lodash": "^4.14.151" }, "files": [ "dist", diff --git a/plugins/catalog-backend/package.json b/plugins/catalog-backend/package.json index b9ccd40862..c9aadf1bf7 100644 --- a/plugins/catalog-backend/package.json +++ b/plugins/catalog-backend/package.json @@ -36,7 +36,6 @@ "@backstage/config": "^0.1.10", "@backstage/errors": "^0.1.2", "@backstage/integration": "^0.6.5", - "@backstage/plugin-search-backend-node": "^0.4.2", "@backstage/search-common": "^0.2.0", "@octokit/graphql": "^4.5.8", "@types/express": "^4.17.6", @@ -53,10 +52,8 @@ "knex": "^0.95.1", "lodash": "^4.17.21", "luxon": "^2.0.2", - "morgan": "^1.10.0", "p-limit": "^3.0.2", "prom-client": "^13.2.0", - "qs": "^6.9.4", "uuid": "^8.0.0", "winston": "^3.2.1", "yaml": "^1.9.2", diff --git a/plugins/catalog-graph/package.json b/plugins/catalog-graph/package.json index 243c046ab5..073a4e7745 100644 --- a/plugins/catalog-graph/package.json +++ b/plugins/catalog-graph/package.json @@ -48,11 +48,7 @@ "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", - "@testing-library/react-hooks": "^3.4.2", - "@types/jest": "^26.0.7", - "@types/node": "^14.14.32", - "cross-fetch": "^3.0.6", - "msw": "^0.29.0" + "@testing-library/react-hooks": "^3.4.2" }, "files": [ "dist" diff --git a/plugins/catalog-graphql/package.json b/plugins/catalog-graphql/package.json index a6e9f6efb8..f0c8b3a9a8 100644 --- a/plugins/catalog-graphql/package.json +++ b/plugins/catalog-graphql/package.json @@ -31,7 +31,6 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.9.0", "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.8", "@graphql-modules/core": "^0.7.17", @@ -48,12 +47,8 @@ "@graphql-codegen/cli": "^1.21.3", "@graphql-codegen/typescript": "^1.17.7", "@graphql-codegen/typescript-resolvers": "^1.17.7", - "@types/express": "^4.17.7", - "@types/supertest": "^2.0.8", "eslint-plugin-graphql": "^4.0.0", - "msw": "^0.29.0", - "supertest": "^6.1.3", - "ts-node": "^10.0.0" + "msw": "^0.29.0" }, "files": [ "dist" diff --git a/plugins/catalog-import/package.json b/plugins/catalog-import/package.json index 832a4e0cdf..cbd712369f 100644 --- a/plugins/catalog-import/package.json +++ b/plugins/catalog-import/package.json @@ -38,7 +38,6 @@ "@backstage/integration": "^0.6.5", "@backstage/integration-react": "^0.1.10", "@backstage/plugin-catalog-react": "^0.5.0", - "@backstage/theme": "^0.2.10", "@material-ui/core": "^4.12.2", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.57", @@ -50,7 +49,6 @@ "react-dom": "^16.13.1", "react-hook-form": "^7.12.2", "react-router": "6.0.0-beta.0", - "react-router-dom": "6.0.0-beta.0", "react-use": "^17.2.4", "yaml": "^1.10.0", "lodash": "^4.17.21" @@ -64,8 +62,6 @@ "@testing-library/react": "^11.2.5", "@testing-library/react-hooks": "^3.3.0", "@testing-library/user-event": "^13.1.8", - "@types/jest": "^26.0.7", - "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", "msw": "^0.29.0" }, diff --git a/plugins/catalog-react/package.json b/plugins/catalog-react/package.json index 0df00be9b3..acafd0da3d 100644 --- a/plugins/catalog-react/package.json +++ b/plugins/catalog-react/package.json @@ -45,22 +45,17 @@ "qs": "^6.9.4", "react": "^16.13.1", "react-router": "6.0.0-beta.0", - "react-router-dom": "6.0.0-beta.0", "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.7.13", - "@backstage/dev-utils": "^0.2.10", "@backstage/test-utils": "^0.1.17", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/react-hooks": "^3.3.0", "@testing-library/user-event": "^13.1.8", - "@types/jest": "^26.0.7", "@types/jwt-decode": "^3.1.0", - "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", - "msw": "^0.29.0", "react-test-renderer": "^16.13.1" }, "files": [ diff --git a/plugins/catalog/package.json b/plugins/catalog/package.json index 9d3bd10963..71f7e9dabf 100644 --- a/plugins/catalog/package.json +++ b/plugins/catalog/package.json @@ -35,8 +35,6 @@ "@backstage/catalog-model": "^0.9.3", "@backstage/core-components": "^0.5.0", "@backstage/core-plugin-api": "^0.1.8", - "@backstage/errors": "^0.1.1", - "@backstage/integration": "^0.6.5", "@backstage/integration-react": "^0.1.10", "@backstage/plugin-catalog-react": "^0.5.0", "@backstage/theme": "^0.2.10", @@ -44,14 +42,11 @@ "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.57", "@types/react": "*", - "classnames": "^2.2.6", - "git-url-parse": "^11.6.0", "lodash": "^4.17.21", "react": "^16.13.1", "react-dom": "^16.13.1", "react-helmet": "6.1.0", "react-router": "6.0.0-beta.0", - "react-router-dom": "6.0.0-beta.0", "react-use": "^17.2.4" }, "devDependencies": { @@ -61,13 +56,8 @@ "@backstage/test-utils": "^0.1.17", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/react-hooks": "^3.3.0", "@testing-library/user-event": "^13.1.8", - "@types/jest": "^26.0.7", - "@types/node": "^14.14.32", - "cross-fetch": "^3.0.6", - "msw": "^0.29.0", - "react-test-renderer": "^16.13.1" + "cross-fetch": "^3.0.6" }, "files": [ "dist" diff --git a/yarn.lock b/yarn.lock index 7657498ff7..db8788cc9d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6777,7 +6777,7 @@ "@types/express" "*" "@types/xml2js" "*" -"@types/express@*", "@types/express@^4.17.12", "@types/express@^4.17.6", "@types/express@^4.17.7": +"@types/express@*", "@types/express@^4.17.12", "@types/express@^4.17.6": version "4.17.12" resolved "https://registry.npmjs.org/@types/express/-/express-4.17.12.tgz#4bc1bf3cd0cfe6d3f6f2853648b40db7d54de350" integrity sha512-pTYas6FrP15B1Oa0bkN5tQMNqOcVXa9j4FTFtO8DWI9kppKib+6NJtfTOOLcwxuuYvcX2+dVG6et1SxW/Kc17Q== From 906de40f5717013d5dbabc9f76829129adf68b71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Mon, 27 Sep 2021 13:29:51 +0200 Subject: [PATCH 2/2] optional dependencies in plugin:diff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- packages/catalog-client/package.json | 1 + packages/catalog-model/package.json | 1 + packages/cli/src/lib/diff/handlers.ts | 5 +++-- plugins/catalog-graph/package.json | 3 ++- plugins/catalog-import/package.json | 1 + plugins/catalog-react/package.json | 1 + plugins/catalog/package.json | 1 + 7 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/catalog-client/package.json b/packages/catalog-client/package.json index 42b0be8030..70e65cb221 100644 --- a/packages/catalog-client/package.json +++ b/packages/catalog-client/package.json @@ -36,6 +36,7 @@ }, "devDependencies": { "@backstage/cli": "^0.7.13", + "@types/jest": "^26.0.7", "msw": "^0.29.0" }, "files": [ diff --git a/packages/catalog-model/package.json b/packages/catalog-model/package.json index 3c986b3292..e648606f48 100644 --- a/packages/catalog-model/package.json +++ b/packages/catalog-model/package.json @@ -42,6 +42,7 @@ }, "devDependencies": { "@backstage/cli": "^0.7.13", + "@types/jest": "^26.0.7", "@types/lodash": "^4.14.151", "yaml": "^1.9.2" }, diff --git a/packages/cli/src/lib/diff/handlers.ts b/packages/cli/src/lib/diff/handlers.ts index 4a17125e5a..904ed35e9a 100644 --- a/packages/cli/src/lib/diff/handlers.ts +++ b/packages/cli/src/lib/diff/handlers.ts @@ -85,6 +85,7 @@ class PackageJsonHandler { targetObj: any = this.targetPkg, prefix?: string, sort?: boolean, + optional?: boolean, ) { const fullFieldName = chalk.cyan( prefix ? `${prefix}[${fieldName}]` : fieldName, @@ -107,7 +108,7 @@ class PackageJsonHandler { } await this.write(); } - } else if (fieldName in obj) { + } else if (fieldName in obj && optional !== true) { if ( await this.prompt( `package.json is missing field ${fullFieldName}, set to ${coloredNewValue}?`, @@ -200,7 +201,7 @@ class PackageJsonHandler { continue; } - await this.syncField(key, pkgDeps, targetDeps, fieldName, true); + await this.syncField(key, pkgDeps, targetDeps, fieldName, true, true); } } diff --git a/plugins/catalog-graph/package.json b/plugins/catalog-graph/package.json index 073a4e7745..75f65a950b 100644 --- a/plugins/catalog-graph/package.json +++ b/plugins/catalog-graph/package.json @@ -48,7 +48,8 @@ "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", - "@testing-library/react-hooks": "^3.4.2" + "@testing-library/react-hooks": "^3.4.2", + "@types/jest": "^26.0.7" }, "files": [ "dist" diff --git a/plugins/catalog-import/package.json b/plugins/catalog-import/package.json index cbd712369f..091ca286d6 100644 --- a/plugins/catalog-import/package.json +++ b/plugins/catalog-import/package.json @@ -62,6 +62,7 @@ "@testing-library/react": "^11.2.5", "@testing-library/react-hooks": "^3.3.0", "@testing-library/user-event": "^13.1.8", + "@types/jest": "^26.0.7", "cross-fetch": "^3.0.6", "msw": "^0.29.0" }, diff --git a/plugins/catalog-react/package.json b/plugins/catalog-react/package.json index acafd0da3d..156cb66de2 100644 --- a/plugins/catalog-react/package.json +++ b/plugins/catalog-react/package.json @@ -54,6 +54,7 @@ "@testing-library/react": "^11.2.5", "@testing-library/react-hooks": "^3.3.0", "@testing-library/user-event": "^13.1.8", + "@types/jest": "^26.0.7", "@types/jwt-decode": "^3.1.0", "cross-fetch": "^3.0.6", "react-test-renderer": "^16.13.1" diff --git a/plugins/catalog/package.json b/plugins/catalog/package.json index 71f7e9dabf..d110bcf57f 100644 --- a/plugins/catalog/package.json +++ b/plugins/catalog/package.json @@ -57,6 +57,7 @@ "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", + "@types/jest": "^26.0.7", "cross-fetch": "^3.0.6" }, "files": [