Skip to content

Use local envio package for testing instead of defaulting to latest - #200

Merged
DZakh merged 5 commits into
mainfrom
dz/use-local-envio
Sep 16, 2024
Merged

Use local envio package for testing instead of defaulting to latest#200
DZakh merged 5 commits into
mainfrom
dz/use-local-envio

Conversation

@DZakh

@DZakh DZakh commented Sep 14, 2024

Copy link
Copy Markdown
Member
  • Should prevent failures on init caused by breaking changes with latest version.
  • Will allow us to start moving some code to the envio package

@DZakh

DZakh commented Sep 14, 2024

Copy link
Copy Markdown
Member Author

@DZakh
DZakh requested a review from JonoPrest September 14, 2024 11:43
{
"name": "envio",
"version": "local",
"private": true,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added private so it's not published by mistake. Otherwise it will be overwritten in ci

"name": "${node_pkg}",
"version": "${version}",
"description": "A ️latency and sync speed optimized, developer friendly blockchain data indexer.",
"description": "A latency and sync speed optimized, developer friendly blockchain data indexer.",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There was an unsupported unicode char for space

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Wow, wonder how that happened 😆

// Handler for the NewGreeting event
Handlers.Greeter.NewGreeting.handler(async ({event, context}) => {
let userId = event.params.user.bits->Address.toString // The id for the User entity
let userId = event.params.user.bits // The id for the User entity

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Help me to catch a bug :)

Comment on lines +1 to +27
#!/usr/bin/env node

import { spawnSync } from "child_process";
import path from "path";
import { fileURLToPath } from "url";

/**
* Runs `envio` with args using nodejs spawn
*/
function runLocalEnvio() {
const args = process.argv.slice(2);
const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
const __dirname = path.dirname(__filename); // get the name of the directory
const processResult = spawnSync(
"cargo",
[
"run",
"--manifest-path",
path.join(__dirname, "../../Cargo.toml"),
...args,
],
{ stdio: "inherit" }
);
process.exit(processResult.status ?? 0);
}

runLocalEnvio();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is awesome. Just thinking we replace the suggestion for adding "lenvio" as an alias and rather just linking this with pnpm or something.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hmm, might be worth trying

@JonoPrest JonoPrest left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Cool, I haven't tested this. I hope the CI behaves, let's keep an eye on the main release when this get's merged.

@DZakh
DZakh enabled auto-merge (squash) September 16, 2024 09:28
@DZakh
DZakh merged commit 3756cc0 into main Sep 16, 2024
@DZakh
DZakh deleted the dz/use-local-envio branch September 16, 2024 09:35
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