opencomponents / oc

OpenComponents, serverless in the front-end world for painless micro-frontends delivery
https://opencomponents.github.io/
MIT License
1.43k stars 122 forks source link

Add cli argument to skip dependencies packaging #769

Closed elboletaire closed 3 years ago

elboletaire commented 6 years ago

In some scenarios people tend to compile dependencies by their own before doing oc publish, so let's add a cli argument, something like --skip-dependencies or --skip-build, to allow us skip the dependencies installation later again via oc.

elboletaire commented 6 years ago

If I start working on it I'd assign it to me. Until then, I leave it open for others to collaborate.

matteofigus commented 6 years ago

So, given we have an oc package command (which contains the _package folder), perhaps I would name this --skip-package - so it would just publish whatever is inside _package (skipping the dependencies' check and all of that). What do you think?

elboletaire commented 6 years ago

I don't know the internals like you, so I guess your argument will probably fit better than mine :_D

matteofigus commented 5 years ago

@elboletaire look at @NimaSoroush's PR that we just merged. Sounds like very similar but for packaging (skips install and does symlinking) https://github.com/opencomponents/oc/pull/971

elboletaire commented 5 years ago

Thanks @matteofigus. Thing is I wasn't able to dedicate more time to this since last time, but I'll look into it as soon as I've time again :smiley:

ricardo-devis-agullo commented 3 years ago

I was thinking on taking on this issue and I think there's 3 use cases to consider when doing this new command.

1. Mirroring what publish does on the same component

oc package your-component-folder oc publish your-component-folder --skip-package

In this case the scenario is you have your component, you package first, it creates the _package folder, so when you run the second command, it just tries to find a _package folder inside, and then it will compress, and publish it.

2. Publishing the folder itself

oc package your-component-folder ... store the _package folder somewhere to be published later oc publish _package --skip-package

In this case, the component is already gone, as we only stored the artifact of the package to be deployed/published at a later stage. So here the CLI will see that there's no _package folder inside of your path, so will try to find a package.json inside, and if there is one, check that we are on a compiled package (checking that theres an oc.packaged = true could do the trick here) and publish those files.

3. Publishing a compressed file

oc package your-component-folder --compress ... store the tar.gz file somewhere to be published later oc publish your-file.tar.gz

Similar to the case 2 but here we also compress and we want to publish that file. In this case I don't see the point of skipping package, since CLI could already assume that if the path is of a compressed file, you just want to publish that.

Does this approach make sense?