summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorTaylor Mullen <[email protected]>2025-05-16 16:22:33 -0700
committerN. Taylor Mullen <[email protected]>2025-05-18 23:49:48 -0700
commit8b8fa6c1ae8e7e95e68d1166bfe28ca6b242577b (patch)
tree91fde5385e3e70f784d8ec6bbbd352f713dafa4f /scripts
parent3d74a7061e2e64d7d8f3850e913acf31b493bcf9 (diff)
Refactor: Convert copy_files.cjs to ES module syntax
- Converted scripts/copy_files.cjs to use ES module syntax (renaming to copy_files.js). - This change aligns with the project's preference for ES modules over CommonJS for better modernity and future-proofing. - Updated eslint.config.js to remove the .cjs override. - Adjusted scripts/build_package.sh to call the new .js file.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build_package.sh2
-rw-r--r--[-rwxr-xr-x]scripts/copy_files.js (renamed from scripts/copy_files.cjs)11
2 files changed, 10 insertions, 3 deletions
diff --git a/scripts/build_package.sh b/scripts/build_package.sh
index 022cae5a..e64d98cc 100755
--- a/scripts/build_package.sh
+++ b/scripts/build_package.sh
@@ -27,7 +27,7 @@ fi
tsc --build
# copy .{md,json} files
-node ../../scripts/copy_files.cjs
+node ../../scripts/copy_files.js
# touch dist/.last_build
touch dist/.last_build
diff --git a/scripts/copy_files.cjs b/scripts/copy_files.js
index 456d6d41..e6c6b696 100755..100644
--- a/scripts/copy_files.cjs
+++ b/scripts/copy_files.js
@@ -1,4 +1,11 @@
#!/usr/bin/env node
+
+/**
+ * @license
+ * Copyright 2025 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,8 +20,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-const fs = require('fs');
-const path = require('path');
+import fs from 'fs';
+import path from 'path';
const sourceDir = path.join('src');
const targetDir = path.join('dist', 'src');