|
1 | | -import path from 'node:path' |
| 1 | +import { hashFile } from '@bifravst/aws-cdk-ecr-helpers/hashFile' |
| 2 | +import { hashFolder } from '@bifravst/aws-cdk-ecr-helpers/hashFolder' |
2 | 3 | import { |
3 | 4 | type ImageBuilder, |
4 | 5 | type ImageChecker, |
5 | 6 | } from '@bifravst/aws-cdk-ecr-helpers/image' |
6 | | -import { hashFolder } from '@bifravst/aws-cdk-ecr-helpers/hashFolder' |
7 | | -import { hashFile } from '@bifravst/aws-cdk-ecr-helpers/hashFile' |
8 | | -import fs from 'node:fs/promises' |
9 | | -import run from '@bifravst/run' |
10 | | -import os from 'node:os' |
11 | 7 | import { packLambdaFromPath } from '@bifravst/aws-cdk-lambda-helpers' |
12 | 8 | import { checkSumOfStrings } from '@bifravst/aws-cdk-lambda-helpers/util' |
13 | | -import type { logFn } from '../../../cli/log.js' |
14 | | -import { ContainerRepositoryId } from '../../../aws/ecr.js' |
| 9 | +import run from '@bifravst/run' |
| 10 | +import fs from 'node:fs/promises' |
| 11 | +import os from 'node:os' |
| 12 | +import path from 'node:path' |
15 | 13 | import { fileURLToPath } from 'node:url' |
| 14 | +import { ContainerRepositoryId } from '../../../aws/ecr.js' |
| 15 | +import type { logFn } from '../../../cli/log.js' |
16 | 16 | const __filename = fileURLToPath(import.meta.url) |
17 | 17 | const __dirname = path.dirname(__filename) |
18 | 18 |
|
@@ -56,13 +56,24 @@ export const buildOpenSSLLambdaImage = async ( |
56 | 56 | log: { debug, stderr: debug, stdout: debug }, |
57 | 57 | }) |
58 | 58 |
|
| 59 | + const deps = new Map<string, string>() |
| 60 | + for (const dep of [ |
| 61 | + '@bifravst/run', |
| 62 | + '@hello.nrfcloud.com/certificate-helpers', |
| 63 | + '@hello.nrfcloud.com/lambda-helpers', |
| 64 | + '@middy/core', |
| 65 | + ]) { |
| 66 | + const version = |
| 67 | + pJSON.dependencies[dep as keyof typeof pJSON.dependencies] ?? |
| 68 | + pJSON.devDependencies[dep as keyof typeof pJSON.devDependencies] |
| 69 | + if (version === undefined) |
| 70 | + throw new Error(`[OpenSSLImage] Failed to determine version for ${dep}!`) |
| 71 | + deps.set(dep, version) |
| 72 | + } |
| 73 | + |
59 | 74 | await run({ |
60 | 75 | command: 'npm', |
61 | | - args: [ |
62 | | - 'i', |
63 | | - `@hello.nrfcloud.com/certificate-helpers@${pJSON.dependencies['@hello.nrfcloud.com/certificate-helpers']}`, |
64 | | - `@bifravst/run@${pJSON.devDependencies['@bifravst/run']}`, |
65 | | - ], |
| 76 | + args: ['i', ...[...deps.entries()].map(([dep, v]) => `${dep}@${v}`)], |
66 | 77 | log: { debug, stderr: debug, stdout: debug }, |
67 | 78 | cwd: path.join(distDir, 'lambda'), |
68 | 79 | }) |
|
0 commit comments