optional dependencies in plugin:diff

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2021-09-27 13:29:51 +02:00
parent 1e48d8cbde
commit 906de40f57
7 changed files with 10 additions and 3 deletions
+1
View File
@@ -36,6 +36,7 @@
},
"devDependencies": {
"@backstage/cli": "^0.7.13",
"@types/jest": "^26.0.7",
"msw": "^0.29.0"
},
"files": [
+1
View File
@@ -42,6 +42,7 @@
},
"devDependencies": {
"@backstage/cli": "^0.7.13",
"@types/jest": "^26.0.7",
"@types/lodash": "^4.14.151",
"yaml": "^1.9.2"
},
+3 -2
View File
@@ -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);
}
}
+2 -1
View File
@@ -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"
+1
View File
@@ -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"
},
+1
View File
@@ -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"
+1
View File
@@ -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": [