Skip to content

Commit

Permalink
fix: add copyright headers
Browse files Browse the repository at this point in the history
  • Loading branch information
ansgarm committed Mar 2, 2023
1 parent a4aa142 commit 1a2fc09
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions packages/cdktf/lib/functions/terraform-functions.generated.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) HashiCorp, Inc
// SPDX-License-Identifier: MPL-2.0
/*
* This file is generated by tools/generate-funtion-bindings.
* To update this file execute 'yarn run generate-function-bindings' in the root of the repository
Expand Down
3 changes: 3 additions & 0 deletions tools/generate-function-bindings/scripts/fetch-metadata.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc
// SPDX-License-Identifier: MPL-2.0

// invokes the terraform cli to get function metadata json
// (requires at least Terraform 1.4.0-beta2)
import { execSync } from "child_process";
Expand Down
15 changes: 12 additions & 3 deletions tools/generate-function-bindings/scripts/generate.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc
// SPDX-License-Identifier: MPL-2.0

// uses the functions.json file to generate the bindings for CDKTF

import fs from "fs/promises";
Expand Down Expand Up @@ -92,9 +95,15 @@ async function fetchMetadata() {

const program = t.program([IMPORTS, fnClass]);

const code = prettier.format(generate(program as any).code, {
parser: "babel",
});
const code = prettier.format(
// adding comments unrelated to code doesn't work with an AST
`// Copyright (c) HashiCorp, Inc
// SPDX-License-Identifier: MPL-2.0
${generate(program as any).code}`,
{
parser: "babel",
}
);

await fs.writeFile(OUTPUT_FILE, code);
}
Expand Down

0 comments on commit 1a2fc09

Please sign in to comment.