Skip to content

Commit

Permalink
feat(core): only include cdk libs in version reporting (#1290)
Browse files Browse the repository at this point in the history
Include only libraries with names that start with "@aws-cdk", "aws-cdk" or "jsii-".

Fixes awslabs/cdk-ops#172
  • Loading branch information
Elad Ben-Israel committed Dec 5, 2018
1 parent f06de18 commit 6184423
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
7 changes: 7 additions & 0 deletions packages/@aws-cdk/cdk/lib/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ export class App extends Root {
}
}

// include only libraries that are in the @aws-cdk npm scope
for (const name of Object.keys(libraries)) {
if (!name.startsWith('@aws-cdk/')) {
delete libraries[name];
}
}

// add jsii runtime version
libraries['jsii-runtime'] = getJsiiAgentVersion();

Expand Down
20 changes: 19 additions & 1 deletion packages/@aws-cdk/cdk/test/test.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,25 @@ export = {

delete process.env.JSII_AGENT;
test.done();
}
},

'version reporting includes only @aws-cdk, aws-cdk and jsii libraries'(test: Test) {
const response = withApp({}, app => {
const stack = new Stack(app, 'stack1');
new Resource(stack, 'MyResource', { type: 'Resource::Type' });
});

const libs = response.runtime.libraries;

const version = require('../package.json').version;
test.deepEqual(libs, {
'@aws-cdk/cdk': version,
'@aws-cdk/cx-api': version,
'jsii-runtime': `node.js/${process.version}`
});

test.done();
},
};

class MyConstruct extends Construct {
Expand Down

0 comments on commit 6184423

Please sign in to comment.