Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion LayerManagerPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const fs = require('fs');

const DEFAULT_CONFIG = {
installLayers: true,
installOptions: [],
exportLayers: true,
upgradeLayerReferences: true,
exportPrefix: '${AWS::StackName}-'
Expand Down Expand Up @@ -63,10 +64,11 @@ class LayerManagerPlugin {

installLayer(path) {
const nodeLayerPath = `${path}/nodejs`;
const installArgsString = this.config.installOptions ? this.config.installOptions.join(' ') : '';

if (fs.existsSync(nodeLayerPath)) {
verbose(this, `Installing nodejs layer ${path}`);
execSync('npm install', {
execSync(`npm install ${installArgsString}`, {
stdio: 'inherit',
cwd: nodeLayerPath
});
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ You may customize the features by adding a `layerConfig` object under `custom`,
custom:
layerConfig:
installLayers: <boolean>
installOptions: <array>
exportLayers: <boolean>
upgradeLayerReferences: <boolean>
exportPrefix: <prefix used for the names of the exported layers>
```

By default, all config options are true and the `exportPrefix` is set to `${AWS:StackName}-`.
By default, all config options are true, the `exportPrefix` is set to `${AWS:StackName}-` and installOptions is an empty array.
1 change: 1 addition & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const DEFAULT_CONFIG = {
exportLayers: true,
exportPrefix: '${AWS::StackName}-',
installLayers: true,
installOptions: [],
upgradeLayerReferences: true
};

Expand Down