Skip to content
This repository was archived by the owner on Mar 27, 2019. It is now read-only.

Add "standalone" option to component.json #512

Closed
netpoetica opened this issue Apr 3, 2014 · 6 comments
Closed

Add "standalone" option to component.json #512

netpoetica opened this issue Apr 3, 2014 · 6 comments

Comments

@netpoetica
Copy link

Based on convo at #511 (comment)

When doing

component build -s name-of-lib

or

component build --standalone name-of-lib

component builder should look for a property called "standalone": true, which would make it so you don't have to even specify the option, and look to the name of the component as the name of the exported module.

Additionally, we may want to be able to override the name of the standalone build with a property like standaloneName, outputName, umdName, something along those lines. I would picture it a couple of ways:

/* "component build" will run with -s and name the component MyComponent, or if standaloneName is not specified, it will become mycomponent. If the name is dash-seperated, it becomes camelcase to avoid the issue with dashes as variable names.*/
{
     "name": "mycomponent",
     "standalone": true,
     "standaloneName": "MyComponent"
}
/* In this method, because standalone is set to a name, it acts like "true" would and also because it's typeof String, u can use the name to create it */
{
     "name": "mycomponent",
     "standalone": "MyComponent"
}
/* Worst case scenario, you still have to specify -s or --standalone, but if you provide a String to standaline property, it will become the name */
{
     "name": "mycomponent",
     "standalone": "MyComponent"
}
@anthonyshort
Copy link
Contributor

This has come up a few times in the past and I think the idea has been turned down. The reason being that the builder shouldn't store build options within the manifest because it isn't relevant information about the package. It could create weird cases when building with packages that have dependencies with options like these.

@jonathanong
Copy link
Contributor

oh i don't think you need this property when building your own component. --standalone options is fine. for me, it's more for if we had a CDN or something that automated UMD builds.

@netpoetica
Copy link
Author

I get the idea that the component.json file, as it is related to the component and not the build process, probably shouldn't have config info for the component-builder, but I think the need for a that type of config exists and should be considered. I imagine that the absence of this configuration is the reason why we see people putting Makefiles in their repos a lot. I think there should be a more convenient way to manage building considering the frequency with which it is done during development.

Additionally, I think it's a steep enough learning curve to get on board with the philosophy of component let alone ask devs to use Make - I think 1 out of 4 or 5 front-end devs (maybe grim outlook) actually know/understand/have seen Makfiles, it will probably intimidate some

@anthonyshort
Copy link
Contributor

I'd be open to trying it out. But I still think it messes with concerns a bit too much. It could be nice for "boot" components. Maybe open a pull request instead.

@visionmedia and @ianstormtaylor are going to hate this though :)

{
   "builder": {
      "standalone": "myapp"
      ...
   }
}

@jonathanong
Copy link
Contributor

we could also use a .rc file or something, but then we end up with more files... might be useful to specify the installation directory and stuff in the .rc file instead though. supporting --out in every command would be pretty annoying.

@jonathanong
Copy link
Contributor

i'm going to add standalone to the docs, but only for automated standalone builds. for local builds, let's discuss this in #517

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants