fix(release): generate licenses without mutating committed inputs
This commit is contained in:
+8
-5
@@ -77,7 +77,10 @@ const notices = ['Agent Workbench third-party notices', '',
|
||||
'Original product code is supplied for the project owner. Its redistribution terms are determined by the project owner.',
|
||||
'Third-party components remain governed by their own licenses. Full available license texts are reproduced below and in licenses/.', '',
|
||||
'The release does not contain Claude Code or Cursor client binaries or recovered application source.', ''];
|
||||
const licenseRoot = path.join(root, 'licenses'); fs.mkdirSync(licenseRoot, { recursive: true });
|
||||
// License generation belongs to the release output. Packaging must not mutate
|
||||
// committed inputs after freezing sourceCommit.
|
||||
const licenseRoot = path.join(portableRoot, 'licenses');
|
||||
fs.cpSync(path.join(root, 'licenses'), licenseRoot, { recursive: true });
|
||||
let licenseCount = 0;
|
||||
for (const [location, entry] of Object.entries(lock.packages).sort(([a], [b]) => a.localeCompare(b))) {
|
||||
if (!location.startsWith('node_modules/')) continue;
|
||||
@@ -105,10 +108,10 @@ notices.push('='.repeat(72), 'REA (rea-agents) ' + reaRuntime.version, 'License:
|
||||
fs.writeFileSync(path.join(licenseRoot, 'Node-' + nodeVersion + '-LICENSE.txt'), nodeLicenseText);
|
||||
notices.push('='.repeat(72), 'Node.js ' + nodeVersion, '', nodeLicenseText);
|
||||
notices.push('='.repeat(72), 'npm bundled with Node.js', 'Complete package and dependency licenses are retained under runtime/node_modules/npm/.', '', fs.readFileSync(path.join(npmRoot, 'LICENSE'), 'utf8'));
|
||||
fs.writeFileSync(path.join(root, 'THIRD_PARTY_NOTICES.txt'), notices.join('\n'));
|
||||
for (const output of [portableRoot, sourceRoot].filter(Boolean)) {
|
||||
fs.cpSync(licenseRoot, path.join(output, 'licenses'), { recursive: true });
|
||||
fs.copyFileSync(path.join(root, 'THIRD_PARTY_NOTICES.txt'), path.join(output, 'THIRD_PARTY_NOTICES.txt'));
|
||||
fs.writeFileSync(path.join(portableRoot, 'THIRD_PARTY_NOTICES.txt'), notices.join('\n'));
|
||||
if (sourceRoot) {
|
||||
fs.cpSync(licenseRoot, path.join(sourceRoot, 'licenses'), { recursive: true });
|
||||
fs.copyFileSync(path.join(portableRoot, 'THIRD_PARTY_NOTICES.txt'), path.join(sourceRoot, 'THIRD_PARTY_NOTICES.txt'));
|
||||
}
|
||||
|
||||
function filesIn(directory, relative = '') {
|
||||
|
||||
Reference in New Issue
Block a user