Skip to content

[1] Prompt for API key on init#97

Merged
JonoPrest merged 13 commits into
mainfrom
jp/init-api-key
Aug 2, 2024
Merged

[1] Prompt for API key on init#97
JonoPrest merged 13 commits into
mainfrom
jp/init-api-key

Conversation

@JonoPrest

@JonoPrest JonoPrest commented Jul 30, 2024

Copy link
Copy Markdown
Collaborator
  • Create new token opens browser at the api token page (then prompts to add it)
  • Add existing just prompts for text (with help text to point to token page)
  • Skip just prints that you can add it later
  • You can also add it via cli flag
  • Generates .env and .env.example for both templates and contract import

Very open to rewording/renaming.

Screen.Recording.2024-07-30.at.17.46.22.mov

@JonoPrest JonoPrest requested a review from DZakh July 31, 2024 12:53
@JonoPrest JonoPrest enabled auto-merge (rebase) July 31, 2024 12:53
@JonoPrest JonoPrest disabled auto-merge July 31, 2024 12:53
@JonoPrest JonoPrest changed the title Prompt for API key on init [1] Prompt for API key on init Jul 31, 2024

@DZakh DZakh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super nice. Left some opinion on wording, but that's not critical.

But there are some blocking requests:

  1. Remove rescript/core and pnpm-lock changes
  2. Rename API token env var name

Comment thread codegenerator/cli/src/cli_args/interactive_init/mod.rs Outdated
Comment thread codegenerator/cli/src/cli_args/interactive_init/mod.rs Outdated
Some(k) => Ok::<_, anyhow::Error>(Some(k)),
None if ecosystem.uses_hypersync() => {
let select = Select::new(
"Add an API token for HyperSync to your .env file?",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can omit mentioning the .env file, since it's an implementation detail and shouldn't really concern the user at the point.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, although that's exactly what this is doing right? IMO I like that it makes it clear that all it's doing is helping you add a token to your .env file and you can manually do it later if you want.

Comment thread codegenerator/cli/src/cli_args/interactive_init/mod.rs Outdated
"@elastic/ecs-pino-format": "1.4.0",
"@envio-dev/hypersync-client": "0.3.4-rc.1",
"@glennsl/rescript-fetch": "0.2.0",
"@rescript/core": "1.5.0",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a conflict. This should be removed

Comment thread codegenerator/cli/templates/dynamic/contract_import_templates/shared/.env.hbs Outdated
Comment thread codegenerator/cli/templates/dynamic/codegen/package.json.hbs Outdated
@JonoPrest JonoPrest requested a review from DZakh August 2, 2024 12:28
@module("@envio-dev/hypersync-client") @scope("HypersyncClient") external new: cfg => t = "new"

let make = (~url) => new({url, enableChecksumAddresses: true})
let defaultToken = "3dc856dd-b0ea-494f-b27e-017b8b6b7e07"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move it to Env.res?

@JonoPrest JonoPrest enabled auto-merge (squash) August 2, 2024 12:58
@JonoPrest JonoPrest merged commit ed8e938 into main Aug 2, 2024
@JonoPrest JonoPrest deleted the jp/init-api-key branch August 2, 2024 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants