@mbc-cqrs-serverless/cli 1.4.0 → 1.5.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/README.md +1 -1
- package/dist/actions/new.action.template-integrity.spec.js +73 -0
- package/package.json +2 -2
- package/templates/.env.local +2 -2
- package/templates/README.md +2 -3
- package/templates/infra-local/docker-compose.yml +8 -9
- package/templates/infra-local/scripts/resources.ps1 +44 -0
- package/templates/infra-local/scripts/resources.sh +23 -0
- package/templates/infra-local/serverless.yml +0 -2
- package/templates/package-lock.json +72 -21
- package/templates/package.json +4 -3
- package/templates/prisma/ddb.ts +4 -1
package/README.md
CHANGED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const fs_1 = require("fs");
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
// `mbc new` copies packages/cli/templates and runs `npm i` plus
|
|
9
|
+
// `npm run migrate` against it, but CI never installs the template. These
|
|
10
|
+
// checks catch template mistakes that only surface in a freshly scaffolded
|
|
11
|
+
// project.
|
|
12
|
+
describe('scaffolding template integrity', () => {
|
|
13
|
+
const templatesDir = path_1.default.join(__dirname, '../../templates');
|
|
14
|
+
describe('package.json overrides', () => {
|
|
15
|
+
const packageJson = JSON.parse((0, fs_1.readFileSync)(path_1.default.join(templatesDir, 'package.json'), 'utf-8'));
|
|
16
|
+
const directDeps = {
|
|
17
|
+
...packageJson.dependencies,
|
|
18
|
+
...packageJson.devDependencies,
|
|
19
|
+
};
|
|
20
|
+
// npm rejects the whole install with EOVERRIDE ("Override for X conflicts
|
|
21
|
+
// with direct dependency") when an override of a direct dependency does
|
|
22
|
+
// not match its spec exactly. Use "$X" to reference the direct spec.
|
|
23
|
+
it.each(Object.entries(packageJson.overrides ?? {}).filter(([name]) => name in directDeps))('override for direct dependency %s matches its spec', (name, override) => {
|
|
24
|
+
const spec = typeof override === 'string'
|
|
25
|
+
? override
|
|
26
|
+
: override['.'];
|
|
27
|
+
if (spec === undefined)
|
|
28
|
+
return;
|
|
29
|
+
expect([directDeps[name], `$${name}`]).toContain(spec);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
describe('prisma/ddb.ts (npm run migrate:ddb)', () => {
|
|
33
|
+
const packageJson = JSON.parse((0, fs_1.readFileSync)(path_1.default.join(templatesDir, 'package.json'), 'utf-8'));
|
|
34
|
+
const source = (0, fs_1.readFileSync)(path_1.default.join(templatesDir, 'prisma/ddb.ts'), 'utf-8');
|
|
35
|
+
// .env.local writes endpoints as http://localhost:${LOCAL_X_PORT:-NNNN};
|
|
36
|
+
// plain dotenv leaves that literal and the DynamoDB client throws
|
|
37
|
+
// "Invalid URL", so the loaded env must go through dotenv-expand.
|
|
38
|
+
it('expands ${VAR:-default} when loading .env', () => {
|
|
39
|
+
expect(source).toMatch(/expand\(\s*dotenv\.config\(/);
|
|
40
|
+
});
|
|
41
|
+
it('declares dotenv and dotenv-expand as direct dependencies', () => {
|
|
42
|
+
const deps = {
|
|
43
|
+
...packageJson.dependencies,
|
|
44
|
+
...packageJson.devDependencies,
|
|
45
|
+
};
|
|
46
|
+
expect(deps).toHaveProperty('dotenv');
|
|
47
|
+
expect(deps).toHaveProperty('dotenv-expand');
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
describe('.env.local DATABASE_URL', () => {
|
|
51
|
+
const lines = (0, fs_1.readFileSync)(path_1.default.join(templatesDir, '.env.local'), 'utf-8').split('\n');
|
|
52
|
+
const index = lines.findIndex((line) => line.startsWith('DATABASE_URL='));
|
|
53
|
+
const databaseUrl = lines[index];
|
|
54
|
+
it('is defined', () => {
|
|
55
|
+
expect(index).toBeGreaterThanOrEqual(0);
|
|
56
|
+
});
|
|
57
|
+
// Prisma expands ${VAR} in .env but not ${VAR:-default}; the latter fails
|
|
58
|
+
// `prisma migrate deploy` with P1013 "invalid port number".
|
|
59
|
+
it('does not use ${VAR:-default} expansion', () => {
|
|
60
|
+
expect(databaseUrl).not.toMatch(/\$\{[A-Z0-9_]+:-/);
|
|
61
|
+
});
|
|
62
|
+
it('only references variables defined earlier in the file', () => {
|
|
63
|
+
const referenced = [...databaseUrl.matchAll(/\$\{([A-Z0-9_]+)\}/g)].map((match) => match[1]);
|
|
64
|
+
const definedBefore = lines
|
|
65
|
+
.slice(0, index)
|
|
66
|
+
.map((line) => line.match(/^([A-Z0-9_]+)=/)?.[1])
|
|
67
|
+
.filter(Boolean);
|
|
68
|
+
for (const name of referenced) {
|
|
69
|
+
expect(definedBefore).toContain(name);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mbc-cqrs-serverless/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "a CLI to get started with MBC CQRS serverless framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mbc",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"@faker-js/faker": "^8.3.1",
|
|
59
59
|
"copyfiles": "^2.4.1"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "eafabfd2770916ea4e9f954f614f8dc5ac4e10b2"
|
|
62
62
|
}
|
package/templates/.env.local
CHANGED
|
@@ -26,7 +26,7 @@ LOCAL_OFFLINE_LAMBDA_PORT=4000
|
|
|
26
26
|
LOCAL_DYNAMODB_PORT=8000
|
|
27
27
|
# MySQL (RDS)
|
|
28
28
|
LOCAL_RDS_PORT=3306
|
|
29
|
-
#
|
|
29
|
+
# Floci (S3)
|
|
30
30
|
LOCAL_S3_PORT=4566
|
|
31
31
|
# SNS
|
|
32
32
|
LOCAL_SNS_PORT=4002
|
|
@@ -93,7 +93,7 @@ SES_FROM_EMAIL=email@example.com
|
|
|
93
93
|
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
|
|
94
94
|
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
|
|
95
95
|
|
|
96
|
-
DATABASE_URL="mysql://root:RootCqrs@localhost:${LOCAL_RDS_PORT
|
|
96
|
+
DATABASE_URL="mysql://root:RootCqrs@localhost:${LOCAL_RDS_PORT}/cqrs?schema=public&connection_limit=1"
|
|
97
97
|
|
|
98
98
|
# serverless dynamodb local stream
|
|
99
99
|
LOCAL_DDB_SAMPLE_STREAM=arn:aws:dynamodb:ddblocal:000000000000:table/local-test-cli-sample-command/stream/2025-01-14T12:05:57.881
|
package/templates/README.md
CHANGED
|
@@ -17,7 +17,7 @@ TechStack:
|
|
|
17
17
|
- DynamoDB
|
|
18
18
|
|
|
19
19
|
- RDS - PostgreSQL
|
|
20
|
-
- Serverless fw &&
|
|
20
|
+
- Serverless fw && Floci for local development
|
|
21
21
|
|
|
22
22
|
## Prepare
|
|
23
23
|
|
|
@@ -147,8 +147,7 @@ $ aws stepfunctions --endpoint-url http://localhost:8083 start-execution --state
|
|
|
147
147
|
- sns: http://localhost:4002
|
|
148
148
|
- sqs: http://localhost:9324
|
|
149
149
|
- sqs admin: http://localhost:9325
|
|
150
|
-
-
|
|
151
|
-
- S3
|
|
150
|
+
- floci (S3): http://localhost:4566
|
|
152
151
|
- appsync: http://localhost:4001
|
|
153
152
|
- cognito: http://localhost:9229
|
|
154
153
|
- eventbridge: http://localhost:4010
|
|
@@ -56,19 +56,15 @@ services:
|
|
|
56
56
|
- ./elasticmq.conf:/opt/elasticmq.conf
|
|
57
57
|
- ./docker-data/elasticmq:/data
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
image:
|
|
59
|
+
floci:
|
|
60
|
+
image: floci/floci:1.6.0
|
|
61
61
|
ports:
|
|
62
62
|
- '${LOCAL_S3_PORT:-4566}:4566'
|
|
63
63
|
environment:
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
- SERVICE_ACCESS_KEY=local
|
|
67
|
-
- SERVICE_SECRET_KEY=local
|
|
68
|
-
- EXTRA_CORS_ALLOWED_ORIGINS=*
|
|
64
|
+
- FLOCI_DEFAULT_REGION=ap-northeast-1
|
|
65
|
+
- FLOCI_STORAGE_MODE=persistent
|
|
69
66
|
volumes:
|
|
70
|
-
-
|
|
71
|
-
- ./docker-data/run/docker.sock:/var/run/docker.sock
|
|
67
|
+
- floci-data:/app/data
|
|
72
68
|
|
|
73
69
|
appsync:
|
|
74
70
|
build:
|
|
@@ -93,3 +89,6 @@ services:
|
|
|
93
89
|
- ${LOCAL_COGNITO_PORT:-9229}:${LOCAL_COGNITO_PORT:-9229}
|
|
94
90
|
volumes:
|
|
95
91
|
- ./docker-data/.cognito:/app/.cognito
|
|
92
|
+
|
|
93
|
+
volumes:
|
|
94
|
+
floci-data:
|
|
@@ -24,5 +24,49 @@ if (-not $bucketExists) {
|
|
|
24
24
|
Write-Host "Bucket $env:S3_BUCKET_NAME already exists."
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
# Presigned upload/view URLs (see DirectoryFileService) are fetched by the
|
|
28
|
+
# browser, so the bucket needs a CORS rule or the preflight fails with 403 and
|
|
29
|
+
# the real request is never sent. The previous LocalStack service granted this
|
|
30
|
+
# implicitly through EXTRA_CORS_ALLOWED_ORIGINS=*, which Floci 1.6.0 does not
|
|
31
|
+
# honor (its global switch is FLOCI_SECURITY_EXTRA_CORS_ALLOWED_ORIGINS); a bucket
|
|
32
|
+
# rule is used instead so local matches production.
|
|
33
|
+
# Production configures CORS in the CDK stack - this is the local equivalent.
|
|
34
|
+
# Applied unconditionally so buckets created before this script gained the rule
|
|
35
|
+
# are brought up to date too.
|
|
36
|
+
Write-Host "======= configure S3 bucket CORS ======="
|
|
37
|
+
$corsConfiguration = @'
|
|
38
|
+
{
|
|
39
|
+
"CORSRules": [
|
|
40
|
+
{
|
|
41
|
+
"AllowedOrigins": ["*"],
|
|
42
|
+
"AllowedMethods": ["GET", "PUT", "POST", "DELETE", "HEAD"],
|
|
43
|
+
"AllowedHeaders": ["*"],
|
|
44
|
+
"ExposeHeaders": ["ETag"]
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
'@
|
|
49
|
+
|
|
50
|
+
# Passed as file:// rather than inline: PowerShell mangles embedded quotes on
|
|
51
|
+
# the way to the AWS CLI.
|
|
52
|
+
$corsFile = Join-Path ([System.IO.Path]::GetTempPath()) "mbc-s3-cors.json"
|
|
53
|
+
# Written BOM-less on purpose. Windows PowerShell 5.1 - still the default
|
|
54
|
+
# powershell.exe - writes a BOM for "-Encoding utf8", and the AWS CLI rejects
|
|
55
|
+
# the file with "Error parsing parameter '--cors-configuration'" before it
|
|
56
|
+
# sends any request, so the rule silently never lands. PowerShell 7 writes no
|
|
57
|
+
# BOM, which is why this only fails on stock Windows. WriteAllText behaves the
|
|
58
|
+
# same on both.
|
|
59
|
+
[System.IO.File]::WriteAllText($corsFile, $corsConfiguration, (New-Object System.Text.UTF8Encoding $false))
|
|
60
|
+
try {
|
|
61
|
+
aws --endpoint-url=http://localhost:$s3Port s3api put-bucket-cors --bucket $env:S3_BUCKET_NAME --cors-configuration "file://$corsFile"
|
|
62
|
+
# aws exits non-zero on both a rejected --cors-configuration (252) and an
|
|
63
|
+
# unreachable endpoint (255), but PowerShell does not throw on native
|
|
64
|
+
# command failure, so without this the rule can silently never land and the
|
|
65
|
+
# script still exits 0.
|
|
66
|
+
if ($LASTEXITCODE -ne 0) { throw "put-bucket-cors failed ($LASTEXITCODE)" }
|
|
67
|
+
} finally {
|
|
68
|
+
Remove-Item $corsFile -ErrorAction SilentlyContinue
|
|
69
|
+
}
|
|
70
|
+
|
|
27
71
|
Write-Host "======= list S3 buckets ======="
|
|
28
72
|
aws --endpoint-url=http://localhost:$s3Port s3 ls
|
|
@@ -19,5 +19,28 @@ else
|
|
|
19
19
|
echo "Bucket $S3_BUCKET_NAME already exists."
|
|
20
20
|
fi
|
|
21
21
|
|
|
22
|
+
# Presigned upload/view URLs (see DirectoryFileService) are fetched by the
|
|
23
|
+
# browser, so the bucket needs a CORS rule or the preflight fails with 403 and
|
|
24
|
+
# the real request is never sent. The previous LocalStack service granted this
|
|
25
|
+
# implicitly through EXTRA_CORS_ALLOWED_ORIGINS=*, which Floci 1.6.0 does not
|
|
26
|
+
# honor (its global switch is FLOCI_SECURITY_EXTRA_CORS_ALLOWED_ORIGINS); a bucket
|
|
27
|
+
# rule is used instead so local matches production.
|
|
28
|
+
# Production configures CORS in the CDK stack — this is the local equivalent.
|
|
29
|
+
# Applied unconditionally so buckets created before this script gained the rule
|
|
30
|
+
# are brought up to date too.
|
|
31
|
+
echo "======= configure S3 bucket CORS ======="
|
|
32
|
+
aws --endpoint-url=${S3_ENDPOINT_URL} s3api put-bucket-cors \
|
|
33
|
+
--bucket $S3_BUCKET_NAME \
|
|
34
|
+
--cors-configuration '{
|
|
35
|
+
"CORSRules": [
|
|
36
|
+
{
|
|
37
|
+
"AllowedOrigins": ["*"],
|
|
38
|
+
"AllowedMethods": ["GET", "PUT", "POST", "DELETE", "HEAD"],
|
|
39
|
+
"AllowedHeaders": ["*"],
|
|
40
|
+
"ExposeHeaders": ["ETag"]
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}'
|
|
44
|
+
|
|
22
45
|
echo "======= list S3 buckets ======="
|
|
23
46
|
aws --endpoint-url=${S3_ENDPOINT_URL} s3 ls
|
|
@@ -119,8 +119,6 @@ custom:
|
|
|
119
119
|
retryDelayMs: 500 # retry delay
|
|
120
120
|
throwRetryExhausted: false # default true
|
|
121
121
|
payloadSizeLimit: '10mb' # Controls the maximum payload size being passed to https://www.npmjs.com/package/bytes (Note: this payload size might not be the same size as your AWS Eventbridge receive)
|
|
122
|
-
# localStackConfig:
|
|
123
|
-
# localStackEndpoint: http://localhost:4566
|
|
124
122
|
|
|
125
123
|
provider:
|
|
126
124
|
name: aws
|
|
@@ -34,6 +34,8 @@
|
|
|
34
34
|
"class-transformer": "^0.5.1",
|
|
35
35
|
"class-validator": "^0.14.0",
|
|
36
36
|
"concurrently": "^9.0.1",
|
|
37
|
+
"dotenv": "^16.4.5",
|
|
38
|
+
"dotenv-expand": "^10.0.0",
|
|
37
39
|
"eslint": "^8.56.0",
|
|
38
40
|
"eslint-config-prettier": "^9.1.0",
|
|
39
41
|
"eslint-plugin-import": "^2.29.1",
|
|
@@ -41,12 +43,12 @@
|
|
|
41
43
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
42
44
|
"jest": "^29.7.0",
|
|
43
45
|
"jest-junit": "^16.0.0",
|
|
46
|
+
"js-yaml": "^4.3.2",
|
|
44
47
|
"nestjs-spelunker": "^1.3.0",
|
|
45
48
|
"prettier": "^3.1.1",
|
|
46
49
|
"run-script-os": "^1.1.6",
|
|
47
50
|
"serverless": "^3.40.0",
|
|
48
51
|
"serverless-dynamodb": "^0.2.47",
|
|
49
|
-
"serverless-localstack": "^1.1.2",
|
|
50
52
|
"serverless-offline": "^13.3.2",
|
|
51
53
|
"serverless-offline-aws-eventbridge": "^2.1.0",
|
|
52
54
|
"serverless-offline-dynamodb-streams": "^7.0.0",
|
|
@@ -265,6 +267,23 @@
|
|
|
265
267
|
}
|
|
266
268
|
}
|
|
267
269
|
},
|
|
270
|
+
"node_modules/@angular-devkit/schematics-cli/node_modules/chokidar": {
|
|
271
|
+
"version": "4.0.3",
|
|
272
|
+
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
|
|
273
|
+
"integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==",
|
|
274
|
+
"dev": true,
|
|
275
|
+
"optional": true,
|
|
276
|
+
"peer": true,
|
|
277
|
+
"dependencies": {
|
|
278
|
+
"readdirp": "^4.0.1"
|
|
279
|
+
},
|
|
280
|
+
"engines": {
|
|
281
|
+
"node": ">= 14.16.0"
|
|
282
|
+
},
|
|
283
|
+
"funding": {
|
|
284
|
+
"url": "https://paulmillr.com/funding/"
|
|
285
|
+
}
|
|
286
|
+
},
|
|
268
287
|
"node_modules/@angular-devkit/schematics-cli/node_modules/jsonc-parser": {
|
|
269
288
|
"version": "3.3.1",
|
|
270
289
|
"resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.3.1.tgz",
|
|
@@ -282,6 +301,21 @@
|
|
|
282
301
|
"@jridgewell/sourcemap-codec": "^1.5.0"
|
|
283
302
|
}
|
|
284
303
|
},
|
|
304
|
+
"node_modules/@angular-devkit/schematics-cli/node_modules/readdirp": {
|
|
305
|
+
"version": "4.1.2",
|
|
306
|
+
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
|
|
307
|
+
"integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==",
|
|
308
|
+
"dev": true,
|
|
309
|
+
"optional": true,
|
|
310
|
+
"peer": true,
|
|
311
|
+
"engines": {
|
|
312
|
+
"node": ">= 14.18.0"
|
|
313
|
+
},
|
|
314
|
+
"funding": {
|
|
315
|
+
"type": "individual",
|
|
316
|
+
"url": "https://paulmillr.com/funding/"
|
|
317
|
+
}
|
|
318
|
+
},
|
|
285
319
|
"node_modules/@aws-crypto/crc32": {
|
|
286
320
|
"version": "5.2.0",
|
|
287
321
|
"resolved": "https://registry.npmjs.org/@aws-crypto/crc32/-/crc32-5.2.0.tgz",
|
|
@@ -14535,6 +14569,18 @@
|
|
|
14535
14569
|
"node": ">= 8"
|
|
14536
14570
|
}
|
|
14537
14571
|
},
|
|
14572
|
+
"node_modules/anymatch/node_modules/picomatch": {
|
|
14573
|
+
"version": "2.3.2",
|
|
14574
|
+
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
|
|
14575
|
+
"integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
|
|
14576
|
+
"dev": true,
|
|
14577
|
+
"engines": {
|
|
14578
|
+
"node": ">=8.6"
|
|
14579
|
+
},
|
|
14580
|
+
"funding": {
|
|
14581
|
+
"url": "https://github.com/sponsors/jonschlinkert"
|
|
14582
|
+
}
|
|
14583
|
+
},
|
|
14538
14584
|
"node_modules/anynum": {
|
|
14539
14585
|
"version": "1.0.0",
|
|
14540
14586
|
"resolved": "https://registry.npmjs.org/anynum/-/anynum-1.0.0.tgz",
|
|
@@ -17970,12 +18016,6 @@
|
|
|
17970
18016
|
"es6-symbol": "^3.1.1"
|
|
17971
18017
|
}
|
|
17972
18018
|
},
|
|
17973
|
-
"node_modules/es6-promisify": {
|
|
17974
|
-
"version": "6.1.1",
|
|
17975
|
-
"resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-6.1.1.tgz",
|
|
17976
|
-
"integrity": "sha512-HBL8I3mIki5C1Cc9QjKUenHtnG0A5/xA8Q/AllRcfiwl2CZFXGK7ddBiCoRwAix4i2KxcQfjtIVcrVbB3vbmwg==",
|
|
17977
|
-
"dev": true
|
|
17978
|
-
},
|
|
17979
18019
|
"node_modules/es6-set": {
|
|
17980
18020
|
"version": "0.1.6",
|
|
17981
18021
|
"resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.6.tgz",
|
|
@@ -22089,9 +22129,19 @@
|
|
|
22089
22129
|
"dev": true
|
|
22090
22130
|
},
|
|
22091
22131
|
"node_modules/js-yaml": {
|
|
22092
|
-
"version": "4.
|
|
22093
|
-
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.
|
|
22094
|
-
"integrity": "sha512-
|
|
22132
|
+
"version": "4.3.2",
|
|
22133
|
+
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz",
|
|
22134
|
+
"integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==",
|
|
22135
|
+
"funding": [
|
|
22136
|
+
{
|
|
22137
|
+
"type": "github",
|
|
22138
|
+
"url": "https://github.com/sponsors/puzrin"
|
|
22139
|
+
},
|
|
22140
|
+
{
|
|
22141
|
+
"type": "github",
|
|
22142
|
+
"url": "https://github.com/sponsors/nodeca"
|
|
22143
|
+
}
|
|
22144
|
+
],
|
|
22095
22145
|
"license": "MIT",
|
|
22096
22146
|
"dependencies": {
|
|
22097
22147
|
"argparse": "^2.0.1"
|
|
@@ -25129,6 +25179,18 @@
|
|
|
25129
25179
|
"node": ">=8.10.0"
|
|
25130
25180
|
}
|
|
25131
25181
|
},
|
|
25182
|
+
"node_modules/readdirp/node_modules/picomatch": {
|
|
25183
|
+
"version": "2.3.2",
|
|
25184
|
+
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
|
|
25185
|
+
"integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
|
|
25186
|
+
"dev": true,
|
|
25187
|
+
"engines": {
|
|
25188
|
+
"node": ">=8.6"
|
|
25189
|
+
},
|
|
25190
|
+
"funding": {
|
|
25191
|
+
"url": "https://github.com/sponsors/jonschlinkert"
|
|
25192
|
+
}
|
|
25193
|
+
},
|
|
25132
25194
|
"node_modules/rechoir": {
|
|
25133
25195
|
"version": "0.6.2",
|
|
25134
25196
|
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz",
|
|
@@ -25830,17 +25892,6 @@
|
|
|
25830
25892
|
"aws-dynamodb-local": "^0.0.14"
|
|
25831
25893
|
}
|
|
25832
25894
|
},
|
|
25833
|
-
"node_modules/serverless-localstack": {
|
|
25834
|
-
"version": "1.2.1",
|
|
25835
|
-
"resolved": "https://registry.npmjs.org/serverless-localstack/-/serverless-localstack-1.2.1.tgz",
|
|
25836
|
-
"integrity": "sha512-obvJHpRo1qRV05OdP7NXXDb6/o1g+oWwAP5GFbnBKpo5+46t15gDJ80LHKnIklT8kR45mNSEbVO6Iw+ctUYhRA==",
|
|
25837
|
-
"dev": true,
|
|
25838
|
-
"dependencies": {
|
|
25839
|
-
"adm-zip": "^0.5.10",
|
|
25840
|
-
"aws-sdk": "^2.402.0",
|
|
25841
|
-
"es6-promisify": "^6.0.1"
|
|
25842
|
-
}
|
|
25843
|
-
},
|
|
25844
25895
|
"node_modules/serverless-offline": {
|
|
25845
25896
|
"version": "13.8.1",
|
|
25846
25897
|
"resolved": "https://registry.npmjs.org/serverless-offline/-/serverless-offline-13.8.1.tgz",
|
package/templates/package.json
CHANGED
|
@@ -64,6 +64,8 @@
|
|
|
64
64
|
"class-transformer": "^0.5.1",
|
|
65
65
|
"class-validator": "^0.14.0",
|
|
66
66
|
"concurrently": "^9.0.1",
|
|
67
|
+
"dotenv": "^16.4.5",
|
|
68
|
+
"dotenv-expand": "^10.0.0",
|
|
67
69
|
"eslint": "^8.56.0",
|
|
68
70
|
"eslint-config-prettier": "^9.1.0",
|
|
69
71
|
"eslint-plugin-import": "^2.29.1",
|
|
@@ -71,13 +73,12 @@
|
|
|
71
73
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
72
74
|
"jest": "^29.7.0",
|
|
73
75
|
"jest-junit": "^16.0.0",
|
|
74
|
-
"js-yaml": "^4.
|
|
76
|
+
"js-yaml": "^4.3.2",
|
|
75
77
|
"nestjs-spelunker": "^1.3.0",
|
|
76
78
|
"prettier": "^3.1.1",
|
|
77
79
|
"run-script-os": "^1.1.6",
|
|
78
80
|
"serverless": "^3.40.0",
|
|
79
81
|
"serverless-dynamodb": "^0.2.47",
|
|
80
|
-
"serverless-localstack": "^1.1.2",
|
|
81
82
|
"serverless-offline": "^13.3.2",
|
|
82
83
|
"serverless-offline-aws-eventbridge": "^2.1.0",
|
|
83
84
|
"serverless-offline-dynamodb-streams": "^7.0.0",
|
|
@@ -124,7 +125,7 @@
|
|
|
124
125
|
"trim-newlines": "^3.0.1",
|
|
125
126
|
"jsonwebtoken": "^9.0.2",
|
|
126
127
|
"lodash": "^4.18.0",
|
|
127
|
-
"js-yaml": "
|
|
128
|
+
"js-yaml": "$js-yaml",
|
|
128
129
|
"tmp": "^0.2.6",
|
|
129
130
|
"qs": "^6.14.2",
|
|
130
131
|
"yaml": "^2.8.3",
|
package/templates/prisma/ddb.ts
CHANGED
|
@@ -10,10 +10,13 @@ import {
|
|
|
10
10
|
UpdateTimeToLiveCommand,
|
|
11
11
|
} from '@aws-sdk/client-dynamodb'
|
|
12
12
|
import dotenv from 'dotenv'
|
|
13
|
+
import { expand } from 'dotenv-expand'
|
|
13
14
|
import { appendFileSync, readFileSync, readdirSync, writeFileSync } from 'fs'
|
|
14
15
|
import path from 'path'
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
// .env.local writes endpoints as http://localhost:${LOCAL_X_PORT:-NNNN};
|
|
18
|
+
// plain dotenv would leave that literal, so expand it like Serverless does.
|
|
19
|
+
expand(dotenv.config())
|
|
17
20
|
|
|
18
21
|
const envFilePath = './.env'
|
|
19
22
|
const tableDir = path.join(__dirname, 'dynamodbs')
|