question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[RFC] Support for additional sides

See original GitHub issue

At the moment we have two hard-coded sides to RedwoodJS: api and web. We use these two sides to inform a bunch of branches in the CLI:

  • yarn rw dev [side]
  • yarn rw build [side]
  • yarn rw test [side]

The [side] part can be either api or web, and both when none are defined. My proposal is that we move the concept of “sides” into the configuration @redwoodjs/internal and supply a bunch of default commands that can be overwritten by the user.

As an example:

When you run yarn rw build api the CLI does something like this:

if (side === "api") {
   await execa("cd api; yarn babel")
}

So, instead of hard-coding that value into the CLI we’re just move it into a configuration option, by default we’ll have something like this (this will not be visible to the user):

// sides.config.js
export const api  = {
    path: './api',
    distPath: './api/dist/',
    commands: {
        build: "yarn babel",
    },
}

Now, the CLI will grab the sides configuration and determine if the “build” command supports and api side during runtime.

This will allow us, and others, to easily expand the concept of sides.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:4
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
viperfxcommented, Jan 22, 2021

I have an additional use case for this feature. I am doing some funky stuff with the router to accept routes via a wildcard subdomain and an “app” domain.

const Routes = () => {
  const subdomain = useSubdomain()

  if (subdomain == "app") {
    return (
      <Router>
        .... admin app routes on app.domain.com
      </Router>
    )
  }else{
    return (
      <Router>
        .... portal app routes on *.domain.com
      </Router>
    )
  }
}

After chatting with @Tobbe about my use case and showing him some issues I’ve noticed with the router and multiple flashes on render, he suspected it may be due to the way I set up the router.

So this seems like a great solution for this, where I would be able to have two web sides.

0reactions
tubbocommented, May 1, 2022

Shared code amongst sides, for which we currently don’t have a solution. Should we… could this be one of the supported sides?

The create-redwood-app CLI generates a package.json that configures the app’s workspaces to be api, web, and packages/*. I’m not sure if people already use this directory for anything, but I always saw that packages directory as a future convention for shared code amongst sides. You could maybe consider all workspaces to be a “side”, except the ones in packages/, and use each side workspace’s package.json scripts for those redwood CLI subcommands.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RFC 2891 - LDAP Control Extension for Server Side Sorting of ...
LDAP Control Extension for Server Side Sorting of Search Results (RFC 2891, ... for some other reason cannot sort the results but still...
Read more >
RFC 3261: SIP: Session Initiation Protocol
SIP makes use of elements called proxy servers to help route requests to the user's ... session is the one with the peer...
Read more >
HTTP/1.1: Method Definitions
RFC 2616 Fielding, et al. 9 Method Definitions. The set of common methods for HTTP/1.1 is defined below. Although this set can be...
Read more >
RFC Profiles - SAP Help Portal
If more RFCs are performed during a transaction step, only the five calls with ... and the workload created by the performance collector...
Read more >
[agl-discussions] [RFC] Device-side support for software ...
The device running AGL is generally the node containing networking or other external communication capabilities to handle input of a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found