-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Init Changelog Sync Script #5776
Changes from 31 commits
5a687f0
d3350fd
5420ab8
7a08878
5620f74
dcc1559
984b55a
fcf7f0f
69695e7
751b2e8
e2b1697
b2a36f6
77261c3
f9b1845
36e0ca4
e4f5787
69e2c25
796df0d
5c9b111
53b14ce
91e337c
df58424
46a4ea6
ba69cad
33ddd76
9ab00cd
f26c934
ed815be
1e79dff
fcfe283
30f19e9
60f20bf
bb5afb8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,23 +28,11 @@ contract Basic { | |
return boolValue; | ||
} | ||
|
||
function getValues() | ||
public | ||
view | ||
returns ( | ||
uint256, | ||
string memory, | ||
bool | ||
) | ||
{ | ||
function getValues() public view returns (uint256, string memory, bool) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These file changes are a result of running |
||
return (intValue, stringValue, boolValue); | ||
} | ||
|
||
function setValues( | ||
uint256 _value, | ||
string memory _stringValue, | ||
bool _boolValue | ||
) public { | ||
function setValues(uint256 _value, string memory _stringValue, bool _boolValue) public { | ||
intValue = _value; | ||
stringValue = _stringValue; | ||
boolValue = _boolValue; | ||
|
@@ -62,19 +50,11 @@ contract Basic { | |
revert('REVERTED WITH REVERT'); | ||
} | ||
|
||
function firesMultiValueEvent( | ||
string memory str, | ||
uint256 val, | ||
bool flag | ||
) public { | ||
function firesMultiValueEvent(string memory str, uint256 val, bool flag) public { | ||
emit MultiValueEvent(str, val, flag); | ||
} | ||
|
||
function firesMultiValueIndexedEvent( | ||
string memory str, | ||
uint256 val, | ||
bool flag | ||
) public { | ||
function firesMultiValueIndexedEvent(string memory str, uint256 val, bool flag) public { | ||
emit MultiValueIndexedEvent(str, val, flag); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,29 +3,29 @@ | |
pragma solidity ^0.8.13; | ||
|
||
contract Greeter { | ||
uint256 counter; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These file changes are a result of running |
||
string private greeting; | ||
uint256 counter; | ||
string private greeting; | ||
|
||
event GREETING_CHANGING(string from, string to); | ||
event GREETING_CHANGED(string greeting); | ||
event GREETING_CHANGING(string from, string to); | ||
event GREETING_CHANGED(string greeting); | ||
|
||
constructor(string memory _greeting) { | ||
greeting = _greeting; | ||
counter = 0; | ||
} | ||
constructor(string memory _greeting) { | ||
greeting = _greeting; | ||
counter = 0; | ||
} | ||
|
||
function greet() public view returns (string memory) { | ||
return greeting; | ||
} | ||
function greet() public view returns (string memory) { | ||
return greeting; | ||
} | ||
|
||
function setGreeting(string memory _greeting) public returns (bool, string memory) { | ||
emit GREETING_CHANGING(greeting, _greeting); | ||
greeting = _greeting; | ||
emit GREETING_CHANGED(greeting); | ||
return (true, greeting); | ||
} | ||
function setGreeting(string memory _greeting) public returns (bool, string memory) { | ||
emit GREETING_CHANGING(greeting, _greeting); | ||
greeting = _greeting; | ||
emit GREETING_CHANGED(greeting); | ||
return (true, greeting); | ||
} | ||
|
||
function increment() public { | ||
counter = counter + 1; | ||
} | ||
function increment() public { | ||
counter = counter + 1; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,8 @@ import { Web3RequestManager, Web3RequestManagerEvent } from './web3_request_mana | |
import { Web3SubscriptionConstructor } from './web3_subscriptions'; | ||
|
||
type ShouldUnsubscribeCondition = ({ | ||
id: sub, | ||
id, | ||
sub, | ||
Comment on lines
+26
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This error was reported after running |
||
}: { | ||
id: string; | ||
sub: unknown; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,17 +18,16 @@ along with web3.js. If not, see <http://www.gnu.org/licenses/>. | |
pragma solidity ^0.8.7; | ||
|
||
contract SampleStorageContract { | ||
uint256 uintNum; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These file changes are a result of running |
||
|
||
uint256 uintNum; | ||
event NEWNUM(uint256 param); | ||
|
||
event NEWNUM(uint256 param); | ||
function storeNum(uint256 param) public { | ||
uintNum = param; | ||
emit NEWNUM(param); | ||
} | ||
|
||
function storeNum(uint256 param) public { | ||
uintNum = param; | ||
emit NEWNUM(param); | ||
} | ||
|
||
function retrieveNum() public view returns (uint256){ | ||
return uintNum; | ||
} | ||
} | ||
function retrieveNum() public view returns (uint256) { | ||
return uintNum; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ import { isAbiParameterSchema } from './validation/abi'; | |
import { isHexStrict } from './validation/string'; | ||
// import { abiToJsonSchemaCases } from '../test/fixtures/abi_to_json_schema'; | ||
|
||
export const parseBaseType = <T = typeof VALID_ETH_BASE_TYPES[number]>( | ||
export const parseBaseType = <T = (typeof VALID_ETH_BASE_TYPES)[number]>( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These file changes are a result of running |
||
type: string, | ||
): { | ||
baseType?: T; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
This file is part of web3.js. | ||
|
||
web3.js is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
web3.js is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
|
||
You should have received a copy of the GNU Lesser General Public License | ||
along with web3.js. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import { readFileSync, writeFileSync } from 'fs'; | ||
|
||
// eslint-disable-next-line import/no-cycle | ||
import { ChangelogConfig, DEFAULT_CHANGELOG_CONFIG } from './types'; | ||
import { getPackageGroupedUnreleasedEntries, getUnreleasedSection } from './sync'; | ||
|
||
export const addChangelogEntry = (commandName: string, args: string[]) => { | ||
let CHANGELOG_CONFIG: ChangelogConfig; | ||
if (args?.[0] !== undefined && args[0].endsWith('.json')) { | ||
CHANGELOG_CONFIG = JSON.parse(readFileSync(args[0], 'utf8')) as ChangelogConfig; | ||
args.shift(); | ||
} else { | ||
CHANGELOG_CONFIG = DEFAULT_CHANGELOG_CONFIG; | ||
} | ||
|
||
const [packageName, changelogEntry] = args; | ||
const parsedChangelog = readFileSync( | ||
`${CHANGELOG_CONFIG.packagesDirectoryPath}/${packageName}/${CHANGELOG_CONFIG.packagesChangelogPath}`, | ||
'utf8', | ||
).split(/\n/); | ||
const groupedUnreleasedEntries = getPackageGroupedUnreleasedEntries( | ||
getUnreleasedSection(parsedChangelog), | ||
); | ||
const formattedCommandName = `### ${ | ||
commandName.charAt(0).toUpperCase() + commandName.slice(1) | ||
}`; | ||
const formattedChangelogEntry = `- ${changelogEntry}`; | ||
|
||
if (groupedUnreleasedEntries[formattedCommandName] !== undefined) { | ||
groupedUnreleasedEntries[formattedCommandName].push(formattedChangelogEntry); | ||
} else { | ||
groupedUnreleasedEntries[formattedCommandName] = [formattedChangelogEntry]; | ||
} | ||
|
||
const flattenedModifiedUnreleasedEntries: string[] = []; | ||
for (const entryHeader of Object.keys(groupedUnreleasedEntries)) { | ||
const entries = groupedUnreleasedEntries[entryHeader]; | ||
flattenedModifiedUnreleasedEntries.push(entryHeader); | ||
flattenedModifiedUnreleasedEntries.push(''); | ||
for (const [index, entry] of entries.entries()) { | ||
flattenedModifiedUnreleasedEntries.push(entry); | ||
if (index + 1 === entries.length) flattenedModifiedUnreleasedEntries.push(''); | ||
} | ||
} | ||
|
||
// +2 is so the header, ## [Unreleased], and the newline after it don't get removed | ||
parsedChangelog.splice(parsedChangelog.findIndex(item => item === '## [Unreleased]') + 2); | ||
parsedChangelog.push(...flattenedModifiedUnreleasedEntries); | ||
writeFileSync( | ||
`${CHANGELOG_CONFIG.packagesDirectoryPath}/${packageName}/${CHANGELOG_CONFIG.packagesChangelogPath}`, | ||
parsedChangelog.join('\n'), | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
This file is part of web3.js. | ||
|
||
web3.js is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
web3.js is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
|
||
You should have received a copy of the GNU Lesser General Public License | ||
along with web3.js. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import { readdirSync } from 'fs'; | ||
|
||
// eslint-disable-next-line import/no-cycle | ||
import { Command, getCommands } from './types'; | ||
|
||
export const parseArgs = (commands: Command[] = getCommands()): unknown => { | ||
const commandArg = process.argv[2]; | ||
for (const command of commands) { | ||
if (command.name === commandArg) { | ||
return command.commandFunction(command.name, process.argv.slice(3)); | ||
} | ||
} | ||
|
||
// eslint-disable-next-line no-console | ||
console.log('Invalid command, please refer to below table for expected commands:'); | ||
// eslint-disable-next-line no-console | ||
console.table(commands); | ||
return undefined; | ||
}; | ||
|
||
export const getListOfPackageNames = (packagesDirectory: string) => | ||
readdirSync(packagesDirectory, { withFileTypes: true }) | ||
.filter(dirent => dirent.isDirectory()) | ||
.map(dirent => dirent.name); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
This file is part of web3.js. | ||
|
||
web3.js is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
web3.js is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
|
||
You should have received a copy of the GNU Lesser General Public License | ||
along with web3.js. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
// eslint-disable-next-line import/no-cycle | ||
import { parseArgs } from './helpers'; | ||
|
||
parseArgs(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ran
yarn changelog sync
to make this change as current4.x
CHANGELOG.md
is missing these headers