mirror of
https://github.com/semaphore-protocol/semaphore.git
synced 2026-01-08 14:24:07 -05:00
chore: publish contracts to soldeer (#820)
* chore: define separate version.ts script * chore: include publishing to soldeer in script * fix(contracts): push to soldeer re 800 * ci: fetch latest contract version from soldeer * refactor: do not use execa in scripts * fix: do not exit process in script * chore: remove comments * refactor: use shebang in ts scripts * chore(contracts): add soldeerignore * chore: inherit stdio in scripts * chore: remove dry run flag * chore: uncomment * chore: fix typo in comment
This commit is contained in:
@@ -26,5 +26,13 @@
|
|||||||
"no-console": ["warn", { "allow": ["info", "warn", "error"] }],
|
"no-console": ["warn", { "allow": ["info", "warn", "error"] }],
|
||||||
"@typescript-eslint/lines-between-class-members": "off",
|
"@typescript-eslint/lines-between-class-members": "off",
|
||||||
"no-param-reassign": "off"
|
"no-param-reassign": "off"
|
||||||
}
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": ["./scripts/*"],
|
||||||
|
"rules": {
|
||||||
|
"no-console": "off"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -94,3 +94,5 @@ typechain-types
|
|||||||
|
|
||||||
# Other
|
# Other
|
||||||
snark-artifacts
|
snark-artifacts
|
||||||
|
|
||||||
|
*.zip
|
||||||
|
|||||||
1
.soldeerignore
Normal file
1
.soldeerignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
package.json
|
||||||
12
package.json
12
package.json
@@ -23,12 +23,12 @@
|
|||||||
"format": "concurrently -c auto -g -n prettier,embark \"prettier -c .\" \"yarn workspace semaphore-docs format\"",
|
"format": "concurrently -c auto -g -n prettier,embark \"prettier -c .\" \"yarn workspace semaphore-docs format\"",
|
||||||
"format:write": "concurrently -c auto -g -n prettier,embark \"prettier -w .\" \"yarn workspace semaphore-docs format:write\"",
|
"format:write": "concurrently -c auto -g -n prettier,embark \"prettier -w .\" \"yarn workspace semaphore-docs format:write\"",
|
||||||
"docs": "typedoc",
|
"docs": "typedoc",
|
||||||
"version:bump": "yarn workspaces foreach -A --no-private version -d ${0} && yarn version apply --all && yarn remove:stable-version-field && NO_HOOK=1 git commit -am \"chore: v${0}\" && git tag v${0}",
|
"version:bump": "scripts/version.ts ${0}",
|
||||||
"version:publish": "yarn build:libraries && yarn clean:cli-templates && yarn workspaces foreach -A --no-private npm publish --tolerate-republish --access public",
|
"version:publish": "scripts/publish.ts",
|
||||||
"version:release": "changelogithub",
|
"version:release": "changelogithub",
|
||||||
"clean": "ts-node scripts/clean-apps.ts && ts-node scripts/clean-packages.ts && yarn clean:cli-templates && rimraf node_modules",
|
"clean": "scripts/clean-apps.ts && scripts/clean-packages.ts && yarn clean:cli-templates && rimraf node_modules",
|
||||||
"clean:cli-templates": "ts-node scripts/clean-cli-templates.ts",
|
"clean:cli-templates": "scripts/clean-cli-templates.ts",
|
||||||
"remove:stable-version-field": "ts-node scripts/remove-stable-version-field.ts && yarn format:write",
|
"remove:stable-version-field": "scripts/remove-stable-version-field.ts && yarn format:write",
|
||||||
"precommit": "lint-staged",
|
"precommit": "lint-staged",
|
||||||
"postinstall": "husky && git config --local core.editor cat"
|
"postinstall": "husky && git config --local core.editor cat"
|
||||||
},
|
},
|
||||||
@@ -57,6 +57,7 @@
|
|||||||
"@types/glob": "^7.2.0",
|
"@types/glob": "^7.2.0",
|
||||||
"@types/jest": "^29.5.12",
|
"@types/jest": "^29.5.12",
|
||||||
"@types/node": "^20",
|
"@types/node": "^20",
|
||||||
|
"@types/semver": "^7",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.0.2",
|
"@typescript-eslint/eslint-plugin": "^7.0.2",
|
||||||
"@typescript-eslint/parser": "^7.0.2",
|
"@typescript-eslint/parser": "^7.0.2",
|
||||||
"changelogithub": "0.12.7",
|
"changelogithub": "0.12.7",
|
||||||
@@ -78,6 +79,7 @@
|
|||||||
"lint-staged": "^15.2.2",
|
"lint-staged": "^15.2.2",
|
||||||
"prettier": "^3.2.5",
|
"prettier": "^3.2.5",
|
||||||
"rimraf": "^5.0.5",
|
"rimraf": "^5.0.5",
|
||||||
|
"semver": "^7.6.2",
|
||||||
"snarkjs": "0.7.4",
|
"snarkjs": "0.7.4",
|
||||||
"ts-jest": "^29.1.2",
|
"ts-jest": "^29.1.2",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
|
|||||||
1
scripts/clean-apps.ts
Normal file → Executable file
1
scripts/clean-apps.ts
Normal file → Executable file
@@ -1,3 +1,4 @@
|
|||||||
|
#!node_modules/.bin/ts-node
|
||||||
import { readdirSync, rmSync } from "fs"
|
import { readdirSync, rmSync } from "fs"
|
||||||
|
|
||||||
const folderName = "apps"
|
const folderName = "apps"
|
||||||
|
|||||||
1
scripts/clean-cli-templates.ts
Normal file → Executable file
1
scripts/clean-cli-templates.ts
Normal file → Executable file
@@ -1,3 +1,4 @@
|
|||||||
|
#!node_modules/.bin/ts-node
|
||||||
import { rmSync } from "fs"
|
import { rmSync } from "fs"
|
||||||
|
|
||||||
const folderName = "packages"
|
const folderName = "packages"
|
||||||
|
|||||||
1
scripts/clean-packages.ts
Normal file → Executable file
1
scripts/clean-packages.ts
Normal file → Executable file
@@ -1,3 +1,4 @@
|
|||||||
|
#!node_modules/.bin/ts-node
|
||||||
import { readdirSync, rmSync } from "fs"
|
import { readdirSync, rmSync } from "fs"
|
||||||
|
|
||||||
const folderName = "packages"
|
const folderName = "packages"
|
||||||
|
|||||||
37
scripts/publish.ts
Executable file
37
scripts/publish.ts
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
#!node_modules/.bin/ts-node
|
||||||
|
import compare from "semver/functions/compare"
|
||||||
|
import { execSync } from "child_process"
|
||||||
|
import contractsPkgJson from "@semaphore-protocol/contracts/package.json"
|
||||||
|
|
||||||
|
const { version: contractsLocalVersion } = contractsPkgJson
|
||||||
|
|
||||||
|
async function maybePushToSoldeer() {
|
||||||
|
// api not documented, may change, found by inspecting the network tab
|
||||||
|
const response = await fetch(
|
||||||
|
"https://api.soldeer.xyz/api/v1/revision?project_name=semaphore-protocol-contracts&limit=1"
|
||||||
|
)
|
||||||
|
const { data, status } = await response.json()
|
||||||
|
|
||||||
|
// fail status if no version published at all yet
|
||||||
|
if (status === "fail" || compare(contractsLocalVersion, data[0].version) === 1)
|
||||||
|
execSync(`soldeer push semaphore-protocol-contracts~${contractsLocalVersion} packages/contracts/contracts`, {
|
||||||
|
stdio: "inherit"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
execSync(`yarn build:libraries`, { stdio: "inherit" })
|
||||||
|
execSync(`yarn clean:cli-templates`)
|
||||||
|
execSync(`yarn workspaces foreach -A --no-private npm publish --tolerate-republish --access public`, {
|
||||||
|
stdio: "inherit"
|
||||||
|
})
|
||||||
|
|
||||||
|
await maybePushToSoldeer()
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
|
.then(() => process.exit(0))
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error)
|
||||||
|
process.exit(1)
|
||||||
|
})
|
||||||
11
scripts/remove-stable-version-field.ts
Normal file → Executable file
11
scripts/remove-stable-version-field.ts
Normal file → Executable file
@@ -1,3 +1,4 @@
|
|||||||
|
#!node_modules/.bin/ts-node
|
||||||
import { readFileSync, readdirSync, writeFileSync } from "node:fs"
|
import { readFileSync, readdirSync, writeFileSync } from "node:fs"
|
||||||
|
|
||||||
const folderName = "packages"
|
const folderName = "packages"
|
||||||
@@ -19,9 +20,7 @@ async function main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
main()
|
main().catch((error) => {
|
||||||
.then(() => process.exit(0))
|
console.error(error)
|
||||||
.catch((error) => {
|
process.exit(1)
|
||||||
console.error(error)
|
})
|
||||||
process.exit(1)
|
|
||||||
})
|
|
||||||
|
|||||||
25
scripts/version.ts
Executable file
25
scripts/version.ts
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
#!node_modules/.bin/ts-node
|
||||||
|
import { execSync } from "child_process"
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
const version = process.argv[2]
|
||||||
|
|
||||||
|
// Perform the workspaces version update
|
||||||
|
execSync(`yarn workspaces foreach -A --no-private version -d ${version}`, { stdio: "inherit" })
|
||||||
|
|
||||||
|
// Apply the versions
|
||||||
|
execSync("yarn version apply --all", { stdio: "inherit" })
|
||||||
|
|
||||||
|
await import("./remove-stable-version-field")
|
||||||
|
|
||||||
|
execSync("yarn format:write")
|
||||||
|
execSync(`NO_HOOK=1 git commit -am 'chore: v${version}'`)
|
||||||
|
execSync(`git tag v${version}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
|
.then(() => process.exit(0))
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error)
|
||||||
|
process.exit(1)
|
||||||
|
})
|
||||||
@@ -7872,7 +7872,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@types/semver@npm:^7.3.12, @types/semver@npm:^7.5.8":
|
"@types/semver@npm:^7, @types/semver@npm:^7.3.12, @types/semver@npm:^7.5.8":
|
||||||
version: 7.5.8
|
version: 7.5.8
|
||||||
resolution: "@types/semver@npm:7.5.8"
|
resolution: "@types/semver@npm:7.5.8"
|
||||||
checksum: 10/3496808818ddb36deabfe4974fd343a78101fa242c4690044ccdc3b95dcf8785b494f5d628f2f47f38a702f8db9c53c67f47d7818f2be1b79f2efb09692e1178
|
checksum: 10/3496808818ddb36deabfe4974fd343a78101fa242c4690044ccdc3b95dcf8785b494f5d628f2f47f38a702f8db9c53c67f47d7818f2be1b79f2efb09692e1178
|
||||||
@@ -24679,6 +24679,7 @@ __metadata:
|
|||||||
"@types/glob": "npm:^7.2.0"
|
"@types/glob": "npm:^7.2.0"
|
||||||
"@types/jest": "npm:^29.5.12"
|
"@types/jest": "npm:^29.5.12"
|
||||||
"@types/node": "npm:^20"
|
"@types/node": "npm:^20"
|
||||||
|
"@types/semver": "npm:^7"
|
||||||
"@typescript-eslint/eslint-plugin": "npm:^7.0.2"
|
"@typescript-eslint/eslint-plugin": "npm:^7.0.2"
|
||||||
"@typescript-eslint/parser": "npm:^7.0.2"
|
"@typescript-eslint/parser": "npm:^7.0.2"
|
||||||
changelogithub: "npm:0.12.7"
|
changelogithub: "npm:0.12.7"
|
||||||
@@ -24700,6 +24701,7 @@ __metadata:
|
|||||||
lint-staged: "npm:^15.2.2"
|
lint-staged: "npm:^15.2.2"
|
||||||
prettier: "npm:^3.2.5"
|
prettier: "npm:^3.2.5"
|
||||||
rimraf: "npm:^5.0.5"
|
rimraf: "npm:^5.0.5"
|
||||||
|
semver: "npm:^7.6.2"
|
||||||
snarkjs: "npm:0.7.4"
|
snarkjs: "npm:0.7.4"
|
||||||
ts-jest: "npm:^29.1.2"
|
ts-jest: "npm:^29.1.2"
|
||||||
ts-node: "npm:^10.9.2"
|
ts-node: "npm:^10.9.2"
|
||||||
@@ -24804,7 +24806,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"semver@npm:^7.1.1, semver@npm:^7.3.2, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.3.8, semver@npm:^7.5.2, semver@npm:^7.5.3, semver@npm:^7.5.4, semver@npm:^7.6.0":
|
"semver@npm:^7.1.1, semver@npm:^7.3.2, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.3.8, semver@npm:^7.5.2, semver@npm:^7.5.3, semver@npm:^7.5.4, semver@npm:^7.6.0, semver@npm:^7.6.2":
|
||||||
version: 7.6.2
|
version: 7.6.2
|
||||||
resolution: "semver@npm:7.6.2"
|
resolution: "semver@npm:7.6.2"
|
||||||
bin:
|
bin:
|
||||||
|
|||||||
Reference in New Issue
Block a user