Skip to content

Commit

Permalink
Bugfixes & QoL update (#231)
Browse files Browse the repository at this point in the history
* Update with relevant details

* Delete apk source

* Bump metaplex and solana web3 deps

* Add process exit just to be sure that the CLI doesn't hang needlessly

* Revert "Bump metaplex and solana web3 deps"

This reverts commit f3e6ac6.

* Make things work right

* Address ticket #230 - whenever there is an error return a non-zero exit code

* More async/await fixes

* Yaml multiline long desc support should be in place

---------

Co-authored-by: creativedrewy <Andrew Watson [email protected]>
  • Loading branch information
creativedrewy and creativedrewy authored Jul 28, 2023
1 parent 04df00c commit 7698394
Show file tree
Hide file tree
Showing 7 changed files with 1,306 additions and 1,187 deletions.
21 changes: 10 additions & 11 deletions packages/cli/src/CliSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ async function tryWithErrorMessage(block: () => Promise<any>) {
const errorMsg = (e as Error | null)?.message ?? "";

showMessage("Error", errorMsg, "error");
process.exit(-1)
}
}

Expand All @@ -72,7 +73,7 @@ export const initCliCmd = mainCli
.command("init")
.description("First-time initialization of tooling configuration")
.action(async () => {
tryWithErrorMessage(async () => {
await tryWithErrorMessage(async () => {
const msg = initScaffold();

showMessage("Initialized", msg);
Expand All @@ -94,7 +95,7 @@ export const createPublisherCliCmd = createCliCmd
.option("-d, --dry-run", "Flag for dry run. Doesn't mint an NFT")
.option("-s, --storage-config <storage-config>", "Provide alternative storage configuration details")
.action(async ({ keypair, url, dryRun, storageConfig }) => {
tryWithErrorMessage(async () => {
await tryWithErrorMessage(async () => {
latestReleaseMessage();
await checkForSelfUpdate();

Expand Down Expand Up @@ -125,7 +126,7 @@ export const createAppCliCmd = createCliCmd
.option("-d, --dry-run", "Flag for dry run. Doesn't mint an NFT")
.option("-s, --storage-config <storage-config>", "Provide alternative storage configuration details")
.action(async ({ publisherMintAddress, keypair, url, dryRun, storageConfig }) => {
tryWithErrorMessage(async () => {
await tryWithErrorMessage(async () => {
latestReleaseMessage();
await checkForSelfUpdate();

Expand Down Expand Up @@ -172,7 +173,7 @@ export const createReleaseCliCmd = createCliCmd
)
.option("-s, --storage-config <storage-config>", "Provide alternative storage configuration details")
.action(async ({ appMintAddress, keypair, url, dryRun, buildToolsPath, storageConfig }) => {
tryWithErrorMessage(async () => {
await tryWithErrorMessage(async () => {
latestReleaseMessage();
await checkForSelfUpdate();

Expand Down Expand Up @@ -218,7 +219,7 @@ mainCli
"Path to Android build tools which contains AAPT2"
)
.action(async ({ keypair, buildToolsPath }) => {
tryWithErrorMessage(async () => {
await tryWithErrorMessage(async () => {
latestReleaseMessage();
await checkForSelfUpdate();

Expand All @@ -233,8 +234,6 @@ mainCli
signer,
buildToolsPath: resolvedBuildToolsPath,
});

//TODO: Add pretty formatting here, but will require more work than other sections
}
});
});
Expand Down Expand Up @@ -283,7 +282,7 @@ publishCommand
requestorIsAuthorized,
dryRun,
}) => {
tryWithErrorMessage(async () => {
await tryWithErrorMessage(async () => {
await checkForSelfUpdate();
await checkSubmissionNetwork(url);

Expand Down Expand Up @@ -354,7 +353,7 @@ publishCommand
critical,
dryRun,
}) => {
tryWithErrorMessage(async () => {
await tryWithErrorMessage(async () => {
await checkForSelfUpdate();
await checkSubmissionNetwork(url);

Expand Down Expand Up @@ -421,7 +420,7 @@ publishCommand
critical,
dryRun,
}) => {
tryWithErrorMessage(async () => {
await tryWithErrorMessage(async () => {
await checkForSelfUpdate();
await checkSubmissionNetwork(url);

Expand Down Expand Up @@ -481,7 +480,7 @@ publishCommand
requestDetails,
{ appMintAddress, releaseMintAddress, keypair, url, requestorIsAuthorized, dryRun }
) => {
tryWithErrorMessage(async () => {
await tryWithErrorMessage(async () => {
await checkForSelfUpdate();
await checkSubmissionNetwork(url);

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/create/CreateCliApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const createAppCommand = async ({
);

if (!dryRun) {
writeToPublishDetails({ app: { address: appAddress } });
await writeToPublishDetails({ app: { address: appAddress } });
}

return { appAddress };
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/create/CreateCliPublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const createPublisherCommand = async ({
);

// TODO(sdlaver): dry-run should not modify config
writeToPublishDetails({ publisher: { address: publisherAddress } });
await writeToPublishDetails({ publisher: { address: publisherAddress } });

return { publisherAddress };
};
4 changes: 1 addition & 3 deletions packages/cli/src/commands/create/CreateCliRelease.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ export const createReleaseCommand = async ({
storageParams: storageParams,
});

writeToPublishDetails({
release: { address: releaseAddress },
});
await writeToPublishDetails({ release: { address: releaseAddress }, });

return { releaseAddress };
}
Expand Down
4 changes: 3 additions & 1 deletion packages/cli/src/config/PublishDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,5 +281,7 @@ export const writeToPublishDetails = async ({ publisher, app, release }: SaveToC
solana_mobile_dapp_publisher_portal: currentConfig.solana_mobile_dapp_publisher_portal
};

fs.writeFileSync(Constants.getConfigFilePath(), dump(newConfig));
fs.writeFileSync(Constants.getConfigFilePath(), dump(newConfig, {
lineWidth: -1
}));
};
2 changes: 2 additions & 0 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { mainCli } from "./CliSetup.js";

async function main() {
await mainCli.parseAsync(process.argv);

process.exit(0)
}

main();
Loading

0 comments on commit 7698394

Please sign in to comment.