Help

Re: Blocks cli v2 beta - how to use code from other directories?

1424 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Ronen_Babayoff
7 - App Architect
7 - App Architect

Hey @Taylor_Savage and @Emma_Yeap,

The block cli v2 docs state the following:

Using code from other directories

The new CLI allows this method of code-sharing by allowing “sibling directories” outside the source directory to be bundled. Those other directories can include npm imports based on link or file.

What does this exactly mean? More specific setup / how-to instructions and an example repo demonstrating that would be very helpful.

Thanks,
Ronen
Eazyapps

12 Replies 12

Also, the example repo doesn’t work out of the box, here’s the error:

Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.
Ronen_Babayoff
7 - App Architect
7 - App Architect

Hey @SeanKeenan , so after forking @airtable/blocks and adding some logging to the new cli, turns out that the Uploading... Incomplete message is because the cli couldn’t find a block with that id.

That is because I accidently used the incorrect airtable api key. The new cli really needs to provide better feedback to the end user on those types of errors, which I assume are pretty common. The current cli also doesn’t provide proper feedback on this, see below for what the current cli provides.

This is the error that I logged from the new cli source code:

errors: [
  {      
    message: 'Could not find a block build with ID "bbdwGFk82bEs5S15g".',
    code: 'RESOURCE_NOT_FOUND'
  }
]

This is the error the current cli provides:

❌ Error: The requested endpoint "/v2/bases/appnDr2vV67PWUiRV/blocks/blkH2isnuKrkCue/builds/start" was not found.

Anyway, was able to release after setting the proper api key.

Thanks,
Ronen

Glad you were able to solve the problem with the Uploading... Incomplete error! I filed an issue in our internal tracker to make these errors better. This is pretty clearly a … non-ideal experience.

I also updated the example to use an Airtable/UI component - that’s an excellent call. It now prints the base name.

Finally - I figured out the issue with the example repo; it didn’t reproduce on my machine because I had a version of react higher up in the directory tree that was being referenced by both installations. I also put a brief explanation at the bottom of the readme as to why this was happening / why the fix is required.

Hope that helps!