Fix: Use Node.js script for cross-platform file copying in build

- Replaces the rsync command in the build_package.sh script with a
  Node.js script (copy_files.cjs) to handle copying necessary files
  (e.g., .md, .json, .sb) during the build process.
- Addresses an issue where the build would fail on systems
  that do not have rsync installed (e.g., some Windows environments or
  minimal Linux distributions) by using a Node.js script, providing a
  cross-platform solution as Node.js is already a project dependency.
- Updates the ESLint configuration to correctly lint .cjs files as
  CommonJS modules.

Fixes https://github.com/google-gemini/gemini-cli/issues/387
This commit is contained in:
Taylor Mullen
2025-05-16 13:54:54 -07:00
committed by N. Taylor Mullen
parent 8b959c2060
commit 8af970061e
3 changed files with 79 additions and 2 deletions

View File

@@ -154,6 +154,34 @@ export default tseslint.config(
},
},
},
// Override for .cjs files to use CommonJS
{
files: ['**/*.cjs'],
languageOptions: {
sourceType: 'commonjs',
globals: {
...globals.node, // Add all Node.js globals
__dirname: 'readonly',
__filename: 'readonly',
exports: 'writable',
module: 'readonly',
require: 'readonly',
},
},
rules: {
// Disable rules that are not applicable to CommonJS
'@typescript-eslint/no-require-imports': 'off',
'no-restricted-syntax': [
'error',
// Keep other restricted syntaxes, but allow require for .cjs
{
selector: 'ThrowStatement > Literal:not([value=/^\\\\w+Error:/])',
message:
'Do not throw string literals or non-Error objects. Throw new Error("...") instead.',
},
],
},
},
// Prettier config must be last
prettierConfig,
// Custom eslint rules for this repo