declapract-typescript-ehmpathy 0.31.11 → 0.33.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/dist/practices/commands/best-practice/package.json +6 -0
- package/dist/practices/commands/best-practice/package.json.declapract.ts +3 -0
- package/dist/practices/commands/best-practice/src/contract/commands/__tmp__/.gitignore +3 -0
- package/dist/practices/commands/best-practice/src/contract/commands/__tmp__/directory.ts +4 -0
- package/dist/practices/commands/best-practice/src/contract/commands/sayHello.ts +20 -0
- package/dist/practices/domain/best-practice/package.json +2 -2
- package/dist/practices/environments/best-practice/src/utils/environment.ts +17 -0
- package/dist/practices/lambda-handlers/best-practice/package.json +1 -1
- package/dist/practices/persist-with-rds/best-practice/package.json +3 -3
- package/dist/practices/serverless/best-practice/serverless.yml +1 -0
- package/dist/useCases.yml +1 -0
- package/package.json +6 -3
- /package/dist/practices/{directory-structure-src/bad-practices → commands/bad-practice}/scripts-dir/.declapract.readme.md +0 -0
- /package/dist/practices/{directory-structure-src/bad-practices → commands/bad-practice}/scripts-dir/src/contract/scripts/<star><star>/<star>.ts.declapract.ts +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { asCommand } from '@ehmpathy/as-command';
|
|
2
|
+
import { UnexpectedCodePathError } from '@ehmpathy/error-fns';
|
|
3
|
+
import { ProcedureInput, getResourceNameFromFileName } from 'visualogic';
|
|
4
|
+
|
|
5
|
+
import { stage } from '../../utils/environment';
|
|
6
|
+
import { log } from '../../utils/logger';
|
|
7
|
+
import { COMMANDS_OUTPUT_DIRECTORY } from './__tmp__/directory';
|
|
8
|
+
|
|
9
|
+
const command = asCommand(
|
|
10
|
+
{
|
|
11
|
+
name: getResourceNameFromFileName(__filename),
|
|
12
|
+
stage,
|
|
13
|
+
dir: COMMANDS_OUTPUT_DIRECTORY,
|
|
14
|
+
log,
|
|
15
|
+
},
|
|
16
|
+
async () => console.log('hello world'),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
// STAGE=prod npx tsx src/contract/commands/sayHello.ts
|
|
20
|
+
if (require.main === module) void command({});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"domain-objects": "@declapract{check.minVersion('0.
|
|
3
|
+
"domain-objects": "@declapract{check.minVersion('0.21.9')}",
|
|
4
4
|
"joi": "@declapract{check.minVersion('17.4.0')}",
|
|
5
|
-
"type-fns": "@declapract{check.minVersion('0.
|
|
5
|
+
"type-fns": "@declapract{check.minVersion('0.16.0')}"
|
|
6
6
|
}
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UnexpectedCodePathError } from '@ehmpathy/error-fns';
|
|
1
2
|
import { createIsOfEnum } from 'type-fns';
|
|
2
3
|
|
|
3
4
|
export enum Stage {
|
|
@@ -7,6 +8,22 @@ export enum Stage {
|
|
|
7
8
|
}
|
|
8
9
|
export const isOfStage = createIsOfEnum(Stage);
|
|
9
10
|
|
|
11
|
+
/**
|
|
12
|
+
* verify that the server is on UTC timezone
|
|
13
|
+
*
|
|
14
|
+
* why?
|
|
15
|
+
* - non UTC timezone usage causes problems and takes a while to track down
|
|
16
|
+
* - by failing fast if the server our code runs in is not in UTC, we avoid these issues
|
|
17
|
+
* =>
|
|
18
|
+
* - create a pit of success
|
|
19
|
+
*/
|
|
20
|
+
const TIMEZONE = process.env.TZ;
|
|
21
|
+
if (TIMEZONE !== 'UTC')
|
|
22
|
+
throw new UnexpectedCodePathError(
|
|
23
|
+
'env.TZ is not set to UTC. this can cause issues. please set the env var',
|
|
24
|
+
{ found: TIMEZONE, desire: 'UTC' },
|
|
25
|
+
);
|
|
26
|
+
|
|
10
27
|
/**
|
|
11
28
|
* this allows us to infer what the stage should be in environments that do not have STAGE specified
|
|
12
29
|
* - e.g., when running locally
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
"yesql": "@declapract{check.minVersion('3.2.2')}"
|
|
5
5
|
},
|
|
6
6
|
"devDependencies": {
|
|
7
|
-
"sql-code-generator": "@declapract{check.minVersion('0.
|
|
8
|
-
"sql-dao-generator": "@declapract{check.minVersion('0.
|
|
7
|
+
"sql-code-generator": "@declapract{check.minVersion('0.10.0')}",
|
|
8
|
+
"sql-dao-generator": "@declapract{check.minVersion('0.8.1')}",
|
|
9
9
|
"sql-schema-control": "@declapract{check.minVersion('1.5.0')}",
|
|
10
|
-
"sql-schema-generator": "@declapract{check.minVersion('0.
|
|
10
|
+
"sql-schema-generator": "@declapract{check.minVersion('0.25.0')}",
|
|
11
11
|
"@types/yesql": "@declapract{check.minVersion('3.2.2')}",
|
|
12
12
|
"@types/pg": "@declapract{check.minVersion('8.6.1')}"
|
|
13
13
|
},
|
|
@@ -17,6 +17,7 @@ provider:
|
|
|
17
17
|
environment: ${self:provider.stage}
|
|
18
18
|
product: ${self:service}
|
|
19
19
|
environment:
|
|
20
|
+
TZ: UTC # guarantee that utc timezone will be used explicitly, to facilitate a pit of success
|
|
20
21
|
NODE_ENV: production # deploy with production optimizations of all resources, to make `dev` and `prod` stage deployments equivalent functionally (i.e., the same code paths in dev and prod)
|
|
21
22
|
STAGE: ${self:provider.stage} # deploy specifying which stage we're targeting, to enable targeting the correct config + resources (e.g., hit dev db -vs- prod db)
|
|
22
23
|
AWS_NODEJS_CONNECTION_REUSE_ENABLED: true # https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/node-reusing-connections.html
|
package/dist/useCases.yml
CHANGED
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.
|
|
5
|
+
"version": "0.33.0",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"repository": "ehmpathy/declapract-typescript-ehmpathy",
|
|
8
8
|
"homepage": "https://github.com/ehmpathy/declapract-typescript-ehmpathy",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"postinstall": "[ -d .git ] && npx husky install || exit 0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
+
"@ehmpathy/error-fns": "1.3.1",
|
|
41
42
|
"expect": "29.4.2",
|
|
42
43
|
"flat": "5.0.2",
|
|
43
|
-
"lodash.uniq": "4.5.0"
|
|
44
|
-
"type-fns": "0.8.1"
|
|
44
|
+
"lodash.uniq": "4.5.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"declapract": "0.11.2"
|
|
@@ -69,6 +69,9 @@
|
|
|
69
69
|
"prettier": "2.8.1",
|
|
70
70
|
"ts-jest": "29.0.3",
|
|
71
71
|
"ts-node": "10.9.1",
|
|
72
|
+
"type-fns": "0.8.1",
|
|
73
|
+
"@ehmpathy/as-command": "1.0.1",
|
|
74
|
+
"visualogic": "1.2.1",
|
|
72
75
|
"typescript": "4.9.4"
|
|
73
76
|
},
|
|
74
77
|
"config": {
|
|
File without changes
|