Skip to content

Commit

Permalink
Merge pull request #2772 from blackflux/dev
Browse files Browse the repository at this point in the history
[Gally]: master <- dev
  • Loading branch information
simlu authored Aug 4, 2023
2 parents b8f8fe8 + 5ae467d commit f81d419
Show file tree
Hide file tree
Showing 6 changed files with 208 additions and 270 deletions.
9 changes: 9 additions & 0 deletions CONFDOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ Manage various configuration files for an open source npm package on github.
<td align="left" valign="top">
<ul>
<li><a href="#blackfluxrobo-config-plugin-var-ref-packagename">packageName</a></li>
<li><a href="#blackfluxrobo-config-plugin-var-ref-nccexclude">nccExclude</a></li>
<li><a href="#blackfluxrobo-config-plugin-var-ref-nccenabled">nccEnabled</a></li>
<li><a href="#blackfluxrobo-config-plugin-var-ref-nodeversion">nodeVersion</a></li>
<li><a href="#blackfluxrobo-config-plugin-var-ref-repokey">repoKey</a></li>
Expand Down Expand Up @@ -613,6 +614,7 @@ Manage package.json for npm package on github.
</td>
<td align="left" valign="top">
<ul>
<li><a href="#blackfluxrobo-config-plugin-var-ref-nccexclude">nccExclude</a></li>
<li><a href="#blackfluxrobo-config-plugin-var-ref-nccenabled">nccEnabled</a></li>
<li><a href="#blackfluxrobo-config-plugin-var-ref-nodeversion">nodeVersion</a></li>
<li><a href="#blackfluxrobo-config-plugin-var-ref-repokey">repoKey</a></li>
Expand Down Expand Up @@ -650,6 +652,7 @@ _Updating <a href="#blackfluxrobo-config-plugin-target-ref-packagejson">package.
</td>
<td align="left" valign="top">
<ul>
<li><a href="#blackfluxrobo-config-plugin-var-ref-nccexclude">nccExclude</a></li>
<li><a href="#blackfluxrobo-config-plugin-var-ref-nccenabled">nccEnabled</a></li>
</ul>
</td>
Expand Down Expand Up @@ -1689,6 +1692,12 @@ Very similar functionality to npm cli.
The name of the project as published to npm.
Note that for scoped packages the name can differ significantly from the repo name.

### <a name="blackfluxrobo-config-plugin-var-ref-nccexclude">nccExclude</a> : `array`

**Default**: ``

*Exclude packages from ncc compilation.*

### <a name="blackfluxrobo-config-plugin-var-ref-nccenabled">nccEnabled</a> : `boolean`

*Enable ncc for service.*
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
},
"homepage": "https://github.com/blackflux/lambda-monitor#readme",
"dependencies": {
"@aws-sdk/client-cloudwatch-logs": "3.379.1",
"@aws-sdk/client-lambda": "3.379.1",
"@aws-sdk/client-resource-groups-tagging-api": "3.379.1",
"@aws-sdk/client-s3": "3.379.1",
"@aws-sdk/client-sqs": "3.379.1",
"@aws-sdk/client-cloudwatch-logs": "3.385.0",
"@aws-sdk/client-lambda": "3.385.0",
"@aws-sdk/client-resource-groups-tagging-api": "3.385.0",
"@aws-sdk/client-s3": "3.385.0",
"@aws-sdk/client-sqs": "3.385.0",
"@blackflux/axios": "1.1.3",
"aws-sdk-wrap": "13.0.6",
"datadog-light": "3.1.0",
Expand All @@ -57,26 +57,26 @@
"lambda-cfn-hook": "3.0.1",
"lambda-monitor-logger": "4.0.0",
"lodash.get": "4.4.2",
"lru-cache-ext": "3.0.2",
"object-scan": "18.5.1",
"lru-cache-ext": "3.0.3",
"object-scan": "19.0.0",
"promise-pool-ext": "3.0.0",
"smart-fs": "3.0.2"
},
"devDependencies": {
"@babel/core": "7.22.9",
"@babel/eslint-parser": "7.22.9",
"@babel/register": "7.22.5",
"@blackflux/eslint-plugin-rules": "2.1.0",
"@blackflux/robo-config-plugin": "9.0.9",
"c8": "7.11.0",
"@blackflux/eslint-plugin-rules": "2.2.0",
"@blackflux/robo-config-plugin": "9.1.8",
"c8": "8.0.1",
"chai": "4.3.7",
"eslint": "8.46.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-plugin-import": "2.28.0",
"eslint-plugin-json": "3.1.0",
"eslint-plugin-markdown": "3.0.1",
"eslint-plugin-mocha": "10.1.0",
"js-gardener": "5.0.0",
"js-gardener": "5.0.1",
"lambda-tdd": "6.3.4",
"minimist": "1.2.8",
"mocha": "10.2.0",
Expand Down
10 changes: 2 additions & 8 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import fs from 'smart-fs';
import LRU from 'lru-cache-ext';
import Joi from 'joi-strict';

const lru = new LRU({
ttl: 60 * 60 * 1000,
max: 10
});

export default (filepath = 'config.json') => lru.memoizeSync('config', () => {
export default (filepath = 'config.json') => {
const config = fs.existsSync(filepath)
? fs.smartRead(filepath)
: { suppress: [] };
Expand All @@ -18,4 +12,4 @@ export default (filepath = 'config.json') => lru.memoizeSync('config', () => {
return {
isSuppressed: (msg) => suppress.some((re) => re.test(msg))
};
});
};
3 changes: 2 additions & 1 deletion src/logic/process-logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import {
} from './util/parser.js';
import Config from '../config.js';

const config = Config(process.env.CONFIG_FILEPATH);

const processLogs = async (event, context) => {
const config = Config(process.env.CONFIG_FILEPATH);
const data = JSON.parse(zlib
.gunzipSync(Buffer.from(event.awslogs.data, 'base64'))
.toString('ascii'));
Expand Down
2 changes: 1 addition & 1 deletion test/hot.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function createListener() {
},
deleteProperty(target, key) {
if (!(key in target)) {
return false;
return true;
}
// eslint-disable-next-line no-param-reassign
delete target[key];
Expand Down
Loading

0 comments on commit f81d419

Please sign in to comment.