From 1a2fc0937f256acc67c92ba82ac5e55462f39233 Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Thu, 23 Feb 2023 11:46:23 +0100 Subject: [PATCH] fix: add copyright headers --- .../functions/terraform-functions.generated.ts | 2 ++ .../scripts/fetch-metadata.ts | 3 +++ .../scripts/generate.ts | 15 ++++++++++++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/cdktf/lib/functions/terraform-functions.generated.ts b/packages/cdktf/lib/functions/terraform-functions.generated.ts index 33e9a87c39..e0d3738e6e 100644 --- a/packages/cdktf/lib/functions/terraform-functions.generated.ts +++ b/packages/cdktf/lib/functions/terraform-functions.generated.ts @@ -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 diff --git a/tools/generate-function-bindings/scripts/fetch-metadata.ts b/tools/generate-function-bindings/scripts/fetch-metadata.ts index efdb21efd4..6b3b2cdb6b 100644 --- a/tools/generate-function-bindings/scripts/fetch-metadata.ts +++ b/tools/generate-function-bindings/scripts/fetch-metadata.ts @@ -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"; diff --git a/tools/generate-function-bindings/scripts/generate.ts b/tools/generate-function-bindings/scripts/generate.ts index 411fd9d7e3..6b60db3236 100644 --- a/tools/generate-function-bindings/scripts/generate.ts +++ b/tools/generate-function-bindings/scripts/generate.ts @@ -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"; @@ -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); }