@bref.sh/layers 3.0.2 → 3.0.3
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 +5 -10
- package/layers.js +2 -36
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,20 +32,15 @@ Get a layer version:
|
|
|
32
32
|
```js
|
|
33
33
|
import { layerVersions } from '@bref.sh/layers';
|
|
34
34
|
|
|
35
|
-
console.log(layerVersions['php-
|
|
36
|
-
console.log(layerVersions['php-
|
|
35
|
+
console.log(layerVersions['php-84']['us-east-1']);
|
|
36
|
+
console.log(layerVersions['arm-php-84']['eu-west-3']);
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
Helpers to get a full ARN:
|
|
40
40
|
|
|
41
41
|
```js
|
|
42
|
-
import {
|
|
42
|
+
import { layerArn } from '@bref.sh/layers';
|
|
43
43
|
|
|
44
|
-
console.log(
|
|
45
|
-
console.log(
|
|
46
|
-
|
|
47
|
-
console.log(fpmLayerArn(region, '8.2'));
|
|
48
|
-
console.log(fpmLayerArn(region, '8.3', 'arm'));
|
|
49
|
-
|
|
50
|
-
console.log(consoleLayerArn(region));
|
|
44
|
+
console.log(layerArn(region, '8.4'));
|
|
45
|
+
console.log(layerArn(region, '8.4', 'arm'));
|
|
51
46
|
```
|
package/layers.js
CHANGED
|
@@ -8,7 +8,7 @@ const layerVersions = require('./layers.json');
|
|
|
8
8
|
* @param {'x86'|'arm'} platform
|
|
9
9
|
* @returns {string} Layer ARN
|
|
10
10
|
*/
|
|
11
|
-
function
|
|
11
|
+
function layerArn(region, phpVersion, platform = 'x86') {
|
|
12
12
|
let layerName = 'php-' + phpVersion.replace('.', '');
|
|
13
13
|
if (platform === 'arm') {
|
|
14
14
|
layerName = 'arm-' + layerName;
|
|
@@ -20,42 +20,8 @@ function functionLayerArn(region, phpVersion, platform = 'x86') {
|
|
|
20
20
|
return `arn:aws:lambda:${region}:873528684822:layer:${layerName}:${version}`;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
/**
|
|
24
|
-
* Returns the ARN for the FPM layer.
|
|
25
|
-
* @param {string} region
|
|
26
|
-
* @param {string} phpVersion (e.g. '8.1')
|
|
27
|
-
* @param {'x86'|'arm'} platform
|
|
28
|
-
* @returns {string} Layer ARN
|
|
29
|
-
*/
|
|
30
|
-
function fpmLayerArn(region, phpVersion, platform = 'x86') {
|
|
31
|
-
let layerName = 'php-' + phpVersion.replace('.', '') + '-fpm';
|
|
32
|
-
if (platform === 'arm') {
|
|
33
|
-
layerName = 'arm-' + layerName;
|
|
34
|
-
}
|
|
35
|
-
const version = layerVersions[layerName]?.[region];
|
|
36
|
-
if (!version) {
|
|
37
|
-
throw new Error(`PHP version ${phpVersion} in ${region} is not supported`);
|
|
38
|
-
}
|
|
39
|
-
return `arn:aws:lambda:${region}:873528684822:layer:${layerName}:${version}`;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Returns the ARN for the Console layer.
|
|
44
|
-
* @param {string} region
|
|
45
|
-
* @returns {string} Layer ARN
|
|
46
|
-
*/
|
|
47
|
-
function consoleLayerArn(region) {
|
|
48
|
-
const version = layerVersions.console[region];
|
|
49
|
-
if (!version) {
|
|
50
|
-
throw new Error(`Console layer does not exist in region ${region}`);
|
|
51
|
-
}
|
|
52
|
-
return `arn:aws:lambda:${region}:873528684822:layer:console:${version}`;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
23
|
module.exports = {
|
|
56
24
|
// Expose the JSON data as a JS dependency for easier use in programmatic environments
|
|
57
25
|
layerVersions,
|
|
58
|
-
|
|
59
|
-
fpmLayerArn,
|
|
60
|
-
consoleLayerArn,
|
|
26
|
+
layerArn,
|
|
61
27
|
};
|