Skip to content

Commit 6a7b7b9

Browse files
committedApr 22, 2024·
Automates the version for X-Aleo-SDK-Version
1 parent 0ec38e9 commit 6a7b7b9

File tree

4 files changed

+48
-4
lines changed

4 files changed

+48
-4
lines changed
 

‎sdk/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"sync-request": "^6.1.0"
4949
},
5050
"devDependencies": {
51+
"@rollup/plugin-replace": "^5.0.5",
5152
"@types/jest": "^29.5.5",
5253
"@types/mime": "^3.0.1",
5354
"@typescript-eslint/eslint-plugin": "^5.41.0",

‎sdk/rollup.config.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import typescript from "rollup-plugin-typescript2";
2+
import replace from "@rollup/plugin-replace";
3+
import $package from "./package.json" assert { type: "json" };
24

35
export default {
46
input: {
@@ -23,6 +25,13 @@ export default {
2325
"@aleohq/wasm",
2426
],
2527
plugins: [
28+
replace({
29+
preventAssignment: true,
30+
delimiters: ['', ''],
31+
values: {
32+
'%%VERSION%%': $package.version,
33+
},
34+
}),
2635
typescript({
2736
tsconfig: "tsconfig.json",
2837
clean: true,

‎sdk/src/network-client.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ class AleoNetworkClient {
4242

4343
} else {
4444
this.headers = {
45-
"X-Aleo-SDK-Version": "0.6.9",
45+
// This is replaced by the actual version by a Rollup plugin
46+
"X-Aleo-SDK-Version": "%%VERSION%%",
4647
};
4748
}
4849
}

‎yarn.lock

+36-3
Original file line numberDiff line numberDiff line change
@@ -2088,6 +2088,14 @@
20882088
"@rollup/pluginutils" "^5.0.1"
20892089
magic-string "^0.30.3"
20902090

2091+
"@rollup/plugin-replace@^5.0.5":
2092+
version "5.0.5"
2093+
resolved "https://registry.yarnpkg.com/@rollup/plugin-replace/-/plugin-replace-5.0.5.tgz#33d5653dce6d03cb24ef98bef7f6d25b57faefdf"
2094+
integrity sha512-rYO4fOi8lMaTg/z5Jb+hKnrHHVn8j2lwkqwyS4kTRhKyWOLf2wST2sWXr4WzWiTcoHTp2sTjqUbqIj2E39slKQ==
2095+
dependencies:
2096+
"@rollup/pluginutils" "^5.0.1"
2097+
magic-string "^0.30.3"
2098+
20912099
"@rollup/pluginutils@^4.1.2":
20922100
version "4.2.1"
20932101
resolved "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-4.2.1.tgz"
@@ -8816,7 +8824,16 @@ string-length@^4.0.1:
88168824
char-regex "^1.0.2"
88178825
strip-ansi "^6.0.0"
88188826

8819-
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
8827+
"string-width-cjs@npm:string-width@^4.2.0":
8828+
version "4.2.3"
8829+
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
8830+
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
8831+
dependencies:
8832+
emoji-regex "^8.0.0"
8833+
is-fullwidth-code-point "^3.0.0"
8834+
strip-ansi "^6.0.1"
8835+
8836+
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
88208837
version "4.2.3"
88218838
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
88228839
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -8883,7 +8900,14 @@ string_decoder@^1.1.1, string_decoder@~1.1.1:
88838900
dependencies:
88848901
safe-buffer "~5.1.0"
88858902

8886-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
8903+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
8904+
version "6.0.1"
8905+
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
8906+
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
8907+
dependencies:
8908+
ansi-regex "^5.0.1"
8909+
8910+
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
88878911
version "6.0.1"
88888912
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
88898913
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -9782,7 +9806,16 @@ wordwrap@0.0.2:
97829806
resolved "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz"
97839807
integrity sha512-xSBsCeh+g+dinoBv3GAOWM4LcVVO68wLXRanibtBSdUvkGWQRGeE9P7IwU9EmDDi4jA6L44lz15CGMwdw9N5+Q==
97849808

9785-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
9809+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
9810+
version "7.0.0"
9811+
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
9812+
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
9813+
dependencies:
9814+
ansi-styles "^4.0.0"
9815+
string-width "^4.1.0"
9816+
strip-ansi "^6.0.0"
9817+
9818+
wrap-ansi@^7.0.0:
97869819
version "7.0.0"
97879820
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
97889821
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==

0 commit comments

Comments
 (0)
Please sign in to comment.