milesj/packemon

Flag to build only one endpoint

kaleidawave opened this issue · 5 comments

Would it possible to add a cli flag to only build one package. Having a case where I have just adjusted one of the entry points and want to test it out now so no need to build out the other packages.

e.g.

packemon build --only bin

Thanks :)

@kaleidawave Definitely! I've actually needed this myself :P

However, I can't remember exactly, but I think you can maybe do packemon build --cwd ./path/to/package.

Awesome, I don't think --cwd is quite what I want. Just to clarify if I have this setup in package.json:

"packemon": [
  {
    "inputs": {
      "index": "src/node.ts"
    },
    "format": "cjs",
    "platform": "node"
  },
  {
    "inputs": {
      "bin": "src/cli.ts"
    },
    "platform": "node"
  },
  {
    "inputs": {
      "web": "src/web.ts"
    },
    "platform": "browser",
    "support": "current"
  },
]

I want to be able to do packemon build --only browser. So instead of:

 Node v10.3
  index [█] cjs (5.27 KB) 47.1s
  bin [█] lib (2.05 KB) 48.8s
 Browser (defaults)
  web [█] lib (543.57 KB) [█] esm (543.22 KB) 46.5s
 Node v12
  import [█] mjs (479 B) 48.1s

It only builds the browser builds

  web [█] lib (543.57 KB) [█] esm (543.22 KB) 46.5s

@kaleidawave Ah yeah, that's different. Also a great suggestion, this sounds great.

Can use --platforms or -p for this.

@milesj Awesome, thanks for adding this! It is working really well, halves the build times when testing :)