Skip to content

Commit

Permalink
fix: ensure aws-cdk-lib and constructs are only peer dependencies (#11)
Browse files Browse the repository at this point in the history
Fixes #8
  • Loading branch information
joshlartz authored Apr 20, 2022
1 parent ca14378 commit f286568
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 84 deletions.
16 changes: 7 additions & 9 deletions .projen/deps.json

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

10 changes: 5 additions & 5 deletions .projen/tasks.json

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

16 changes: 6 additions & 10 deletions .projenrc.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
const { awscdk } = require('projen');

const deps = [
'aws-cdk-lib',
'constructs',
];

const project = new awscdk.AwsCdkConstructLibrary({
packageName: '@aws-cdk-containers/ecs-service-extensions',
author: 'Amazon Web Services',
authorAddress: 'https://aws.amazon.com',
authorOrganization: true,
cdkVersion: '2.1.0',
cdkVersion: '2.8.0',
defaultReleaseBranch: 'main',
name: 'cdklabs/cdk-ecs-service-extensions',
repositoryUrl: 'https://github.com/cdklabs/cdk-ecs-service-extensions.git',
stability: 'experimental',
majorVersion: 2,
prerelease: 'alpha',

deps,
peerDeps: deps,
peerDeps: [
'aws-cdk-lib',
'constructs',
],
devDeps: [
'@types/jest',
'aws-cdk-lib',
'jest',
],

Expand Down Expand Up @@ -59,4 +55,4 @@ const project = new awscdk.AwsCdkConstructLibrary({
autoApproveUpgrades: true,
});

project.synth();
project.synth();
48 changes: 3 additions & 45 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ The environment's cluster must not be imported.

---

##### `isConstruct` <a name="isConstruct" id="@aws-cdk-containers/ecs-service-extensions.Environment.isConstruct"></a>
##### ~~`isConstruct`~~ <a name="isConstruct" id="@aws-cdk-containers/ecs-service-extensions.Environment.isConstruct"></a>

```typescript
import { Environment } from '@aws-cdk-containers/ecs-service-extensions'
Expand All @@ -99,20 +99,6 @@ Environment.isConstruct(x: any)

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct`
instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on
disk are seen as independent, completely different libraries. As a
consequence, the class `Construct` in each copy of the `constructs` library
is seen as a different class, and an instance of one class will not test as
`instanceof` the other class. `npm install` will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the `constructs`
library can be accidentally installed, and `instanceof` will behave
unpredictably. It is safest to avoid using `instanceof`, and using
this type-testing method instead.

###### `x`<sup>Required</sup> <a name="x" id="@aws-cdk-containers/ecs-service-extensions.Environment.isConstruct.parameter.x"></a>

- *Type:* any
Expand Down Expand Up @@ -299,7 +285,7 @@ Adding a default cloudmap namespace to the cluster will throw an error, as we do

---

##### `isConstruct` <a name="isConstruct" id="@aws-cdk-containers/ecs-service-extensions.ImportedEnvironment.isConstruct"></a>
##### ~~`isConstruct`~~ <a name="isConstruct" id="@aws-cdk-containers/ecs-service-extensions.ImportedEnvironment.isConstruct"></a>

```typescript
import { ImportedEnvironment } from '@aws-cdk-containers/ecs-service-extensions'
Expand All @@ -309,20 +295,6 @@ ImportedEnvironment.isConstruct(x: any)

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct`
instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on
disk are seen as independent, completely different libraries. As a
consequence, the class `Construct` in each copy of the `constructs` library
is seen as a different class, and an instance of one class will not test as
`instanceof` the other class. `npm install` will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the `constructs`
library can be accidentally installed, and `instanceof` will behave
unpredictably. It is safest to avoid using `instanceof`, and using
this type-testing method instead.

###### `x`<sup>Required</sup> <a name="x" id="@aws-cdk-containers/ecs-service-extensions.ImportedEnvironment.isConstruct.parameter.x"></a>

- *Type:* any
Expand Down Expand Up @@ -549,7 +521,7 @@ The URL to look up.

---

##### `isConstruct` <a name="isConstruct" id="@aws-cdk-containers/ecs-service-extensions.Service.isConstruct"></a>
##### ~~`isConstruct`~~ <a name="isConstruct" id="@aws-cdk-containers/ecs-service-extensions.Service.isConstruct"></a>

```typescript
import { Service } from '@aws-cdk-containers/ecs-service-extensions'
Expand All @@ -559,20 +531,6 @@ Service.isConstruct(x: any)

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct`
instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on
disk are seen as independent, completely different libraries. As a
consequence, the class `Construct` in each copy of the `constructs` library
is seen as a different class, and an instance of one class will not test as
`instanceof` the other class. `npm install` will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the `constructs`
library can be accidentally installed, and `instanceof` will behave
unpredictably. It is safest to avoid using `instanceof`, and using
this type-testing method instead.

###### `x`<sup>Required</sup> <a name="x" id="@aws-cdk-containers/ecs-service-extensions.Service.isConstruct.parameter.x"></a>

- *Type:* any
Expand Down
9 changes: 3 additions & 6 deletions package.json

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

18 changes: 9 additions & 9 deletions yarn.lock

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

0 comments on commit f286568

Please sign in to comment.