declapract-typescript-ehmpathy 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/declapract.declare.yml +4 -0
- package/dist/examples/todo.md +1 -0
- package/dist/getVariables.ts +27 -0
- package/dist/practices/cicd-deploy-package/bad-practices/old-names/.github/workflows/publish_on_tag.yml.declapract.ts +3 -0
- package/dist/practices/cicd-deploy-package/best-practice/.declapract.readme.md +2 -0
- package/dist/practices/cicd-deploy-package/best-practice/.github/workflows/publish-on-tag.yml +36 -0
- package/dist/practices/cicd-deploy-service/bad-practices/old-names/.github/workflows/deploy_dev_on_main.yml.declapract.ts +3 -0
- package/dist/practices/cicd-deploy-service/bad-practices/old-names/.github/workflows/deploy_dev_on_master.yml.declapract.ts +3 -0
- package/dist/practices/cicd-deploy-service/bad-practices/old-names/.github/workflows/deploy_on_tag.yml.declapract.ts +3 -0
- package/dist/practices/cicd-deploy-service/bad-practices/old-names/.github/workflows/deploy_prod_on_tag.yml.declapract.ts +3 -0
- package/dist/practices/cicd-deploy-service/best-practice/.declapract.readme.md +4 -0
- package/dist/practices/cicd-deploy-service/best-practice/.github/workflows/deploy-dev-on-main.yml +59 -0
- package/dist/practices/cicd-deploy-service/best-practice/.github/workflows/deploy-prod-on-tag.yml +74 -0
- package/dist/practices/cicd-integrate/bad-practices/old-names/.github/workflows/ci-on-commit.yml.declapract.ts +3 -0
- package/dist/practices/cicd-integrate/bad-practices/old-names/.github/workflows/ci_on_commit.yml.declapract.ts +3 -0
- package/dist/practices/cicd-integrate/bad-practices/old-names/.github/workflows/test_on_commit.yml.declapract.ts +3 -0
- package/dist/practices/cicd-integrate/best-practice/.declapract.readme.md +3 -0
- package/dist/practices/cicd-integrate/best-practice/.github/workflows/pr-release-on-main.yml +17 -0
- package/dist/practices/cicd-integrate/best-practice/.github/workflows/test-on-commit.yml +285 -0
- package/dist/practices/config/bad-practices/configs-contain-wrong-account-id/config/dev.json.declapract.ts +9 -0
- package/dist/practices/config/bad-practices/configs-contain-wrong-account-id/config/prod.json.declapract.ts +9 -0
- package/dist/practices/config/bad-practices/configs-contain-wrong-account-id/config/test.json.declapract.ts +9 -0
- package/dist/practices/config/bad-practices/divergent-config-shapes/.declapract.readme.md +8 -0
- package/dist/practices/config/bad-practices/divergent-config-shapes/config/dev.json.declapract.ts +37 -0
- package/dist/practices/config/bad-practices/divergent-config-shapes/config/prod.json.declapract.ts +37 -0
- package/dist/practices/config/bad-practices/in-util-dir-directly/.declapract.readme.md +1 -0
- package/dist/practices/config/bad-practices/in-util-dir-directly/src/<star><star>/<star>.ts.declapract.ts +16 -0
- package/dist/practices/config/bad-practices/in-util-dir-directly/src/utils/config.integration.test.ts.declapract.ts +3 -0
- package/dist/practices/config/bad-practices/in-util-dir-directly/src/utils/config.ts.declapract.ts +3 -0
- package/dist/practices/config/bad-practices/promise-config/src/<star><star>/<star>.ts.declapract.ts +19 -0
- package/dist/practices/config/best-practice/config/dev.json +3 -0
- package/dist/practices/config/best-practice/config/dev.json.declapract.ts +3 -0
- package/dist/practices/config/best-practice/config/prod.json +3 -0
- package/dist/practices/config/best-practice/config/prod.json.declapract.ts +3 -0
- package/dist/practices/config/best-practice/config/test.json +3 -0
- package/dist/practices/config/best-practice/config/test.json.declapract.ts +3 -0
- package/dist/practices/config/best-practice/nontyped_modules/config-with-paramstore.d.ts +1 -0
- package/dist/practices/config/best-practice/package.json +5 -0
- package/dist/practices/config/best-practice/package.json.declapract.ts +3 -0
- package/dist/practices/config/best-practice/provision/aws/product/parameter-store.tf +3 -0
- package/dist/practices/config/best-practice/provision/aws/product/parameter-store.tf.declapract.ts +16 -0
- package/dist/practices/config/best-practice/provision/aws/product/variables.tf +3 -0
- package/dist/practices/config/best-practice/provision/aws/product/variables.tf.declapract.ts +3 -0
- package/dist/practices/config/best-practice/src/utils/config/Config.ts +1 -0
- package/dist/practices/config/best-practice/src/utils/config/Config.ts.declapract.ts +7 -0
- package/dist/practices/config/best-practice/src/utils/config/getConfig.integration.test.ts +8 -0
- package/dist/practices/config/best-practice/src/utils/config/getConfig.ts +8 -0
- package/dist/practices/config/best-practice/src/utils/environment.ts +3 -0
- package/dist/practices/config/best-practice/src/utils/environment.ts.declapract.ts +3 -0
- package/dist/practices/conventional-commits/best-practice/.declapract.readme.md +5 -0
- package/dist/practices/conventional-commits/best-practice/.husky/commit-msg +4 -0
- package/dist/practices/conventional-commits/best-practice/commitlint.config.js +4 -0
- package/dist/practices/conventional-commits/best-practice/package.json +17 -0
- package/dist/practices/conventional-commits/best-practice/package.json.declapract.ts +3 -0
- package/dist/practices/dates-and-times/bad-practices/moment/.declapract.readme.md +9 -0
- package/dist/practices/dates-and-times/bad-practices/moment/package.json.declapract.ts +12 -0
- package/dist/practices/dates-and-times/best-practice/.declapract.readme.md +1 -0
- package/dist/practices/dates-and-times/best-practice/package.json +5 -0
- package/dist/practices/dates-and-times/best-practice/package.json.declapract.ts +3 -0
- package/dist/practices/directory-structure-src/bad-practices/model-dir/.declapract.readme.md +2 -0
- package/dist/practices/directory-structure-src/bad-practices/model-dir/src/<star><star>/<star>.ts.declapract.ts +44 -0
- package/dist/practices/directory-structure-src/bad-practices/model-dir/src/model/<star><star>/<star>.ts.declapract.ts +16 -0
- package/dist/practices/directory-structure-src/bad-practices/services-dir/.declapract.readme.md +5 -0
- package/dist/practices/directory-structure-src/bad-practices/services-dir/src/services/<star><star>/<star>.ts.declapract.ts +3 -0
- package/dist/practices/directory-structure-src/best-practice/.declapract.readme.md +32 -0
- package/dist/practices/directory-structure-src/best-practice/src/contract/<star><star>/<star>.ts.declapract.ts +4 -0
- package/dist/practices/directory-structure-src/best-practice/src/data/clients/<star><star>/<star>.ts.declapract.ts +3 -0
- package/dist/practices/directory-structure-src/best-practice/src/data/dao/<star><star>/<star>.ts.declapract.ts +3 -0
- package/dist/practices/directory-structure-src/best-practice/src/domain/constants.ts.declapract.ts +15 -0
- package/dist/practices/directory-structure-src/best-practice/src/domain/index.ts.declapract.ts +3 -0
- package/dist/practices/directory-structure-src/best-practice/src/domain/objects/index.ts.declapract.ts +4 -0
- package/dist/practices/directory-structure-src/best-practice/src/logic/<star><star>/<star>.ts.declapract.ts +4 -0
- package/dist/practices/domain/bad-practices/schematic-joi-model/src/domain/<star><star>/<star>.ts.declapract.ts +16 -0
- package/dist/practices/domain/best-practice/package.json +7 -0
- package/dist/practices/domain/best-practice/package.json.declapract.ts +3 -0
- package/dist/practices/domain/best-practice/src/domain/objects/index.ts.declapract.ts +4 -0
- package/dist/practices/environments/best-practice/.declapract.readme.md +30 -0
- package/dist/practices/environments/best-practice/provision/aws/environments/dev/main.tf.declapract.ts +3 -0
- package/dist/practices/environments/best-practice/provision/aws/environments/prod/main.tf.declapract.ts +3 -0
- package/dist/practices/environments/best-practice/provision/aws/environments/test/main.tf.declapract.ts +3 -0
- package/dist/practices/environments/best-practice/src/utils/environment.ts +35 -0
- package/dist/practices/errors/best-practice/src/utils/errors/UnexpectedCodePathError.ts +14 -0
- package/dist/practices/format/best-practice/package.json +6 -0
- package/dist/practices/format/best-practice/package.json.declapract.ts +3 -0
- package/dist/practices/git/best-practice/.gitignore.declapract.ts +29 -0
- package/dist/practices/lambda-clients/bad-practices/lambda-service-client-package/.declapract.readme.md +1 -0
- package/dist/practices/lambda-clients/bad-practices/lambda-service-client-package/package.json +5 -0
- package/dist/practices/lambda-clients/bad-practices/lambda-service-client-package/package.json.declapract.ts +16 -0
- package/dist/practices/lambda-clients/best-practice/package.json +5 -0
- package/dist/practices/lambda-clients/best-practice/package.json.declapract.ts +3 -0
- package/dist/practices/lambda-clients/best-practice/src/data/clients/<star>.ts +1 -0
- package/dist/practices/lambda-clients/best-practice/src/data/clients/<star>.ts.declapract.ts +3 -0
- package/dist/practices/lambda-handlers/best-practice/package.json +9 -0
- package/dist/practices/lambda-handlers/best-practice/package.json.declapract.ts +3 -0
- package/dist/practices/lambda-handlers/best-practice/src/contract/handlers/<star><star>/<star>.declapract.ts +3 -0
- package/dist/practices/linting/best-practice/.eslintrc.js +44 -0
- package/dist/practices/linting/best-practice/package.json +16 -0
- package/dist/practices/linting/best-practice/package.json.declapract.ts +4 -0
- package/dist/practices/logging/best-practice/package.json +5 -0
- package/dist/practices/logging/best-practice/package.json.declapract.ts +3 -0
- package/dist/practices/logging/best-practice/src/utils/logger.ts +3 -0
- package/dist/practices/node/bad-practices/license/package.json.declapract.ts +22 -0
- package/dist/practices/node/best-practice/.nvmrc +1 -0
- package/dist/practices/node/best-practice/package.json +11 -0
- package/dist/practices/node/best-practice/package.json.declapract.ts +3 -0
- package/dist/practices/node/best-practice/readme.md +1 -0
- package/dist/practices/node/best-practice/readme.md.declapract.ts +3 -0
- package/dist/practices/nonpublished-modules/.declapract.readme.md +5 -0
- package/dist/practices/nonpublished-modules/bad-practices/ahbode-standard-lambda-handler/.declapract.readme.md +1 -0
- package/dist/practices/nonpublished-modules/bad-practices/ahbode-standard-lambda-handler/src/__nonpublished_modules__/ahbode-standard-lambda-handler/<star><star>/<star>.ts.declapract.ts +3 -0
- package/dist/practices/nonpublished-modules/bad-practices/ahbode-standard-lambda-handler/src/contract/handlers/<star>.integration.test.ts +1 -0
- package/dist/practices/nonpublished-modules/bad-practices/ahbode-standard-lambda-handler/src/contract/handlers/<star>.integration.test.ts.declapract.ts +15 -0
- package/dist/practices/nonpublished-modules/bad-practices/ahbode-standard-lambda-handler/src/contract/handlers/<star>.ts +1 -0
- package/dist/practices/nonpublished-modules/bad-practices/ahbode-standard-lambda-handler/src/contract/handlers/<star>.ts.declapract.ts +13 -0
- package/dist/practices/nonpublished-modules/bad-practices/deep-omit/.declapract.readme.md +1 -0
- package/dist/practices/nonpublished-modules/bad-practices/deep-omit/src/__nonpublished_modules__/deep-omit/<star><star>/<star>.ts.declapract.ts +3 -0
- package/dist/practices/nonpublished-modules/bad-practices/deep-omit/src/data/dao/<star><star>/<star>.integration.test.ts +1 -0
- package/dist/practices/nonpublished-modules/bad-practices/deep-omit/src/data/dao/<star><star>/<star>.integration.test.ts.declapract.ts +18 -0
- package/dist/practices/nonpublished-modules/bad-practices/simple-dynamodb-client/.declapract.readme.md +1 -0
- package/dist/practices/nonpublished-modules/bad-practices/simple-dynamodb-client/src/__nonpublished_modules__/simple-dynamodb-client/<star><star>/<star>.ts.declapract.ts +3 -0
- package/dist/practices/package-json-order/best-practice/.declapract.readme.md +3 -0
- package/dist/practices/package-json-order/best-practice/package.json.declapract.ts +171 -0
- package/dist/practices/persist-with-dynamodb/best-practice/package.json +5 -0
- package/dist/practices/persist-with-dynamodb/best-practice/package.json.declapract.ts +3 -0
- package/dist/practices/persist-with-rds/bad-practices/non-prefixed-manual-init-sqls/provision/schema/sql/init/database.sql.declapract.ts +3 -0
- package/dist/practices/persist-with-rds/bad-practices/non-prefixed-manual-init-sqls/provision/schema/sql/init/extensions.sql.declapract.ts +13 -0
- package/dist/practices/persist-with-rds/bad-practices/non-prefixed-manual-init-sqls/provision/schema/sql/init/schema.sql.declapract.ts +3 -0
- package/dist/practices/persist-with-rds/bad-practices/non-prefixed-manual-init-sqls/provision/schema/sql/init/user.cicd.sql.declapract.ts +3 -0
- package/dist/practices/persist-with-rds/bad-practices/non-prefixed-manual-init-sqls/provision/schema/sql/init/user.datalakedb.sql.declapract.ts +3 -0
- package/dist/practices/persist-with-rds/bad-practices/non-prefixed-manual-init-sqls/readme.md +5 -0
- package/dist/practices/persist-with-rds/bad-practices/old-config-file-names/codegen.sql.yml.declapract.ts +3 -0
- package/dist/practices/persist-with-rds/bad-practices/schema-entities-dir/.declapract.readme.md +1 -0
- package/dist/practices/persist-with-rds/bad-practices/schema-entities-dir/provision/schema/entities/<star>.ts.declapract.ts +12 -0
- package/dist/practices/persist-with-rds/bad-practices/schema-entities-dir/provision/schema/sql/entities.yml.declapract.ts +13 -0
- package/dist/practices/persist-with-rds/best-practice/.declapract.readme.md +6 -0
- package/dist/practices/persist-with-rds/best-practice/codegen.sql.dao.yml +18 -0
- package/dist/practices/persist-with-rds/best-practice/codegen.sql.dao.yml.declapract.ts +3 -0
- package/dist/practices/persist-with-rds/best-practice/codegen.sql.schema.yml +6 -0
- package/dist/practices/persist-with-rds/best-practice/codegen.sql.types.yml +15 -0
- package/dist/practices/persist-with-rds/best-practice/config/dev.json +20 -0
- package/dist/practices/persist-with-rds/best-practice/config/dev.json.declapract.ts +15 -0
- package/dist/practices/persist-with-rds/best-practice/config/prod.json +20 -0
- package/dist/practices/persist-with-rds/best-practice/config/prod.json.declapract.ts +3 -0
- package/dist/practices/persist-with-rds/best-practice/config/test.json +20 -0
- package/dist/practices/persist-with-rds/best-practice/config/test.json.declapract.ts +3 -0
- package/dist/practices/persist-with-rds/best-practice/package.json +27 -0
- package/dist/practices/persist-with-rds/best-practice/package.json.declapract.ts +3 -0
- package/dist/practices/persist-with-rds/best-practice/provision/aws/product/parameter-store.tf +24 -0
- package/dist/practices/persist-with-rds/best-practice/provision/aws/product/parameter-store.tf.declapract.ts +18 -0
- package/dist/practices/persist-with-rds/best-practice/provision/docker/integration_test_db/build-image.dockerfile +7 -0
- package/dist/practices/persist-with-rds/best-practice/provision/docker/integration_test_db/docker-compose.yml +13 -0
- package/dist/practices/persist-with-rds/best-practice/provision/docker/integration_test_db/init/.gitignore +3 -0
- package/dist/practices/persist-with-rds/best-practice/provision/docker/integration_test_db/init/readme.md +3 -0
- package/dist/practices/persist-with-rds/best-practice/provision/docker/integration_test_db/wait-for-postgres.sh +15 -0
- package/dist/practices/persist-with-rds/best-practice/provision/schema/connection.config.js +23 -0
- package/dist/practices/persist-with-rds/best-practice/provision/schema/control.yml +7 -0
- package/dist/practices/persist-with-rds/best-practice/provision/schema/deploy.database.sh +71 -0
- package/dist/practices/persist-with-rds/best-practice/provision/schema/sql/init/.database.sql +10 -0
- package/dist/practices/persist-with-rds/best-practice/provision/schema/sql/init/.extensions.sql +16 -0
- package/dist/practices/persist-with-rds/best-practice/provision/schema/sql/init/.extensions.sql.declapract.ts +37 -0
- package/dist/practices/persist-with-rds/best-practice/provision/schema/sql/init/.schema.sql +11 -0
- package/dist/practices/persist-with-rds/best-practice/provision/schema/sql/init/.user.cicd.sql +14 -0
- package/dist/practices/persist-with-rds/best-practice/provision/schema/sql/init/.user.datalakedb.sql +12 -0
- package/dist/practices/persist-with-rds/best-practice/provision/schema/sql/init/default_transaction_isolation.sql +6 -0
- package/dist/practices/persist-with-rds/best-practice/provision/schema/sql/init/user.service.sql +16 -0
- package/dist/practices/persist-with-rds/best-practice/provision/schema/sql/init.yml +9 -0
- package/dist/practices/persist-with-rds/best-practice/provision/schema/sql/init.yml.declapract.ts +3 -0
- package/dist/practices/persist-with-rds/best-practice/src/utils/config/getConfig.ts +2 -0
- package/dist/practices/persist-with-rds/best-practice/src/utils/config/getConfig.ts.declapract.ts +3 -0
- package/dist/practices/persist-with-rds/best-practice/src/utils/database/getDatabaseConnection.integration.test.ts +10 -0
- package/dist/practices/persist-with-rds/best-practice/src/utils/database/getDatabaseConnection.ts +65 -0
- package/dist/practices/persist-with-rds/best-practice/src/utils/database/withDatabaseConnection.ts +38 -0
- package/dist/practices/persist-with-rds/best-practice/src/utils/database/withDatabaseTransaction.ts +20 -0
- package/dist/practices/prettier/bad-practices/format-script/package.json.declapract.ts +26 -0
- package/dist/practices/prettier/best-practice/.prettierignore +1 -0
- package/dist/practices/prettier/best-practice/package.json +10 -0
- package/dist/practices/prettier/best-practice/package.json.declapract.ts +3 -0
- package/dist/practices/prettier/best-practice/prettier.config.js +9 -0
- package/dist/practices/runtime-type-checking/bad-practices/joi-types/package.json +5 -0
- package/dist/practices/runtime-type-checking/bad-practices/joi-types/package.json.declapract.ts +18 -0
- package/dist/practices/runtime-type-checking/bad-practices/old-joi-syntax-valid-input-cant-be-array/.declapract.readme.md +1 -0
- package/dist/practices/runtime-type-checking/bad-practices/old-joi-syntax-valid-input-cant-be-array/src/<star><star>/<star>.ts.declapract.ts +15 -0
- package/dist/practices/runtime-type-checking/best-practice/package.json +5 -0
- package/dist/practices/runtime-type-checking/best-practice/package.json.declapract.ts +3 -0
- package/dist/practices/serverless/bad-practices/generic-deploy-script/package.json +8 -0
- package/dist/practices/serverless/bad-practices/generic-deploy-script/package.json.declapract.ts +23 -0
- package/dist/practices/serverless/bad-practices/old-sls-plugins/package.json +6 -0
- package/dist/practices/serverless/bad-practices/old-sls-plugins/package.json.declapract.ts +19 -0
- package/dist/practices/serverless/best-practice/package.json +11 -0
- package/dist/practices/serverless/best-practice/package.json.declapract.ts +3 -0
- package/dist/practices/serverless/best-practice/serverless.yml +70 -0
- package/dist/practices/serverless/best-practice/serverless.yml.declapract.ts +26 -0
- package/dist/practices/terraform/bad-practices/terraform-dir/.declapract.readme.md +8 -0
- package/dist/practices/terraform/bad-practices/terraform-dir/provision/terraform/<star><star>/.gitignore.declapract.ts +12 -0
- package/dist/practices/terraform/bad-practices/terraform-dir/provision/terraform/<star><star>/<star>.hcl.declapract.ts +12 -0
- package/dist/practices/terraform/bad-practices/terraform-dir/provision/terraform/<star><star>/<star>.tf.declapract.ts +12 -0
- package/dist/practices/terraform/best-practice/.terraform-version +1 -0
- package/dist/practices/terraform/best-practice/package.json +6 -0
- package/dist/practices/terraform/best-practice/package.json.declapract.ts +3 -0
- package/dist/practices/terraform/best-practice/provision/aws/environments/dev/main.tf +18 -0
- package/dist/practices/terraform/best-practice/provision/aws/environments/dev/versions.tf +9 -0
- package/dist/practices/terraform/best-practice/provision/aws/environments/prod/main.tf +18 -0
- package/dist/practices/terraform/best-practice/provision/aws/environments/prod/versions.tf +9 -0
- package/dist/practices/terraform/best-practice/provision/aws/environments/test/main.tf +18 -0
- package/dist/practices/terraform/best-practice/provision/aws/environments/test/versions.tf +9 -0
- package/dist/practices/terraform/best-practice/provision/aws/product/variables.tf +14 -0
- package/dist/practices/terraform/best-practice/provision/github/environment/import-existing-repo.sh +12 -0
- package/dist/practices/terraform/best-practice/provision/github/environment/main.tf +20 -0
- package/dist/practices/terraform/best-practice/provision/github/environment/versions.tf +9 -0
- package/dist/practices/terraform/best-practice/provision/github/product/repository.tf +70 -0
- package/dist/practices/testing/bad-practices/mocks/.declapract.readme.md +8 -0
- package/dist/practices/testing/bad-practices/mocks/<star><star>/__mock__/<star>.js +3 -0
- package/dist/practices/testing/bad-practices/mocks/<star><star>/__mock__/<star>.ts +3 -0
- package/dist/practices/testing/bad-practices/old-acceptance-test-utils/acceptance/_utils/getDataFromLastOpenBracketAtStartOfLine.ts.declapract.ts +3 -0
- package/dist/practices/testing/bad-practices/old-acceptance-test-utils/acceptance/_utils/invokeLambda.ts.declapract.ts +3 -0
- package/dist/practices/testing/bad-practices/old-acceptance-test-utils/acceptance/lambdas/<star>.ts.declapract.ts +44 -0
- package/dist/practices/testing/bad-practices/old-acceptance-test-utils-2/acceptance/__test_utils__/environment.ts.declapract.ts +3 -0
- package/dist/practices/testing/bad-practices/old-acceptance-test-utils-2/acceptance/lambdas/<star>.ts.declapract.ts +22 -0
- package/dist/practices/testing/bad-practices/old-acceptance-test-utils-3/acceptance/_utils/environment.ts.declapract.ts +3 -0
- package/dist/practices/testing/bad-practices/old-acceptance-test-utils-3/acceptance/lambdas/<star>.ts.declapract.ts +18 -0
- package/dist/practices/testing/bad-practices/old-extension-pattern/.declapract.readme.md +3 -0
- package/dist/practices/testing/bad-practices/old-extension-pattern/<star><star>/<star>.test.acceptance.ts.declapract.ts +11 -0
- package/dist/practices/testing/bad-practices/old-extension-pattern/<star><star>/<star>.test.integration.ts.declapract.ts +11 -0
- package/dist/practices/testing/best-practice/.declapract.readme.md +45 -0
- package/dist/practices/testing/best-practice/acceptance/<star><star>/<star>.acceptance.test.ts.declapract.ts +3 -0
- package/dist/practices/testing/best-practice/acceptance/environment.ts +5 -0
- package/dist/practices/testing/best-practice/acceptance/lambdas/<star>.acceptance.test.ts.declapract.ts +32 -0
- package/dist/practices/testing/best-practice/jest.acceptance.config.js +15 -0
- package/dist/practices/testing/best-practice/jest.acceptance.env.js +2 -0
- package/dist/practices/testing/best-practice/jest.config.js +1 -0
- package/dist/practices/testing/best-practice/jest.integration.config.js +10 -0
- package/dist/practices/testing/best-practice/jest.integration.env.js +13 -0
- package/dist/practices/testing/best-practice/jest.unit.config.js +15 -0
- package/dist/practices/testing/best-practice/jest.unit.env.js +16 -0
- package/dist/practices/testing/best-practice/package.json +16 -0
- package/dist/practices/testing/best-practice/package.json.declapract.ts +3 -0
- package/dist/practices/testing/best-practice/src/<star><star>/<star>.integration.test.ts.declapract.ts +3 -0
- package/dist/practices/testing/best-practice/src/<star><star>/<star>.test.ts.declapract.ts +3 -0
- package/dist/practices/testing/best-practice/src/utils/environment.ts +3 -0
- package/dist/practices/testing/best-practice/src/utils/environment.ts.declapract.ts +3 -0
- package/dist/practices/testing/defineFunctionNameFromTestFileName.ts +11 -0
- package/dist/practices/typescript/best-practice/.declapract.readme.md +10 -0
- package/dist/practices/typescript/best-practice/package.json +12 -0
- package/dist/practices/typescript/best-practice/package.json.declapract.ts +3 -0
- package/dist/practices/typescript/best-practice/tsconfig.build.json +17 -0
- package/dist/practices/typescript/best-practice/tsconfig.json +18 -0
- package/dist/practices/uuid/bad-practices/npm-uuidv4/.declapract.readme.md +1 -0
- package/dist/practices/uuid/bad-practices/npm-uuidv4/package.json.declapract.ts +17 -0
- package/dist/practices/uuid/best-practice/.declapract.readme.md +1 -0
- package/dist/practices/uuid/best-practice/package.json +8 -0
- package/dist/practices/uuid/best-practice/package.json.declapract.ts +3 -0
- package/dist/useCases.yml +48 -0
- package/package.json +96 -0
- package/readme.md +39 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FileCheckFunction, FileFixFunction } from 'declapract';
|
|
2
|
+
|
|
3
|
+
export const check: FileCheckFunction = (contents) => {
|
|
4
|
+
if (contents?.includes(`import { locally } from '../_utils/environment';`))
|
|
5
|
+
return; // then it matches bad practice
|
|
6
|
+
throw new Error('does not match bad practice');
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const fix: FileFixFunction = async (contents) => {
|
|
10
|
+
if (!contents) return {}; // do nothing if no contents. really, this shouldn't have been called
|
|
11
|
+
return {
|
|
12
|
+
contents: contents.replace(
|
|
13
|
+
// replace the bad import
|
|
14
|
+
`import { locally } from '../_utils/environment';`,
|
|
15
|
+
`import { locally } from '../environment';`,
|
|
16
|
+
),
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
a previous, now deprecated, best practice was to have the extension of `*.test.integration.ts` or `*.test.acceptance.ts` on test files
|
|
2
|
+
|
|
3
|
+
we've since moved over to `*.integration.test.ts` and `*.acceptance.test.ts` (it having the `.test.ts` extension still makes tools that dont expect different test types work with these test files out of the box, which is a nice to have)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FileCheckType, FileFixFunction } from 'declapract';
|
|
2
|
+
|
|
3
|
+
export const check = FileCheckType.EXISTS; // if files matching this pattern exist, bad practice
|
|
4
|
+
|
|
5
|
+
export const fix: FileFixFunction = (contents, context) => ({
|
|
6
|
+
relativeFilePath: context.relativeFilePath.replace(
|
|
7
|
+
/\.test\.acceptance\.ts$/,
|
|
8
|
+
'.acceptance.test.ts',
|
|
9
|
+
),
|
|
10
|
+
contents,
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FileCheckType, FileFixFunction } from 'declapract';
|
|
2
|
+
|
|
3
|
+
export const check = FileCheckType.EXISTS; // if files matching this pattern exist, bad practice
|
|
4
|
+
|
|
5
|
+
export const fix: FileFixFunction = (contents, context) => ({
|
|
6
|
+
relativeFilePath: context.relativeFilePath.replace(
|
|
7
|
+
/\.test\.integration\.ts$/,
|
|
8
|
+
'.integration.test.ts',
|
|
9
|
+
),
|
|
10
|
+
contents,
|
|
11
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# best practices for testing
|
|
2
|
+
|
|
3
|
+
## purpose of testing:
|
|
4
|
+
- think use cases, edge cases, and play with the business logic / model you've defined
|
|
5
|
+
- define use cases, edge cases, and previous failure points explicitly for future reference
|
|
6
|
+
- automate checking that:
|
|
7
|
+
- code complies with spec (i.e., all use cases and requirements are satisfied)
|
|
8
|
+
- regressions will not occur
|
|
9
|
+
- predicted error cases are covered
|
|
10
|
+
|
|
11
|
+
## three test types:
|
|
12
|
+
- unit tests
|
|
13
|
+
- test precisely scoped business logic, mocking out all dependencies
|
|
14
|
+
- purpose is to test that the unit/function of logic that you're defining does the logic in it correctly
|
|
15
|
+
- integration tests
|
|
16
|
+
- test end to end logic OR test boundaries between calling a dependent service
|
|
17
|
+
- for example:
|
|
18
|
+
- test boundaries with a dependent api
|
|
19
|
+
- test that we are communicating w/ database correctly
|
|
20
|
+
- test that we are
|
|
21
|
+
- test end to end logic
|
|
22
|
+
- test that a handler acts correctly in different cases
|
|
23
|
+
- test that a highly composed business logic function produces the correct results in all cases
|
|
24
|
+
- acceptance tests
|
|
25
|
+
- test that the deployed product works
|
|
26
|
+
- ideally: test an end to end pipeline of each use case it needs to support
|
|
27
|
+
- note: typically its sufficient to trust that integration tests have already tested the use cases and then all we need to test is that the lambda can be hit
|
|
28
|
+
|
|
29
|
+
// todo: add examples to the above
|
|
30
|
+
// todo: finesse the above definitions now that we're formally defining them
|
|
31
|
+
|
|
32
|
+
## pattern
|
|
33
|
+
|
|
34
|
+
- each test type gets its own file extension
|
|
35
|
+
- unit -> `.test.ts` (the default extension)
|
|
36
|
+
- integration -> `.integration.test.ts`
|
|
37
|
+
- acceptance -> `.acceptance.test.ts`
|
|
38
|
+
- each test type gets its own config (e.g., specify what extension to use)
|
|
39
|
+
- `jest.unit.config`
|
|
40
|
+
- `jest.integration.config`
|
|
41
|
+
- `jest.acceptance.config`
|
|
42
|
+
- each test type gets its own environment setup file (e.g., global mocks, or checks, etc)
|
|
43
|
+
- `jest.unit.env`
|
|
44
|
+
- `jest.integration.env`
|
|
45
|
+
- `jest.acceptance.env`
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Stage, stage } from '../src/utils/environment';
|
|
2
|
+
|
|
3
|
+
export const locally = process.env.LOCALLY === 'true'; // whether we want to acceptance test locally or deployed lambda
|
|
4
|
+
|
|
5
|
+
export const testInProdOnly = stage === Stage.PRODUCTION ? test : test.skip; // allow testing in prod env only (sometimes we don't deploy certain things in dev / test)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { FileCheckFunction } from 'declapract';
|
|
3
|
+
import expect from 'expect';
|
|
4
|
+
|
|
5
|
+
import { defineFunctionNameFromTestFileName } from '../../../defineFunctionNameFromTestFileName';
|
|
6
|
+
|
|
7
|
+
export const check: FileCheckFunction = (contents, context) => {
|
|
8
|
+
if (!contents)
|
|
9
|
+
throw new Error('expected at least one lambda acceptance test');
|
|
10
|
+
|
|
11
|
+
// check that each import was found
|
|
12
|
+
const expectedImports = [
|
|
13
|
+
"import { invokeLambdaForTesting } from 'simple-lambda-testing-methods';",
|
|
14
|
+
"import { stage } from '../../src/utils/environment';",
|
|
15
|
+
"import { locally } from '../environment';",
|
|
16
|
+
];
|
|
17
|
+
const missedImports = expectedImports.filter(
|
|
18
|
+
(expectedImport) => !contents.includes(expectedImport),
|
|
19
|
+
);
|
|
20
|
+
if (missedImports.length)
|
|
21
|
+
throw new Error(
|
|
22
|
+
`
|
|
23
|
+
${chalk.green(`- Expected imports ${['', ...expectedImports].join('\n - ')}`)}
|
|
24
|
+
`.trim(),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const expectedTestName = defineFunctionNameFromTestFileName({ context });
|
|
28
|
+
const expectedDescribe = `
|
|
29
|
+
describe('${expectedTestName}', () => {
|
|
30
|
+
`.trim();
|
|
31
|
+
expect(contents).toContain(expectedDescribe);
|
|
32
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// https://jestjs.io/docs/en/configuration.html
|
|
2
|
+
module.exports = {
|
|
3
|
+
preset: 'ts-jest',
|
|
4
|
+
globals: {
|
|
5
|
+
'ts-jest': {
|
|
6
|
+
tsconfig: 'tsconfig.json',
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
verbose: true,
|
|
10
|
+
testEnvironment: 'node',
|
|
11
|
+
moduleFileExtensions: ['js', 'ts'],
|
|
12
|
+
testMatch: ['**/*.acceptance.test.ts'],
|
|
13
|
+
setupFiles: ['core-js'],
|
|
14
|
+
setupFilesAfterEnv: ['./jest.acceptance.env.js'],
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./jest.unit.config'); // default to unit tests
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// https://jestjs.io/docs/en/configuration.html
|
|
2
|
+
module.exports = {
|
|
3
|
+
preset: 'ts-jest',
|
|
4
|
+
verbose: true,
|
|
5
|
+
testEnvironment: 'node',
|
|
6
|
+
moduleFileExtensions: ['js', 'ts'],
|
|
7
|
+
testMatch: ['**/*.integration.test.ts'],
|
|
8
|
+
setupFiles: ['core-js'],
|
|
9
|
+
setupFilesAfterEnv: ['./jest.integration.env.js'],
|
|
10
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
2
|
+
const { stage, Stage } = require('./src/utils/environment');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* sanity check that integration tests are only run in 'test' environment
|
|
6
|
+
* - if they are run in prod environment, we could load a bunch of junk data into our prod databases, which would be no bueno
|
|
7
|
+
*/
|
|
8
|
+
if (stage !== Stage.TEST && process.env.I_KNOW_WHAT_IM_DOING !== 'true')
|
|
9
|
+
throw new Error(`integration-test is not targeting stage 'test'`);
|
|
10
|
+
|
|
11
|
+
// set a longer timeout
|
|
12
|
+
// eslint-disable-next-line no-undef
|
|
13
|
+
jest.setTimeout(90000); // since we're calling downstream apis
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// https://jestjs.io/docs/en/configuration.html
|
|
2
|
+
module.exports = {
|
|
3
|
+
preset: 'ts-jest',
|
|
4
|
+
verbose: true,
|
|
5
|
+
testEnvironment: 'node',
|
|
6
|
+
moduleFileExtensions: ['js', 'ts'],
|
|
7
|
+
testMatch: [
|
|
8
|
+
// note: order matters
|
|
9
|
+
'**/*.test.ts',
|
|
10
|
+
'!**/*.acceptance.test.ts',
|
|
11
|
+
'!**/*.integration.test.ts',
|
|
12
|
+
],
|
|
13
|
+
setupFiles: ['core-js'],
|
|
14
|
+
setupFilesAfterEnv: ['./jest.unit.env.js'],
|
|
15
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* eslint-disable global-require */
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
3
|
+
const { stage, Stage } = require('./src/utils/environment');
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line no-undef
|
|
6
|
+
jest.mock('./src/utils/config/getConfig', () => ({
|
|
7
|
+
// eslint-disable-next-line no-undef
|
|
8
|
+
getConfig: jest.fn().mockImplementation(() => require('./config/test.json')), // mock that getConfig just returns plaintext test env config in unit tests
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* sanity check that unit tests are only run in 'test' environment
|
|
13
|
+
* - if they are run in prod environment, we could load a bunch of junk data into our prod databases, which would be no bueno
|
|
14
|
+
*/
|
|
15
|
+
if (stage !== Stage.TEST && process.env.I_KNOW_WHAT_IM_DOING !== 'true')
|
|
16
|
+
throw new Error(`unit-test is not targeting stage 'test'`);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"devDependencies": {
|
|
3
|
+
"@types/jest": "@declapract{check.minVersion('29.2.4')}",
|
|
4
|
+
"jest": "@declapract{check.minVersion('29.3.1')}",
|
|
5
|
+
"ts-jest": "@declapract{check.minVersion('29.0.3')}",
|
|
6
|
+
"core-js": "@declapract{check.minVersion('3.26.1')}",
|
|
7
|
+
"simple-lambda-testing-methods": "@declapract{check.minVersion('0.2.1')}"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test:unit": "jest -c ./jest.unit.config.js --forceExit --coverage --verbose --passWithNoTests",
|
|
11
|
+
"test:integration": "jest -c ./jest.integration.config.js --forceExit --coverage --verbose --passWithNoTests",
|
|
12
|
+
"test:acceptance:locally": "npm run build && LOCALLY=true jest -c ./jest.acceptance.config.js --forceExit --verbose --runInBand",
|
|
13
|
+
"test": "npm run test:commits && npm run test:types && npm run test:format && npm run test:lint && npm run test:unit && npm run test:integration && npm run test:acceptance:locally",
|
|
14
|
+
"test:acceptance": "npm run build && jest -c ./jest.acceptance.config.js --forceExit --verbose --runInBand"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FileCheckContext } from 'declapract';
|
|
2
|
+
|
|
3
|
+
export const defineFunctionNameFromTestFileName = ({
|
|
4
|
+
context,
|
|
5
|
+
}: {
|
|
6
|
+
context: FileCheckContext;
|
|
7
|
+
}): string =>
|
|
8
|
+
context.relativeFilePath // same name as the file
|
|
9
|
+
.split('/')
|
|
10
|
+
.slice(-1)[0]!
|
|
11
|
+
.replace('.acceptance.test.ts', ''); // remove the extension from the file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
this bundle defines best practices for tsconfig
|
|
2
|
+
|
|
3
|
+
namely:
|
|
4
|
+
- build vs test config
|
|
5
|
+
- default name as test config, so that ide's automatically typecheck test files for you
|
|
6
|
+
- otherwise, they exclude them, and you only find ts errors _after_ you run tsc - not while looking at file
|
|
7
|
+
- strict
|
|
8
|
+
- strict mode on tsc prevents a _ton_ of errors
|
|
9
|
+
- without it, `Type | null` -> `Type` -> so you have a bunch of bugs whenever a value could be null but you dont expect it to be / realize it could be
|
|
10
|
+
- it defeats the point of typechecking, really
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"devDependencies": {
|
|
3
|
+
"typescript": "@declapract{check.minVersion('4.9.4')}",
|
|
4
|
+
"@tsconfig/node-lts-strictest": "@declapract{check.minVersion('18.12.1')}"
|
|
5
|
+
},
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build:clean": "rm dist/ -rf",
|
|
8
|
+
"build:compile": "tsc -p ./tsconfig.build.json",
|
|
9
|
+
"build": "npm run build:clean && npm run build:compile",
|
|
10
|
+
"test:types": "tsc -p ./tsconfig.build.json --noEmit"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"rootDir": "src"
|
|
5
|
+
},
|
|
6
|
+
"exclude": [
|
|
7
|
+
"dist",
|
|
8
|
+
"coverage",
|
|
9
|
+
"node_modules",
|
|
10
|
+
"acceptance",
|
|
11
|
+
"provision",
|
|
12
|
+
"jest.*",
|
|
13
|
+
"prettier.*",
|
|
14
|
+
"commitlint.*",
|
|
15
|
+
"src/**/*.test.(ts|js)"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@tsconfig/node-lts-strictest/tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"importsNotUsedAsValues": "remove",
|
|
5
|
+
"noPropertyAccessFromIndexSignature": false,
|
|
6
|
+
"resolveJsonModule": true,
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"outDir": "dist",
|
|
9
|
+
},
|
|
10
|
+
"include": [
|
|
11
|
+
"src/**/*.ts"
|
|
12
|
+
],
|
|
13
|
+
"exclude": [
|
|
14
|
+
"dist",
|
|
15
|
+
"coverage",
|
|
16
|
+
"node_modules",
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
`uuidv4` has been deprecated in favor of `uuid` per maintainers
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FileCheckFunction, FileFixFunction } from 'declapract';
|
|
2
|
+
|
|
3
|
+
export const check: FileCheckFunction = (contents) => {
|
|
4
|
+
const packageJSONObject = JSON.parse(contents!);
|
|
5
|
+
if (Object.keys(packageJSONObject.dependencies).includes('uuidv4')) return; // matches
|
|
6
|
+
throw new Error('does not match bad practice');
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const fix: FileFixFunction = (contents) => {
|
|
10
|
+
if (!contents) return {}; // should not occur
|
|
11
|
+
const packageJSONObject = JSON.parse(contents);
|
|
12
|
+
const fixedPackageJSONObject = {
|
|
13
|
+
...packageJSONObject,
|
|
14
|
+
dependencies: { ...packageJSONObject.dependencies, uuidv4: undefined },
|
|
15
|
+
};
|
|
16
|
+
return { contents: JSON.stringify(fixedPackageJSONObject, null, 2) };
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
industry standard; the community has converged on it
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# define the different types of combinations of the best practices that we support
|
|
2
|
+
use-cases:
|
|
3
|
+
typescript-project:
|
|
4
|
+
practices:
|
|
5
|
+
- cicd-integrate
|
|
6
|
+
- conventional-commits
|
|
7
|
+
- directory-structure-src
|
|
8
|
+
- domain
|
|
9
|
+
- errors
|
|
10
|
+
- format
|
|
11
|
+
- git
|
|
12
|
+
- linting
|
|
13
|
+
- node
|
|
14
|
+
- nonpublished-modules
|
|
15
|
+
- package-json-order
|
|
16
|
+
- prettier
|
|
17
|
+
- testing
|
|
18
|
+
- typescript
|
|
19
|
+
- uuid
|
|
20
|
+
npm-package:
|
|
21
|
+
extends:
|
|
22
|
+
- typescript-project
|
|
23
|
+
practices:
|
|
24
|
+
- cicd-deploy-package
|
|
25
|
+
lambda-service:
|
|
26
|
+
extends:
|
|
27
|
+
- typescript-project
|
|
28
|
+
practices:
|
|
29
|
+
- cicd-deploy-service
|
|
30
|
+
- config
|
|
31
|
+
- dates-and-times
|
|
32
|
+
- environments
|
|
33
|
+
- lambda-clients
|
|
34
|
+
- lambda-handlers
|
|
35
|
+
- logging
|
|
36
|
+
- runtime-type-checking
|
|
37
|
+
- serverless
|
|
38
|
+
- terraform
|
|
39
|
+
lambda-service-with-rds:
|
|
40
|
+
extends:
|
|
41
|
+
- lambda-service
|
|
42
|
+
practices:
|
|
43
|
+
- persist-with-rds
|
|
44
|
+
lambda-service-with-dynamodb: # note that projects can still use both by specifying the `declapract.use-case: [lambda-service-with-dynamodb, lambda-service-with-rds]` since we allow use-cases to add together. `use-cases` just enable us to enforce a "minimum" set of practices
|
|
45
|
+
extends:
|
|
46
|
+
- lambda-service
|
|
47
|
+
practices:
|
|
48
|
+
- persist-with-dynamodb
|
package/package.json
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "declapract-typescript-ehmpathy",
|
|
3
|
+
"version": "0.17.0",
|
|
4
|
+
"description": "declapract best practices declarations for typescript",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"repository": "ehmpathy/declapract-typescript-ehmpathy",
|
|
7
|
+
"homepage": "https://github.com/ehmpathy/declapract-typescript-ehmpathy",
|
|
8
|
+
"files": [
|
|
9
|
+
"/dist",
|
|
10
|
+
"/declapract.declare.yml"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "rm -rf ./dist && npx declapract compile",
|
|
14
|
+
"fix:format:prettier": "prettier --write '**/*.ts' --config ./prettier.config.js",
|
|
15
|
+
"fix:format:terraform": "terraform fmt -recursive",
|
|
16
|
+
"fix:format": "npm run fix:format:prettier && npm run fix:format:terraform",
|
|
17
|
+
"test:types": "tsc -p ./tsconfig.build.json --noEmit",
|
|
18
|
+
"test:format": "prettier --parser typescript --check 'src/**/*.ts' --config ./prettier.config.js",
|
|
19
|
+
"test:lint": "echo 'todo'",
|
|
20
|
+
"test:unit": "jest -c ./jest.unit.config.js --forceExit --coverage --verbose --passWithNoTests",
|
|
21
|
+
"test:integration": "echo 'no op'",
|
|
22
|
+
"test:validate": "npm run build && npx declapract validate",
|
|
23
|
+
"test": "npm run test:types && npm run test:format && npm run test:validate && npm run test:unit",
|
|
24
|
+
"prepush": "npm run build && npm run test",
|
|
25
|
+
"preversion": "npm run prepush",
|
|
26
|
+
"postversion": "git push origin HEAD --tags --no-verify",
|
|
27
|
+
"test:format:prettier": "prettier --parser typescript --check 'src/**/*.ts' --config ./prettier.config.js",
|
|
28
|
+
"commit:with-cli": "npx cz",
|
|
29
|
+
"test:commits": "LAST_TAG=$(git describe --tags --abbrev=0 @^ 2> /dev/null || git rev-list --max-parents=0 HEAD) && npx commitlint --from $LAST_TAG --to HEAD --verbose"
|
|
30
|
+
},
|
|
31
|
+
"author": "uladkasach",
|
|
32
|
+
"license": "ISC",
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@middy/core": "1.0.0",
|
|
35
|
+
"@types/yesql": "3.2.2",
|
|
36
|
+
"aws-lambda": "1.0.5",
|
|
37
|
+
"aws-sdk": "2.658.0",
|
|
38
|
+
"axios": "0.21.1",
|
|
39
|
+
"change-case": "4.1.2",
|
|
40
|
+
"config-with-paramstore": "1.1.1",
|
|
41
|
+
"date-fns": "2.14.0",
|
|
42
|
+
"declapract": "0.10.0",
|
|
43
|
+
"domain-objects": "0.7.5",
|
|
44
|
+
"expect": "27.1.1",
|
|
45
|
+
"flat": "5.0.2",
|
|
46
|
+
"joi": "17.4.0",
|
|
47
|
+
"lodash.uniq": "4.5.0",
|
|
48
|
+
"middy": "0.33.2",
|
|
49
|
+
"pg": "8.2.1",
|
|
50
|
+
"simple-dynamodb-client": "^0.7.1",
|
|
51
|
+
"simple-lambda-client": "2.1.3",
|
|
52
|
+
"simple-lambda-handlers": "0.5.0",
|
|
53
|
+
"simple-leveled-log-methods": "0.2.1",
|
|
54
|
+
"simple-type-guards": "0.1.3",
|
|
55
|
+
"uuid": "3.4.0",
|
|
56
|
+
"yesql": "4.1.3"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@trivago/prettier-plugin-sort-imports": "2.0.4",
|
|
60
|
+
"@tsconfig/node-lts-strictest": "18.12.1",
|
|
61
|
+
"@types/aws-lambda": "8.10.40",
|
|
62
|
+
"@types/flat": "5.0.2",
|
|
63
|
+
"@types/jest": "29.2.4",
|
|
64
|
+
"@types/joi": "14.3.4",
|
|
65
|
+
"@types/lodash.uniq": "4.5.6",
|
|
66
|
+
"@types/pg": "7.14.3",
|
|
67
|
+
"@types/shelljs": "0.8.6",
|
|
68
|
+
"@types/uuid": "3.4.7",
|
|
69
|
+
"@typescript-eslint/eslint-plugin": "5.46.1",
|
|
70
|
+
"@typescript-eslint/parser": "5.46.1",
|
|
71
|
+
"core-js": "3.26.1",
|
|
72
|
+
"eslint": "8.30.0",
|
|
73
|
+
"eslint-config-airbnb-base": "15.0.0",
|
|
74
|
+
"eslint-config-airbnb-typescript": "17.0.0",
|
|
75
|
+
"eslint-config-prettier": "8.5.0",
|
|
76
|
+
"eslint-plugin-import": "2.26.0",
|
|
77
|
+
"eslint-plugin-prettier": "4.2.1",
|
|
78
|
+
"jest": "29.3.1",
|
|
79
|
+
"prettier": "2.8.1",
|
|
80
|
+
"serverless": "1.66.0",
|
|
81
|
+
"serverless-offline": "5.12.1",
|
|
82
|
+
"serverless-pseudo-parameters": "2.5.0",
|
|
83
|
+
"shelljs": "0.8.3",
|
|
84
|
+
"simple-lambda-testing-methods": "0.1.1",
|
|
85
|
+
"sql-code-generator": "0.8.2",
|
|
86
|
+
"sql-dao-generator": "0.2.0",
|
|
87
|
+
"sql-schema-control": "0.7.3",
|
|
88
|
+
"sql-schema-generator": "0.21.1",
|
|
89
|
+
"ts-jest": "29.0.3",
|
|
90
|
+
"typescript": "4.9.4",
|
|
91
|
+
"@commitlint/cli": "13.1.0",
|
|
92
|
+
"@commitlint/config-conventional": "13.1.0",
|
|
93
|
+
"cz-conventional-changelog": "3.3.0",
|
|
94
|
+
"husky": "7.0.2"
|
|
95
|
+
}
|
|
96
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# declapract-typescript-ehmpathy
|
|
2
|
+
|
|
3
|
+
declapract = declared best practices
|
|
4
|
+
|
|
5
|
+
this repo contains the [ehmpathy org's](github.com/ehmpathy) declared best practices for typescript, for usage with [declapract](https://github.com/ehmpathy/declapract)
|
|
6
|
+
|
|
7
|
+
# usage
|
|
8
|
+
|
|
9
|
+
1. add `declapract` to your repo
|
|
10
|
+
```sh
|
|
11
|
+
npm install --save-dev declapract
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
2. add a declapract usage config to your repo
|
|
15
|
+
```yml
|
|
16
|
+
# declapract.use.yml
|
|
17
|
+
declarations: npm:declapract-typescript-ehmpathy
|
|
18
|
+
useCase: lambda-service # specify which use case your repo is following, see `declapract-typescript-ehmpathy:src/useCases.yml` for options
|
|
19
|
+
variables: # specify the values of the variables to use against checks
|
|
20
|
+
organizationName: 'awesome-org'
|
|
21
|
+
projectName: 'svc-awesome-thing'
|
|
22
|
+
infrastructureNamespaceId: 'abcde12345'
|
|
23
|
+
slackReleaseWebHook: 'https://...'
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
3. clone a declared best practices example, do bootstrap a new repo
|
|
27
|
+
```sh
|
|
28
|
+
declapract clone lambda-service-with-rds # bootstrap a new lambda-service-with-rds repo
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
4. check that your repo is conforming to best practices
|
|
32
|
+
```
|
|
33
|
+
declapract check
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
5. fix a specific practice that your repo is failing to conform to (if it has an automatic fix declared)
|
|
37
|
+
```sh
|
|
38
|
+
declapract fix --practice dates-and-times # e.g., apply a fix for the the dates-and-times practice
|
|
39
|
+
```
|