From 176ae63ee374005b8c8cd2f2de3fc7673b1cf30c Mon Sep 17 00:00:00 2001 From: Michael Mason Date: Thu, 28 Sep 2023 09:21:12 -0700 Subject: [PATCH 1/6] changelog --- packages/gasket-plugin-express/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/gasket-plugin-express/CHANGELOG.md b/packages/gasket-plugin-express/CHANGELOG.md index 8019538ba..1893cc4cd 100644 --- a/packages/gasket-plugin-express/CHANGELOG.md +++ b/packages/gasket-plugin-express/CHANGELOG.md @@ -1,5 +1,7 @@ # `@gasket/plugin-express` +### 6.41.2 + - Fix ordering of error middlewares so they come after API routes - Docs on configuring middleware paths ([#613]) From 6077a7d0c02bcf006fea1c90e10076628e223108 Mon Sep 17 00:00:00 2001 From: Michael Mason Date: Thu, 28 Sep 2023 09:21:46 -0700 Subject: [PATCH 2/6] v6.41.2 --- lerna.json | 2 +- package-lock.json | 58 +++++++++---------- packages/gasket-helper-intl/package.json | 2 +- packages/gasket-plugin-express/package.json | 2 +- packages/gasket-plugin-intl/package.json | 6 +- packages/gasket-preset-api/package.json | 4 +- packages/gasket-preset-nextjs/package.json | 4 +- packages/gasket-react-intl/package.json | 4 +- packages/gasket-typescript-tests/package.json | 14 ++--- 9 files changed, 48 insertions(+), 48 deletions(-) diff --git a/lerna.json b/lerna.json index 76342c96a..a7d0918f1 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "6.41.1", + "version": "6.41.2", "$schema": "https://json.schemastore.org/lerna.json", "useWorkspaces": true, "useNx": true, diff --git a/package-lock.json b/package-lock.json index 9cf4140a5..cd98129fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37449,7 +37449,7 @@ }, "packages/gasket-helper-intl": { "name": "@gasket/helper-intl", - "version": "6.39.0", + "version": "6.41.2", "license": "MIT", "dependencies": { "lodash.merge": "^4.6.0" @@ -37917,7 +37917,7 @@ }, "packages/gasket-plugin-express": { "name": "@gasket/plugin-express", - "version": "6.41.1", + "version": "6.41.2", "license": "MIT", "dependencies": { "@types/express": "^4.17.13", @@ -38070,10 +38070,10 @@ }, "packages/gasket-plugin-intl": { "name": "@gasket/plugin-intl", - "version": "6.41.1", + "version": "6.41.2", "license": "MIT", "dependencies": { - "@gasket/helper-intl": "^6.39.0", + "@gasket/helper-intl": "^6.41.2", "@hapi/accept": "^6.0.0", "debug": "^4.3.4", "fs-extra": "^10.0.0", @@ -38088,7 +38088,7 @@ "devDependencies": { "@gasket/engine": "^6.39.3", "@gasket/plugin-log": "^6.39.3", - "@gasket/react-intl": "^6.41.1", + "@gasket/react-intl": "^6.41.2", "cross-env": "^7.0.3", "eslint": "^8.7.0", "eslint-config-godaddy": "^7.0.0", @@ -38843,13 +38843,13 @@ }, "packages/gasket-preset-api": { "name": "@gasket/preset-api", - "version": "6.41.1", + "version": "6.41.2", "license": "MIT", "dependencies": { "@gasket/plugin-config": "^6.41.1", "@gasket/plugin-docs": "^6.41.1", "@gasket/plugin-docsify": "^6.39.3", - "@gasket/plugin-express": "^6.41.1", + "@gasket/plugin-express": "^6.41.2", "@gasket/plugin-https": "^6.39.3", "@gasket/plugin-lint": "^6.41.0", "@gasket/plugin-log": "^6.39.3", @@ -38861,10 +38861,10 @@ }, "packages/gasket-preset-nextjs": { "name": "@gasket/preset-nextjs", - "version": "6.41.1", + "version": "6.41.2", "license": "MIT", "dependencies": { - "@gasket/plugin-express": "^6.41.1", + "@gasket/plugin-express": "^6.41.2", "@gasket/plugin-https": "^6.39.3", "@gasket/plugin-log": "^6.39.3", "@gasket/plugin-nextjs": "^6.41.1", @@ -38887,13 +38887,13 @@ }, "packages/gasket-react-intl": { "name": "@gasket/react-intl", - "version": "6.41.1", + "version": "6.41.2", "license": "MIT", "dependencies": { "@babel/runtime": "^7.12.5", "@gasket/data": "^6.41.1", "@gasket/fetch": "^6.39.0", - "@gasket/helper-intl": "^6.39.0", + "@gasket/helper-intl": "^6.41.2", "hoist-non-react-statics": "^3.0.0", "just-extend": "^6.2.0", "prop-types": "^15.7.2" @@ -39059,14 +39059,14 @@ }, "packages/gasket-typescript-tests": { "name": "@gasket/typescript-tests", - "version": "6.41.1", + "version": "6.41.2", "license": "MIT", "devDependencies": { "@gasket/cli": "^6.41.1", "@gasket/data": "^6.41.1", "@gasket/engine": "^6.41.0", "@gasket/fetch": "^6.39.0", - "@gasket/helper-intl": "^6.39.0", + "@gasket/helper-intl": "^6.41.2", "@gasket/log": "^6.39.0", "@gasket/nextjs": "^6.41.1", "@gasket/plugin-analyze": "^6.39.3", @@ -39075,9 +39075,9 @@ "@gasket/plugin-docs": "^6.41.1", "@gasket/plugin-docsify": "^6.39.3", "@gasket/plugin-elastic-apm": "^6.39.3", - "@gasket/plugin-express": "^6.41.1", + "@gasket/plugin-express": "^6.41.2", "@gasket/plugin-https": "^6.39.3", - "@gasket/plugin-intl": "^6.41.1", + "@gasket/plugin-intl": "^6.41.2", "@gasket/plugin-log": "^6.39.3", "@gasket/plugin-manifest": "^6.39.3", "@gasket/plugin-metadata": "^6.41.1", @@ -39089,10 +39089,10 @@ "@gasket/plugin-swagger": "^6.39.3", "@gasket/plugin-webpack": "^6.39.3", "@gasket/plugin-workbox": "^6.39.3", - "@gasket/preset-api": "^6.41.1", - "@gasket/preset-nextjs": "^6.41.1", + "@gasket/preset-api": "^6.41.2", + "@gasket/preset-nextjs": "^6.41.2", "@gasket/preset-pwa": "^6.39.3", - "@gasket/react-intl": "^6.41.1", + "@gasket/react-intl": "^6.41.2", "@gasket/redux": "^6.39.0", "@gasket/resolve": "^6.41.0", "@gasket/utils": "^6.41.0", @@ -42789,9 +42789,9 @@ "version": "file:packages/gasket-plugin-intl", "requires": { "@gasket/engine": "^6.39.3", - "@gasket/helper-intl": "^6.39.0", + "@gasket/helper-intl": "^6.41.2", "@gasket/plugin-log": "^6.39.3", - "@gasket/react-intl": "^6.41.1", + "@gasket/react-intl": "^6.41.2", "@hapi/accept": "^6.0.0", "cross-env": "^7.0.3", "debug": "^4.3.4", @@ -43437,7 +43437,7 @@ "@gasket/plugin-config": "^6.41.1", "@gasket/plugin-docs": "^6.41.1", "@gasket/plugin-docsify": "^6.39.3", - "@gasket/plugin-express": "^6.41.1", + "@gasket/plugin-express": "^6.41.2", "@gasket/plugin-https": "^6.39.3", "@gasket/plugin-lint": "^6.41.0", "@gasket/plugin-log": "^6.39.3", @@ -43448,7 +43448,7 @@ "@gasket/preset-nextjs": { "version": "file:packages/gasket-preset-nextjs", "requires": { - "@gasket/plugin-express": "^6.41.1", + "@gasket/plugin-express": "^6.41.2", "@gasket/plugin-https": "^6.39.3", "@gasket/plugin-log": "^6.39.3", "@gasket/plugin-nextjs": "^6.41.1", @@ -43478,7 +43478,7 @@ "@babel/runtime": "^7.12.5", "@gasket/data": "^6.41.1", "@gasket/fetch": "^6.39.0", - "@gasket/helper-intl": "^6.39.0", + "@gasket/helper-intl": "^6.41.2", "@testing-library/react": "^13.4.0", "assume": "^2.3.0", "assume-sinon": "^1.1.0", @@ -43614,7 +43614,7 @@ "@gasket/data": "^6.41.1", "@gasket/engine": "^6.41.0", "@gasket/fetch": "^6.39.0", - "@gasket/helper-intl": "^6.39.0", + "@gasket/helper-intl": "^6.41.2", "@gasket/log": "^6.39.0", "@gasket/nextjs": "^6.41.1", "@gasket/plugin-analyze": "^6.39.3", @@ -43623,9 +43623,9 @@ "@gasket/plugin-docs": "^6.41.1", "@gasket/plugin-docsify": "^6.39.3", "@gasket/plugin-elastic-apm": "^6.39.3", - "@gasket/plugin-express": "^6.41.1", + "@gasket/plugin-express": "^6.41.2", "@gasket/plugin-https": "^6.39.3", - "@gasket/plugin-intl": "^6.41.1", + "@gasket/plugin-intl": "^6.41.2", "@gasket/plugin-log": "^6.39.3", "@gasket/plugin-manifest": "^6.39.3", "@gasket/plugin-metadata": "^6.41.1", @@ -43637,10 +43637,10 @@ "@gasket/plugin-swagger": "^6.39.3", "@gasket/plugin-webpack": "^6.39.3", "@gasket/plugin-workbox": "^6.39.3", - "@gasket/preset-api": "^6.41.1", - "@gasket/preset-nextjs": "^6.41.1", + "@gasket/preset-api": "^6.41.2", + "@gasket/preset-nextjs": "^6.41.2", "@gasket/preset-pwa": "^6.39.3", - "@gasket/react-intl": "^6.41.1", + "@gasket/react-intl": "^6.41.2", "@gasket/redux": "^6.39.0", "@gasket/resolve": "^6.41.0", "@gasket/utils": "^6.41.0", diff --git a/packages/gasket-helper-intl/package.json b/packages/gasket-helper-intl/package.json index be4eca942..a3cfdd7a4 100644 --- a/packages/gasket-helper-intl/package.json +++ b/packages/gasket-helper-intl/package.json @@ -1,6 +1,6 @@ { "name": "@gasket/helper-intl", - "version": "6.39.0", + "version": "6.41.2", "description": "Internal helpers used by loaders to resolve locale file paths", "main": "lib/server.js", "browser": "lib/index.js", diff --git a/packages/gasket-plugin-express/package.json b/packages/gasket-plugin-express/package.json index b7dbeb804..edae40fae 100644 --- a/packages/gasket-plugin-express/package.json +++ b/packages/gasket-plugin-express/package.json @@ -1,6 +1,6 @@ { "name": "@gasket/plugin-express", - "version": "6.41.1", + "version": "6.41.2", "description": "Adds express support to your application", "main": "lib", "types": "lib/index.d.ts", diff --git a/packages/gasket-plugin-intl/package.json b/packages/gasket-plugin-intl/package.json index f53059785..4c70c8753 100644 --- a/packages/gasket-plugin-intl/package.json +++ b/packages/gasket-plugin-intl/package.json @@ -1,6 +1,6 @@ { "name": "@gasket/plugin-intl", - "version": "6.41.1", + "version": "6.41.2", "description": "NodeJS script to build localization files.", "main": "lib", "types": "lib/index.d.ts", @@ -38,7 +38,7 @@ }, "homepage": "https://github.com/godaddy/gasket/tree/main/packages/gasket-plugin-intl", "dependencies": { - "@gasket/helper-intl": "^6.39.0", + "@gasket/helper-intl": "^6.41.2", "@hapi/accept": "^6.0.0", "debug": "^4.3.4", "fs-extra": "^10.0.0", @@ -53,7 +53,7 @@ "devDependencies": { "@gasket/engine": "^6.39.3", "@gasket/plugin-log": "^6.39.3", - "@gasket/react-intl": "^6.41.1", + "@gasket/react-intl": "^6.41.2", "cross-env": "^7.0.3", "eslint": "^8.7.0", "eslint-config-godaddy": "^7.0.0", diff --git a/packages/gasket-preset-api/package.json b/packages/gasket-preset-api/package.json index f0f763973..2e13328ef 100644 --- a/packages/gasket-preset-api/package.json +++ b/packages/gasket-preset-api/package.json @@ -1,6 +1,6 @@ { "name": "@gasket/preset-api", - "version": "6.41.1", + "version": "6.41.2", "description": "Create Express-based API with Gasket", "main": "lib", "types": "lib/index.d.ts", @@ -23,7 +23,7 @@ "@gasket/plugin-config": "^6.41.1", "@gasket/plugin-docs": "^6.41.1", "@gasket/plugin-docsify": "^6.39.3", - "@gasket/plugin-express": "^6.41.1", + "@gasket/plugin-express": "^6.41.2", "@gasket/plugin-https": "^6.39.3", "@gasket/plugin-lint": "^6.41.0", "@gasket/plugin-log": "^6.39.3", diff --git a/packages/gasket-preset-nextjs/package.json b/packages/gasket-preset-nextjs/package.json index 573dabf77..e9583d2df 100644 --- a/packages/gasket-preset-nextjs/package.json +++ b/packages/gasket-preset-nextjs/package.json @@ -1,6 +1,6 @@ { "name": "@gasket/preset-nextjs", - "version": "6.41.1", + "version": "6.41.2", "description": "Basic NextJS Framework", "main": "lib", "types": "lib/index.d.ts", @@ -20,7 +20,7 @@ "url": "https://github.com/godaddy/gasket/issues" }, "dependencies": { - "@gasket/plugin-express": "^6.41.1", + "@gasket/plugin-express": "^6.41.2", "@gasket/plugin-https": "^6.39.3", "@gasket/plugin-log": "^6.39.3", "@gasket/plugin-nextjs": "^6.41.1", diff --git a/packages/gasket-react-intl/package.json b/packages/gasket-react-intl/package.json index 393b2c6fe..6143fc879 100644 --- a/packages/gasket-react-intl/package.json +++ b/packages/gasket-react-intl/package.json @@ -1,6 +1,6 @@ { "name": "@gasket/react-intl", - "version": "6.41.1", + "version": "6.41.2", "description": "React component library to enable localization for gasket apps.", "main": "lib", "browser": "lib", @@ -47,7 +47,7 @@ "@babel/runtime": "^7.12.5", "@gasket/data": "^6.41.1", "@gasket/fetch": "^6.39.0", - "@gasket/helper-intl": "^6.39.0", + "@gasket/helper-intl": "^6.41.2", "hoist-non-react-statics": "^3.0.0", "just-extend": "^6.2.0", "prop-types": "^15.7.2" diff --git a/packages/gasket-typescript-tests/package.json b/packages/gasket-typescript-tests/package.json index 2d86f7187..098b91daf 100644 --- a/packages/gasket-typescript-tests/package.json +++ b/packages/gasket-typescript-tests/package.json @@ -1,7 +1,7 @@ { "name": "@gasket/typescript-tests", "private": true, - "version": "6.41.1", + "version": "6.41.2", "description": "Not a published package; hosts unit tests to verify TypeScript support", "files": [ "lib" @@ -37,7 +37,7 @@ "@gasket/data": "^6.41.1", "@gasket/engine": "^6.41.0", "@gasket/fetch": "^6.39.0", - "@gasket/helper-intl": "^6.39.0", + "@gasket/helper-intl": "^6.41.2", "@gasket/log": "^6.39.0", "@gasket/nextjs": "^6.41.1", "@gasket/plugin-analyze": "^6.39.3", @@ -46,9 +46,9 @@ "@gasket/plugin-docs": "^6.41.1", "@gasket/plugin-docsify": "^6.39.3", "@gasket/plugin-elastic-apm": "^6.39.3", - "@gasket/plugin-express": "^6.41.1", + "@gasket/plugin-express": "^6.41.2", "@gasket/plugin-https": "^6.39.3", - "@gasket/plugin-intl": "^6.41.1", + "@gasket/plugin-intl": "^6.41.2", "@gasket/plugin-log": "^6.39.3", "@gasket/plugin-manifest": "^6.39.3", "@gasket/plugin-metadata": "^6.41.1", @@ -60,10 +60,10 @@ "@gasket/plugin-swagger": "^6.39.3", "@gasket/plugin-webpack": "^6.39.3", "@gasket/plugin-workbox": "^6.39.3", - "@gasket/preset-api": "^6.41.1", - "@gasket/preset-nextjs": "^6.41.1", + "@gasket/preset-api": "^6.41.2", + "@gasket/preset-nextjs": "^6.41.2", "@gasket/preset-pwa": "^6.39.3", - "@gasket/react-intl": "^6.41.1", + "@gasket/react-intl": "^6.41.2", "@gasket/redux": "^6.39.0", "@gasket/resolve": "^6.41.0", "@gasket/utils": "^6.41.0", From 807dd34ad05fee5ac41c3d4ae4804e3516ed55a4 Mon Sep 17 00:00:00 2001 From: Michael Mason Date: Thu, 28 Sep 2023 09:23:03 -0700 Subject: [PATCH 3/6] [docs] --- README.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 16d3dde9a..646030355 100644 --- a/README.md +++ b/README.md @@ -146,8 +146,8 @@ Available presets | Name | Version | Description | | ----------------------- | ------- | ------------------------------------------ | -| [@gasket/preset-api] | 6.41.0 | Create Express-based API with Gasket | -| [@gasket/preset-nextjs] | 6.41.0 | Basic NextJS Framework | +| [@gasket/preset-api] | 6.41.2 | Create Express-based API with Gasket | +| [@gasket/preset-nextjs] | 6.41.2 | Basic NextJS Framework | | [@gasket/preset-pwa] | 6.39.3 | Turn Gasket apps into Progressive Web Apps | ## Plugins @@ -158,29 +158,29 @@ Available plugins | ------------------------------- | ------- | -------------------------------------------------------------------------- | | [@gasket/plugin-analyze] | 6.39.3 | Gasket Analyzer Plugin | | [@gasket/plugin-command] | 6.41.0 | Plugin to enable other plugins to inject new gasket commands | -| [@gasket/plugin-config] | 6.41.0 | Supports application-specific (non-Gasket) configuration | +| [@gasket/plugin-config] | 6.41.1 | Supports application-specific (non-Gasket) configuration | | [@gasket/plugin-cypress] | 6.39.0 | Integrates Cypress based testing into your Gasket application | -| [@gasket/plugin-docs] | 6.39.3 | Centralize doc files from plugins and modules | +| [@gasket/plugin-docs] | 6.41.1 | Centralize doc files from plugins and modules | | [@gasket/plugin-docs-graphs] | 6.39.0 | Generate mermaid graphs of an applications gasket lifecycles | | [@gasket/plugin-docsify] | 6.39.3 | View collated docs with Docsify | | [@gasket/plugin-docusaurus] | 6.39.3 | Gasket plugin for docusaurus | | [@gasket/plugin-elastic-apm] | 6.39.3 | Adds Elastic APM instrumentation to your application | -| [@gasket/plugin-express] | 6.39.3 | Adds express support to your application | -| [@gasket/plugin-fastify] | 6.39.3 | Adds fastify support to your application | +| [@gasket/plugin-express] | 6.41.2 | Adds express support to your application | +| [@gasket/plugin-fastify] | 6.41.1 | Adds fastify support to your application | | [@gasket/plugin-git] | 6.41.0 | Adds git support to your application | | [@gasket/plugin-happyfeet] | 6.39.1 | A gasket plugin to enable happyfeet healthchecks | | [@gasket/plugin-https] | 6.39.3 | Create http/s servers with graceful termination | -| [@gasket/plugin-intl] | 6.39.3 | NodeJS script to build localization files. | +| [@gasket/plugin-intl] | 6.41.2 | NodeJS script to build localization files. | | [@gasket/plugin-jest] | 6.39.0 | Integrated jest into your application. | | [@gasket/plugin-lifecycle] | 6.39.3 | Allows a gasket/ directory to be used for lifecycle hooks in applications. | | [@gasket/plugin-lint] | 6.41.0 | Adds GoDaddy standard linting to your application | | [@gasket/plugin-log] | 6.39.3 | Gasket log plugin | | [@gasket/plugin-manifest] | 6.39.3 | The web app manifest for progressive Gasket applications | -| [@gasket/plugin-metadata] | 6.41.0 | Adds metadata to gasket lifecycles | +| [@gasket/plugin-metadata] | 6.41.1 | Adds metadata to gasket lifecycles | | [@gasket/plugin-metrics] | 6.39.3 | Collect metrics for gasket commands | | [@gasket/plugin-mocha] | 6.39.0 | Integrates mocha based testing in to your Gasket application | | [@gasket/plugin-morgan] | 6.39.3 | Adds morgan request logger to your app | -| [@gasket/plugin-nextjs] | 6.41.0 | Adds Next support to your application | +| [@gasket/plugin-nextjs] | 6.41.1 | Adds Next support to your application | | [@gasket/plugin-redux] | 6.39.3 | Gasket Redux Setup | | [@gasket/plugin-service-worker] | 6.39.3 | Gasket Service Worker Plugin | | [@gasket/plugin-start] | 6.39.3 | Adds commands for building and starting Gasket apps | @@ -195,19 +195,19 @@ Supporting modules | Name | Version | Description | | -------------------------- | ------- | ------------------------------------------------------------------------------------ | | [@gasket/assets] | 6.39.0 | Gasket assets | -| [@gasket/cli] | 6.41.0 | CLI for rapid application development with gasket | -| [@gasket/data] | 6.39.0 | Helper package for accessing embedded Gasket Data in the browser | +| [@gasket/cli] | 6.41.1 | CLI for rapid application development with gasket | +| [@gasket/data] | 6.41.1 | Helper package for accessing embedded Gasket Data in the browser | | [@gasket/engine] | 6.41.0 | Plugin engine for gasket | | [@gasket/fetch] | 6.39.0 | Gasket Fetch API | -| [@gasket/helper-intl] | 6.39.0 | Internal helpers used by loaders to resolve locale file paths | +| [@gasket/helper-intl] | 6.41.2 | Internal helpers used by loaders to resolve locale file paths | | [@gasket/log] | 6.39.0 | Gasket client and server logger | -| [@gasket/nextjs] | 6.40.0 | Gasket integrations for Next.js apps | -| [@gasket/react-intl] | 6.39.0 | React component library to enable localization for gasket apps. | +| [@gasket/nextjs] | 6.41.1 | Gasket integrations for Next.js apps | +| [@gasket/react-intl] | 6.41.2 | React component library to enable localization for gasket apps. | | [@gasket/redux] | 6.39.0 | Gasket Redux Configuration | | [@gasket/resolve] | 6.41.0 | Essential module resolution & configuration management for gasket plugins & presets. | -| [@gasket/typescript-tests] | 6.41.0 | Not a published package; hosts unit tests to verify TypeScript support | +| [@gasket/typescript-tests] | 6.41.2 | Not a published package; hosts unit tests to verify TypeScript support | | [@gasket/utils] | 6.41.0 | Reusable utilities for Gasket internals | -| [create-gasket-app] | 6.41.0 | starter pack for creating a gasket app | +| [create-gasket-app] | 6.41.1 | starter pack for creating a gasket app | ## Configurations From 0fc8367e05233a3238dc87bfbe632d9e8af4f53e Mon Sep 17 00:00:00 2001 From: Jacob Page <85361835+jpage-godaddy@users.noreply.github.com> Date: Fri, 29 Sep 2023 08:47:56 -0700 Subject: [PATCH 4/6] Discourage first and last timing (#623) * Discourage first and last timing Discourage the use of `first` and `last` for lifecycle hook timings. * Update packages/gasket-cli/docs/plugins.md Co-authored-by: Andrew Gerard <63810935+agerard-godaddy@users.noreply.github.com> --------- Co-authored-by: Andrew Gerard <63810935+agerard-godaddy@users.noreply.github.com> --- packages/gasket-cli/docs/plugins.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/gasket-cli/docs/plugins.md b/packages/gasket-cli/docs/plugins.md index 2a195f293..44c0901d8 100644 --- a/packages/gasket-cli/docs/plugins.md +++ b/packages/gasket-cli/docs/plugins.md @@ -77,10 +77,14 @@ type Hook = HandlerFunction | { } ``` -The `before` and other timing properties establish ordering with respect to -other plugins. You can also use a first or last boolean instead to try to ensure -that it runs first or last (if multiple plugins do this, they'll run in -parallel). +The timing properties establish the execution order of a lifecycle hook with respect to that of other plugins. This does not change the order of lifecycle events, only the execution order of the hooks for the lifecycle event. + +| Property | Description | +|----------|-------------| +| `before` | Array of names of plugins whose hooks for the lifecycle your own hook should run before. This will guarantee that the hooks of those other plugins will wait for your hook to complete before running. | +| `after` | Array of names of plugins whose hooks for the lifecycle your own hook should run after. This will guarantee that your hook will wait for the hooks of those other plugins to complete before running. | +| `first` | Boolean indicating that your hook will run before that of any other plugin. You should avoid this whenever possible because it will prevent the ability of other hooks to run before yours, unless they also set `first`. Instead, use the `before` property to list _known plugins_ that have hooks known to be incompatible with running before or in parallel to yours. If multiple plugins use this flag for the same lifecycle, they will run in parallel unless `before` or `after` are also set. | +| `last` | Boolean indicating that your hook will run after those of all the other plugins. You should avoid this whenever possible because it will prevent the ability of other hooks to run after yours, unless they also set `last`. Instead, use the `after` property to list _known plugins_ that must have their hooks complete before yours runs. If multiple plugins use this flag for the same lifecycle, they will run in parallel unless `before` or `after` are also set. | The handler functions are called with a `GasketAPI` followed by any arguments passed when the event was invoked. You can see the full definitions for the From 210d2e88a210039ad924cd3d78fe8321db195784 Mon Sep 17 00:00:00 2001 From: Andrew Gerard <63810935+agerard-godaddy@users.noreply.github.com> Date: Fri, 29 Sep 2023 09:08:09 -0700 Subject: [PATCH 5/6] Drop node 16 from CI (#625) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d8478da9..89f0409f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: - node-version: [16.x,18.x] + node-version: [18.x, 20.x] steps: - uses: actions/checkout@v3 From b960f6cb21148ae766be803ee3c83f9cc6a866db Mon Sep 17 00:00:00 2001 From: Andrew Gerard <63810935+agerard-godaddy@users.noreply.github.com> Date: Fri, 29 Sep 2023 09:19:11 -0700 Subject: [PATCH 6/6] Test exec async ordering (#622) * test: async exec ordering * test: order within first grouping * test: before + first * fix: code style alignment --------- Co-authored-by: Kawika Bader --- packages/gasket-engine/test/exec.test.js | 82 +++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-) diff --git a/packages/gasket-engine/test/exec.test.js b/packages/gasket-engine/test/exec.test.js index c91bdcee0..a3b23161a 100644 --- a/packages/gasket-engine/test/exec.test.js +++ b/packages/gasket-engine/test/exec.test.js @@ -1,3 +1,7 @@ +async function pause(ms) { + await new Promise(resolve => setTimeout(resolve, ms)); +} + describe('The exec method', () => { let engine, hookASpy, hookBSpy; @@ -10,6 +14,34 @@ describe('The exec method', () => { hooks: { eventA() { return Promise.resolve(1); + }, + eventB: { + timing: { + after: ['pluginB'] + }, + async handler() { + const start = Date.now(); + await pause(10); + return { + value: 'A', + start, + end: Date.now() + }; + } + }, + eventC: { + timing: { + first: true + }, + async handler() { + const start = Date.now(); + await pause(10); + return { + value: 'A', + start, + end: Date.now() + }; + } } } }; @@ -19,6 +51,30 @@ describe('The exec method', () => { hooks: { eventA() { return 2; + }, + async eventB() { + const start = Date.now(); + await pause(10); + return { + value: 'B', + start, + end: Date.now() + }; + }, + eventC: { + timing: { + first: true, + before: ['pluginA'] + }, + async handler() { + const start = Date.now(); + await pause(10); + return { + value: 'B', + start, + end: Date.now() + }; + } } } }; @@ -59,7 +115,7 @@ describe('The exec method', () => { }); it('resolves to an empty array if nothing hooked the event', async () => { - const result = await engine.exec('eventB'); + const result = await engine.exec('eventMissing'); expect(result).toEqual([]); }); @@ -81,4 +137,28 @@ describe('The exec method', () => { await expect(engine.exec('mock')).rejects.toThrow(Error); }); + + it('should await if ordered', async () => { + const result = await engine.exec('eventB'); + + expect(result).toEqual([ + expect.objectContaining({ value: 'B' }), + expect.objectContaining({ value: 'A' }) + ]); + + const [resultsB, resultsA] = result; + expect(resultsA.start).toBeGreaterThanOrEqual(resultsB.end); + }); + + it('should await if ordered within first grouping', async () => { + const result = await engine.exec('eventC'); + + expect(result).toEqual([ + expect.objectContaining({ value: 'B' }), + expect.objectContaining({ value: 'A' }) + ]); + + const [resultsB, resultsA] = result; + expect(resultsA.start).toBeGreaterThanOrEqual(resultsB.end); + }); });