@bifravst/aws-cdk-lambda-helpers 1.3.3 → 1.4.1
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.js +20 -10
- package/package.json +4 -5
package/dist/src/packLayer.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { spawn } from 'child_process';
|
2
2
|
import { createWriteStream } from 'fs';
|
3
|
-
import { copyFile, mkdir, readFile, rm, writeFile } from 'fs/promises';
|
3
|
+
import { copyFile, mkdir, readFile, rm, stat, writeFile } from 'fs/promises';
|
4
4
|
import { glob } from 'glob';
|
5
5
|
import path from 'path';
|
6
6
|
import { ZipFile } from 'yazl';
|
@@ -30,16 +30,31 @@ export const packLayer = async ({ id, dependencies, baseDir, distDir, }) => {
|
|
30
30
|
[dep]: resolvedDependency,
|
31
31
|
};
|
32
32
|
}, {});
|
33
|
+
const checkSumFiles = [
|
34
|
+
// Include this script, so artefact is updated if the way it's built is changed
|
35
|
+
fileURLToPath(import.meta.url),
|
36
|
+
];
|
33
37
|
const packageJSON = path.join(nodejsDir, 'package.json');
|
34
38
|
await writeFile(packageJSON, JSON.stringify({
|
35
39
|
dependencies: depsToBeInstalled,
|
36
40
|
}), 'utf-8');
|
37
|
-
|
38
|
-
|
41
|
+
checkSumFiles.push(packageJSON);
|
42
|
+
let hasLockFile = true;
|
43
|
+
try {
|
44
|
+
// package-lock.json may not exist
|
45
|
+
await stat(packageLockJsonFile);
|
46
|
+
const packageLock = path.join(nodejsDir, 'package-lock.json');
|
47
|
+
await copyFile(packageLockJsonFile, packageLock);
|
48
|
+
checkSumFiles.push(packageLock);
|
49
|
+
}
|
50
|
+
catch {
|
51
|
+
hasLockFile = false;
|
52
|
+
// pass
|
53
|
+
}
|
39
54
|
await new Promise((resolve, reject) => {
|
40
55
|
const [cmd, ...args] = [
|
41
56
|
'npm',
|
42
|
-
'ci',
|
57
|
+
hasLockFile ? 'ci' : 'i',
|
43
58
|
'--ignore-scripts',
|
44
59
|
'--only=prod',
|
45
60
|
'--no-audit',
|
@@ -76,12 +91,7 @@ export const packLayer = async ({ id, dependencies, baseDir, distDir, }) => {
|
|
76
91
|
layerZipFile: zipFileName,
|
77
92
|
hash: checkSumOfStrings([
|
78
93
|
JSON.stringify(dependencies),
|
79
|
-
await checkSumOfFiles(
|
80
|
-
packageJSON,
|
81
|
-
packageLock,
|
82
|
-
// Include this script, so artefact is updated if the way it's built is changed
|
83
|
-
fileURLToPath(import.meta.url),
|
84
|
-
]),
|
94
|
+
await checkSumOfFiles(checkSumFiles),
|
85
95
|
]),
|
86
96
|
};
|
87
97
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@bifravst/aws-cdk-lambda-helpers",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.4.1",
|
4
4
|
"description": "Helper functions which simplify working with TypeScript lambdas for AWS CDK.",
|
5
5
|
"exports": {
|
6
6
|
".": {
|
@@ -51,10 +51,10 @@
|
|
51
51
|
"author": "Nordic Semiconductor ASA | nordicsemi.no",
|
52
52
|
"license": "BSD-3-Clause",
|
53
53
|
"devDependencies": {
|
54
|
-
"@aws-sdk/client-cloudformation": "3.
|
54
|
+
"@aws-sdk/client-cloudformation": "3.555.0",
|
55
55
|
"@bifravst/eslint-config-typescript": "6.0.22",
|
56
56
|
"@bifravst/prettier-config": "1.0.0",
|
57
|
-
"@commitlint/config-conventional": "19.
|
57
|
+
"@commitlint/config-conventional": "19.2.2",
|
58
58
|
"@nordicsemiconductor/cloudformation-helpers": "^9.0.3",
|
59
59
|
"@nordicsemiconductor/from-env": "^3.0.1",
|
60
60
|
"@types/aws-lambda": "8.10.137",
|
@@ -104,14 +104,13 @@
|
|
104
104
|
"access": "public"
|
105
105
|
},
|
106
106
|
"files": [
|
107
|
-
"package-lock.json",
|
108
107
|
"dist/src",
|
109
108
|
"LICENSE",
|
110
109
|
"README.md"
|
111
110
|
],
|
112
111
|
"prettier": "@bifravst/prettier-config",
|
113
112
|
"dependencies": {
|
114
|
-
"@swc/core": "1.4.
|
113
|
+
"@swc/core": "1.4.14",
|
115
114
|
"glob": "10.3.12",
|
116
115
|
"typescript": "5.4.5",
|
117
116
|
"yazl": "2.5.1"
|