-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(boxes): refactor npx to improve readability, added upgrade opti…
…on and manual versioning (#4855)
- Loading branch information
1 parent
6522738
commit ef76d3f
Showing
48 changed files
with
674 additions
and
369 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
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,41 @@ | ||
#!/usr/bin/env node | ||
import { Command } from "commander"; | ||
const program = new Command(); | ||
import { chooseAndCloneBox } from "./scripts/steps/chooseBox.js"; | ||
import { sandboxRun } from "./scripts/steps/sandbox/run.js"; | ||
import { sandboxInstallOrUpdate } from "./scripts/steps/sandbox/install.js"; | ||
import { axios } from "./scripts/utils.js"; | ||
|
||
const getLatestStable = async () => { | ||
const { data } = await axios.get( | ||
`https://api.github.com/repos/AztecProtocol/aztec-packages/releases`, | ||
); | ||
return data[0].tag_name.split("-v")[1]; | ||
}; | ||
|
||
// versioning is confusing here because "latest" and "master" point to the same thing at times | ||
// so let's clarify a bit: | ||
// | ||
// if the user has set a version (ex. "master" or "0.23.0"), use that | ||
// otherwise use the stable release (ex. 0.24.0) | ||
const latestStable = await getLatestStable(); | ||
const versionToInstall = process.env.VERSION || latestStable; | ||
|
||
// if the user has set a semver version (matches the regex), fetch that tag (i.e. aztec-packages-v0.23.0) | ||
// otherwise use the version as the tag | ||
const tagToUse = versionToInstall.match(/^\d+\.\d+\.\d+$/) | ||
? `aztec-packages-v${versionToInstall}` | ||
: versionToInstall; | ||
|
||
program.action(async () => { | ||
// STEP 1: Choose the boilerplate | ||
await chooseAndCloneBox(tagToUse, versionToInstall); | ||
|
||
// STEP 2: Install the Sandbox | ||
await sandboxInstallOrUpdate(latestStable, versionToInstall); | ||
|
||
// STEP 3: Running the Sandbox | ||
await sandboxRun(versionToInstall); | ||
}); | ||
|
||
program.parse(); |
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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 @@ | ||
[package] | ||
name = "boxreact" | ||
authors = [""] | ||
compiler_version = ">=0.18.0" | ||
type = "contract" | ||
|
||
[dependencies] | ||
aztec = { path = "../../../../../noir-projects/aztec-nr/aztec" } | ||
value_note = { path = "../../../../../noir-projects/aztec-nr/value-note" } |
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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 @@ | ||
[package] | ||
name = "vanilla" | ||
authors = [""] | ||
compiler_version = ">=0.18.0" | ||
type = "contract" | ||
|
||
[dependencies] | ||
aztec = { path = "../../../../../noir-projects/aztec-nr/aztec" } | ||
value_note = { path = "../../../../../noir-projects/aztec-nr/value-note" } |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.