forked from cdk8s-team/cdk8s-validation-plugin-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.projenrc.js
71 lines (56 loc) · 2.47 KB
/
.projenrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
const { typescript } = require('projen');
const project = new typescript.TypeScriptProject({
defaultReleaseBranch: 'main',
name: 'cdk8s-validation-plugin-example',
repositoryUrl: 'https://github.com/cdk8s-team/cdk8s-validation-plugin-example.git',
description: 'This is an example project for implementing cdk8s validation plugins',
authorName: 'Amazon Web Services',
authorUrl: 'https://aws.amazon.com',
minNodeVersion: '14.18.0',
devDeps: [
// provides the validation interface you plugin needs
// to implement. required only at compile time, which is why
// its just a dev dependency.
'cdk8s-cli',
// used in integration tests to author a cdk8s application.
'cdk8s',
'cdk8s-plus-24',
'constructs',
'ts-node',
// just utility stuff for tests
'fs-extra',
'@types/fs-extra',
],
deps: [
// specific dependency of our plugin.
// you can use any dependency you like.
'yaml',
],
autoApproveOptions: {
allowedUsernames: ['cdk8s-automation'],
secret: 'GITHUB_TOKEN',
},
autoApproveUpgrades: true,
});
// the cdk8s-cli uses the "exports" directive in package.json
// to restrict the modules that can be imported from it.
// we need to add this config so that typescript detects it.
// see https://www.typescriptlang.org/docs/handbook/esm-node.html
// see https://www.typescriptlang.org/docs/handbook/esm-node.html#packagejson-exports-imports-and-self-referencing
project.tsconfig.compilerOptions.moduleResolution = 'nodenext';
project.tsconfigDev.compilerOptions.moduleResolution = 'nodenext';
project.gitignore.exclude('.vscode/');
// we add a task to run the integration tests. they cannot be executed
// along with unit tests because they require compiling the source code.
const integ = project.addTask('integ');
integ.exec('jest --testPathIgnorePatterns "^((?!integ).)*$" --passWithNoTests --all --updateSnapshot --coverageProvider=v8');
// we need to compile first because cdk8s will need to load the plugin
// as part of the integ tests, so the .js files need to be available.
integ.prependSpawn(project.compileTask);
// we need to change the standard test command so that it doesn't
// run integration tests
project.testTask.reset('jest --testPathIgnorePatterns ".*integ.*" --passWithNoTests --all --updateSnapshot --coverageProvider=v8');
project.testTask.spawn(project.tasks.tryFind('eslint'));
// add the integration tests just before we package everything up.
project.packageTask.prependSpawn(integ);
project.synth();