Skip to content

Commit

Permalink
chore: migrate back to v1 (#29)
Browse files Browse the repository at this point in the history
In order to allow Construct Hub to leverage 3rd-party libraries, we decided to use v1 instead of v2.
  • Loading branch information
Elad Ben-Israel committed May 3, 2021
1 parent 60fdc6f commit 2469305
Show file tree
Hide file tree
Showing 8 changed files with 448 additions and 92 deletions.
67 changes: 56 additions & 11 deletions .projen/deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dependencies": [
{
"name": "@aws-cdk/assert",
"version": "^2.0.0-alpha.13",
"version": "^1.101.0",
"type": "build"
},
{
Expand All @@ -22,11 +22,6 @@
"name": "@typescript-eslint/parser",
"type": "build"
},
{
"name": "constructs",
"version": "^10.0.5",
"type": "build"
},
{
"name": "eslint",
"type": "build"
Expand Down Expand Up @@ -95,18 +90,68 @@
"type": "build"
},
{
"name": "aws-cdk-lib",
"version": "^2.0.0-alpha.13",
"name": "@aws-cdk/aws-certificatemanager",
"version": "^1.101.0",
"type": "peer"
},
{
"name": "@aws-cdk/aws-cloudwatch",
"version": "^1.101.0",
"type": "peer"
},
{
"name": "@aws-cdk/aws-route53",
"version": "^1.101.0",
"type": "peer"
},
{
"name": "@aws-cdk/aws-sns",
"version": "^1.101.0",
"type": "peer"
},
{
"name": "@aws-cdk/core",
"version": "^1.101.0",
"type": "peer"
},
{
"name": "@aws-cdk/cx-api",
"version": "^1.101.0",
"type": "peer"
},
{
"name": "constructs",
"version": "^10.0.5",
"version": "^3.2.27",
"type": "peer"
},
{
"name": "aws-cdk-lib",
"version": "^2.0.0-alpha.13",
"name": "@aws-cdk/aws-certificatemanager",
"version": "^1.101.0",
"type": "runtime"
},
{
"name": "@aws-cdk/aws-cloudwatch",
"version": "^1.101.0",
"type": "runtime"
},
{
"name": "@aws-cdk/aws-route53",
"version": "^1.101.0",
"type": "runtime"
},
{
"name": "@aws-cdk/aws-sns",
"version": "^1.101.0",
"type": "runtime"
},
{
"name": "@aws-cdk/core",
"version": "^1.101.0",
"type": "runtime"
},
{
"name": "@aws-cdk/cx-api",
"version": "^1.101.0",
"type": "runtime"
}
],
Expand Down
15 changes: 12 additions & 3 deletions .projenrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,19 @@ const project = new AwsCdkConstructLibrary({
authorAddress: 'aws-cdk-team@amazon.com',
authorOrganization: true,

cdkVersion: '2.0.0-alpha.13',
cdkDependencies: ['aws-cdk-lib'],
cdkVersion: '1.101.0',
cdkDependencies: [
'@aws-cdk/core',
'@aws-cdk/cx-api',
'@aws-cdk/aws-cloudwatch',
'@aws-cdk/aws-certificatemanager',
'@aws-cdk/aws-route53',
'@aws-cdk/aws-sns',
],

devDeps: ['constructs@^10.0.5', 'yaml'],
devDeps: [
'yaml',
],

pullRequestTemplateContents: [
'',
Expand Down
18 changes: 9 additions & 9 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Name|Description



__Implements__: [IConstruct](#constructs-iconstruct), [IDependable](#constructs-idependable)
__Extends__: [Construct](#constructs-construct)
__Implements__: [IConstruct](#constructs-iconstruct), [IConstruct](#aws-cdk-core-iconstruct), [IConstruct](#constructs-iconstruct), [IDependable](#aws-cdk-core-idependable)
__Extends__: [Construct](#aws-cdk-core-construct)

### Initializer

Expand All @@ -32,16 +32,16 @@ __Extends__: [Construct](#constructs-construct)
new ConstructHub(scope: Construct, id: string, _props: ConstructHubProps)
```

* **scope** (<code>[Construct](#constructs-construct)</code>) *No description*
* **scope** (<code>[Construct](#aws-cdk-core-construct)</code>) *No description*
* **id** (<code>string</code>) *No description*
* **_props** (<code>[ConstructHubProps](#construct-hub-constructhubprops)</code>) *No description*
* **hostedZone** (<code>[aws_route53.IHostedZone](#aws-cdk-lib-aws-route53-ihostedzone)</code>) The root domain name where this instance of Construct Hub will be served.
* **hostedZone** (<code>[IHostedZone](#aws-cdk-aws-route53-ihostedzone)</code>) The root domain name where this instance of Construct Hub will be served.
* **contactUrls** (<code>[ContactURLs](#construct-hub-contacturls)</code>) Contact URLs to be used for contacting this Construct Hub operators. __*Default*__: none
* **dashboardName** (<code>string</code>) The name of the CloudWatch Dashboard created to observe this application. __*Default*__: the path to this construct is used as the dashboard name.
* **enableNpmFeed** (<code>boolean</code>) Whether the package feed from the npmjs.com registry should be enabled. __*Default*__: true
* **pathPrefix** (<code>string</code>) An optional path prefix to use for serving the Construct Hub. __*Default*__: none.
* **tlsCertificate** (<code>[aws_certificatemanager.ICertificate](#aws-cdk-lib-aws-certificatemanager-icertificate)</code>) The certificate to use for serving the Construct Hub over a custom domain. __*Default*__: a DNS-Validated certificate will be provisioned using the provided `hostedZone`.
* **updatesTopic** (<code>[aws_sns.ITopic](#aws-cdk-lib-aws-sns-itopic)</code>) An optional topic to be notified whenever a new package is indexed into this Construct Hub instance. __*Default*__: none
* **tlsCertificate** (<code>[ICertificate](#aws-cdk-aws-certificatemanager-icertificate)</code>) The certificate to use for serving the Construct Hub over a custom domain. __*Default*__: a DNS-Validated certificate will be provisioned using the provided `hostedZone`.
* **updatesTopic** (<code>[ITopic](#aws-cdk-aws-sns-itopic)</code>) An optional topic to be notified whenever a new package is indexed into this Construct Hub instance. __*Default*__: none



Expand All @@ -55,13 +55,13 @@ new ConstructHub(scope: Construct, id: string, _props: ConstructHubProps)

Name | Type | Description
-----|------|-------------
**hostedZone**🔹 | <code>[aws_route53.IHostedZone](#aws-cdk-lib-aws-route53-ihostedzone)</code> | The root domain name where this instance of Construct Hub will be served.
**hostedZone**🔹 | <code>[IHostedZone](#aws-cdk-aws-route53-ihostedzone)</code> | The root domain name where this instance of Construct Hub will be served.
**contactUrls**?🔹 | <code>[ContactURLs](#construct-hub-contacturls)</code> | Contact URLs to be used for contacting this Construct Hub operators.<br/>__*Default*__: none
**dashboardName**?🔹 | <code>string</code> | The name of the CloudWatch Dashboard created to observe this application.<br/>__*Default*__: the path to this construct is used as the dashboard name.
**enableNpmFeed**?🔹 | <code>boolean</code> | Whether the package feed from the npmjs.com registry should be enabled.<br/>__*Default*__: true
**pathPrefix**?🔹 | <code>string</code> | An optional path prefix to use for serving the Construct Hub.<br/>__*Default*__: none.
**tlsCertificate**?🔹 | <code>[aws_certificatemanager.ICertificate](#aws-cdk-lib-aws-certificatemanager-icertificate)</code> | The certificate to use for serving the Construct Hub over a custom domain.<br/>__*Default*__: a DNS-Validated certificate will be provisioned using the provided `hostedZone`.
**updatesTopic**?🔹 | <code>[aws_sns.ITopic](#aws-cdk-lib-aws-sns-itopic)</code> | An optional topic to be notified whenever a new package is indexed into this Construct Hub instance.<br/>__*Default*__: none
**tlsCertificate**?🔹 | <code>[ICertificate](#aws-cdk-aws-certificatemanager-icertificate)</code> | The certificate to use for serving the Construct Hub over a custom domain.<br/>__*Default*__: a DNS-Validated certificate will be provisioned using the provided `hostedZone`.
**updatesTopic**?🔹 | <code>[ITopic](#aws-cdk-aws-sns-itopic)</code> | An optional topic to be notified whenever a new package is indexed into this Construct Hub instance.<br/>__*Default*__: none



Expand Down
19 changes: 14 additions & 5 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions src/construct-hub.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import { aws_certificatemanager, aws_route53, aws_sns } from 'aws-cdk-lib';
import { Construct } from 'constructs';
import * as certificatemanager from '@aws-cdk/aws-certificatemanager';
import * as route53 from '@aws-cdk/aws-route53';
import * as sns from '@aws-cdk/aws-sns';
import { Construct } from '@aws-cdk/core';

export interface ConstructHubProps {
/**
* The root domain name where this instance of Construct Hub will be served.
*/
readonly hostedZone: aws_route53.IHostedZone;
readonly hostedZone: route53.IHostedZone;

/**
* The certificate to use for serving the Construct Hub over a custom domain.
*
* @default - a DNS-Validated certificate will be provisioned using the
* provided `hostedZone`.
*/
readonly tlsCertificate?: aws_certificatemanager.ICertificate;
readonly tlsCertificate?: certificatemanager.ICertificate;

/**
* An optional path prefix to use for serving the Construct Hub.
Expand Down Expand Up @@ -42,7 +44,7 @@ export interface ConstructHubProps {
*
* @default - none
*/
readonly updatesTopic?: aws_sns.ITopic;
readonly updatesTopic?: sns.ITopic;

/**
* The name of the CloudWatch Dashboard created to observe this application.
Expand Down
18 changes: 0 additions & 18 deletions test/__snapshots__/construct-hub.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions test/construct-hub.test.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import '@aws-cdk/assert/jest';

import { App, Stack, aws_route53, cx_api } from 'aws-cdk-lib';
import * as route53 from '@aws-cdk/aws-route53';
import { App, Stack } from '@aws-cdk/core';
import * as cxapi from '@aws-cdk/cx-api';
import { stringify as yaml } from 'yaml';

import { ConstructHub } from '../src/construct-hub';
import { ConstructHub } from '../src';

expect.addSnapshotSerializer({
test: (val) => val instanceof cx_api.CloudFormationStackArtifact,
serialize: (val: cx_api.CloudFormationStackArtifact) => yaml(val.template),
test: (val) => val instanceof cxapi.CloudFormationStackArtifact,
serialize: (val: cxapi.CloudFormationStackArtifact) => yaml(val.template),
});

test('minimal configuration', () => {
// Given
const app = new App();
const stack = new Stack(app, 'Stack');
const hostedZone = new aws_route53.PublicHostedZone(stack, 'HostedZone', { zoneName: 'hub.constructs.test' });
const hostedZone = new route53.PublicHostedZone(stack, 'HostedZone', { zoneName: 'hub.constructs.test' });

// When
new ConstructHub(stack, 'ConstructHub', { hostedZone });
Expand Down
Loading

0 comments on commit 2469305

Please sign in to comment.