Monorepo with build artifact support, to create a one-off experiments sandbox?

Hi Netlify, our team loves your product and we’re already using the monorepo feature (with multiple Netlify projects attached to subdirectories of the same repo).

This post is for a different need, and I’m curious if there’s a way it can be done:

I want to build a ‘sandbox’ for our dev team to quickly push one-off experiments inside a single project. I would be able to engineer the multi-project build process, including copying the dist directories to public and automating a simple index page to jump between projects.

sandbox/

  • experiment A [code base]
    • dist [build dir]
  • experiment B
    • dist
  • experiment C
    • dist
  • public
    • index.html (my code would auto-generate this)
    • experiment-a/
      • index.html
    • experiment-b/
      • index.html
    • experiment-c/
      • index.html

To make this efficient though, I’d need to be able to access the build artifacts of the previous build, so that only the experiments that changed would be rebuilt.

Like,

  • extract build artifact cache
  • build [builds the changed experiment, deletes one artifact folder and replaces it]

Is this something Netlify can do? If you guys can make the build artifacts available, I can do the rest. Thanks!

– TL;DR a bit more background if helpful –

The goal here is to provide the simplest way for our devs to publish quick demos to a single known URL w/ password, that the whole company can have access to and continue to reference when new demos go up.

Currently we have to create separate Netlify projects and link them to the repo(s), plus set up two LFS environment variables and password protection on each one. Managers have to get involved in these admin tasks which makes it tedious and cumbersome for small one-off projects.

In the olden days it was quick and easy to just FTP a folder to a protected url and send out a link – this is an attempt to get back to that level of ease for quick demos, but with efficient build automation.

The reason I need the build artifacts is that later when there’s 10 or 20 demos, I want a way to perform a partial build of just the demo that changed, while leaving the rest of the site intact. If it requires an extra step of generating a build artifact and then sending it to secondary Netlify project, that would be fine.

If Netlify can’t do this we could solve the problem some other way by pushing built files to a cloud service or something…

I think I have a way to do this – build artifacts can theoretically be cached using a custom build plugin and the cache util.

Maybe I’ll publish a generic “Cache Build Artfifacts” plugin to make that easier to do generically.

Meanwhile, a node script up top can check for changes, trigger build(s), then copy the dist files to public.

Here’s to hoping it works :crossed_fingers:

1 Like

hi there mosesoak! thanks for writing and checking with us - and i’m glad you are continuing to make progress on your project. sometimes (most of the time :grimacing: ) we are a bit too busy to really take the time to dig into experiments and suchlike, but we can usually find the time to answer specific questions if you have them, so please do keep posting your progress.

1 Like