@bifravst/aws-cdk-lambda-helpers 1.5.2 → 1.7.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/src/packLayer.d.ts
CHANGED
@@ -2,7 +2,7 @@ export type PackedLayer = {
|
|
2
2
|
layerZipFile: string;
|
3
3
|
hash: string;
|
4
4
|
};
|
5
|
-
export declare const packLayer: ({ id, dependencies, baseDir, distDir, }: {
|
5
|
+
export declare const packLayer: ({ id, dependencies, baseDir, distDir, installCommand, }: {
|
6
6
|
id: string;
|
7
7
|
dependencies: string[];
|
8
8
|
/**
|
@@ -13,4 +13,11 @@ export declare const packLayer: ({ id, dependencies, baseDir, distDir, }: {
|
|
13
13
|
* @default ${baseDir}/dist/layers
|
14
14
|
*/
|
15
15
|
distDir?: string;
|
16
|
+
/**
|
17
|
+
* Returns the command to run, the first element is the command (e.g. `npm`) and the rest are its arguments.
|
18
|
+
*/
|
19
|
+
installCommand?: (args: {
|
20
|
+
packageFile: string;
|
21
|
+
packageLockFile: string;
|
22
|
+
}) => [string, ...Array<string>];
|
16
23
|
}) => Promise<PackedLayer>;
|
package/dist/src/packLayer.js
CHANGED
@@ -6,7 +6,7 @@ import path from 'path';
|
|
6
6
|
import { ZipFile } from 'yazl';
|
7
7
|
import { checkSumOfFiles, checkSumOfStrings } from './checksumOfFiles.js';
|
8
8
|
import { fileURLToPath } from 'node:url';
|
9
|
-
export const packLayer = async ({ id, dependencies, baseDir, distDir, }) => {
|
9
|
+
export const packLayer = async ({ id, dependencies, baseDir, distDir, installCommand, }) => {
|
10
10
|
const base = baseDir ?? process.cwd();
|
11
11
|
const dist = distDir ?? path.join(base, 'dist', 'layers');
|
12
12
|
const packageJsonFile = path.join(base, 'package.json');
|
@@ -52,7 +52,10 @@ export const packLayer = async ({ id, dependencies, baseDir, distDir, }) => {
|
|
52
52
|
// pass
|
53
53
|
}
|
54
54
|
await new Promise((resolve, reject) => {
|
55
|
-
const [cmd, ...args] =
|
55
|
+
const [cmd, ...args] = installCommand?.({
|
56
|
+
packageFile: packageJSON,
|
57
|
+
packageLockFile: packageLockJsonFile,
|
58
|
+
}) ?? [
|
56
59
|
'npm',
|
57
60
|
hasLockFile ? 'ci' : 'i',
|
58
61
|
'--ignore-scripts',
|