From 99a5d903fb33da4c7fa9a21c8afdeb3d7c27369e Mon Sep 17 00:00:00 2001 From: david-heidema Date: Tue, 16 Apr 2024 10:07:50 -0500 Subject: [PATCH 01/12] Implement new backend --- .changeset/empty-avocados-jam.md | 5 ++ package.json | 2 +- packages/backend/package.json | 2 +- .../scaffolder-backend-module-utils/README.md | 14 +++++ .../package.json | 7 ++- .../src/actions/index.ts | 21 +++++++ .../src/alpha.ts | 17 ++++++ .../src/module.ts | 51 ++++++++++++++++ yarn.lock | 60 +++++++++++++++++-- 9 files changed, 172 insertions(+), 7 deletions(-) create mode 100644 .changeset/empty-avocados-jam.md create mode 100644 plugins/scaffolder-actions/scaffolder-backend-module-utils/src/actions/index.ts create mode 100644 plugins/scaffolder-actions/scaffolder-backend-module-utils/src/alpha.ts create mode 100644 plugins/scaffolder-actions/scaffolder-backend-module-utils/src/module.ts diff --git a/.changeset/empty-avocados-jam.md b/.changeset/empty-avocados-jam.md new file mode 100644 index 000000000..9078806fb --- /dev/null +++ b/.changeset/empty-avocados-jam.md @@ -0,0 +1,5 @@ +--- +'@roadiehq/scaffolder-backend-module-utils': patch +--- + +Update to new backend system diff --git a/package.json b/package.json index dc160d189..1c1642ff1 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "private": true, "engines": { - "node": "14 || 16 || 18" + "node": "14 || 16 || 18 || 20" }, "scripts": { "dev": "concurrently \"yarn start\" \"yarn start-backend\"", diff --git a/packages/backend/package.json b/packages/backend/package.json index 4f6835764..acc26627f 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -8,7 +8,7 @@ "role": "backend" }, "engines": { - "node": "14 || 16 || 18" + "node": "14 || 16 || 18 || 20" }, "scripts": { "build": "backstage-cli package build", diff --git a/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md b/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md index 5f11020ac..e4a82fbcf 100644 --- a/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md +++ b/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md @@ -93,6 +93,20 @@ return await createRouter({ }); ``` +### New backend system + +```typescript +import { createBackend } from '@backstage/backend-defaults'; +import { createBackendModule } from '@backstage/backend-plugin-api'; +import { scaffolderBackendModuleUtils } from '@roadiehq/scaffolder-backend-module-http-request'; + +const backend = createBackend(); +backend.add(import('@backstage/plugin-proxy-backend/alpha')); +backend.add(import('@backstage/plugin-scaffolder-backend/alpha')); +backend.add(scaffolderBackendModuleUtils); +backend.start(); +``` + ## Actions: ### Zip diff --git a/plugins/scaffolder-actions/scaffolder-backend-module-utils/package.json b/plugins/scaffolder-actions/scaffolder-backend-module-utils/package.json index e099011db..f8b03daf1 100644 --- a/plugins/scaffolder-actions/scaffolder-backend-module-utils/package.json +++ b/plugins/scaffolder-actions/scaffolder-backend-module-utils/package.json @@ -41,10 +41,15 @@ }, "dependencies": { "@backstage/backend-common": "^0.21.6", + "@backstage/backend-plugin-api": "^0.6.16", "@backstage/config": "^1.2.0", "@backstage/errors": "^1.2.4", "@backstage/plugin-scaffolder-backend": "^1.22.3", "@backstage/plugin-scaffolder-node": "^0.4.2", + "@types/adm-zip": "^0.5.5", + "@types/fs-extra": "^11.0.4", + "@types/lodash": "^4.17.0", + "@types/mock-fs": "^4.13.4", "adm-zip": "^0.5.9", "cross-fetch": "^3.1.4", "detect-indent": "^6.1.0", @@ -55,8 +60,8 @@ "yaml": "^2.3.4" }, "devDependencies": { - "@backstage/cli": "^0.26.2", "@backstage/backend-test-utils": "^0.3.6", + "@backstage/cli": "^0.26.2", "@testing-library/jest-dom": "^6.4.2", "@types/adm-zip": "^0.4.34", "@types/fs-extra": "^9.0.13", diff --git a/plugins/scaffolder-actions/scaffolder-backend-module-utils/src/actions/index.ts b/plugins/scaffolder-actions/scaffolder-backend-module-utils/src/actions/index.ts new file mode 100644 index 000000000..6e756e0ad --- /dev/null +++ b/plugins/scaffolder-actions/scaffolder-backend-module-utils/src/actions/index.ts @@ -0,0 +1,21 @@ +/* + * Copyright 2021 Larder Software Limited + * + * 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 * from './zip'; +export * from './fs'; +export * from './merge'; +export * from './sleep'; +export * from './jsonata'; +export * from './serialize'; diff --git a/plugins/scaffolder-actions/scaffolder-backend-module-utils/src/alpha.ts b/plugins/scaffolder-actions/scaffolder-backend-module-utils/src/alpha.ts new file mode 100644 index 000000000..3c8e63b56 --- /dev/null +++ b/plugins/scaffolder-actions/scaffolder-backend-module-utils/src/alpha.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2024 Larder Software Limited + * + * 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 * from './module'; +export { scaffolderBackendModuleUtils as default } from './module'; diff --git a/plugins/scaffolder-actions/scaffolder-backend-module-utils/src/module.ts b/plugins/scaffolder-actions/scaffolder-backend-module-utils/src/module.ts new file mode 100644 index 000000000..5ae170fad --- /dev/null +++ b/plugins/scaffolder-actions/scaffolder-backend-module-utils/src/module.ts @@ -0,0 +1,51 @@ +/* + * Copyright 2024 Larder Software Limited + * + * 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 { createBackendModule } from '@backstage/backend-plugin-api'; +import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha'; +import * as backendModuleUtils from './actions'; + +/** + * @public + * The Roadie Module for the Scaffolder Backend + */ +export const scaffolderBackendModuleUtils = createBackendModule({ + pluginId: 'scaffolder', + moduleId: 'scaffolder-backend-module-utils', + register({ registerInit }) { + registerInit({ + deps: { + scaffolder: scaffolderActionsExtensionPoint, + }, + async init({ scaffolder }) { + scaffolder.addActions( + backendModuleUtils.createAppendFileAction(), + backendModuleUtils.createJSONataAction(), + backendModuleUtils.createJsonJSONataTransformAction(), + backendModuleUtils.createMergeAction(), + backendModuleUtils.createMergeJSONAction({}), + backendModuleUtils.createParseFileAction(), + backendModuleUtils.createReplaceInFileAction(), + backendModuleUtils.createSerializeJsonAction(), + backendModuleUtils.createSerializeYamlAction(), + backendModuleUtils.createSleepAction(), + backendModuleUtils.createWriteFileAction(), + backendModuleUtils.createYamlJSONataTransformAction(), + backendModuleUtils.createZipAction(), + ); + }, + }); + }, +}); diff --git a/yarn.lock b/yarn.lock index 0e2cbe6b4..f0730bff8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11173,6 +11173,13 @@ dependencies: "@types/node" "*" +"@types/adm-zip@^0.5.5": + version "0.5.5" + resolved "https://registry.yarnpkg.com/@types/adm-zip/-/adm-zip-0.5.5.tgz#4588042726aa5f351d7ea88232e4a952f60e7c1a" + integrity sha512-YCGstVMjc4LTY5uK9/obvxBya93axZOVOyf2GSUulADzmLhYE45u2nAssCs/fWBs1Ifq5Vat75JTPwd5XZoPJw== + dependencies: + "@types/node" "*" + "@types/aria-query@^5.0.1": version "5.0.4" resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-5.0.4.tgz#1a31c3d378850d2778dabb6374d036dcba4ba708" @@ -11417,6 +11424,14 @@ "@types/qs" "*" "@types/serve-static" "*" +"@types/fs-extra@^11.0.4": + version "11.0.4" + resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-11.0.4.tgz#e16a863bb8843fba8c5004362b5a73e17becca45" + integrity sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ== + dependencies: + "@types/jsonfile" "*" + "@types/node" "*" + "@types/fs-extra@^9.0.13": version "9.0.13" resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-9.0.13.tgz#7594fbae04fe7f1918ce8b3d213f74ff44ac1f45" @@ -11551,6 +11566,13 @@ resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== +"@types/jsonfile@*": + version "6.1.4" + resolved "https://registry.yarnpkg.com/@types/jsonfile/-/jsonfile-6.1.4.tgz#614afec1a1164e7d670b4a7ad64df3e7beb7b702" + integrity sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ== + dependencies: + "@types/node" "*" + "@types/jsonwebtoken@^9.0.0": version "9.0.5" resolved "https://registry.yarnpkg.com/@types/jsonwebtoken/-/jsonwebtoken-9.0.5.tgz#0bd9b841c9e6c5a937c17656e2368f65da025588" @@ -11575,6 +11597,11 @@ resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.202.tgz#f09dbd2fb082d507178b2f2a5c7e74bd72ff98f8" integrity sha512-OvlIYQK9tNneDlS0VN54LLd5uiPCBOp7gS5Z0f1mjoJYBrtStzgmJBxONW3U6OZqdtNzZPmn9BS/7WI7BFFcFQ== +"@types/lodash@^4.17.0": + version "4.17.0" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.0.tgz#d774355e41f372d5350a4d0714abb48194a489c3" + integrity sha512-t7dhREVv6dbNj0q17X12j7yDG4bD/DHYX7o5/DbDxobP0HnGPgpRz2Ej77aL7TZT3DSw13fqUTj8J4mMnqa7WA== + "@types/long@^4.0.0": version "4.0.2" resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a" @@ -11632,7 +11659,7 @@ resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.5.tgz#ec10755e871497bcd83efe927e43ec46e8c0747e" integrity sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag== -"@types/mock-fs@^4.13.1": +"@types/mock-fs@^4.13.1", "@types/mock-fs@^4.13.4": version "4.13.4" resolved "https://registry.yarnpkg.com/@types/mock-fs/-/mock-fs-4.13.4.tgz#e73edb4b4889d44d23f1ea02d6eebe50aa30b09a" integrity sha512-mXmM0o6lULPI8z3XNnQCpL0BGxPwx1Ul1wXYEPBGl4efShyxW2Rln0JOPEWGyZaYZMM6OVXM/15zUuFMY52ljg== @@ -27631,7 +27658,16 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -27705,7 +27741,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -27719,6 +27755,13 @@ strip-ansi@5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -29818,7 +29861,7 @@ wordwrap@^1.0.0: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -29836,6 +29879,15 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.0.1, wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" From 5eabc75f6a62a81886e5f8af8031b50c1105beb6 Mon Sep 17 00:00:00 2001 From: david-heidema Date: Tue, 16 Apr 2024 10:08:21 -0500 Subject: [PATCH 02/12] Implement new backend --- yarn.lock | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/yarn.lock b/yarn.lock index f0730bff8..6353135c4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11807,13 +11807,20 @@ resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.7.tgz#50ae4353eaaddc04044279812f52c8c65857dbcb" integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ== -"@types/react-dom@*", "@types/react-dom@<18.0.0", "@types/react-dom@^18", "@types/react-dom@^18.0.0": +"@types/react-dom@*", "@types/react-dom@^18.0.0": version "18.2.23" resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.2.23.tgz#112338760f622a16d64271b408355f2f27f6302c" integrity sha512-ZQ71wgGOTmDYpnav2knkjr3qXdAFu0vsk8Ci5w3pGAIdj7/kKAyn+VsQDhXsmzzzepAiI9leWMmubXz690AI/A== dependencies: "@types/react" "*" +"@types/react-dom@<18.0.0": + version "17.0.25" + resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.25.tgz#e0e5b3571e1069625b3a3da2b279379aa33a0cb5" + integrity sha512-urx7A7UxkZQmThYA4So0NelOVjx3V4rNFVJwp0WZlbIK5eM4rNJDiN3R/E9ix0MBh6kAEojk/9YL+Te6D9zHNA== + dependencies: + "@types/react" "^17" + "@types/react-redux@^7.1.20": version "7.1.33" resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-7.1.33.tgz#53c5564f03f1ded90904e3c90f77e4bd4dc20b15" @@ -11852,7 +11859,7 @@ dependencies: "@types/react" "*" -"@types/react@*", "@types/react@^16.13.1 || ^17.0.0", "@types/react@^16.13.1 || ^17.0.0 || ^18.0.0", "@types/react@^18": +"@types/react@*", "@types/react@^16.13.1 || ^17.0.0 || ^18.0.0": version "18.2.74" resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.74.tgz#2d52eb80e4e7c4ea8812c89181d6d590b53f958c" integrity sha512-9AEqNZZyBx8OdZpxzQlaFEVCSFUM2YXJH46yPOiOpm078k6ZLOCcuAzGum/zK8YBwY+dbahVNbHrbgrAwIRlqw== @@ -11860,6 +11867,15 @@ "@types/prop-types" "*" csstype "^3.0.2" +"@types/react@^16.13.1 || ^17.0.0", "@types/react@^17": + version "17.0.80" + resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.80.tgz#a5dfc351d6a41257eb592d73d3a85d3b7dbcbb41" + integrity sha512-LrgHIu2lEtIo8M7d1FcI3BdwXWoRQwMoXOZ7+dPTW0lYREjmlHl3P0U1VD0i/9tppOuv8/sam7sOjx34TxSFbA== + dependencies: + "@types/prop-types" "*" + "@types/scheduler" "^0.16" + csstype "^3.0.2" + "@types/recharts@^1.8.14": version "1.8.29" resolved "https://registry.yarnpkg.com/@types/recharts/-/recharts-1.8.29.tgz#5e117521a65bf015b808350b45b65553ff5011f3" @@ -11902,6 +11918,11 @@ dependencies: htmlparser2 "^4.1.0" +"@types/scheduler@^0.16": + version "0.16.8" + resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.8.tgz#ce5ace04cfeabe7ef87c0091e50752e36707deff" + integrity sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A== + "@types/semver@^7.3.12", "@types/semver@^7.5.0": version "7.5.8" resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e" From 3ccec9d423d140b4ff4bef39d3876ea6e978e88e Mon Sep 17 00:00:00 2001 From: david-heidema Date: Tue, 16 Apr 2024 13:45:37 -0500 Subject: [PATCH 03/12] Update dependencies --- .../package.json | 6 +- yarn.lock | 66 +++---------------- 2 files changed, 10 insertions(+), 62 deletions(-) diff --git a/plugins/scaffolder-actions/scaffolder-backend-module-utils/package.json b/plugins/scaffolder-actions/scaffolder-backend-module-utils/package.json index f8b03daf1..ea746d0a2 100644 --- a/plugins/scaffolder-actions/scaffolder-backend-module-utils/package.json +++ b/plugins/scaffolder-actions/scaffolder-backend-module-utils/package.json @@ -46,10 +46,6 @@ "@backstage/errors": "^1.2.4", "@backstage/plugin-scaffolder-backend": "^1.22.3", "@backstage/plugin-scaffolder-node": "^0.4.2", - "@types/adm-zip": "^0.5.5", - "@types/fs-extra": "^11.0.4", - "@types/lodash": "^4.17.0", - "@types/mock-fs": "^4.13.4", "adm-zip": "^0.5.9", "cross-fetch": "^3.1.4", "detect-indent": "^6.1.0", @@ -60,8 +56,8 @@ "yaml": "^2.3.4" }, "devDependencies": { - "@backstage/backend-test-utils": "^0.3.6", "@backstage/cli": "^0.26.2", + "@backstage/backend-test-utils": "^0.3.6", "@testing-library/jest-dom": "^6.4.2", "@types/adm-zip": "^0.4.34", "@types/fs-extra": "^9.0.13", diff --git a/yarn.lock b/yarn.lock index 6353135c4..d405b7a6e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11173,13 +11173,6 @@ dependencies: "@types/node" "*" -"@types/adm-zip@^0.5.5": - version "0.5.5" - resolved "https://registry.yarnpkg.com/@types/adm-zip/-/adm-zip-0.5.5.tgz#4588042726aa5f351d7ea88232e4a952f60e7c1a" - integrity sha512-YCGstVMjc4LTY5uK9/obvxBya93axZOVOyf2GSUulADzmLhYE45u2nAssCs/fWBs1Ifq5Vat75JTPwd5XZoPJw== - dependencies: - "@types/node" "*" - "@types/aria-query@^5.0.1": version "5.0.4" resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-5.0.4.tgz#1a31c3d378850d2778dabb6374d036dcba4ba708" @@ -11424,14 +11417,6 @@ "@types/qs" "*" "@types/serve-static" "*" -"@types/fs-extra@^11.0.4": - version "11.0.4" - resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-11.0.4.tgz#e16a863bb8843fba8c5004362b5a73e17becca45" - integrity sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ== - dependencies: - "@types/jsonfile" "*" - "@types/node" "*" - "@types/fs-extra@^9.0.13": version "9.0.13" resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-9.0.13.tgz#7594fbae04fe7f1918ce8b3d213f74ff44ac1f45" @@ -11566,13 +11551,6 @@ resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== -"@types/jsonfile@*": - version "6.1.4" - resolved "https://registry.yarnpkg.com/@types/jsonfile/-/jsonfile-6.1.4.tgz#614afec1a1164e7d670b4a7ad64df3e7beb7b702" - integrity sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ== - dependencies: - "@types/node" "*" - "@types/jsonwebtoken@^9.0.0": version "9.0.5" resolved "https://registry.yarnpkg.com/@types/jsonwebtoken/-/jsonwebtoken-9.0.5.tgz#0bd9b841c9e6c5a937c17656e2368f65da025588" @@ -11597,11 +11575,6 @@ resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.202.tgz#f09dbd2fb082d507178b2f2a5c7e74bd72ff98f8" integrity sha512-OvlIYQK9tNneDlS0VN54LLd5uiPCBOp7gS5Z0f1mjoJYBrtStzgmJBxONW3U6OZqdtNzZPmn9BS/7WI7BFFcFQ== -"@types/lodash@^4.17.0": - version "4.17.0" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.0.tgz#d774355e41f372d5350a4d0714abb48194a489c3" - integrity sha512-t7dhREVv6dbNj0q17X12j7yDG4bD/DHYX7o5/DbDxobP0HnGPgpRz2Ej77aL7TZT3DSw13fqUTj8J4mMnqa7WA== - "@types/long@^4.0.0": version "4.0.2" resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a" @@ -11659,7 +11632,7 @@ resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.5.tgz#ec10755e871497bcd83efe927e43ec46e8c0747e" integrity sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag== -"@types/mock-fs@^4.13.1", "@types/mock-fs@^4.13.4": +"@types/mock-fs@^4.13.1": version "4.13.4" resolved "https://registry.yarnpkg.com/@types/mock-fs/-/mock-fs-4.13.4.tgz#e73edb4b4889d44d23f1ea02d6eebe50aa30b09a" integrity sha512-mXmM0o6lULPI8z3XNnQCpL0BGxPwx1Ul1wXYEPBGl4efShyxW2Rln0JOPEWGyZaYZMM6OVXM/15zUuFMY52ljg== @@ -11807,20 +11780,13 @@ resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.7.tgz#50ae4353eaaddc04044279812f52c8c65857dbcb" integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ== -"@types/react-dom@*", "@types/react-dom@^18.0.0": - version "18.2.23" - resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.2.23.tgz#112338760f622a16d64271b408355f2f27f6302c" - integrity sha512-ZQ71wgGOTmDYpnav2knkjr3qXdAFu0vsk8Ci5w3pGAIdj7/kKAyn+VsQDhXsmzzzepAiI9leWMmubXz690AI/A== +"@types/react-dom@*", "@types/react-dom@<18.0.0", "@types/react-dom@^18", "@types/react-dom@^18.0.0": + version "18.2.25" + resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.2.25.tgz#2946a30081f53e7c8d585eb138277245caedc521" + integrity sha512-o/V48vf4MQh7juIKZU2QGDfli6p1+OOi5oXx36Hffpc9adsHeXjVp8rHuPkjd8VT8sOJ2Zp05HR7CdpGTIUFUA== dependencies: "@types/react" "*" -"@types/react-dom@<18.0.0": - version "17.0.25" - resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.25.tgz#e0e5b3571e1069625b3a3da2b279379aa33a0cb5" - integrity sha512-urx7A7UxkZQmThYA4So0NelOVjx3V4rNFVJwp0WZlbIK5eM4rNJDiN3R/E9ix0MBh6kAEojk/9YL+Te6D9zHNA== - dependencies: - "@types/react" "^17" - "@types/react-redux@^7.1.20": version "7.1.33" resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-7.1.33.tgz#53c5564f03f1ded90904e3c90f77e4bd4dc20b15" @@ -11859,23 +11825,14 @@ dependencies: "@types/react" "*" -"@types/react@*", "@types/react@^16.13.1 || ^17.0.0 || ^18.0.0": - version "18.2.74" - resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.74.tgz#2d52eb80e4e7c4ea8812c89181d6d590b53f958c" - integrity sha512-9AEqNZZyBx8OdZpxzQlaFEVCSFUM2YXJH46yPOiOpm078k6ZLOCcuAzGum/zK8YBwY+dbahVNbHrbgrAwIRlqw== +"@types/react@*", "@types/react@^16.13.1 || ^17.0.0", "@types/react@^16.13.1 || ^17.0.0 || ^18.0.0", "@types/react@^18": + version "18.2.79" + resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.79.tgz#c40efb4f255711f554d47b449f796d1c7756d865" + integrity sha512-RwGAGXPl9kSXwdNTafkOEuFrTBD5SA2B3iEB96xi8+xu5ddUa/cpvyVCSNn+asgLCTHkb5ZxN8gbuibYJi4s1w== dependencies: "@types/prop-types" "*" csstype "^3.0.2" -"@types/react@^16.13.1 || ^17.0.0", "@types/react@^17": - version "17.0.80" - resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.80.tgz#a5dfc351d6a41257eb592d73d3a85d3b7dbcbb41" - integrity sha512-LrgHIu2lEtIo8M7d1FcI3BdwXWoRQwMoXOZ7+dPTW0lYREjmlHl3P0U1VD0i/9tppOuv8/sam7sOjx34TxSFbA== - dependencies: - "@types/prop-types" "*" - "@types/scheduler" "^0.16" - csstype "^3.0.2" - "@types/recharts@^1.8.14": version "1.8.29" resolved "https://registry.yarnpkg.com/@types/recharts/-/recharts-1.8.29.tgz#5e117521a65bf015b808350b45b65553ff5011f3" @@ -11918,11 +11875,6 @@ dependencies: htmlparser2 "^4.1.0" -"@types/scheduler@^0.16": - version "0.16.8" - resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.8.tgz#ce5ace04cfeabe7ef87c0091e50752e36707deff" - integrity sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A== - "@types/semver@^7.3.12", "@types/semver@^7.5.0": version "7.5.8" resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e" From 60113aa46b316b4b69479d0d45e84f34debff668 Mon Sep 17 00:00:00 2001 From: david-heidema <86263453+david-heidema@users.noreply.github.com> Date: Wed, 17 Apr 2024 11:56:43 -0500 Subject: [PATCH 04/12] Update README --- .../scaffolder-backend-module-utils/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md b/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md index e4a82fbcf..516b369ff 100644 --- a/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md +++ b/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md @@ -98,7 +98,7 @@ return await createRouter({ ```typescript import { createBackend } from '@backstage/backend-defaults'; import { createBackendModule } from '@backstage/backend-plugin-api'; -import { scaffolderBackendModuleUtils } from '@roadiehq/scaffolder-backend-module-http-request'; +import { scaffolderBackendModuleUtils } from '@roadiehq/scaffolder-backend-module-http-request/alpha'; const backend = createBackend(); backend.add(import('@backstage/plugin-proxy-backend/alpha')); From d770b5dede334ec2d43c2f95ca32476ba0748818 Mon Sep 17 00:00:00 2001 From: david-heidema <86263453+david-heidema@users.noreply.github.com> Date: Wed, 17 Apr 2024 12:14:06 -0500 Subject: [PATCH 05/12] Update import in readme --- .../scaffolder-backend-module-utils/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md b/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md index 516b369ff..867b6283f 100644 --- a/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md +++ b/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md @@ -98,12 +98,11 @@ return await createRouter({ ```typescript import { createBackend } from '@backstage/backend-defaults'; import { createBackendModule } from '@backstage/backend-plugin-api'; -import { scaffolderBackendModuleUtils } from '@roadiehq/scaffolder-backend-module-http-request/alpha'; const backend = createBackend(); backend.add(import('@backstage/plugin-proxy-backend/alpha')); backend.add(import('@backstage/plugin-scaffolder-backend/alpha')); -backend.add(scaffolderBackendModuleUtils); +backend.add(import('@roadiehq/scaffolder-backend-module-http-request/alpha')); backend.start(); ``` From 6e753ebf12fdf0277751199e4ae67f70a5d87e75 Mon Sep 17 00:00:00 2001 From: david-heidema <86263453+david-heidema@users.noreply.github.com> Date: Wed, 17 Apr 2024 12:17:03 -0500 Subject: [PATCH 06/12] fix typo of import on readme --- .../scaffolder-backend-module-utils/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md b/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md index 867b6283f..5225246ec 100644 --- a/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md +++ b/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md @@ -102,7 +102,7 @@ import { createBackendModule } from '@backstage/backend-plugin-api'; const backend = createBackend(); backend.add(import('@backstage/plugin-proxy-backend/alpha')); backend.add(import('@backstage/plugin-scaffolder-backend/alpha')); -backend.add(import('@roadiehq/scaffolder-backend-module-http-request/alpha')); +backend.add(import('@roadiehq/scaffolder-backend-module-utils/alpha')); backend.start(); ``` From dc613a2ae90929a805abc67acc443770a1f96ee6 Mon Sep 17 00:00:00 2001 From: david-heidema <86263453+david-heidema@users.noreply.github.com> Date: Thu, 18 Apr 2024 10:05:42 -0500 Subject: [PATCH 07/12] Revert node engines --- package.json | 2 +- packages/backend/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1c1642ff1..dc160d189 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "private": true, "engines": { - "node": "14 || 16 || 18 || 20" + "node": "14 || 16 || 18" }, "scripts": { "dev": "concurrently \"yarn start\" \"yarn start-backend\"", diff --git a/packages/backend/package.json b/packages/backend/package.json index acc26627f..4f6835764 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -8,7 +8,7 @@ "role": "backend" }, "engines": { - "node": "14 || 16 || 18 || 20" + "node": "14 || 16 || 18" }, "scripts": { "build": "backstage-cli package build", From 35082f99cff675f06adb045042c6676844af3d97 Mon Sep 17 00:00:00 2001 From: david-heidema <86263453+david-heidema@users.noreply.github.com> Date: Thu, 18 Apr 2024 10:33:50 -0500 Subject: [PATCH 08/12] Enhance readme --- .../scaffolder-actions/scaffolder-backend-module-utils/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md b/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md index 5225246ec..36de8dc75 100644 --- a/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md +++ b/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md @@ -96,6 +96,7 @@ return await createRouter({ ### New backend system ```typescript +// packages/backend/src/index.ts import { createBackend } from '@backstage/backend-defaults'; import { createBackendModule } from '@backstage/backend-plugin-api'; From 7579c071f54dc4f8010d712f9406c3a5b9fb79d0 Mon Sep 17 00:00:00 2001 From: david-heidema <86263453+david-heidema@users.noreply.github.com> Date: Thu, 18 Apr 2024 10:40:07 -0500 Subject: [PATCH 09/12] Enhance Readme --- .../scaffolder-backend-module-utils/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md b/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md index 36de8dc75..5524e3328 100644 --- a/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md +++ b/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md @@ -95,6 +95,13 @@ return await createRouter({ ### New backend system +## From your Backstage root directory + +``` +cd packages/backend +yarn add @roadiehq/scaffolder-backend-module-utils/alpha +``` + ```typescript // packages/backend/src/index.ts import { createBackend } from '@backstage/backend-defaults'; From 34851b735880dc8ff33a8dd04a53e7a54daf17af Mon Sep 17 00:00:00 2001 From: david-heidema <86263453+david-heidema@users.noreply.github.com> Date: Wed, 24 Apr 2024 09:41:52 -0500 Subject: [PATCH 10/12] Address PR issues --- .changeset/empty-avocados-jam.md | 2 +- .../src/{alpha.ts => new-backend.ts} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename plugins/scaffolder-actions/scaffolder-backend-module-utils/src/{alpha.ts => new-backend.ts} (100%) diff --git a/.changeset/empty-avocados-jam.md b/.changeset/empty-avocados-jam.md index 9078806fb..6d1491b2f 100644 --- a/.changeset/empty-avocados-jam.md +++ b/.changeset/empty-avocados-jam.md @@ -1,5 +1,5 @@ --- -'@roadiehq/scaffolder-backend-module-utils': patch +'@roadiehq/scaffolder-backend-module-utils': minor --- Update to new backend system diff --git a/plugins/scaffolder-actions/scaffolder-backend-module-utils/src/alpha.ts b/plugins/scaffolder-actions/scaffolder-backend-module-utils/src/new-backend.ts similarity index 100% rename from plugins/scaffolder-actions/scaffolder-backend-module-utils/src/alpha.ts rename to plugins/scaffolder-actions/scaffolder-backend-module-utils/src/new-backend.ts From 4d05fc4b28fc84ecf437bcb5c04b0c7356055da0 Mon Sep 17 00:00:00 2001 From: david-heidema <86263453+david-heidema@users.noreply.github.com> Date: Wed, 24 Apr 2024 09:50:09 -0500 Subject: [PATCH 11/12] Update readme related PR issues --- .../scaffolder-backend-module-utils/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md b/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md index 5524e3328..f428f05c3 100644 --- a/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md +++ b/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md @@ -110,7 +110,7 @@ import { createBackendModule } from '@backstage/backend-plugin-api'; const backend = createBackend(); backend.add(import('@backstage/plugin-proxy-backend/alpha')); backend.add(import('@backstage/plugin-scaffolder-backend/alpha')); -backend.add(import('@roadiehq/scaffolder-backend-module-utils/alpha')); +backend.add(import('@roadiehq/scaffolder-backend-module-utils/new-backend')); backend.start(); ``` From 7de72ac1ac262d9d6c450d9897be723e3c7747ba Mon Sep 17 00:00:00 2001 From: david-heidema <86263453+david-heidema@users.noreply.github.com> Date: Wed, 24 Apr 2024 09:52:24 -0500 Subject: [PATCH 12/12] Update Readme for PR issues --- .../scaffolder-backend-module-utils/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md b/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md index f428f05c3..7e9e31a64 100644 --- a/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md +++ b/plugins/scaffolder-actions/scaffolder-backend-module-utils/README.md @@ -99,7 +99,7 @@ return await createRouter({ ``` cd packages/backend -yarn add @roadiehq/scaffolder-backend-module-utils/alpha +yarn add @roadiehq/scaffolder-backend-module-utils/new-backend ``` ```typescript