Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix command-line args parsing on scripts #56

Merged
merged 2 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)}`;
}
Loading