Add a comment documenting the package version being used (#2918)
This commit is contained in:
committed by
GitHub
parent
7fe5326c2d
commit
c9bdb1f0ae
27
scripts/release/update-comment.js
Executable file
27
scripts/release/update-comment.js
Executable file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const fs = require('fs');
|
||||
const glob = require('glob');
|
||||
const proc = require('child_process');
|
||||
|
||||
const gitStatus = proc.execFileSync('git', ['status', '--porcelain', '-uno', 'contracts']);
|
||||
|
||||
if (gitStatus.length > 0) {
|
||||
console.error('Contracts directory is not clean');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const { version } = require('../../package.json');
|
||||
|
||||
const files = glob.sync('contracts/!(mocks)/**/*.sol');
|
||||
|
||||
for (const file of files) {
|
||||
const current = fs.readFileSync(file, 'utf8');
|
||||
const updated = current.replace(
|
||||
/(\/\/ SPDX-License-Identifier:.*)$(\n\/\/ OpenZeppelin Contracts v.*$)?/m,
|
||||
`$1\n// OpenZeppelin Contracts v${version} (${file.replace('contracts/', '')})`,
|
||||
);
|
||||
fs.writeFileSync(file, updated);
|
||||
}
|
||||
|
||||
proc.execFileSync('git', ['add', '--update', 'contracts']);
|
||||
@ -4,5 +4,6 @@ set -o errexit
|
||||
|
||||
scripts/release/update-changelog-release-date.js
|
||||
scripts/release/synchronize-versions.js
|
||||
scripts/release/update-comment.js
|
||||
|
||||
oz-docs update-version
|
||||
|
||||
Reference in New Issue
Block a user