Skip to content

Commit

Permalink
Update from template (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
lorisleiva authored Oct 24, 2024
1 parent 7562c92 commit 7ec99c9
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ runs:

- name: Install Solana
if: ${{ inputs.solana == 'true' }}
uses: metaplex-foundation/actions/install-solana@v1
uses: solana-program/actions/install-solana@v1
with:
version: ${{ env.SOLANA_VERSION }}
cache: true
Expand Down
10 changes: 8 additions & 2 deletions clients/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,15 @@
"access": "public",
"registry": "https://registry.npmjs.org"
},
"repository": "https://github.com/solana-program/address-lookup-table.git",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/solana-program/address-lookup-table.git"
},
"bugs": {
"url": "https://github.com/solana-program/address-lookup-table/issues"
},
"homepage": "https://github.com/solana-program/address-lookup-table#readme",
"peerDependencies": {
"@solana/web3.js": "2.0.0-rc.1"
},
Expand All @@ -50,7 +57,6 @@
"rimraf": "^5.0.5",
"tsup": "^8.1.2",
"typedoc": "^0.25.12",
"typedoc-plugin-missing-exports": "^2.2.0",
"typescript": "^5.5.3"
},
"ava": {
Expand Down
12 changes: 0 additions & 12 deletions clients/js/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@
"template:upgrade": "zx ./scripts/upgrade-template.mjs"
},
"devDependencies": {
"@iarna/toml": "^2.2.5",
"@codama/renderers-js": "^1.0.0",
"@codama/renderers-rust": "^1.0.0",
"@iarna/toml": "^2.2.5",
"codama": "^1.0.0",
"typescript": "^5.5.2",
"zx": "^7.2.3"
},
"engines": {
"node": ">=v20.0.0"
},
"packageManager": "[email protected]"
}
5 changes: 3 additions & 2 deletions scripts/client/test-rust.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import { cliArguments, workingDirectory } from '../utils.mjs';
const testArgs = cliArguments();

const hasSolfmt = await which('solfmt', { nothrow: true });
const sbfOutDir = path.join(workingDirectory, 'target', 'deploy');

// Run the tests.
cd(path.join(workingDirectory, 'clients', 'rust'));
if (hasSolfmt) {
await $`cargo test-sbf ${testArgs} 2>&1 | solfmt`;
await $`SBF_OUT_DIR=${sbfOutDir} cargo test --features "test-sbf" ${testArgs} 2>&1 | solfmt`;
} else {
await $`cargo test-sbf ${testArgs}`;
await $`SBF_OUT_DIR=${sbfOutDir} cargo test --features "test-sbf" ${testArgs}`;
}
10 changes: 4 additions & 6 deletions scripts/program/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ import './dump.mjs';
const buildArgs = ['--features', 'bpf-entrypoint', ...cliArguments()];

// Build the programs.
await Promise.all(
getProgramFolders().map(async (folder) => {
const manifestPath = path.join(workingDirectory, folder, 'Cargo.toml');
for (const folder of getProgramFolders()) {
const manifestPath = path.join(workingDirectory, folder, 'Cargo.toml');

await $`cargo-build-sbf --manifest-path ${manifestPath} ${buildArgs}`;
})
);
await $`cargo-build-sbf --manifest-path ${manifestPath} ${buildArgs}`;
}
18 changes: 8 additions & 10 deletions scripts/program/format.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ const [cargoArgs, fmtArgs] = partitionArguments(formatArgs, '--');
const toolchain = getToolchainArgument('format');

// Format the programs.
await Promise.all(
getProgramFolders().map(async (folder) => {
const manifestPath = path.join(workingDirectory, folder, 'Cargo.toml');
for (const folder of getProgramFolders()) {
const manifestPath = path.join(workingDirectory, folder, 'Cargo.toml');

if (fix) {
await $`cargo ${toolchain} fmt --manifest-path ${manifestPath} ${cargoArgs} -- ${fmtArgs}`;
} else {
await $`cargo ${toolchain} fmt --manifest-path ${manifestPath} ${cargoArgs} -- --check ${fmtArgs}`;
}
})
);
if (fix) {
await $`cargo ${toolchain} fmt --manifest-path ${manifestPath} ${cargoArgs} -- ${fmtArgs}`;
} else {
await $`cargo ${toolchain} fmt --manifest-path ${manifestPath} ${cargoArgs} -- --check ${fmtArgs}`;
}
}
20 changes: 9 additions & 11 deletions scripts/program/lint.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,15 @@ const lintArgs = [
];

const fix = popArgument(lintArgs, '--fix');
const toolchain = getToolchainArgument('format');
const toolchain = getToolchainArgument('lint');

// Lint the programs using clippy.
await Promise.all(
getProgramFolders().map(async (folder) => {
const manifestPath = path.join(workingDirectory, folder, 'Cargo.toml');
for (const folder of getProgramFolders()) {
const manifestPath = path.join(workingDirectory, folder, 'Cargo.toml');

if (fix) {
await $`cargo ${toolchain} clippy --manifest-path ${manifestPath} --fix ${lintArgs}`;
} else {
await $`cargo ${toolchain} clippy --manifest-path ${manifestPath} ${lintArgs}`;
}
})
);
if (fix) {
await $`cargo ${toolchain} clippy --manifest-path ${manifestPath} --fix ${lintArgs}`;
} else {
await $`cargo ${toolchain} clippy --manifest-path ${manifestPath} ${lintArgs}`;
}
}
18 changes: 8 additions & 10 deletions scripts/program/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@ const testArgs = ['--features', 'bpf-entrypoint', ...cliArguments()];
const hasSolfmt = await which('solfmt', { nothrow: true });

// Test the programs.
await Promise.all(
getProgramFolders().map(async (folder) => {
const manifestPath = path.join(workingDirectory, folder, 'Cargo.toml');
for (const folder of getProgramFolders()) {
const manifestPath = path.join(workingDirectory, folder, 'Cargo.toml');

if (hasSolfmt) {
await $`RUST_LOG=error cargo test-sbf --manifest-path ${manifestPath} ${testArgs} 2>&1 | solfmt`;
} else {
await $`RUST_LOG=error cargo test-sbf --manifest-path ${manifestPath} ${testArgs}`;
}
})
);
if (hasSolfmt) {
await $`RUST_LOG=error cargo test-sbf --manifest-path ${manifestPath} ${testArgs} 2>&1 | solfmt`;
} else {
await $`RUST_LOG=error cargo test-sbf --manifest-path ${manifestPath} ${testArgs}`;
}
}

0 comments on commit 7ec99c9

Please sign in to comment.