solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

solid-starts multiple adapters, explicit adapter configuration and build output

Open LiQuidProQuo opened this issue 3 years ago • 3 comments

issue

by default start will build with the 'node' adapter. Just adding an adapter package( solid-start-* ), will change the adapter to one of the installed adapters. with multiple adapters added, one will be picked *alphabetically

consideration

  1. do not automatically pick adapter, make configuration explicit( at least when there are multiple adapters installed)

  2. add ability to specify one or more adapters as build target as cli options and/or configuration.

pnpm build --adapter=netlify 
pnpm build --adapter=netlify --adapter=static
export default defineConfig({
  plugins: [solid(
    { adapters: {
      'solid-start-cloudflare-workers':{
        dist: './dist/cloudflare-workers'
      },
      'solid-start-static':{
        dist: './dist/static'
      }
    } }

  )],
});
  1. isolate and normalize build target for each adapter, so builds can easily be deployed to different targets there is no convention to where adapters should output the build, so we can find overriding adapters and non conventional name target.
static => ./dist
solid-start-cloudflare-workers => ./dist
vercel => ./.vercel
netlify => ./netlify

repro (auto picking "random" adapter )

pnpm create solid
....
pnpm install 

pnpm build            # will build with `node`


pnpm add solid-start-static
pnpm  build          # will build with 'static'

pnpm add solid-start-netlify
pnpm  build          # will build with 'netlify'

pnpm add solid-start-vercel
pnpm  build          # will still use 'netlify'   'n'>'v'

LiQuidProQuo avatar Sep 27 '22 22:09 LiQuidProQuo

Yeah the reason for the automation was for build pipelines where they auto pick up and people didn't configure it. This was an added feature. There is an env variable you can set to pick adapter. I think it is START_ADAPTER.

I have definitely been hit unexpectedly by this behavior myself. I think in that case environment detection might be better default in the multi-adaptor case where it isn't specified. But that will probably take some doing.

ryansolid avatar Sep 27 '22 23:09 ryansolid

Yeah the automatic detection is rarely helpful and more trouble than its worth. Also it should be explicit over implicit. And the env variable can be used to override I guess for temporarily changing what adapter is used

nksaraf avatar Sep 29 '22 00:09 nksaraf

I would like to have a configurable output location too. I'm often using Nx monorepos and the standard place to put the build output is in a totally separate folder from the source. It's not just for aesthetics but it also makes it easier to hook into Nx's build caching system.

/dist
  /apps
    /my-solid-app <-- output folder
/apps
  /my-solid-app <-- source

Also I stumbled on the Vavite project recently, maybe it could be useful for the idea of configuring multiple adapters at the same time: https://github.com/cyco130/vavite/tree/main/packages/multibuild-cli

patdx avatar Oct 13 '22 05:10 patdx

Ok removed the auto adapter thing.

ryansolid avatar Jan 10 '23 06:01 ryansolid