Skip to content

Commit

Permalink
fix(cdk8s): deprecate cdk8sPlusVersion option (#1273)
Browse files Browse the repository at this point in the history
REFACTOR: removes cdk8sPlusVersion options

Signed-off-by: Hunter Thompson <aatman@auroville.org.in>

Closes #1272 

BREAKING CHANGE: `cdk8s-plus` is not included automatically in cdk8s project. Users need to add this dependency explicitly.

---
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • Loading branch information
Hunter-Thompson committed Dec 1, 2021
1 parent 1acaeb6 commit 6532fc9
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 162 deletions.
6 changes: 0 additions & 6 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,6 @@ new Cdk8sTypeScriptApp(options: Cdk8sTypeScriptAppOptions)
* **appEntrypoint** (<code>string</code>) The CDK8s app's entrypoint (relative to the source directory, which is "src" by default). __*Default*__: "main.ts"
* **cdk8sCliVersion** (<code>string</code>) cdk8s-cli version. __*Default*__: "cdk8sVersion"
* **cdk8sCliVersionPinning** (<code>boolean</code>) Use pinned version instead of caret version for CDK8s-cli. __*Default*__: false
* **cdk8sPlusVersion** (<code>string</code>) cdk8s-plus-17 version. __*Default*__: "cdk8sVersion"
* **cdk8sPlusVersionPinning** (<code>boolean</code>) Use pinned version instead of caret version for cdk8s-plus-17. __*Default*__: false
* **cdk8sVersionPinning** (<code>boolean</code>) Use pinned version instead of caret version for CDK8s. __*Default*__: false
* **constructsVersion** (<code>string</code>) constructs verion. __*Default*__: "3.2.34"
Expand All @@ -872,7 +871,6 @@ Name | Type | Description
-----|------|-------------
**appEntrypoint**🔹 | <code>string</code> | The CDK8s app entrypoint.
**cdk8sCliVersion**🔹 | <code>string</code> | The cdk8s-cli version this app is using.
**cdk8sPlusVersion**🔹 | <code>string</code> | The cdk8s-plus-17 version this app is using.
**cdk8sVersion**🔹 | <code>string</code> | The CDK8s version this app is using.
**constructsVersion**🔹 | <code>string</code> | The constructs version this app is using.

Expand Down Expand Up @@ -1422,7 +1420,6 @@ new ConstructLibraryCdk8s(options: ConstructLibraryCdk8sOptions)
* **rootdir** (<code>string</code>) *No description* __*Default*__: "."
* **catalog** (<code>[Catalog](#projen-catalog)</code>) Libraries will be picked up by the construct catalog when they are published to npm as jsii modules and will be published under:. __*Default*__: new version will be announced
* **cdk8sVersion** (<code>string</code>) Minimum target version this library is tested against.
* **cdk8sPlusVersion** (<code>string</code>) cdk8s-plus-17 version. __*Default*__: "cdk8sVersion"
* **cdk8sPlusVersionPinning** (<code>boolean</code>) Use pinned version instead of caret version for cdk8s-plus-17. __*Default*__: false
* **cdk8sVersionPinning** (<code>boolean</code>) Use pinned version instead of caret version for CDK8s. __*Default*__: false
* **constructsVersion** (<code>string</code>) constructs verion. __*Default*__: "3.2.34"
Expand All @@ -1435,7 +1432,6 @@ new ConstructLibraryCdk8s(options: ConstructLibraryCdk8sOptions)

Name | Type | Description
-----|------|-------------
**cdk8sPlusVersion**🔹 | <code>string</code> | The cdk8s-plus-17 version this app is using.
**cdk8sVersion**🔹 | <code>string</code> | The CDK8s version this app is using.
**constructsVersion**🔹 | <code>string</code> | The constructs version this app is using.

Expand Down Expand Up @@ -9301,7 +9297,6 @@ Name | Type | Description
**bundlerOptions**?🔹 | <code>[javascript.BundlerOptions](#projen-javascript-bundleroptions)</code> | Options for `Bundler`.<br/>__*Optional*__
**cdk8sCliVersion**?🔹 | <code>string</code> | cdk8s-cli version.<br/>__*Default*__: "cdk8sVersion"
**cdk8sCliVersionPinning**?🔹 | <code>boolean</code> | Use pinned version instead of caret version for CDK8s-cli.<br/>__*Default*__: false
**cdk8sPlusVersion**?🔹 | <code>string</code> | cdk8s-plus-17 version.<br/>__*Default*__: "cdk8sVersion"
**cdk8sPlusVersionPinning**?🔹 | <code>boolean</code> | Use pinned version instead of caret version for cdk8s-plus-17.<br/>__*Default*__: false
**cdk8sVersionPinning**?🔹 | <code>boolean</code> | Use pinned version instead of caret version for CDK8s.<br/>__*Default*__: false
**clobber**?🔹 | <code>boolean</code> | Add a `clobber` task which resets the repo to origin.<br/>__*Default*__: true
Expand Down Expand Up @@ -9615,7 +9610,6 @@ Name | Type | Description
**bundledDeps**?🔹 | <code>Array<string></code> | List of dependencies to bundle into this module.<br/>__*Optional*__
**bundlerOptions**?🔹 | <code>[javascript.BundlerOptions](#projen-javascript-bundleroptions)</code> | Options for `Bundler`.<br/>__*Optional*__
**catalog**?🔹 | <code>[Catalog](#projen-catalog)</code> | Libraries will be picked up by the construct catalog when they are published to npm as jsii modules and will be published under:.<br/>__*Default*__: new version will be announced
**cdk8sPlusVersion**?🔹 | <code>string</code> | cdk8s-plus-17 version.<br/>__*Default*__: "cdk8sVersion"
**cdk8sPlusVersionPinning**?🔹 | <code>boolean</code> | Use pinned version instead of caret version for cdk8s-plus-17.<br/>__*Default*__: false
**cdk8sVersionPinning**?🔹 | <code>boolean</code> | Use pinned version instead of caret version for CDK8s.<br/>__*Default*__: false
**clobber**?🔹 | <code>boolean</code> | Add a `clobber` task which resets the repo to origin.<br/>__*Default*__: true
Expand Down
22 changes: 0 additions & 22 deletions src/cdk8s-app-ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ export interface Cdk8sTypeScriptAppOptions extends TypeScriptProjectOptions {

readonly constructsVersion?: string;

/**
* cdk8s-plus-17 version
*
* @default "cdk8sVersion"
*/

readonly cdk8sPlusVersion?: string;

/**
* cdk8s-cli version
*
Expand Down Expand Up @@ -106,12 +98,6 @@ export class Cdk8sTypeScriptApp extends TypeScriptAppProject {
*/
public readonly constructsVersion: string;

/**
* The cdk8s-plus-17 version this app is using.
*/

public readonly cdk8sPlusVersion: string;

/**
* The cdk8s-cli version this app is using.
*/
Expand Down Expand Up @@ -147,12 +133,6 @@ export class Cdk8sTypeScriptApp extends TypeScriptAppProject {

this.cdk8sVersion = options.cdk8sVersionPinning ? options.cdk8sVersion : `^${options.cdk8sVersion}`;

if (!! options.cdk8sPlusVersion) {
this.cdk8sPlusVersion = options.cdk8sPlusVersionPinning ? options.cdk8sPlusVersion : `^${options.cdk8sPlusVersion}`;
} else {
this.cdk8sPlusVersion = this.cdk8sVersion;
}

if (options.constructsVersion) {
this.constructsVersion = options.constructsVersionPinning ? options.constructsVersion: `^${options.constructsVersion}`;
} else {
Expand All @@ -170,14 +150,12 @@ export class Cdk8sTypeScriptApp extends TypeScriptAppProject {
this.addDeps(
`cdk8s@${this.cdk8sVersion}`,
`constructs@${this.constructsVersion}`,
`cdk8s-plus-17@${this.cdk8sPlusVersion}`,
);
this.addDevDeps(
'ts-node@^9',
`cdk8s-cli@${this.cdk8sCliVersion}`,
`cdk8s@${this.cdk8sVersion}`,
`constructs@${this.constructsVersion}`,
`cdk8s-plus-17@${this.cdk8sPlusVersion}`,
);

const synth = this.addTask('synth', {
Expand Down
22 changes: 0 additions & 22 deletions src/cdk8s-construct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ export interface ConstructLibraryCdk8sOptions extends ConstructLibraryOptions {

readonly constructsVersion?: string;

/**
* cdk8s-plus-17 version
*
* @default "cdk8sVersion"
*/

readonly cdk8sPlusVersion?: string;

/**
* Use pinned version instead of caret version for CDK8s.
*
Expand Down Expand Up @@ -76,12 +68,6 @@ export class ConstructLibraryCdk8s extends ConstructLibrary {
*/
public readonly constructsVersion: string;

/**
* The cdk8s-plus-17 version this app is using.
*/

public readonly cdk8sPlusVersion: string;

constructor(options: ConstructLibraryCdk8sOptions) {
super(options);

Expand All @@ -97,17 +83,9 @@ export class ConstructLibraryCdk8s extends ConstructLibrary {
this.constructsVersion = '^3.2.34';
}


if (!! options.cdk8sPlusVersion) {
this.cdk8sPlusVersion = options.cdk8sPlusVersionPinning ? options.cdk8sPlusVersion : `^${options.cdk8sPlusVersion}`;
} else {
this.cdk8sPlusVersion = this.cdk8sVersion;
}

this.addPeerDeps(
`constructs@${this.constructsVersion}`,
`cdk8s@${this.cdk8sVersion}`,
`cdk8s-plus-17@${this.cdk8sPlusVersion}`,
);
}
}
34 changes: 0 additions & 34 deletions test/__snapshots__/inventory.test.ts.snap

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

33 changes: 12 additions & 21 deletions test/cdk8s-app-project-ts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ test ('test if cdk8s synth is possible', () => {
defaultReleaseBranch: 'main',
releaseWorkflow: true,
constructsVersion: '3.3.75',
cdk8sPlusVersion: '1.0.0-beta.18',
});

const output = synthSnapshot(project);
Expand All @@ -30,9 +29,8 @@ test ('test if cdk8s synth is possible', () => {
]);

expect(output['package.json'].dependencies).toStrictEqual({
'cdk8s': '^1.0.0-beta.18',
'cdk8s-plus-17': '^1.0.0-beta.18',
'constructs': '^3.3.75',
cdk8s: '^1.0.0-beta.18',
constructs: '^3.3.75',
});

});
Expand All @@ -48,9 +46,8 @@ test ('constructs version undefined', () => {
const output = synthSnapshot(project);

expect(output['package.json'].dependencies).toStrictEqual({
'cdk8s': '^1.0.0-beta.11',
'cdk8s-plus-17': '^1.0.0-beta.11',
'constructs': '^3.2.34',
cdk8s: '^1.0.0-beta.11',
constructs: '^3.2.34',
});


Expand All @@ -69,9 +66,8 @@ test ('constructs version pinning', () => {
const output = synthSnapshot(project);

expect(output['package.json'].dependencies).toStrictEqual({
'cdk8s': '^1.0.0-beta.18',
'cdk8s-plus-17': '^1.0.0-beta.18',
'constructs': '3.3.75',
cdk8s: '^1.0.0-beta.18',
constructs: '3.3.75',
});
});

Expand All @@ -87,9 +83,8 @@ test ('cdk8sPlusVersion undefined', () => {
const output = synthSnapshot(project);

expect(output['package.json'].dependencies).toStrictEqual({
'cdk8s': '^1.0.0-beta.11',
'cdk8s-plus-17': '^1.0.0-beta.11',
'constructs': '^3.3.75',
cdk8s: '^1.0.0-beta.11',
constructs: '^3.3.75',
});
});

Expand All @@ -98,17 +93,15 @@ test ('cdk8sPlusVersion defined', () => {
cdk8sVersion: '1.0.0-beta.11',
name: 'project',
defaultReleaseBranch: 'main',
cdk8sPlusVersion: '1.0.0-beta.10',
releaseWorkflow: true,
constructsVersion: '3.3.75',
});

const output = synthSnapshot(project);

expect(output['package.json'].dependencies).toStrictEqual({
'cdk8s': '^1.0.0-beta.11',
'cdk8s-plus-17': '^1.0.0-beta.10',
'constructs': '^3.3.75',
cdk8s: '^1.0.0-beta.11',
constructs: '^3.3.75',
});
});

Expand All @@ -117,7 +110,6 @@ test ('cdk8sPlusVersion pinning', () => {
cdk8sVersion: '1.0.0-beta.11',
name: 'project',
defaultReleaseBranch: 'main',
cdk8sPlusVersion: '1.0.0-beta.10',
cdk8sPlusVersionPinning: true,
releaseWorkflow: true,
constructsVersion: '3.3.75',
Expand All @@ -126,8 +118,7 @@ test ('cdk8sPlusVersion pinning', () => {
const output = synthSnapshot(project);

expect(output['package.json'].dependencies).toStrictEqual({
'cdk8s': '^1.0.0-beta.11',
'cdk8s-plus-17': '1.0.0-beta.10',
'constructs': '^3.3.75',
cdk8s: '^1.0.0-beta.11',
constructs: '^3.3.75',
});
});
65 changes: 8 additions & 57 deletions test/cdk8s-construct.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ test ('constructs version defined', () => {


expect(output['package.json'].peerDependencies).toStrictEqual({
'cdk8s': '^1.0.0-beta.18',
'cdk8s-plus-17': '^1.0.0-beta.18',
'constructs': '^3.3.75',
cdk8s: '^1.0.0-beta.18',
constructs: '^3.3.75',
});

});
Expand All @@ -38,9 +37,8 @@ test ('constructs version undefined', () => {
const output = synthSnapshot(project);

expect(output['package.json'].peerDependencies).toStrictEqual({
'cdk8s': '^1.0.0-beta.11',
'cdk8s-plus-17': '^1.0.0-beta.11',
'constructs': '^3.2.34',
cdk8s: '^1.0.0-beta.11',
constructs: '^3.2.34',
});


Expand All @@ -62,9 +60,8 @@ test ('constructs version pinning', () => {
const output = synthSnapshot(project);

expect(output['package.json'].peerDependencies).toStrictEqual({
'cdk8s': '^1.0.0-beta.18',
'cdk8s-plus-17': '^1.0.0-beta.18',
'constructs': '3.3.75',
cdk8s: '^1.0.0-beta.18',
constructs: '3.3.75',
});

});
Expand All @@ -84,53 +81,7 @@ test ('cdk8sPlusVersion undefined', () => {
const output = synthSnapshot(project);

expect(output['package.json'].peerDependencies).toStrictEqual({
'cdk8s': '^1.0.0-beta.11',
'cdk8s-plus-17': '^1.0.0-beta.11',
'constructs': '^3.3.75',
});
});

test ('cdk8sPlusVersion defined', () => {
const project = new ConstructLibraryCdk8s({
cdk8sVersion: '1.0.0-beta.11',
name: 'project',
defaultReleaseBranch: 'main',
cdk8sPlusVersion: '1.0.0-beta.10',
releaseWorkflow: true,
repositoryUrl: 'github.com/test/test',
author: 'test',
authorAddress: 'test@test.com',
constructsVersion: '3.3.75',
});

const output = synthSnapshot(project);

expect(output['package.json'].peerDependencies).toStrictEqual({
'cdk8s': '^1.0.0-beta.11',
'cdk8s-plus-17': '^1.0.0-beta.10',
'constructs': '^3.3.75',
});
});

test ('cdk8sPlusVersion pinning', () => {
const project = new ConstructLibraryCdk8s({
cdk8sVersion: '1.0.0-beta.11',
name: 'project',
defaultReleaseBranch: 'main',
cdk8sPlusVersion: '1.0.0-beta.10',
cdk8sPlusVersionPinning: true,
releaseWorkflow: true,
repositoryUrl: 'github.com/test/test',
author: 'test',
authorAddress: 'test@test.com',
constructsVersion: '3.3.75',
});

const output = synthSnapshot(project);

expect(output['package.json'].peerDependencies).toStrictEqual({
'cdk8s': '^1.0.0-beta.11',
'cdk8s-plus-17': '1.0.0-beta.10',
'constructs': '^3.3.75',
cdk8s: '^1.0.0-beta.11',
constructs: '^3.3.75',
});
});

0 comments on commit 6532fc9

Please sign in to comment.