From 0ea2f42d3d8e7d47f42174acecbf0eeed490d702 Mon Sep 17 00:00:00 2001 From: Mike Pirog Date: Sat, 7 Dec 2024 10:46:01 -0500 Subject: [PATCH] Optimized for midcore (#48) * Optimized for midcore * Optimized for midcore part 2 * Optimized for midcore part 3 * Optimized for midcore part 4 --- .eslintrc.json | 19 ++++++++++++++++--- .github/workflows/pr-docs-tests.yml | 2 +- .github/workflows/pr-linter.yml | 2 +- .github/workflows/pr-postgres-tests.yml | 4 ++-- .github/workflows/pr-unit-tests.yml | 2 +- .node-version | 2 +- .npmignore | 2 ++ CHANGELOG.md | 2 ++ builders/postgres.js | 2 +- docs/.vitepress/config.mjs | 6 +++--- docs/config.md | 4 ++-- docs/development.md | 2 +- docs/index.md | 8 ++++---- docs/install.md | 2 +- docs/support.md | 4 ++-- docs/team.md | 6 +++--- examples/10/README.md | 14 +++++--------- examples/11/README.md | 14 +++++--------- examples/12/README.md | 14 +++++--------- examples/13/README.md | 14 +++++--------- examples/14/README.md | 14 +++++--------- examples/15/README.md | 14 +++++--------- examples/16/README.md | 14 +++++--------- examples/9.6/README.md | 16 ++++++---------- examples/custom/README.md | 14 +++++--------- index.js | 2 +- package-lock.json | 22 +++------------------- package.json | 3 --- tmpfile | 0 utils/get-default-healthcheck.js | 2 +- 30 files changed, 94 insertions(+), 132 deletions(-) delete mode 100644 tmpfile diff --git a/.eslintrc.json b/.eslintrc.json index 18ddef1..635beae 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,7 +1,8 @@ { "env": { "node": true, - "mocha": true + "mocha": true, + "es2021": true }, "parser": "@babel/eslint-parser", "parserOptions": { @@ -9,15 +10,27 @@ "ecmaVersion": 8, "requireConfigFile": false }, - "extends": "google", + "extends": [ + "eslint:recommended", + "google" + ], "rules": { "arrow-parens": ["error", "as-needed" ], "max-len": ["error", { - "code": 120, + "code": 140, "ignoreComments": true }], + "no-empty": ["error", { + "allowEmptyCatch": true + }], + "no-unused-vars": ["error", { + "vars": "all", + "args": "after-used", + "ignoreRestSiblings": false + }], + "require-jsdoc": ["error", { "require": { "FunctionDeclaration": true, diff --git a/.github/workflows/pr-docs-tests.yml b/.github/workflows/pr-docs-tests.yml index ea07050..3537cb8 100644 --- a/.github/workflows/pr-docs-tests.yml +++ b/.github/workflows/pr-docs-tests.yml @@ -11,7 +11,7 @@ jobs: os: - ubuntu-24.04 node-version: - - '18' + - '20' steps: # Install deps and cache - name: Checkout code diff --git a/.github/workflows/pr-linter.yml b/.github/workflows/pr-linter.yml index 4bd4214..7dbfd1b 100644 --- a/.github/workflows/pr-linter.yml +++ b/.github/workflows/pr-linter.yml @@ -11,7 +11,7 @@ jobs: os: - ubuntu-24.04 node-version: - - '18' + - '20' steps: # Install deps and cache - name: Checkout code diff --git a/.github/workflows/pr-postgres-tests.yml b/.github/workflows/pr-postgres-tests.yml index cf75133..944c9b9 100644 --- a/.github/workflows/pr-postgres-tests.yml +++ b/.github/workflows/pr-postgres-tests.yml @@ -12,11 +12,11 @@ jobs: fail-fast: false matrix: lando-version: - - 3-edge-slim + - 3-edge os: - ubuntu-24.04 node-version: - - '18' + - '20' leia-test: - examples/9.6 - examples/10 diff --git a/.github/workflows/pr-unit-tests.yml b/.github/workflows/pr-unit-tests.yml index 35b75b9..e42d0b0 100644 --- a/.github/workflows/pr-unit-tests.yml +++ b/.github/workflows/pr-unit-tests.yml @@ -13,7 +13,7 @@ jobs: - ubuntu-24.04 - macos-14 node-version: - - '18' + - '20' steps: # Install deps and cache - name: Checkout code diff --git a/.node-version b/.node-version index 3c03207..209e3ef 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -18 +20 diff --git a/.npmignore b/.npmignore index 4a071d5..2330742 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,6 @@ .github +.nyc_output +coverage docs examples guides diff --git a/CHANGELOG.md b/CHANGELOG.md index 0474cf1..018f4fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }}) +* Optimized for `midcore` + ## v1.4.3 - [December 6, 2024](https://github.com/lando/postgres/releases/tag/v1.4.3) * Updated the version index.md to get Docuverse page to build correctly. diff --git a/builders/postgres.js b/builders/postgres.js index 74e72d0..200aa3b 100644 --- a/builders/postgres.js +++ b/builders/postgres.js @@ -67,6 +67,6 @@ module.exports = { // Send it downstream super(id, options, {services: _.set({}, options.name, postgres)}); - }; + } }, }; diff --git a/docs/.vitepress/config.mjs b/docs/.vitepress/config.mjs index 440c495..858116e 100644 --- a/docs/.vitepress/config.mjs +++ b/docs/.vitepress/config.mjs @@ -8,8 +8,8 @@ const {name, version} = require('../../package.json'); const landoPlugin = name.replace('@lando/', ''); export default defineConfig({ - title: 'Lando Postgres Plugin', - description: 'The offical Lando plugin for Postgres.', + title: 'Lando PostgreSQL Plugin', + description: 'The offical Lando plugin for PostgreSQL.', landoDocs: 3, landoPlugin, version, @@ -20,7 +20,7 @@ export default defineConfig({ ], themeConfig: { multiVersionBuild: { - satisfies: '>=1.0.0', + satisfies: '>=1.4.0', }, sidebar: sidebar(), }, diff --git a/docs/config.md b/docs/config.md index b1ef455..09966fc 100644 --- a/docs/config.md +++ b/docs/config.md @@ -5,9 +5,9 @@ description: Learn how to configure the Lando Postgres service. # Configuration -Here are the configuration options, set to the default values, for this service. If you are unsure about where this goes or what this means, we *highly recommend* scanning the [services documentation](https://docs.lando.dev/core/v3/services/lando.html) to get a good handle on how the magicks work. +Here are the configuration options, set to the default values, for this service. If you are unsure about where this goes or what this means, we *highly recommend* scanning the [services documentation](https://docs.lando.dev/services/lando-3.html) to get a good handle on how the magicks work. -Also note that the below options are in addition to the [build steps](https://docs.lando.dev/core/v3/services/lando.html#build-steps) and [overrides](https://docs.lando.dev/core/v3/services/lando.html#overrides) that are available to every service. +Also note that the below options are in addition to the [build steps](https://docs.lando.dev/services/lando-3.html#build-steps) and [overrides](https://docs.lando.dev/services/lando-3.html#overrides) that are available to every service. ::: warning Be careful when switching database type, version or credentials! You should be careful switching database `type`, `version` or `creds`. diff --git a/docs/development.md b/docs/development.md index d7992ac..1bab6e6 100644 --- a/docs/development.md +++ b/docs/development.md @@ -1,6 +1,6 @@ --- title: Development -description: Learn how to develop and contribute to the Lando Postgres service +description: Learn how to develop and contribute to the Lando PostgreSQL service --- # Development diff --git a/docs/index.md b/docs/index.md index 2f48f7d..f225db8 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,14 +1,14 @@ --- -title: Postgres Lando Plugin +title: PostgreSQL Lando Plugin description: Add a highly configurable Postgres service to Lando for local development with all the power of Docker and Docker Compose. next: ./config.html --- -# Postgres +# PostgreSQL [PostgreSQL](https://www.postgresql.org/) is an advanced open source database server. -You can easily add it to your Lando app by adding an entry to the [services](https://docs.lando.dev/core/v3/services/lando.html) top-level config in your [Landofile](https://docs.lando.dev/core/v3). +You can easily add it to your Lando app by adding an entry to the [services](https://docs.lando.dev/services/lando-3.html) top-level config in your [Landofile](https://docs.lando.dev/landofile/). ```yaml services: @@ -28,7 +28,7 @@ services: * **[10](https://hub.docker.com/r/bitnami/postgresql)** **(default)** * [10.6.0](https://hub.docker.com/r/bitnami/postgresql) * [9.6](https://hub.docker.com/r/bitnami/postgresql) -* [custom](https://docs.lando.dev/core/v3/services/lando.html#overrides) +* [custom](https://docs.lando.dev/services/lando-3.html#overrides) ## Patch versions diff --git a/docs/install.md b/docs/install.md index 38dd2f4..24f9840 100644 --- a/docs/install.md +++ b/docs/install.md @@ -1,6 +1,6 @@ --- title: Installation -description: How to install the Lando Postgres Plugin. +description: How to install the Lando PostgreSQL Plugin. --- # Installation diff --git a/docs/support.md b/docs/support.md index e3f2bb6..7ac0487 100644 --- a/docs/support.md +++ b/docs/support.md @@ -1,6 +1,6 @@ --- title: Contact Us -description: Get help and support for the Lando Postgres Plugin +description: Get help and support for the Lando PostgreSQL Plugin --- # Contact Us @@ -21,4 +21,4 @@ If you need priority and dedicated support, expediated bug fixes or more feature

- \ No newline at end of file + diff --git a/docs/team.md b/docs/team.md index 38dd679..0e7fb6d 100644 --- a/docs/team.md +++ b/docs/team.md @@ -1,5 +1,5 @@ --- -description: Learn about the team that made the Postgres plugin. +description: Learn about the team that made the PostgreSQL plugin. layout: page title: Team --- @@ -10,7 +10,7 @@ title: Team Team @@ -22,4 +22,4 @@ import {useTeam} from '@lando/vitepress-theme-default-plus'; const members = useTeam(); - \ No newline at end of file + diff --git a/examples/10/README.md b/examples/10/README.md index cfa6965..9414e5e 100644 --- a/examples/10/README.md +++ b/examples/10/README.md @@ -1,12 +1,10 @@ -Postgres Example -================ +# PostgreSQL 10 Example This example exists primarily to test the following documentation: * [Postgres Service](https://docs.devwithlando.io/tutorials/postgres.html) -Start up tests --------------- +## Start up tests Run the following commands to get up and running with this example. @@ -16,14 +14,13 @@ lando poweroff lando start ``` -Verification commands ---------------------- +## Verification commands Run the following commands to validate things are rolling as they should. ```bash # Should use 10 as the specified version -lando ssh -s defaults -c "psql -V" | grep "10" +lando exec defaults -- psql -V | grep "10" # Should see the default database on healthcheck lando healthcheckdefaults | grep 'database' @@ -35,8 +32,7 @@ lando verifydefaultsdatabase | grep 'pg_database' lando crossconnect | grep 'pg_database' ``` -Destroy tests -------------- +## Destroy tests Run the following commands to trash this app like nothing ever happened. diff --git a/examples/11/README.md b/examples/11/README.md index 6293ad3..6c66c19 100644 --- a/examples/11/README.md +++ b/examples/11/README.md @@ -1,12 +1,10 @@ -Postgres Example -================ +# PostgreSQL 11 Example This example exists primarily to test the following documentation: * [Postgres Service](https://docs.devwithlando.io/tutorials/postgres.html) -Start up tests --------------- +## Start up tests Run the following commands to get up and running with this example. @@ -16,14 +14,13 @@ lando poweroff lando start ``` -Verification commands ---------------------- +## Verification commands Run the following commands to validate things are rolling as they should. ```bash # Should use 11 as the specified version -lando ssh -s defaults -c "psql -V" | grep "11" +lando exec defaults -- psql -V | grep "11" # Should see the default database on healthcheck lando healthcheckdefaults | grep 'database' @@ -35,8 +32,7 @@ lando verifydefaultsdatabase | grep 'pg_database' lando crossconnect | grep 'pg_database' ``` -Destroy tests -------------- +## Destroy tests Run the following commands to trash this app like nothing ever happened. diff --git a/examples/12/README.md b/examples/12/README.md index c767112..8342a67 100644 --- a/examples/12/README.md +++ b/examples/12/README.md @@ -1,12 +1,10 @@ -Postgres Example -================ +# PostgreSQL 12 Example This example exists primarily to test the following documentation: * [Postgres Service](https://docs.devwithlando.io/tutorials/postgres.html) -Start up tests --------------- +## Start up tests Run the following commands to get up and running with this example. @@ -16,14 +14,13 @@ lando poweroff lando start ``` -Verification commands ---------------------- +## Verification commands Run the following commands to validate things are rolling as they should. ```bash # Should use 12 as the specified version -lando ssh -s defaults -c "psql -V" | grep "12" +lando exec defaults -- psql -V | grep "12" # Should see the default database on healthcheck lando healthcheckdefaults | grep 'database' @@ -35,8 +32,7 @@ lando verifydefaultsdatabase | grep 'pg_database' lando crossconnect | grep 'pg_database' ``` -Destroy tests -------------- +## Destroy tests Run the following commands to trash this app like nothing ever happened. diff --git a/examples/13/README.md b/examples/13/README.md index 04e6203..379fbfc 100644 --- a/examples/13/README.md +++ b/examples/13/README.md @@ -1,12 +1,10 @@ -Postgres Example -================ +# PostgreSQL 13 Example This example exists primarily to test the following documentation: * [Postgres Service](https://docs.devwithlando.io/tutorials/postgres.html) -Start up tests --------------- +## Start up tests Run the following commands to get up and running with this example. @@ -16,14 +14,13 @@ lando poweroff lando start ``` -Verification commands ---------------------- +## Verification commands Run the following commands to validate things are rolling as they should. ```bash # Should use 13 as the specified version -lando ssh -s defaults -c "psql -V" | grep "13" +lando exec defaults -- psql -V | grep "13" # Should see the default database on healthcheck lando healthcheckdefaults | grep 'database' @@ -35,8 +32,7 @@ lando verifydefaultsdatabase | grep 'pg_database' lando crossconnect | grep 'pg_database' ``` -Destroy tests -------------- +## Destroy tests Run the following commands to trash this app like nothing ever happened. diff --git a/examples/14/README.md b/examples/14/README.md index a020f17..d5f0c4e 100644 --- a/examples/14/README.md +++ b/examples/14/README.md @@ -1,12 +1,10 @@ -Postgres Example -================ +# PostgreSQL 14 Example This example exists primarily to test the following documentation: * [Postgres Service](https://docs.devwithlando.io/tutorials/postgres.html) -Start up tests --------------- +## Start up tests Run the following commands to get up and running with this example. @@ -16,14 +14,13 @@ lando poweroff lando start ``` -Verification commands ---------------------- +## Verification commands Run the following commands to validate things are rolling as they should. ```bash # Should use 14 as the specified version -lando ssh -s defaults -c "psql -V" | grep "14" +lando exec defaults -- psql -V | grep "14" # Should see the default database on healthcheck lando healthcheckdefaults | grep 'database' @@ -35,8 +32,7 @@ lando verifydefaultsdatabase | grep 'pg_database' lando crossconnect | grep 'pg_database' ``` -Destroy tests -------------- +## Destroy tests Run the following commands to trash this app like nothing ever happened. diff --git a/examples/15/README.md b/examples/15/README.md index 79b47d8..2e8b32d 100644 --- a/examples/15/README.md +++ b/examples/15/README.md @@ -1,12 +1,10 @@ -Postgres Example -================ +# PostgreSQL 15 Example This example exists primarily to test the following documentation: * [Postgres Service](https://docs.devwithlando.io/tutorials/postgres.html) -Start up tests --------------- +## Start up tests Run the following commands to get up and running with this example. @@ -16,14 +14,13 @@ lando poweroff lando start ``` -Verification commands ---------------------- +## Verification commands Run the following commands to validate things are rolling as they should. ```bash # Should use 15 as the specified version -lando ssh -s defaults -c "psql -V" | grep "15" +lando exec defaults -- psql -V | grep "15" # Should see the default database on healthcheck lando healthcheckdefaults | grep 'database' @@ -35,8 +32,7 @@ lando verifydefaultsdatabase | grep 'pg_database' lando crossconnect | grep 'pg_database' ``` -Destroy tests -------------- +## Destroy tests Run the following commands to trash this app like nothing ever happened. diff --git a/examples/16/README.md b/examples/16/README.md index bc15fca..485b510 100644 --- a/examples/16/README.md +++ b/examples/16/README.md @@ -1,12 +1,10 @@ -Postgres Example -================ +# PostgreSQL 16 Example This example exists primarily to test the following documentation: * [Postgres Service](https://docs.devwithlando.io/tutorials/postgres.html) -Start up tests --------------- +## Start up tests Run the following commands to get up and running with this example. @@ -16,14 +14,13 @@ lando poweroff lando start ``` -Verification commands ---------------------- +## Verification commands Run the following commands to validate things are rolling as they should. ```bash # Should use 16 as the specified version -lando ssh -s defaults -c "psql -V" | grep "16" +lando exec defaults -- psql -V | grep "16" # Should see the default database on healthcheck lando healthcheckdefaults | grep 'database' @@ -35,8 +32,7 @@ lando verifydefaultsdatabase | grep 'pg_database' lando crossconnect | grep 'pg_database' ``` -Destroy tests -------------- +## Destroy tests Run the following commands to trash this app like nothing ever happened. diff --git a/examples/9.6/README.md b/examples/9.6/README.md index 7352c90..0aed768 100644 --- a/examples/9.6/README.md +++ b/examples/9.6/README.md @@ -1,12 +1,10 @@ -Postgres Example -================ +# PostgreSQL 9.6 Example This example exists primarily to test the following documentation: * [Postgres Service](https://docs.devwithlando.io/tutorials/postgres.html) -Start up tests --------------- +## Start up tests Run the following commands to get up and running with this example. @@ -16,17 +14,16 @@ lando poweroff lando start ``` -Verification commands ---------------------- +## Verification commands Run the following commands to validate things are rolling as they should. ```bash # Should use 9 as the specified version -lando ssh -s defaults -c "psql -V" | grep "9" +lando exec defaults -- "psql -V" | grep "9" # Should use patch version when set by the user -lando ssh -s patch -c "psql -V" | grep "9.6.14" +lando exec patch -- "psql -V" | grep "9.6.14" # Should see the default database on healthcheck lando healthcheckdefaults | grep 'database' @@ -38,8 +35,7 @@ lando verifydefaultsdatabase | grep 'pg_database' lando crossconnect | grep 'pg_database' ``` -Destroy tests -------------- +## Destroy tests Run the following commands to trash this app like nothing ever happened. diff --git a/examples/custom/README.md b/examples/custom/README.md index 49d878a..8aa2849 100644 --- a/examples/custom/README.md +++ b/examples/custom/README.md @@ -1,12 +1,10 @@ -Postgres Example -================ +# PostgreSQL Custom Example This example exists primarily to test the following documentation: * [Postgres Service](https://docs.devwithlando.io/tutorials/postgres.html) -Start up tests --------------- +## Start up tests Run the following commands to get up and running with this example. @@ -16,14 +14,13 @@ lando poweroff lando start ``` -Verification commands ---------------------- +## Verification commands Run the following commands to validate things are rolling as they should. ```bash # Should use the specfied version when set by the user -lando ssh -s custom -c "psql -V" | grep "11." +lando exec custom -- psql -V | grep "11." # Should use the correct custom user pass db lando verifycustom | grep 'pg_database' @@ -41,8 +38,7 @@ lando info -s mimicarecipe | grep user | grep postgres lando info -s mimicarecipe | grep 'mimic' ``` -Destroy tests -------------- +## Destroy tests Run the following commands to trash this app like nothing ever happened. diff --git a/index.js b/index.js index 4b6e364..529aa95 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,3 @@ 'use strict'; -module.exports = lando => {}; +module.exports = () => {}; diff --git a/package-lock.json b/package-lock.json index 648c1a0..cb0991e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,14 +6,12 @@ "packages": { "": { "name": "@lando/postgres", - "version": "1.4.1", + "version": "1.4.3", "bundleDependencies": [ - "@lando/postgres", "lodash" ], "license": "GPL-3.0", "dependencies": { - "@lando/postgres": "^1.1.0", "lodash": "^4.17.21" }, "devDependencies": { @@ -1533,21 +1531,6 @@ "node": ">=8" } }, - "node_modules/@lando/postgres": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@lando/postgres/-/postgres-1.1.0.tgz", - "integrity": "sha512-DG2chpzdeBTJ1jieALOy6EPAL+BYU1by3+nArrGY98fQ/5PlRN/oNoJ9BOjoNmiWtR6GpfaZpVpun+T0zdp+Cw==", - "bundleDependencies": [ - "lodash" - ], - "inBundle": true, - "dependencies": { - "lodash": "^4.17.21" - }, - "engines": { - "node": ">=18.0.0" - } - }, "node_modules/@lando/vitepress-theme-default-plus": { "version": "1.1.0-beta.24", "resolved": "https://registry.npmjs.org/@lando/vitepress-theme-default-plus/-/vitepress-theme-default-plus-1.1.0-beta.24.tgz", @@ -5493,7 +5476,8 @@ "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "inBundle": true + "inBundle": true, + "license": "MIT" }, "node_modules/lodash-es": { "version": "4.17.21", diff --git a/package.json b/package.json index e46719c..2183727 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,6 @@ "test": "npm run lint && npm run test:unit" }, "dependencies": { - "@lando/postgres": "^1.1.0", "lodash": "^4.17.21" }, "devDependencies": { @@ -60,11 +59,9 @@ "vitepress": "^1.3.4" }, "bundledDependencies": [ - "@lando/postgres", "lodash" ], "bundleDependencies": [ - "@lando/postgres", "lodash" ] } diff --git a/tmpfile b/tmpfile deleted file mode 100644 index e69de29..0000000 diff --git a/utils/get-default-healthcheck.js b/utils/get-default-healthcheck.js index 087dc8c..740c791 100644 --- a/utils/get-default-healthcheck.js +++ b/utils/get-default-healthcheck.js @@ -12,6 +12,6 @@ module.exports = options => { options.creds.database ? healthcheck.push(`--dbname=${options.creds.database}`) : false; return healthcheck.concat([ - '-c "\\\l"', + '-c "\\l"', ]).join(' '); };