Skip to content

Commit

Permalink
Merge pull request #56 from solana-program/febo/fix-args-parsing
Browse files Browse the repository at this point in the history
Fix command-line args parsing on scripts
  • Loading branch information
febo authored Jun 14, 2024
2 parents 99ef740 + 10a3345 commit 36269ed
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/nasty-timers-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-solana-program": patch
---

Fix command-line args parsing on scripts
2 changes: 1 addition & 1 deletion template/base/scripts/program/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import './dump.mjs';
await Promise.all(
getProgramFolders().map(async (folder) => {
await $`cd ${path.join(workingDirectory, folder)}`.quiet();
await $`cargo-build-sbf ${argv._}`;
await $`cargo-build-sbf ${process.argv.slice(3)}`;
})
);
2 changes: 1 addition & 1 deletion template/base/scripts/program/format.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import { workingDirectory, getProgramFolders } from '../utils.mjs';
await Promise.all(
getProgramFolders().map(async (folder) => {
await $`cd ${path.join(workingDirectory, folder)}`.quiet();
await $`cargo fmt ${argv._}`;
await $`cargo fmt ${process.argv.slice(3)}`;
})
);
2 changes: 1 addition & 1 deletion template/base/scripts/program/lint.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import { workingDirectory, getProgramFolders } from '../utils.mjs';
await Promise.all(
getProgramFolders().map(async (folder) => {
await $`cd ${path.join(workingDirectory, folder)}`.quiet();
await $`cargo clippy ${argv._}`;
await $`cargo clippy ${process.argv.slice(3)}`;
})
);
4 changes: 2 additions & 2 deletions template/base/scripts/program/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ await Promise.all(
const hasSolfmt = await which('solfmt', { nothrow: true });

if (hasSolfmt) {
await $`RUST_LOG=error cargo test-sbf ${argv._} 2>&1 | solfmt`;
await $`RUST_LOG=error cargo test-sbf ${process.argv.slice(3)} 2>&1 | solfmt`;
} else {
await $`RUST_LOG=error cargo test-sbf ${argv._}`;
await $`RUST_LOG=error cargo test-sbf ${process.argv.slice(3)}`;
}
})
);
2 changes: 1 addition & 1 deletion template/clients/js/scripts/client/test-js.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ await $`pnpm validator:restart`;
cd(path.join(workingDirectory, 'clients', 'js'));
await $`pnpm install`;
await $`pnpm build`;
await $`pnpm test ${argv._}`;
await $`pnpm test ${process.argv.slice(3)}`;
2 changes: 1 addition & 1 deletion template/clients/rust/scripts/client/lint-rust.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import { workingDirectory } from '../utils.mjs';

// Check the client using Clippy.
cd(path.join(workingDirectory, 'clients', 'rust'));
await $`cargo clippy ${argv._}`;
await $`cargo clippy ${process.argv.slice(3)}`;
4 changes: 2 additions & 2 deletions template/clients/rust/scripts/client/test-rust.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { workingDirectory } from '../utils.mjs';
cd(path.join(workingDirectory, 'clients', 'rust'));
const hasSolfmt = await which('solfmt', { nothrow: true });
if (hasSolfmt) {
await $`cargo test-sbf ${argv._} 2>&1 | solfmt`;
await $`cargo test-sbf ${process.argv.slice(3)} 2>&1 | solfmt`;
} else {
await $`cargo test-sbf ${argv._}`;
await $`cargo test-sbf ${process.argv.slice(3)}`;
}

0 comments on commit 36269ed

Please sign in to comment.