-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #931 from Pauan/feat/scripts
Adding in change-version and deploy scripts
- Loading branch information
Showing
9 changed files
with
117 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## Publish instructions | ||
|
||
Replace `$VERSION` with the desired new version (e.g. `0.7.0`): | ||
|
||
```bash | ||
npm login | ||
yarn change-version $VERSION | ||
yarn deploy | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { readFile, writeFile } from "node:fs/promises"; | ||
import { glob } from "glob"; | ||
|
||
|
||
// Updates the version in the `package.json` file | ||
async function updateVersion(path, newVersion) { | ||
const json = await readFile(path, { encoding: "utf8" }); | ||
|
||
const replaced = json.replace(/"version": *"[^"]+"/, `"version": "${newVersion}"`); | ||
|
||
await writeFile(path, replaced); | ||
} | ||
|
||
|
||
// Updates the `package.json` file so it uses the correct | ||
// version of `@provablehq/wasm` and `@provablehq/sdk` | ||
async function updateDependency(path, newVersion) { | ||
const json = await readFile(path, { encoding: "utf8" }); | ||
|
||
const replaced = json | ||
.replace(/"@provablehq\/sdk": *"[^"]+"/g, `"@provablehq/sdk": "^${newVersion}"`) | ||
.replace(/"@provablehq\/wasm": *"[^"]+"/g, `"@provablehq/wasm": "^${newVersion}"`) | ||
.replace(/"create-leo-app": *"[^"]+"/g, `"create-leo-app": "^${newVersion}"`); | ||
|
||
await writeFile(path, replaced); | ||
} | ||
|
||
|
||
// Updates the version of the published `package.json` files | ||
async function updateVersions(newVersion) { | ||
await Promise.all([ | ||
"create-leo-app/package.json", | ||
"sdk/package.json", | ||
"wasm/package.json", | ||
].map(async (file) => { | ||
await updateVersion(file, newVersion); | ||
})); | ||
} | ||
|
||
|
||
// Updates all of the `package.json` files so they use the correct | ||
// version of `@provablehq/wasm` and `@provablehq/sdk` | ||
async function updateDependencies(newVersion) { | ||
const files = await glob("**/package.json", { ignore: "**/node_modules/**" }); | ||
|
||
await Promise.all(files.map(async (file) => { | ||
await updateDependency(file, newVersion); | ||
})); | ||
} | ||
|
||
|
||
const newVersion = process.argv[2]; | ||
|
||
await updateVersions(newVersion); | ||
await updateDependencies(newVersion); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5334,6 +5334,18 @@ glob@^10.2.2, glob@^10.3.7, glob@^10.4.5: | |
package-json-from-dist "^1.0.0" | ||
path-scurry "^1.11.1" | ||
|
||
glob@^11.0.0: | ||
version "11.0.0" | ||
resolved "https://registry.yarnpkg.com/glob/-/glob-11.0.0.tgz#6031df0d7b65eaa1ccb9b29b5ced16cea658e77e" | ||
integrity sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g== | ||
dependencies: | ||
foreground-child "^3.1.0" | ||
jackspeak "^4.0.1" | ||
minimatch "^10.0.0" | ||
minipass "^7.1.2" | ||
package-json-from-dist "^1.0.0" | ||
path-scurry "^2.0.0" | ||
|
||
glob@^7.0.3, glob@^7.1.3, glob@^7.1.4: | ||
version "7.2.3" | ||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" | ||
|
@@ -6027,6 +6039,13 @@ jackspeak@^3.1.2: | |
optionalDependencies: | ||
"@pkgjs/parseargs" "^0.11.0" | ||
|
||
jackspeak@^4.0.1: | ||
version "4.0.2" | ||
resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-4.0.2.tgz#11f9468a3730c6ff6f56823a820d7e3be9bef015" | ||
integrity sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw== | ||
dependencies: | ||
"@isaacs/cliui" "^8.0.2" | ||
|
||
jest-worker@^27.4.5: | ||
version "27.5.1" | ||
resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0" | ||
|
@@ -6357,6 +6376,11 @@ lru-cache@^10.2.0: | |
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119" | ||
integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ== | ||
|
||
lru-cache@^11.0.0: | ||
version "11.0.1" | ||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-11.0.1.tgz#3a732fbfedb82c5ba7bca6564ad3f42afcb6e147" | ||
integrity sha512-CgeuL5uom6j/ZVrg7G/+1IXqRY8JXX4Hghfy5YE0EhoYQWvndP1kufu58cmZLNIDKnRhZrXfdS9urVWx98AipQ== | ||
|
||
lru-cache@^4.1.5: | ||
version "4.1.5" | ||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" | ||
|
@@ -6531,6 +6555,13 @@ minimalistic-assert@^1.0.0: | |
resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" | ||
integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== | ||
|
||
minimatch@^10.0.0: | ||
version "10.0.1" | ||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-10.0.1.tgz#ce0521856b453c86e25f2c4c0d03e6ff7ddc440b" | ||
integrity sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ== | ||
dependencies: | ||
brace-expansion "^2.0.1" | ||
|
||
minimatch@^3.0.2, minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: | ||
version "3.1.2" | ||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" | ||
|
@@ -7008,6 +7039,14 @@ path-scurry@^1.11.1: | |
lru-cache "^10.2.0" | ||
minipass "^5.0.0 || ^6.0.2 || ^7.0.0" | ||
|
||
path-scurry@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-2.0.0.tgz#9f052289f23ad8bf9397a2a0425e7b8615c58580" | ||
integrity sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg== | ||
dependencies: | ||
lru-cache "^11.0.0" | ||
minipass "^7.1.2" | ||
|
||
[email protected]: | ||
version "0.1.10" | ||
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.10.tgz#67e9108c5c0551b9e5326064387de4763c4d5f8b" | ||
|