Skip to content

Commit

Permalink
feat: bump minimum node version to 12.x (projen#1113)
Browse files Browse the repository at this point in the history
  • Loading branch information
Elad Ben-Israel authored Oct 4, 2021
1 parent 903610f commit b493fac
Show file tree
Hide file tree
Showing 14 changed files with 117 additions and 53 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml

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

10 changes: 5 additions & 5 deletions .github/workflows/release.yml

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

4 changes: 2 additions & 2 deletions .github/workflows/upgrade-main.yml

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

2 changes: 1 addition & 1 deletion .projen/deps.json

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

2 changes: 1 addition & 1 deletion .projenrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const project = new JsiiProject({

projenDevDependency: false, // because I am projen
releaseToNpm: true,
minNodeVersion: '10.17.0',
minNodeVersion: '12.7.0',
codeCov: true,
defaultReleaseBranch: 'main',
gitpod: true,
Expand Down
4 changes: 2 additions & 2 deletions package.json

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

34 changes: 17 additions & 17 deletions src/__tests__/__snapshots__/integ.test.ts.snap

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

12 changes: 6 additions & 6 deletions src/__tests__/__snapshots__/jsii.test.ts.snap

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

2 changes: 1 addition & 1 deletion src/__tests__/integration/cdk8s/cdk8s.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
exports.options = {
minNodeVersion: '10.17.0',
minNodeVersion: '12.7.0',
repository: 'https://github.com/awslabs/cdk8s.git',
authorName: 'Amazon Web Services',
authorUrl: 'https://aws.amazon.com',
Expand Down
39 changes: 39 additions & 0 deletions src/__tests__/jsii.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,45 @@ test('docgen: true should just work', () => {
expect(output['.projen/tasks.json'].tasks.docgen.steps[0].exec).toStrictEqual('jsii-docgen');
});

describe('superchain image is selected based on the node version', () => {
const opts = {
author: 'My name',
name: 'testproject',
authorAddress: 'https://foo.bar',
defaultReleaseBranch: 'main',
repositoryUrl: 'https://github.com/foo/bar.git',
};

test('defaults to 1-buster-slim without minNodeVersion', () => {
const project = new TestJsiiProject(opts);
const output = synthSnapshot(project);
expect(output['.github/workflows/build.yml']).toContain('image: jsii/superchain:1-buster-slim');
});

test('12.x', () => {
const project = new TestJsiiProject({ ...opts, minNodeVersion: '12.22.1' });
const output = synthSnapshot(project);
expect(output['.github/workflows/build.yml']).toContain('image: jsii/superchain:1-buster-slim-node12');
});

test('14.x', () => {
const project = new TestJsiiProject({ ...opts, minNodeVersion: '14.42.1' });
const output = synthSnapshot(project);
expect(output['.github/workflows/build.yml']).toContain('image: jsii/superchain:1-buster-slim-node14');
});

test('16.x', () => {
const project = new TestJsiiProject({ ...opts, minNodeVersion: '16.22.1' });
const output = synthSnapshot(project);
expect(output['.github/workflows/build.yml']).toContain('image: jsii/superchain:1-buster-slim-node16');
});

test('unsupported version', () => {
expect(() => new TestJsiiProject({ ...opts, minNodeVersion: '15.3.20' })).toThrow('No jsii/superchain image available for node 15.x. Supported node versions: 12.x,14.x,16.x');
expect(() => new TestJsiiProject({ ...opts, minNodeVersion: '10.2.3' })).toThrow('No jsii/superchain image available for node 10.x. Supported node versions: 12.x,14.x,16.x');
});
});

class TestJsiiProject extends JsiiProject {
constructor(options: JsiiProjectOptions) {
super({
Expand Down
Loading

0 comments on commit b493fac

Please sign in to comment.