diff options
| author | matt korwel <[email protected]> | 2025-07-03 22:57:01 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-04 03:57:01 +0000 |
| commit | d43ea268b01e80166ca9325bf174a9796105715f (patch) | |
| tree | b9af69c504a328074fcb4bff8165ede0460d05d7 /scripts/prepare-package.js | |
| parent | 32db5ba0e1b7628fa6714bea8532377641b1af18 (diff) | |
Releasing: Utilizing Github Actions and Tagging for release. (#2852)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: N. Taylor Mullen <[email protected]>
Diffstat (limited to 'scripts/prepare-package.js')
| -rw-r--r-- | scripts/prepare-package.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/scripts/prepare-package.js b/scripts/prepare-package.js new file mode 100644 index 00000000..5498499b --- /dev/null +++ b/scripts/prepare-package.js @@ -0,0 +1,51 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import fs from 'fs'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +// ES module equivalent of __dirname +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +const rootDir = path.resolve(__dirname, '..'); + +function copyFiles(packageName, filesToCopy) { + const packageDir = path.resolve(rootDir, 'packages', packageName); + if (!fs.existsSync(packageDir)) { + console.error(`Error: Package directory not found at ${packageDir}`); + process.exit(1); + } + + console.log(`Preparing package: ${packageName}`); + for (const [source, dest] of Object.entries(filesToCopy)) { + const sourcePath = path.resolve(rootDir, source); + const destPath = path.resolve(packageDir, dest); + try { + fs.copyFileSync(sourcePath, destPath); + console.log(`Copied ${source} to packages/${packageName}/`); + } catch (err) { + console.error(`Error copying ${source}:`, err); + process.exit(1); + } + } +} + +// Prepare 'core' package +copyFiles('core', { + 'README.md': 'README.md', + LICENSE: 'LICENSE', + '.npmrc': '.npmrc', +}); + +// Prepare 'cli' package +copyFiles('cli', { + 'README.md': 'README.md', + LICENSE: 'LICENSE', +}); + +console.log('Successfully prepared all packages.'); |
