-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.projenrc.ts
54 lines (49 loc) · 1.76 KB
/
.projenrc.ts
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
import { cdk, TextFile } from "projen";
const project = new cdk.JsiiProject({
author: "GoodNotes DevOps",
defaultReleaseBranch: "main",
jsiiVersion: "~5.0.0",
name: "ts-interface-generator",
projenrcTs: true,
repositoryUrl: "https://github.com/GoodNotes/ts-interface-generator.git",
devDeps: ["@datadog/datadog-api-client", "ts-morph"],
prettier: true,
release: false,
autoApproveOptions: {
allowedUsernames: ["gn-devops-ci"],
// must be different Token from PROJEN_GITHUB_TOKEN to approve PR
secret: "GITHUB_TOKEN",
},
autoApproveUpgrades: true,
});
// Configuration to export the Dashboard API Object to an Interface
// ensure to add "@datadog/datadog-api-client" as a devDeps to the project first
const datadogSourceFilesGlob =
"node_modules/@datadog/datadog-api-client/dist/packages/datadog-api-client-v1/**/*.d.ts";
const datadogBuildInstructions = [
{
targetFile: "src/Dashboard.generated.ts",
sourceTypes: [
{
file: "node_modules/@datadog/datadog-api-client/dist/packages/datadog-api-client-v1/models/Dashboard.d.ts",
type: "Dashboard",
},
],
},
];
const datadogBuildInstructionsFile = "datadog-build-instructions.json";
new TextFile(project, datadogBuildInstructionsFile, {
lines: [JSON.stringify(datadogBuildInstructions, null, 2)],
});
// add task to generate interfaces from the DataDog API Client
const exportDataDogInterfacesTask = project.addTask(
"export-datadog-interfaces",
{
exec: `ts-node projenrc/cli.ts '${datadogSourceFilesGlob}' '${datadogBuildInstructionsFile}'`,
description: "Generate interfaces from the DataDog API Client",
},
);
// add to pre-compile task
project.preCompileTask.spawn(exportDataDogInterfacesTask);
project.synth();