Skip to content

Commit e9e345a

Browse files
Merge pull request #38 from VenusProtocol/develop
Release to main
2 parents 55f196e + 30087d8 commit e9e345a

File tree

60 files changed

+20209
-4232
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+20209
-4232
lines changed

.github/prepare_slim_package.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Create a slim folder with the minium content we want, and remove unneeded files
2+
mkdir slim && cp -r artifacts* package.json README.md deployments slim && cd slim
3+
find deployments -mindepth 1 -depth -not -name "*_addresses.json*" -exec rm -r "{}" +
4+
find artifacts -mindepth 1 -depth -not -regex "artifacts/contracts.*" -exec rm -r "{}" +
5+
find artifacts-zk -mindepth 1 -depth -not -regex "artifacts-zk/contracts.*" -exec rm -r "{}" +
6+
find artifacts -mindepth 1 -depth -regex "artifacts/.*dbg\.json" -exec rm -r "{}" +
7+
8+
# Add "-slim" to the version in the npm package, keeping the tag "-dev" if it exists
9+
jq '.version |= sub("^(?<core>[0-9]+\\.[0-9]+\\.[0-9]+)"; "\(.core)-slim")' package.json > package.tmp.json && mv package.tmp.json package.json
10+
11+
# Remove the "prepare" and "postinstall" scripts, they won't work for this slim version
12+
jq 'del(.scripts.prepare)' package.json > package.tmp.json && mv package.tmp.json package.json
13+
jq 'del(.scripts.postinstall)' package.json > package.tmp.json && mv package.tmp.json package.json
14+
15+
# Empty devDependencies and dependencies
16+
jq '.dependencies = {}' package.json > package.tmp.json && mv package.tmp.json package.json
17+
jq '.devDependencies = {}' package.json > package.tmp.json && mv package.tmp.json package.json

.github/publish_slim_package.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Ensure npm 11.5.1 or later is installed
2+
npm install -g npm@latest
3+
4+
cd slim
5+
6+
# Extract to PRE_RELEASE_TAG the tag in the version field of the package json, or the empty string if it doesn't exist
7+
PRE_RELEASE_TAG=$(jq -r '.version | if test("-") then capture("^[0-9]+\\.[0-9]+\\.[0-9]+-(?<tag>[a-zA-Z-]+)") | .tag else "" end' package.json)
8+
9+
# Publish the package to a custom tag for slim versions
10+
npm publish --access public --tag $PRE_RELEASE_TAG

.github/workflows/cd.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
- main
77
- develop
88

9+
permissions:
10+
id-token: write # Required for OIDC
11+
contents: read
12+
913
jobs:
1014
release:
1115
runs-on: ubuntu-latest
@@ -19,6 +23,8 @@ jobs:
1923
- uses: actions/setup-node@v4
2024
with:
2125
cache: "yarn"
26+
node-version: "22.14.0"
27+
registry-url: "https://registry.npmjs.org"
2228

2329
- name: Install dependencies
2430
run: yarn
@@ -29,9 +35,14 @@ jobs:
2935
- name: Release
3036
env:
3137
GITHUB_TOKEN: ${{ secrets.VENUS_TOOLS_TOKEN }}
32-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3338
GIT_AUTHOR_NAME: Venus Tools
3439
GIT_AUTHOR_EMAIL: tools@venus.io
3540
GIT_COMMITTER_NAME: Venus Tools
3641
GIT_COMMITTER_EMAIL: tools@venus.io
3742
run: yarn semantic-release
43+
44+
- name: Prepare slim package
45+
run: bash .github/prepare_slim_package.sh
46+
47+
- name: Publish slim package
48+
run: bash .github/publish_slim_package.sh

.github/workflows/ci.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,6 @@ jobs:
115115
EXPORT=true yarn hardhat export --network ${NETWORK} --export ./deployments/${NETWORK}.json
116116
jq -M '{name, chainId, addresses: .contracts | map_values(.address)}' ./deployments/${NETWORK}.json > ./deployments/${NETWORK}_addresses.json
117117
done
118-
for NETWORK in zksyncsepolia zksyncmainnet; do
119-
EXPORT=true yarn hardhat export --network ${NETWORK} --export ./deployments/${NETWORK}.json --config hardhat.config.zksync.ts
120-
jq -M '{name, chainId, addresses: .contracts | map_values(.address)}' ./deployments/${NETWORK}.json > ./deployments/${NETWORK}_addresses.json
121-
done
122118
yarn prettier
123119
124120
- uses: stefanzweifel/git-auto-commit-action@v5

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ scenario
1010
typechain
1111
contracts/oracle
1212
CHANGELOG.md
13+
docs

.prettierrc

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,30 @@
22
"arrowParens": avoid,
33
"bracketSpacing": true,
44
"endOfLine": "auto",
5-
"importOrder": ["module-alias/register", "<THIRD_PARTY_MODULES>", "^[./]"],
6-
"importOrderParserPlugins": ["typescript"],
5+
"importOrder": [
6+
"module-alias/register",
7+
"<THIRD_PARTY_MODULES>",
8+
"^[./]"
9+
],
10+
"importOrderParserPlugins": [
11+
"typescript"
12+
],
713
"importOrderSeparation": true,
814
"importOrderSortSpecifiers": true,
915
"printWidth": 120,
1016
"singleQuote": false,
1117
"tabWidth": 2,
1218
"trailingComma": all,
13-
"overrides": [{ "files": "*.sol", "options": { "tabWidth": 4 } }],
14-
}
19+
"overrides": [
20+
{
21+
"files": "*.sol",
22+
"options": {
23+
"tabWidth": 4
24+
}
25+
}
26+
],
27+
"plugins": [
28+
"prettier-plugin-solidity",
29+
"@trivago/prettier-plugin-sort-imports"
30+
]
31+
}

.solhint.json

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,26 @@
44
"code-complexity": ["error", 15],
55
"compiler-version": ["error", ">=0.5.0"],
66
"const-name-snakecase": "error",
7+
"immutable-vars-naming": "off",
78
"constructor-syntax": "error",
8-
"func-visibility": ["error", { "ignoreConstructors": true }],
9+
"func-visibility": [
10+
"error",
11+
{
12+
"ignoreConstructors": true
13+
}
14+
],
15+
"function-max-lines": ["warn", 60],
916
"max-line-length": ["error", 175],
1017
"not-rely-on-time": "off",
1118
"no-global-import": "error",
12-
"reason-string": ["warn", { "maxLength": 64 }],
13-
"ordering": "error"
19+
"reason-string": [
20+
"warn",
21+
{
22+
"maxLength": 64
23+
}
24+
],
25+
"ordering": "warn",
26+
"state-visibility": "off",
27+
"avoid-low-level-calls": "off"
1428
}
1529
}

0 commit comments

Comments
 (0)