Skip to content

Add ability to specify config via package.json #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 10, 2017
Merged

Conversation

johno
Copy link
Member

@johno johno commented Oct 18, 2017

Toying around with this idea, seems like it might be cleaner to do something like:

{
  "scripts": {
    "build": "x0 build",
    "dev": "x0 dev | lab -d app -w | micro",
    "start": "micro"
  },
  "x0": {
    "entry": "app/App",
    "outDir": "public",
    "proxy": {
      "/api": "http://localhost:3000"
    }
  }

Instead of

{
  "scripts": {
    "build": "x0 build app/App -d public",
    "dev": "x0 dev app/App --proxy http://localhost:3000 | lab -d app -w | micro",
    "start": "micro"
  }
}

One scenario where it'd be especially useful is for more complex proxy configurations where one might want to use regexes, multiple proxies or paths, etc.

lib/dev/index.js Outdated
@@ -50,7 +58,9 @@ const start = async (filename, options, config) => {

devOptions.contentBase = path.dirname(filename) // process.cwd()

if (proxy) {
if (pkgOpts.proxy) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const opts = Object.assign({}, pkgOpts, options)

@johno johno merged commit 276bc47 into master Nov 10, 2017
@johno johno deleted the package-config branch November 10, 2017 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant