Skip to content

Commit

Permalink
chore(infra): move scarb install to root
Browse files Browse the repository at this point in the history
  • Loading branch information
Starkware committed Sep 19, 2024
1 parent ceec042 commit f757b87
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 7 deletions.
7 changes: 7 additions & 0 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ version = "0.15.1"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:981ebd7ddfbd9fc03515fa7790ca41c8b721ea020412651510ab63e40ebd2303"

[[package]]
name = "perpetuals"
version = "0.1.0"
dependencies = [
"snforge_std",
]

[[package]]
name = "snforge_scarb_plugin"
version = "0.2.0"
Expand Down
2 changes: 1 addition & 1 deletion Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["workspace/apps/staking/contracts", "workspace/packages/contracts"]
members = ["workspace/apps/staking/contracts", "workspace/packages/contracts", "workspace/apps/perpetuals/contracts"]


[workspace.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"dev": "turbo run dev --parallel",
"dev:apps": "node ./scripts/dev-apps.js",
"format": "sort-package-json && prettier --write \"**.+(js|json|md|yaml)\" && turbo run format --parallel",
"postinstall": "pnpm manypkg:check",
"postinstall": "pnpm manypkg:check && node ./scripts/postinstall.js",
"lint": "turbo run lint",
"manypkg:check": "manypkg check || exit 0",
"npkill": "npkill",
Expand Down
11 changes: 9 additions & 2 deletions workspace/scripts/postinstall.js → scripts/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,15 @@ process.env['PATH'] = `${process.env['PATH']}:${process.env['HOME']}/.asdf/bin:$
if (process.env.CI) {
fs.appendFileSync(process.env.GITHUB_ENV, `PATH=${process.env['PATH']}\n`);
} else {
execSync(`echo -e "\\n. ~/.asdf/asdf.sh" >> ~/.bashrc`);
execSync(`echo -e "\\n. ~/.asdf/completions/asdf.bash" >> ~/.bashrc`);
try {
// Check if the asdf.sh exists in .bashrc
execSync(`grep -Fq asdf.sh ~/.bashrc`);
// If grep finds the line, it means it exists
} catch (err) {
// If grep fails, it means the text doesn't exist, so we append it
execSync(`printf "\\n. ~/.asdf/asdf.sh" >> ~/.bashrc`);
execSync(`printf "\\n. ~/.asdf/completions/asdf.bash" >> ~/.bashrc`);
}
}

// Install scarb
Expand Down
3 changes: 1 addition & 2 deletions workspace/apps/staking/contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "@staking/contracts",
"version": "0.1.1-dev.219",
"version": "0.1.1-dev.220",
"private": true,
"description": "staking contracts",
"scripts": {
"build": "scarb build",
"clean": "scarb clean && snforge clean-cache",
"dev": "scarb cairo-run",
"format": "pnpm sort-package-json && scarb fmt",
"postinstall": "node ../../../scripts/postinstall.js",
"lint": "scarb fmt --check",
"test": "scarb test"
},
Expand Down
1 change: 0 additions & 1 deletion workspace/packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"clean": "scarb clean && snforge clean-cache",
"dev": "scarb cairo-run",
"format": "pnpm sort-package-json && scarb fmt",
"postinstall": "node ../../scripts/postinstall.js",
"lint": "scarb fmt --check",
"test": "scarb test"
},
Expand Down

0 comments on commit f757b87

Please sign in to comment.