Help

The Community will be temporarily unavailable starting on Friday February 28. We’ll be back as soon as we can! To learn more, check out our Announcements blog post.

How do I run block release in a monorepo? (Using npm workspaces)

Topic Labels: Custom Extensions
Solved
Jump to Solution
3107 3
cancel
Showing results for 
Search instead for 
Did you mean: 
Eugene_Kim
6 - Interface Innovator
6 - Interface Innovator

I’m running issues when running block release to deploy my Airtable app.

I’m using npm workspaces as I develop my Custom Airtable App since I’m using a monorepo to make code management and sharing convenient.

Here’s the basic folder structure for my project:

  • project_root/
    • packages/ - houses workspaces
      • common/
        • contains code shared by airtable_app and server workspaces
        • package name: @shoptable/common
      • airtable_app/ - contains the airtable block app
      • server/ - another workspace

Here are the steps I take before running block release:

  1. npm i from project_root
  2. cd packages/airtable_app
  3. block release

I run into the following error:

building
copying package.json file
copying package-lock.json file

❌ Error: package-lock.json does not exist!
Failed to build the block code!

There’s only a package-lock.json generated at the project_root level. How can I get around this issue with my development environment?

Current Workaround

The only way I’ve found that works is to run npm pack on my @shoptable/common package and reference it in airtable_app/package.json's dependencies as such:

{
...
  "@shoptable/common": "file:../common/shoptable-common-1.0.0.tgz",
...
}

This isn’t ideal given that during development I’d like to simply refer to the workspace via the version number so as to make sure that I have the latest changes I’m working on.

Is there a better way to run block release given my monorepo setup?

Other things I’ve tried that didn’t work

In airtable_app/package.json I’ve tried declaring @shoptable/common as a local dependency like so:

{
...
  "@shoptable/common": "file:../common",
...
}

And then running npm i from within the airtable_app/ dir. This gets me a little further but I get the following failure after running :

building
copying package.json file
copying package-lock.json file
installing node modules
[npm]
[npm] added 164 packages, and audited 166 packages in 2s
[npm]
[npm] 6 packages are looking for funding
[npm]   run `npm fund` for details
[npm]
[npm] found 0 vulnerabilities
transpiling and building frontend bundle
Bundle Error: Cannot find module '@shoptable/common' from '/private/var/folders/1t/rfq1yymx391fmcn0lj_9trm80000gn/T/airtableBlocks/build/1622060082006/transpiled/user/src'

❌ Error: Cannot find module '@shoptable/common' from '/private/var/folders/1t/rfq1yymx391fmcn0lj_9trm80000gn/T/airtableBlocks/build/1622060082006/transpiled/user/src'
Failed to build the block code!
1 Solution

Accepted Solutions
Taylor_Savage
7 - App Architect
7 - App Architect

Hey there! We’re currently working on a new version of the CLI that generally is much more flexible around the types of builds it supports - hoping to have a beta release for this as early as next week.

In the meantime though - try running block release --disable-isolated-build with the current CLI?

See Solution in Thread

3 Replies 3
Taylor_Savage
7 - App Architect
7 - App Architect

Hey there! We’re currently working on a new version of the CLI that generally is much more flexible around the types of builds it supports - hoping to have a beta release for this as early as next week.

In the meantime though - try running block release --disable-isolated-build with the current CLI?

Hi @Taylor_Savage , that worked! Many thanks. Could you provide additional details on what that flag does?

It’s great to hear that more flexibility is on the way :slightly_smiling_face: How can I stay in the loop with these changes? The @airtable/blocks-cli project doesn’t seem to be publicly accessible.

@Taylor_Savage does the --disable-isolated-build flag work for block submit as well?