declapract-typescript-ehmpathy 0.35.0 → 0.35.2
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/dist/practices/config/best-practice/src/utils/config/Config.ts +1 -1
- package/dist/practices/environments/best-practice/src/utils/environment.ts +11 -9
- package/dist/practices/persist-with-dynamodb/best-practice/package.json +2 -2
- package/dist/practices/persist-with-rds/best-practice/package.json +3 -3
- package/package.json +1 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { UnexpectedCodePathError } from '@ehmpathy/error-fns';
|
|
2
1
|
import { createIsOfEnum } from 'type-fns';
|
|
3
2
|
|
|
3
|
+
import { log } from './logger';
|
|
4
|
+
|
|
4
5
|
export enum Stage {
|
|
5
6
|
PRODUCTION = 'prod',
|
|
6
7
|
DEVELOPMENT = 'dev',
|
|
@@ -9,20 +10,21 @@ export enum Stage {
|
|
|
9
10
|
export const isOfStage = createIsOfEnum(Stage);
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
+
* ensure that the server is on UTC timezone
|
|
13
14
|
*
|
|
14
15
|
* why?
|
|
15
|
-
* - non UTC timezone usage causes problems and takes a while to track down
|
|
16
|
-
* - by
|
|
17
|
-
*
|
|
18
|
-
* - create a pit of success
|
|
16
|
+
* - non UTC timezone usage causes consistency problems and takes a while to track down
|
|
17
|
+
* - by warning and correcting if the server the code runs on in is not in UTC, we avoid these issues
|
|
18
|
+
* - instead, users should push down converting from UTC into the users TZ as far as possible
|
|
19
19
|
*/
|
|
20
20
|
const TIMEZONE = process.env.TZ;
|
|
21
|
-
if (TIMEZONE !== 'UTC')
|
|
22
|
-
|
|
23
|
-
'env.TZ is not set to UTC. this can cause issues.
|
|
21
|
+
if (TIMEZONE !== 'UTC') {
|
|
22
|
+
log.warn(
|
|
23
|
+
'env.TZ is not set to UTC. this can cause issues. updating this on your behalf',
|
|
24
24
|
{ found: TIMEZONE, desire: 'UTC' },
|
|
25
25
|
);
|
|
26
|
+
process.env.TZ = 'UTC';
|
|
27
|
+
}
|
|
26
28
|
|
|
27
29
|
/**
|
|
28
30
|
* this allows us to infer what the stage should be in environments that do not have STAGE specified
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
9
|
"generate:dao:dynamodb": "npx dynamodb-dao-generator generate && npm run fix:format",
|
|
10
|
-
"provision:docker:up": "docker
|
|
11
|
-
"provision:docker:down": "docker
|
|
10
|
+
"provision:docker:up": "docker compose -f ./provision/docker/integration-test-db/docker-compose.yml up -d --force-recreate --build --renew-anon-volumes",
|
|
11
|
+
"provision:docker:down": "docker compose -f ./provision/docker/integration-test-db/docker-compose.yml down",
|
|
12
12
|
"provision:dynamodb:schema": "terraform -chdir=provision/aws/environments/test apply -auto-approve",
|
|
13
13
|
"provision:integration-test-db": "npm run provision:docker:up && npm run provision:dynamodb:schema"
|
|
14
14
|
}
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"generate:types-from-sql": "npx sql-code-generator generate -c codegen.sql.types.yml && npm run fix:format",
|
|
19
19
|
"provision:docker:clear": "docker rm -f $(docker ps -a -f 'publish=7821' -q) 2>/dev/null || true && echo 'ensured port is available 👍'",
|
|
20
20
|
"provision:docker:prepare": "cp provision/schema/sql/init/.extensions.sql provision/docker/integration-test-db/init/extensions.sql && cp provision/schema/sql/init/.schema.sql provision/docker/integration-test-db/init/schema.sql && cp provision/schema/sql/init/.user.cicd.sql provision/docker/integration-test-db/init/user.cicd.sql",
|
|
21
|
-
"provision:docker:up": "docker
|
|
22
|
-
"provision:docker:await": "docker
|
|
23
|
-
"provision:docker:down": "docker
|
|
21
|
+
"provision:docker:up": "docker compose -f ./provision/docker/integration-test-db/docker-compose.yml up -d --force-recreate --build --renew-anon-volumes",
|
|
22
|
+
"provision:docker:await": "docker compose -f ./provision/docker/integration-test-db/docker-compose.yml exec -T postgres /root/wait-for-postgres.sh",
|
|
23
|
+
"provision:docker:down": "docker compose -f ./provision/docker/integration-test-db/docker-compose.yml down",
|
|
24
24
|
"provision:schema:plan": "npx sql-schema-control plan -c provision/schema/control.yml",
|
|
25
25
|
"provision:schema:apply": "npx sql-schema-control apply -c provision/schema/control.yml",
|
|
26
26
|
"provision:schema:sync": "npx sql-schema-control sync -c provision/schema/control.yml",
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "declapract-typescript-ehmpathy",
|
|
3
3
|
"author": "ehmpathy",
|
|
4
4
|
"description": "declapract best practices declarations for typescript",
|
|
5
|
-
"version": "0.35.
|
|
5
|
+
"version": "0.35.2",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"repository": "ehmpathy/declapract-typescript-ehmpathy",
|
|
8
8
|
"homepage": "https://github.com/ehmpathy/declapract-typescript-ehmpathy",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"postinstall": "[ -d .git ] && npx husky install || exit 0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@ehmpathy/error-fns": "1.3.1",
|
|
42
41
|
"domain-objects": "0.22.1",
|
|
43
42
|
"expect": "29.4.2",
|
|
44
43
|
"flat": "5.0.2"
|