wirejs-deploy-amplify-basic 0.1.162-llm → 0.1.163-llm

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.
@@ -1,3 +1,4 @@
1
+ import fs from 'fs';
1
2
  import path from 'path';
2
3
  import { randomUUID } from 'crypto';
3
4
  import {
@@ -14,7 +15,7 @@ import { Bucket, BlockPublicAccess } from 'aws-cdk-lib/aws-s3';
14
15
  import { Table, AttributeType, BillingMode } from 'aws-cdk-lib/aws-dynamodb';
15
16
  import { AnyPrincipal, PolicyStatement } from 'aws-cdk-lib/aws-iam';
16
17
 
17
- import { TableDefinition, indexName } from 'wirejs-resources';
18
+ import { TableDefinition, indexName, DeploymentConfig } from 'wirejs-resources';
18
19
  import { TableIndexes } from './constructs/table-indexes';
19
20
  import { RealtimeService } from './constructs/realtime-service';
20
21
  import { auth } from './auth/resource';
@@ -22,13 +23,14 @@ import { auth } from './auth/resource';
22
23
  // @ts-ignore
23
24
  import generatedResources from './generated-resources';
24
25
  import { copyFileSync } from 'fs';
25
- import { cwd } from 'process';
26
+ import { config, cwd } from 'process';
26
27
 
27
28
  const __filename = import.meta.url.replace(/^file:/, '');
28
29
  const __dirname = path.dirname(__filename);
29
30
 
30
31
  const generated: any[] = generatedResources;
31
32
 
33
+ const CONFIG_PATH = path.join(cwd(), 'deployment-config.ts');
32
34
  const APP_ID = process.env.AWS_APP_ID ?? process.env.PWD?.replace(/[^a-zA-Z0-9-_]/g, '_');
33
35
  const BRANCH_ID = process.env.AWS_BRANCH ?? process.env.USER ?? 'anonymous';
34
36
  const TABLE_NAME_PREFIX = `${APP_ID}-${BRANCH_ID}-`;
@@ -49,19 +51,31 @@ copyFileSync(
49
51
  path.join(cwd(), 'api', 'wirejs-handler.ts')
50
52
  );
51
53
 
54
+ let cfg: DeploymentConfig = {};
55
+ if (fs.existsSync(CONFIG_PATH)) {
56
+ cfg = (await import(CONFIG_PATH)).default as DeploymentConfig;
57
+ console.log("\nDeployment config found: ", JSON.stringify(cfg), "\n");
58
+ } else {
59
+ console.log('\nNo deployment config found. Using defaults.\n')
60
+ }
61
+
52
62
  const api = new NodejsFunction(backend.stack, 'ApiHandler', {
53
- runtime: Runtime.NODEJS_22_X,
54
- memorySize: 2 * 1024,
63
+ runtime: {
64
+ 20: Runtime.NODEJS_20_X,
65
+ 22: Runtime.NODEJS_22_X,
66
+ 24: Runtime.NODEJS_24_X,
67
+ }[cfg.runtimeNodeVersion ?? 24],
68
+ memorySize: cfg.runtimeDesiredMemoryMB ?? 2 * 1024,
55
69
  handler: 'handler',
56
70
  entry: path.join(cwd(), 'api', 'wirejs-handler.ts'),
57
71
  bundling: {
58
- nodeModules: ['jsdom'],
59
- format: OutputFormat.CJS,
60
- minify: false,
61
- sourceMap: true,
72
+ nodeModules: cfg.bundleNodeModules ?? ['jsdom'],
73
+ format: cfg.bundleFormat === 'esm' ? OutputFormat.ESM : OutputFormat.CJS,
74
+ minify: Boolean(cfg.bundleMinify),
75
+
62
76
  },
63
77
  depsLockFilePath: path.join(cwd(), 'package-lock.json'),
64
- timeout: Duration.minutes(15)
78
+ timeout: Duration.seconds(cfg.runtimeTimeoutSeconds ?? 15 * 60),
65
79
  });
66
80
 
67
81
  /**
@@ -3,6 +3,6 @@
3
3
  "dependencies": {
4
4
  "jsdom": "^25.0.1",
5
5
  "wirejs-dom": "^1.0.44",
6
- "wirejs-resources": "^0.1.162-llm"
6
+ "wirejs-resources": "^0.1.163-llm"
7
7
  }
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wirejs-deploy-amplify-basic",
3
- "version": "0.1.162-llm",
3
+ "version": "0.1.163-llm",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -44,7 +44,7 @@
44
44
  "recursive-copy": "^2.0.14",
45
45
  "rimraf": "^6.0.1",
46
46
  "wirejs-dom": "^1.0.44",
47
- "wirejs-resources": "^0.1.162-llm"
47
+ "wirejs-resources": "^0.1.163-llm"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@aws-amplify/backend": "^1.14.0",