gaztec 0.1.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ name: Test
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v4
10
+ - uses: pnpm/action-setup@v4
11
+ - uses: actions/setup-node@v4
12
+ with:
13
+ node-version: 22
14
+ cache: "pnpm"
15
+
16
+ - name: Install dependencies
17
+ run: pnpm install --frozen-lockfile
18
+
19
+ - name: Run tests
20
+ run: pnpm test
package/README.md CHANGED
@@ -20,15 +20,16 @@ npm i gaztec -D
20
20
 
21
21
  ```sh
22
22
  # create a file that defines the version of Aztec for your project
23
- echo "2.0.3" > .gaztecrc
23
+ echo "4.0.0-devnet.2-patch.2" > .gaztecrc
24
24
 
25
25
  # use `gaztec` where you would use `aztec`
26
26
  gaztec --version
27
- #> 2.0.3
27
+ #> 4.0.0-devnet.2-patch.2
28
+ ```
28
29
 
29
- # replacement for `aztec-nargo`
30
- gaztec-nargo
30
+ ## Compatibility with `aztec`
31
31
 
32
- # replacement for `aztec-postprocess-contract`
33
- gaztec-postprocess-contract
34
- ```
32
+ | gaztec version | aztec version |
33
+ | -------------- | ------------- |
34
+ | < 1.0.0 | < 4.0.0 |
35
+ | >= 1.0.0 | >= 4.0.0 |
package/gaztec-install CHANGED
@@ -1,41 +1,54 @@
1
1
  #!/usr/bin/env bash
2
2
  set -euo pipefail
3
3
 
4
- install_aztec() {
5
- local version=$1
6
-
7
- local aztec_path="$HOME/.aztec/v$version/bin"
8
-
9
- if [[ ! -f "$aztec_path/aztec" ]]; then
10
- echo "Installing aztec $version in $aztec_path"
11
- VERSION=$version BIN_PATH=$aztec_path NON_INTERACTIVE=1 bash -i <(curl -s https://raw.githubusercontent.com/AztecProtocol/aztec-packages/refs/tags/v$version/aztec-up/bin/aztec-install)
12
- fi
13
- }
14
4
 
15
5
  AZTEC_VERSION=""
16
- # go from the current dir to the root of the filesystem and find the first .gaztecrc file
6
+ # go from the current dir to the root of the filesystem and find the first .aztecrc or .gaztecrc file
17
7
  dir=$(pwd)
18
8
  while [[ $dir != "/" ]]; do
9
+ # fail if both .aztecrc and .gaztecrc files are found
10
+ if [[ -f "$dir/.aztecrc" && -f "$dir/.gaztecrc" ]]; then
11
+ echo "Found both .aztecrc and .gaztecrc files in $dir. Please only use one of them." >&2
12
+ exit 1
13
+ fi
14
+
15
+ if [[ -f "$dir/.aztecrc" ]]; then
16
+ AZTEC_VERSION=$(cat $dir/.aztecrc | tr -d '\n')
17
+ echo "Using aztec version $AZTEC_VERSION from $dir/.aztecrc" >&2
18
+ break
19
+ fi
20
+
19
21
  if [[ -f "$dir/.gaztecrc" ]]; then
20
22
  AZTEC_VERSION=$(cat $dir/.gaztecrc | tr -d '\n')
21
- echo "Using aztec version $AZTEC_VERSION from $dir/.gaztecrc"
23
+ echo "Using aztec version $AZTEC_VERSION from $dir/.gaztecrc" >&2
24
+ # deprecation warning
25
+ echo "WARNING: .gaztecrc is deprecated. Please rename to .aztecrc instead." >&2
22
26
  break
23
27
  fi
28
+
24
29
  dir=$(dirname $dir)
25
30
  done
26
31
 
27
32
  # fallback
28
33
  if [[ -z "$AZTEC_VERSION" ]]; then
29
- echo "No .gaztecrc file found in the current or parent directories starting from $(pwd). Falling back to the latest version."
34
+ echo "No .aztecrc file found in the current or parent directories starting from $(pwd). Falling back to the latest version." >&2
30
35
  # fetch the latest version from github releases, remove the v prefix
31
36
  AZTEC_VERSION=$(curl -s https://api.github.com/repos/AztecProtocol/aztec-packages/releases/latest | jq -r '.tag_name' | sed 's/^v//')
32
- echo "Latest version is $AZTEC_VERSION"
37
+ echo "Latest version is $AZTEC_VERSION" >&2
33
38
  fi
34
39
 
35
- export VERSION=$AZTEC_VERSION
40
+ AZTEC_PATH="$HOME/.aztec"
41
+ AZTEC_UP="$AZTEC_PATH/bin/aztec-up"
36
42
 
37
- install_aztec $AZTEC_VERSION
43
+ if [[ ! -f "$AZTEC_UP" ]]; then
44
+ echo "aztec-up could not be found. Installing it..." >&2
45
+ # FOUNDRY_DIR is needed due to a bug in aztec-up
46
+ FOUNDRY_DIR="$HOME/.foundry" VERSION=$AZTEC_VERSION NON_INTERACTIVE=1 bash -i <(curl -sL https://install.aztec.network/$AZTEC_VERSION)
47
+ fi
48
+
49
+ if ! $AZTEC_UP list | grep $AZTEC_VERSION; then
50
+ echo "Installing aztec version $AZTEC_VERSION..." >&2
51
+ $AZTEC_UP install $AZTEC_VERSION
52
+ fi
38
53
 
39
- AZTEC="$HOME/.aztec/v$AZTEC_VERSION/bin/aztec"
40
- AZTEC_NARGO="$HOME/.aztec/v$AZTEC_VERSION/bin/aztec-nargo"
41
- AZTEC_POSTPROCESS_CONTRACT="$HOME/.aztec/v$AZTEC_VERSION/bin/aztec-postprocess-contract"
54
+ AZTEC="$AZTEC_PATH/versions/$AZTEC_VERSION/node_modules/.bin/aztec"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gaztec",
3
- "version": "0.1.2",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "description": "Aztec version manager",
6
6
  "repository": {
@@ -9,8 +9,9 @@
9
9
  },
10
10
  "bin": {
11
11
  "gaztec-install": "./gaztec-install",
12
- "gaztec": "./gaztec",
13
- "gaztec-nargo": "./gaztec-nargo",
14
- "gaztec-postprocess-contract": "./gaztec-postprocess-contract"
12
+ "gaztec": "./gaztec"
13
+ },
14
+ "scripts": {
15
+ "test": "cd test && ./test.sh"
15
16
  }
16
17
  }
package/test/.aztecrc ADDED
@@ -0,0 +1 @@
1
+ 4.0.0-devnet.2-patch.2
package/test/test.sh ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ source $(dirname -- "${BASH_SOURCE[0]}")/../gaztec --version
5
+
6
+ echo "Test passed"
package/gaztec-nargo DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- source "$(dirname -- "${BASH_SOURCE[0]}")/gaztec-install"
5
-
6
- $AZTEC_NARGO $@
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- source "$(dirname -- "${BASH_SOURCE[0]}")/gaztec-install"
5
-
6
- $AZTEC_POSTPROCESS_CONTRACT $@