From 071b6eb6600f0705f5f19a50976d6a43ee9c3348 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Mon, 10 Jan 2022 10:57:20 +0100 Subject: [PATCH 1/7] added STYLE.md Signed-off-by: Patrik Oldsberg --- .github/styles/vocab.txt | 1 + STYLE.md | 217 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 218 insertions(+) create mode 100644 STYLE.md diff --git a/.github/styles/vocab.txt b/.github/styles/vocab.txt index d3ea8c1c27..b24d5e77f2 100644 --- a/.github/styles/vocab.txt +++ b/.github/styles/vocab.txt @@ -68,6 +68,7 @@ deduplicated deps dependabot destructured +destructuring dev devops devs diff --git a/STYLE.md b/STYLE.md new file mode 100644 index 0000000000..3d7de3c4de --- /dev/null +++ b/STYLE.md @@ -0,0 +1,217 @@ +# Introduction + +This file describes the various style and design conventions that are used in the Backstage main repository. While you may choose to use these conventions in your own Backstage projects, it is not required. + +# TypeScript Coding Conventions + +Our TypeScript style is inspired by the [style guidelines](https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines) of the TypeScript implementation itself. + +## Naming + +1. Use PascalCase for type names. +1. Do not use `I` as a prefix for interface names. +1. Use PascalCase for `enum` values. +1. Use camelCase for function names. +1. Use camelCase for property names and local variables. +1. Do not use `_` as a prefix for private properties. +1. Use whole words in names when possible. + +## Syntax and Types + +1. Use `undefined`. Do not use `null`. +1. Prefer `for..of` over `.forEach`. +1. Do not introduce new types/values to the global namespace. + +## File and Export Structure + +1. Shared types should be defined in types.ts. +1. Keep `index.ts` free from implementation, it should only contain re-exports. +1. If a file has a single or a main export, name the file after the export. + +## Error Handling + +1. Rely on `@backstage/errors` for custom error types. + ```ts + throw NotFoundError(`Could not find resource with id '${id}'`); + ``` +1. Check error types by comparing the name + ```ts + if (error.name === 'NotFoundError') { + // ... + } + ``` +1. Use `ResponseError` to convert `fetch` error responses. + ```ts + if (!res.ok) { + throw await ResponseError.fromResponse(res); + } + ``` + +## API Design + +This section describes guidelines for designing public APIs. It can also be applied to internal implementations, but it is less necessary. + +1. Keep [SOLID](https://en.wikipedia.org/wiki/SOLID) principles in mind. +1. Be mindful of the number of top-level exports of each package, strive to keep it low. +1. Prioritize consistency over correctness, stick to existing patterns within the same class/file/folder/package. +1. Consume interfaces rather than concrete implementations. +1. Prefer classes for encapsulating functionality and implementing interfaces. +1. Suffix the name of concrete implementations with the name of the implemented interface. Use a prefix that describes the behavior of the implementation, or use a `Default` prefix. + + ```ts + interface ImageLoader { ... } // interface for loading images + + class DefaultImageLoader implements ImageLoader { /* loads an image */ } + class CachingImageLoader implements ImageLoader { /* caches loaded images */ } + class ResizingImageLoader implements ImageLoader { /* resizes loaded images */ } + ``` + +1. Keep constructors private, prefer static factory methods for creating instances. + + ```ts + class DefaultImageLoader implements ImageLoader { + // Use `create` for the main way to create an instance. + static create(options?: ImageLoaderOptions) { + /* ... */ + } + + // If there are multiple different types of instances that can be + // created, suffix the create method. + static createWithCaching(options?: ImageLoaderOptions) { + /* ... */ + } + + // If the instantiation process is based on a specific value, use `from*`. + // The most common example of this is reading from configuration. + // Use a second parameter in case additional options are needed. + static fromConfig(config: Config, deps: { logger: Logger }) { + /* ... */ + } + + // Other types of values can work too + static fromUrl(url: URL) { + /* ... */ + } + + private constructor(/* ... */) { + /* ... */ + } + } + ``` + +1. When a type relates directly to other symbols, use the name of those as prefix for the type. + + ```ts + // Always prefix a prop type with the name of the component. + function MyComponent(props: MyComponentProps) {} + + // Option types should be prefixed with the name of the operation. + function upgradeWidget(options: UpgradeWidgetOptions) {} + function activateWidget(options: ActivateWidgetOptions) {} + + // An exception to this are create methods, where the name of the thing + // being created may be used as the prefix instead. + function createWidget(options: WidgetOptions) {} + + // In this case the related names for request types are `ReportsApi` and + // the method name. If there is a low risk of conflict we can keep them + // short by only prefixing with the method name, but if there is a higher + // risk of conflict then we would want to use the full prefix instead, while + // omitting redundant parts, i.e. `ReportsApiUploadRequest. + interface ReportsApi { + uploadReports(request: UploadReportsRequest): Promise; + deleteReport(request: DeleteReportRequest): Promise; + } + ``` + +# Documentation Guidelines + +We use [API Extractor](https://api-extractor.com/pages/overview/demo_docs/) to generate our documentation, which in turn uses [TSDoc](https://github.com/microsoft/tsdoc) to parse our doc comments. + +The doc comments are of the good old `/** ... */` format, with tags of the format `@` used to mark various things. The [TSDoc website](https://tsdoc.org/) has a good index of all available tags. + +There are a few things to pay attention to make the documentation show up in a nice way on the website... + +## Declare exported functions using the `function` keyword + +API documenter will not recognize arrow functions as functions, but rather as a constant that shows up in the list of exported variables. By declaring functions using the `function` keyword, they will show up in the list of functions. They will also get a much nicer documentation page for the individual function that shows information about parameters and return types. + +This also extends to React components, since API documenter doesn't have any special handling of those. By always defining exported React components using the `function` keyword, we make them show up among the list of functions in the API reference, where they are then easily discoverable through the `(props)` args (which you should be sure to include!). + +![image](https://user-images.githubusercontent.com/4984472/133120461-59d74c3e-ebd9-44f9-900d-cc30f54a3cd2.png) + +```ts +/** + * Properties for ErrorPanel. + */ +export interface ErrorPanelProps { + ... +} + +/** + * Renders a warning panel as the effect of an error. + */ +export function ErrorPanel(props: ErrorPanelProps) { + ... +} +``` + +## Do not destruct parameters in public function declarations + +If the parameters of a function are destructed in the parameter list, they will show up in the documentation like this: + +![image](https://user-images.githubusercontent.com/4984472/133117011-3e6cb6da-40dd-450e-8d33-51bdcf412e08.png) + +Instead prefer to use a single parameter variable and then move the destructuring into the function body instead, which will look much nicer: + +![image](https://user-images.githubusercontent.com/4984472/133120542-d648de43-5495-43a8-b532-f5e6f6ab736e.png) + +Also be sure to check that the type used by the parameter is exported, as it otherwise won't be discoverable through documentation. + +## Use `@remarks` to split long descriptions + +The API reference has an index of exported symbols for each package, which uses a short description, while clicking through to the page for a symbol shows the full description. By default all descriptions are considered "short", and you have manually add a divider where the description should be cut off using the `@remarks` tag. + +```ts +/** + * This function helps you create a thing. + * + * @remarks + * + * Here is a much longer and more elaborate description of how the + * creation of a thing works, which is way too long to fit on the index page. + */ +function createTheThing() {} +``` + +## Use `@param` to document parameters + +When using the `@param` tag to document a parameter it will show up in the **Parameters** section: + +![image](https://user-images.githubusercontent.com/4984472/133120977-64004074-0afb-4e8a-9a2a-c846f04eb3d9.png) + +Be sure to include a `-` after the parameter name as well as [required by TSDoc](https://tsdoc.org/pages/tags/param/), or you'll get a warning in the API report. + +```ts +/** + * Generates a PluginCacheManager for consumption by plugins. + * + * @param pluginId - The plugin that the cache manager should be created for. Plugin names should be unique. + */ +forPlugin(pluginId: string): PluginCacheManager { + ... +} +``` + +## Fill in missing references using `{@link ...}` + +Not all types are detected and referenced on the documentation page. Most notably variables, and therefore ApiRefs, will not have clickable links to other symbols that they reference. We instead fill in this missing information using inline `{@link ...}` tags in the description: + +```ts +/** + * {@link ApiRef} for the {@link DiscoveryApi}. + */ +export const discoveryApiRef: ApiRef = createApiRef(...); +``` + +![image](https://user-images.githubusercontent.com/4984472/133123632-d00cefd9-a70f-43f6-8f14-40c253554ee1.png) From 67c53777ec34f690ac435797c8e74c265bff7187 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 11 Jan 2022 12:20:07 +0100 Subject: [PATCH 2/7] STYLE.md: review fixes Signed-off-by: Patrik Oldsberg --- STYLE.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/STYLE.md b/STYLE.md index 3d7de3c4de..8fbe87eb5f 100644 --- a/STYLE.md +++ b/STYLE.md @@ -24,7 +24,7 @@ Our TypeScript style is inspired by the [style guidelines](https://github.com/Mi ## File and Export Structure -1. Shared types should be defined in types.ts. +1. Shared types should be defined in `types.ts`. 1. Keep `index.ts` free from implementation, it should only contain re-exports. 1. If a file has a single or a main export, name the file after the export. @@ -32,7 +32,7 @@ Our TypeScript style is inspired by the [style guidelines](https://github.com/Mi 1. Rely on `@backstage/errors` for custom error types. ```ts - throw NotFoundError(`Could not find resource with id '${id}'`); + throw new NotFoundError(`Could not find resource with id '${id}'`); ``` 1. Check error types by comparing the name ```ts @@ -142,7 +142,7 @@ This also extends to React components, since API documenter doesn't have any spe ```ts /** - * Properties for ErrorPanel. + * Properties for {@link ErrorPanel}. */ export interface ErrorPanelProps { ... @@ -170,7 +170,7 @@ Also be sure to check that the type used by the parameter is exported, as it oth ## Use `@remarks` to split long descriptions -The API reference has an index of exported symbols for each package, which uses a short description, while clicking through to the page for a symbol shows the full description. By default all descriptions are considered "short", and you have manually add a divider where the description should be cut off using the `@remarks` tag. +The API reference has an index of exported symbols for each package, which uses a short description, while clicking through to the page for a symbol shows the full description. By default all descriptions are considered "short", and you have to manually add a divider where the description should be cut off using the `@remarks` tag. ```ts /** @@ -205,7 +205,7 @@ forPlugin(pluginId: string): PluginCacheManager { ## Fill in missing references using `{@link ...}` -Not all types are detected and referenced on the documentation page. Most notably variables, and therefore ApiRefs, will not have clickable links to other symbols that they reference. We instead fill in this missing information using inline `{@link ...}` tags in the description: +Not all types are detected and referenced on the documentation page. Most notably variables, and therefore `ApiRef`s, will not have clickable links to other symbols that they reference. We instead fill in this missing information using inline `{@link ...}` tags in the description: ```ts /** From dffff180b77a31f26fff8ddb39ccd76d1f3f9a30 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Jan 2022 04:13:02 +0000 Subject: [PATCH 3/7] build(deps-dev): bump jest-when from 3.3.1 to 3.5.0 Bumps [jest-when](https://github.com/timkindberg/jest-when) from 3.3.1 to 3.5.0. - [Release notes](https://github.com/timkindberg/jest-when/releases) - [Commits](https://github.com/timkindberg/jest-when/compare/v3.3.1...v3.5.0) --- updated-dependencies: - dependency-name: jest-when dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- yarn.lock | 207 +++--------------------------------------------------- 1 file changed, 8 insertions(+), 199 deletions(-) diff --git a/yarn.lock b/yarn.lock index 89f1597307..5a436fbacf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3572,15 +3572,6 @@ resolved "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.2.tgz#26520bf09abe4a5644cd5414e37125a8954241dd" integrity sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw== -"@jest/console@^24.9.0": - version "24.9.0" - resolved "https://registry.npmjs.org/@jest/console/-/console-24.9.0.tgz#79b1bc06fb74a8cfb01cbdedf945584b1b9707f0" - integrity sha512-Zuj6b8TnKXi3q4ymac8EQfc3ea/uhLeCGThFqXeC8H9/raaH8ARPUTdId+XyGd03Z4In0/VjD2OYFcBF09fNLQ== - dependencies: - "@jest/source-map" "^24.9.0" - chalk "^2.0.1" - slash "^2.0.0" - "@jest/console@^26.6.2": version "26.6.2" resolved "https://registry.npmjs.org/@jest/console/-/console-26.6.2.tgz#4e04bc464014358b03ab4937805ee36a0aeb98f2" @@ -3690,15 +3681,6 @@ optionalDependencies: node-notifier "^8.0.0" -"@jest/source-map@^24.9.0": - version "24.9.0" - resolved "https://registry.npmjs.org/@jest/source-map/-/source-map-24.9.0.tgz#0e263a94430be4b41da683ccc1e6bffe2a191714" - integrity sha512-/Xw7xGlsZb4MJzNDgB7PW5crou5JqWiBQaz6xyPd3ArOg2nfn/PunV8+olXbbEZzNl591o5rWKE9BRDaFAuIBg== - dependencies: - callsites "^3.0.0" - graceful-fs "^4.1.15" - source-map "^0.6.0" - "@jest/source-map@^26.6.2": version "26.6.2" resolved "https://registry.npmjs.org/@jest/source-map/-/source-map-26.6.2.tgz#29af5e1e2e324cafccc936f218309f54ab69d535" @@ -3708,15 +3690,6 @@ graceful-fs "^4.2.4" source-map "^0.6.0" -"@jest/test-result@^24.9.0": - version "24.9.0" - resolved "https://registry.npmjs.org/@jest/test-result/-/test-result-24.9.0.tgz#11796e8aa9dbf88ea025757b3152595ad06ba0ca" - integrity sha512-XEFrHbBonBJ8dGp2JmF8kP/nQI/ImPpygKHwQ/SY+es59Z3L5PI4Qb9TQQMAEeYsThG1xF0k6tmG0tIKATNiiA== - dependencies: - "@jest/console" "^24.9.0" - "@jest/types" "^24.9.0" - "@types/istanbul-lib-coverage" "^2.0.0" - "@jest/test-result@^26.6.2": version "26.6.2" resolved "https://registry.npmjs.org/@jest/test-result/-/test-result-26.6.2.tgz#55da58b62df134576cc95476efa5f7949e3f5f18" @@ -3759,15 +3732,6 @@ source-map "^0.6.1" write-file-atomic "^3.0.0" -"@jest/types@^24.9.0": - version "24.9.0" - resolved "https://registry.npmjs.org/@jest/types/-/types-24.9.0.tgz#63cb26cb7500d069e5a389441a7c6ab5e909fc59" - integrity sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw== - dependencies: - "@types/istanbul-lib-coverage" "^2.0.0" - "@types/istanbul-reports" "^1.1.1" - "@types/yargs" "^13.0.0" - "@jest/types@^26.6.2": version "26.6.2" resolved "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz#bef5a532030e1d88a2f5a6d933f84e97226ed48e" @@ -7570,14 +7534,6 @@ dependencies: "@types/istanbul-lib-coverage" "*" -"@types/istanbul-reports@^1.1.1": - version "1.1.2" - resolved "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-1.1.2.tgz#e875cc689e47bce549ec81f3df5e6f6f11cfaeb2" - integrity sha512-P/W9yOX/3oPZSpaYOCQzGqgCQRXn0FFO/V8bWrCQs+wLmvVVxk6CRBXALEvNs9OHIatlnlFokfhuDo2ug01ciw== - dependencies: - "@types/istanbul-lib-coverage" "*" - "@types/istanbul-lib-report" "*" - "@types/istanbul-reports@^3.0.0": version "3.0.0" resolved "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.0.tgz#508b13aa344fa4976234e75dddcc34925737d821" @@ -8268,11 +8224,6 @@ "@types/node" "*" "@types/ssh2-streams" "*" -"@types/stack-utils@^1.0.1": - version "1.0.1" - resolved "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" - integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== - "@types/stack-utils@^2.0.0": version "2.0.0" resolved "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.0.tgz#7036640b4e21cc2f259ae826ce843d277dad8cff" @@ -8538,13 +8489,6 @@ resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-15.0.0.tgz#cb3f9f741869e20cce330ffbeb9271590483882d" integrity sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw== -"@types/yargs@^13.0.0": - version "13.0.11" - resolved "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.11.tgz#def2f0c93e4bdf2c61d7e34899b17e34be28d3b1" - integrity sha512-NRqD6T4gktUrDi1o1wLH3EKC1o2caCr7/wR87ODcbVITQF106OM3sFN92ysZ++wqelOd1CTzatnOBRDYYG6wGQ== - dependencies: - "@types/yargs-parser" "*" - "@types/yargs@^15.0.0": version "15.0.4" resolved "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.4.tgz#7e5d0f8ca25e9d5849f2ea443cf7c402decd8299" @@ -9235,7 +9179,7 @@ ansi-regex@^3.0.0: resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= -ansi-regex@^4.0.0, ansi-regex@^4.1.0: +ansi-regex@^4.1.0: version "4.1.0" resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== @@ -9250,7 +9194,7 @@ ansi-styles@^2.2.1: resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= -ansi-styles@^3.2.0, ansi-styles@^3.2.1: +ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== @@ -10730,16 +10674,6 @@ builtins@^1.0.3: resolved "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88" integrity sha1-y5T662HIaWRR2zZTThQi+U8K7og= -bunyan@^1.8.12: - version "1.8.15" - resolved "https://registry.npmjs.org/bunyan/-/bunyan-1.8.15.tgz#8ce34ca908a17d0776576ca1b2f6cbd916e93b46" - integrity sha512-0tECWShh6wUysgucJcBAoYegf3JJoZWibxdqhTm7OHPeT42qdjkZ29QCMcKwbgU1kiH+auSIasNRXMLWXafXig== - optionalDependencies: - dtrace-provider "~0.8" - moment "^2.19.3" - mv "~2" - safe-json-stringify "~1" - busboy@^0.3.1: version "0.3.1" resolved "https://registry.npmjs.org/busboy/-/busboy-0.3.1.tgz#170899274c5bf38aae27d5c62b71268cd585fd1b" @@ -13216,11 +13150,6 @@ dicer@0.3.0: dependencies: streamsearch "0.1.2" -diff-sequences@^24.9.0: - version "24.9.0" - resolved "https://registry.npmjs.org/diff-sequences/-/diff-sequences-24.9.0.tgz#5715d6244e2aa65f48bba0bc972db0b0b11e95b5" - integrity sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew== - diff-sequences@^26.6.2: version "26.6.2" resolved "https://registry.npmjs.org/diff-sequences/-/diff-sequences-26.6.2.tgz#48ba99157de1923412eed41db6b6d4aa9ca7c0b1" @@ -13511,13 +13440,6 @@ dset@^3.1.0: resolved "https://registry.npmjs.org/dset/-/dset-3.1.0.tgz#23feb6df93816ea452566308b1374d6e869b0d7b" integrity sha512-7xTQ5DzyE59Nn+7ZgXDXjKAGSGmXZHqttMVVz1r4QNfmGpyj+cm2YtI3II0c/+4zS4a9yq2mBhgdeq2QnpcYlw== -dtrace-provider@~0.8: - version "0.8.8" - resolved "https://registry.npmjs.org/dtrace-provider/-/dtrace-provider-0.8.8.tgz#2996d5490c37e1347be263b423ed7b297fb0d97e" - integrity sha512-b7Z7cNtHPhH9EJhNNbbeqTcXB8LGFFZhq1PGgEvpeHlzd36bhbdTWoE/Ba/YguqpBSlAPKnARWhVlhunCMwfxg== - dependencies: - nan "^2.14.0" - duplexer2@~0.1.4: version "0.1.4" resolved "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1" @@ -14587,18 +14509,6 @@ expand-brackets@^2.1.4: snapdragon "^0.8.1" to-regex "^3.0.1" -expect@^24.8.0: - version "24.9.0" - resolved "https://registry.npmjs.org/expect/-/expect-24.9.0.tgz#b75165b4817074fa4a157794f46fe9f1ba15b6ca" - integrity sha512-wvVAx8XIol3Z5m9zvZXiyZOQ+sRJqNTIm6sGjdWlaZIeupQGO3WbYI+15D/AmEwZywL6wtJkbAbJtzkOfBuR0Q== - dependencies: - "@jest/types" "^24.9.0" - ansi-styles "^3.2.0" - jest-get-type "^24.9.0" - jest-matcher-utils "^24.9.0" - jest-message-util "^24.9.0" - jest-regex-util "^24.9.0" - expect@^26.6.2: version "26.6.2" resolved "https://registry.npmjs.org/expect/-/expect-26.6.2.tgz#c6b996bf26bf3fe18b67b2d0f51fc981ba934417" @@ -15781,17 +15691,6 @@ glob@7.1.6: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^6.0.1: - version "6.0.4" - resolved "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz#0f08860f6a155127b2fadd4f9ce24b1aab6e4d22" - integrity sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI= - dependencies: - inflight "^1.0.4" - inherits "2" - minimatch "2 || 3" - once "^1.3.0" - path-is-absolute "^1.0.0" - glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@^7.1.7, glob@^7.2.0: version "7.2.0" resolved "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" @@ -18116,16 +18015,6 @@ jest-css-modules@^2.1.0: dependencies: identity-obj-proxy "3.0.0" -jest-diff@^24.9.0: - version "24.9.0" - resolved "https://registry.npmjs.org/jest-diff/-/jest-diff-24.9.0.tgz#931b7d0d5778a1baf7452cb816e325e3724055da" - integrity sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ== - dependencies: - chalk "^2.0.1" - diff-sequences "^24.9.0" - jest-get-type "^24.9.0" - pretty-format "^24.9.0" - jest-diff@^26.0.0, jest-diff@^26.6.2: version "26.6.2" resolved "https://registry.npmjs.org/jest-diff/-/jest-diff-26.6.2.tgz#1aa7468b52c3a68d7d5c5fdcdfcd5e49bd164394" @@ -18179,11 +18068,6 @@ jest-environment-node@^26.6.2: jest-mock "^26.6.2" jest-util "^26.6.2" -jest-get-type@^24.9.0: - version "24.9.0" - resolved "https://registry.npmjs.org/jest-get-type/-/jest-get-type-24.9.0.tgz#1684a0c8a50f2e4901b6644ae861f579eed2ef0e" - integrity sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q== - jest-get-type@^26.3.0: version "26.3.0" resolved "https://registry.npmjs.org/jest-get-type/-/jest-get-type-26.3.0.tgz#e97dc3c3f53c2b406ca7afaed4493b1d099199e0" @@ -18242,16 +18126,6 @@ jest-leak-detector@^26.6.2: jest-get-type "^26.3.0" pretty-format "^26.6.2" -jest-matcher-utils@^24.9.0: - version "24.9.0" - resolved "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-24.9.0.tgz#f5b3661d5e628dffe6dd65251dfdae0e87c3a073" - integrity sha512-OZz2IXsu6eaiMAwe67c1T+5tUAtQyQx27/EMEkbFAGiw52tB9em+uGbzpcgYVpA8wl0hlxKPZxrly4CXU/GjHA== - dependencies: - chalk "^2.0.1" - jest-diff "^24.9.0" - jest-get-type "^24.9.0" - pretty-format "^24.9.0" - jest-matcher-utils@^26.6.2: version "26.6.2" resolved "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz#8e6fd6e863c8b2d31ac6472eeb237bc595e53e7a" @@ -18262,20 +18136,6 @@ jest-matcher-utils@^26.6.2: jest-get-type "^26.3.0" pretty-format "^26.6.2" -jest-message-util@^24.9.0: - version "24.9.0" - resolved "https://registry.npmjs.org/jest-message-util/-/jest-message-util-24.9.0.tgz#527f54a1e380f5e202a8d1149b0ec872f43119e3" - integrity sha512-oCj8FiZ3U0hTP4aSui87P4L4jC37BtQwUMqk+zk/b11FR19BJDeZsZAvIHutWnmtw7r85UmR3CEWZ0HWU2mAlw== - dependencies: - "@babel/code-frame" "^7.0.0" - "@jest/test-result" "^24.9.0" - "@jest/types" "^24.9.0" - "@types/stack-utils" "^1.0.1" - chalk "^2.0.1" - micromatch "^3.1.10" - slash "^2.0.0" - stack-utils "^1.0.1" - jest-message-util@^26.6.2: version "26.6.2" resolved "https://registry.npmjs.org/jest-message-util/-/jest-message-util-26.6.2.tgz#58173744ad6fc0506b5d21150b9be56ef001ca07" @@ -18304,11 +18164,6 @@ jest-pnp-resolver@^1.2.2: resolved "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz#b704ac0ae028a89108a4d040b3f919dfddc8e33c" integrity sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w== -jest-regex-util@^24.9.0: - version "24.9.0" - resolved "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-24.9.0.tgz#c13fb3380bde22bf6575432c493ea8fe37965636" - integrity sha512-05Cmb6CuxaA+Ys6fjr3PhvV3bGQmO+2p2La4hFbU+W5uOc479f7FdLXUWXw4pYMAhhSZIuKHwSXSu6CsSBAXQA== - jest-regex-util@^26.0.0: version "26.0.0" resolved "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-26.0.0.tgz#d25e7184b36e39fd466c3bc41be0971e821fee28" @@ -18472,12 +18327,9 @@ jest-watcher@^26.6.2: string-length "^4.0.1" jest-when@^3.1.0: - version "3.3.1" - resolved "https://registry.npmjs.org/jest-when/-/jest-when-3.3.1.tgz#04f978b2e522a290b1d91db7ab6ca029a7925513" - integrity sha512-nbQxKeHqfmoSE38TfLVPCgxG+rnsgHSXsdH1wdE9bqHt9US6twHjSXV+fD4ncfsIWNXqhv7zRvN5jn/QYL2UwA== - dependencies: - bunyan "^1.8.12" - expect "^24.8.0" + version "3.5.0" + resolved "https://registry.npmjs.org/jest-when/-/jest-when-3.5.0.tgz#364ab8dc149a5d683f9cc14e44d73d03b84b0d97" + integrity sha512-/IkPkG5lo2tyXH3a+VraYe7t/ma6UK9VPQko7hr6YgEtjoHyfAPpLXzyhnSNxxKRzNQDrw8YoGPCOkdTLR4mHA== jest-worker@^26.5.0, jest-worker@^26.6.2: version "26.6.2" @@ -20850,7 +20702,7 @@ minimalistic-crypto-utils@^1.0.1: resolved "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= -"minimatch@2 || 3", minimatch@3.0.4, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: +minimatch@3.0.4, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== @@ -21035,7 +20887,7 @@ moment-timezone@^0.5.31: dependencies: moment ">= 2.9.0" -"moment@>= 2.9.0", moment@^2.19.3, moment@^2.27.0, moment@^2.29.1: +"moment@>= 2.9.0", moment@^2.27.0, moment@^2.29.1: version "2.29.1" resolved "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3" integrity sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ== @@ -21169,15 +21021,6 @@ mute-stream@0.0.8, mute-stream@~0.0.4: resolved "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== -mv@~2: - version "2.1.1" - resolved "https://registry.npmjs.org/mv/-/mv-2.1.1.tgz#ae6ce0d6f6d5e0a4f7d893798d03c1ea9559b6a2" - integrity sha1-rmzg1vbV4KT32JN5jQPB6pVZtqI= - dependencies: - mkdirp "~0.5.1" - ncp "~2.0.0" - rimraf "~2.4.0" - mysql2@^2.2.5: version "2.3.3" resolved "https://registry.npmjs.org/mysql2/-/mysql2-2.3.3.tgz#944f3deca4b16629052ff8614fbf89d5552545a0" @@ -21271,11 +21114,6 @@ natural-compare@^1.4.0: resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= -ncp@~2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz#195a21d6c46e361d2fb1281ba38b91e9df7bdbb3" - integrity sha1-GVoh1sRuNh0vsSgbo4uR6d9727M= - needle@^2.2.1: version "2.6.0" resolved "https://registry.npmjs.org/needle/-/needle-2.6.0.tgz#24dbb55f2509e2324b4a99d61f413982013ccdbe" @@ -23454,16 +23292,6 @@ pretty-error@^2.1.1: lodash "^4.17.20" renderkid "^2.0.4" -pretty-format@^24.9.0: - version "24.9.0" - resolved "https://registry.npmjs.org/pretty-format/-/pretty-format-24.9.0.tgz#12fac31b37019a4eea3c11aa9a959eb7628aa7c9" - integrity sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA== - dependencies: - "@jest/types" "^24.9.0" - ansi-regex "^4.0.0" - ansi-styles "^3.2.0" - react-is "^16.8.4" - pretty-format@^26.0.0, pretty-format@^26.6.2: version "26.6.2" resolved "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz#e35c2705f14cb7fe2fe94fa078345b444120fc93" @@ -24203,7 +24031,7 @@ react-inspector@^5.1.0, react-inspector@^5.1.1: is-dom "^1.0.0" prop-types "^15.0.0" -react-is@^16.13.1, react-is@^16.7.0, react-is@^16.8.0, react-is@^16.8.4, react-is@^16.8.6, react-is@^16.9.0: +react-is@^16.13.1, react-is@^16.7.0, react-is@^16.8.0, react-is@^16.8.6, react-is@^16.9.0: version "16.13.1" resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== @@ -25301,13 +25129,6 @@ rimraf@3.0.2, rimraf@^3.0.0, rimraf@^3.0.2: dependencies: glob "^7.1.3" -rimraf@~2.4.0: - version "2.4.5" - resolved "https://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz#ee710ce5d93a8fdb856fb5ea8ff0e2d75934b2da" - integrity sha1-7nEM5dk6j9uFb7Xqj/Di11k0sto= - dependencies: - glob "^6.0.1" - rimraf@~2.6.2: version "2.6.3" resolved "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" @@ -25457,11 +25278,6 @@ safe-identifier@^0.4.2: resolved "https://registry.npmjs.org/safe-identifier/-/safe-identifier-0.4.2.tgz#cf6bfca31c2897c588092d1750d30ef501d59fcb" integrity sha512-6pNbSMW6OhAi9j+N8V+U715yBQsaWJ7eyEUaOrawX+isg5ZxhUlV1NipNtgaKHmFGiABwt+ZF04Ii+3Xjkg+8w== -safe-json-stringify@~1: - version "1.2.0" - resolved "https://registry.npmjs.org/safe-json-stringify/-/safe-json-stringify-1.2.0.tgz#356e44bc98f1f93ce45df14bcd7c01cda86e0afd" - integrity sha512-gH8eh2nZudPQO6TytOvbxnuhYBOvDBBLW52tz5q6X58lJcd/tkmqFR+5Z9adS8aJtURSXWThWy/xJtJwixErvg== - safe-regex2@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/safe-regex2/-/safe-regex2-2.0.0.tgz#b287524c397c7a2994470367e0185e1916b1f5b9" @@ -26384,13 +26200,6 @@ stack-trace@0.0.x: resolved "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0" integrity sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA= -stack-utils@^1.0.1: - version "1.0.4" - resolved "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.4.tgz#4b600971dcfc6aed0cbdf2a8268177cc916c87c8" - integrity sha512-IPDJfugEGbfizBwBZRZ3xpccMdRyP5lqsBWXGQWimVjua/ccLCeMOAVjlc1R7LxFjo5sEDhyNIXd8mo/AiDS9w== - dependencies: - escape-string-regexp "^2.0.0" - stack-utils@^2.0.2: version "2.0.2" resolved "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.2.tgz#5cf48b4557becb4638d0bc4f21d23f5d19586593" From 18023e40ce7411d26baf3d2c711af82e4564db44 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 12 Jan 2022 10:41:26 +0100 Subject: [PATCH 4/7] chore: prettify changeset Signed-off-by: blam --- .changeset/dependabot-0c71dee.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/dependabot-0c71dee.md b/.changeset/dependabot-0c71dee.md index adae011546..b2d7f3dc2a 100644 --- a/.changeset/dependabot-0c71dee.md +++ b/.changeset/dependabot-0c71dee.md @@ -2,4 +2,4 @@ '@backstage/backend-common': patch --- -build(deps-dev): bump `http-errors` from 1.8.0 to 2.0.0 \ No newline at end of file +build(deps-dev): bump `http-errors` from 1.8.0 to 2.0.0 From b7ecbb60147a0d3091002783b04d9afb52fd3ceb Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 12 Jan 2022 10:46:12 +0100 Subject: [PATCH 5/7] chore: needs a new line at the end Signed-off-by: blam --- .github/workflows/dependabot-changeset-maker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-changeset-maker.yml b/.github/workflows/dependabot-changeset-maker.yml index dcf9f47a54..715ba33578 100644 --- a/.github/workflows/dependabot-changeset-maker.yml +++ b/.github/workflows/dependabot-changeset-maker.yml @@ -35,7 +35,7 @@ jobs: async function createChangeset(fileName, commitMessage, packages) { const pkgs = packages.map(pkg => `'${pkg}': patch`).join('\n'); const message = commitMessage.replace(/([bB])ump ([\S]+)/, '$1ump `$2`'); - const body = `---\n${pkgs}\n---\n\n${message}`; + const body = `---\n${pkgs}\n---\n\n${message}\n`; await fs.writeFile(fileName, body); } From 57ce85be71020fb8dfe3acd76947c85b0c42e394 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 12 Jan 2022 10:48:14 +0100 Subject: [PATCH 6/7] chore: trim the message to remove any extra chars Signed-off-by: blam --- .github/workflows/dependabot-changeset-maker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-changeset-maker.yml b/.github/workflows/dependabot-changeset-maker.yml index 715ba33578..8ed71f1cc3 100644 --- a/.github/workflows/dependabot-changeset-maker.yml +++ b/.github/workflows/dependabot-changeset-maker.yml @@ -34,8 +34,8 @@ jobs: async function createChangeset(fileName, commitMessage, packages) { const pkgs = packages.map(pkg => `'${pkg}': patch`).join('\n'); - const message = commitMessage.replace(/([bB])ump ([\S]+)/, '$1ump `$2`'); - const body = `---\n${pkgs}\n---\n\n${message}\n`; + const message = commitMessage.replace(/([bB])ump ([\S]+)/, '$1ump `$2`').trim(); + const body = `---\n${pkgs}\n---\n\n${message}`; await fs.writeFile(fileName, body); } From 783537bb1a809f29d29a6dd05e41403540e732f5 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 12 Jan 2022 11:00:36 +0100 Subject: [PATCH 7/7] chore: add back the newline char Signed-off-by: blam --- .github/workflows/dependabot-changeset-maker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-changeset-maker.yml b/.github/workflows/dependabot-changeset-maker.yml index 8ed71f1cc3..e38ce12c6d 100644 --- a/.github/workflows/dependabot-changeset-maker.yml +++ b/.github/workflows/dependabot-changeset-maker.yml @@ -35,7 +35,7 @@ jobs: async function createChangeset(fileName, commitMessage, packages) { const pkgs = packages.map(pkg => `'${pkg}': patch`).join('\n'); const message = commitMessage.replace(/([bB])ump ([\S]+)/, '$1ump `$2`').trim(); - const body = `---\n${pkgs}\n---\n\n${message}`; + const body = `---\n${pkgs}\n---\n\n${message}\n`; await fs.writeFile(fileName, body); }