-
Notifications
You must be signed in to change notification settings - Fork 110
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
Support for importing an existing package.json with arbitrary fields … #58
base: master
Are you sure you want to change the base?
Conversation
wow. this is really annoying to do nicely in go... i'm working on a way of making it play nicely... its kinda ugly so far but i'll probably still push it soon so you can mess around with it. |
Try out the code in #59 It allows extra fields to exist in the package.json without them being clobbered. Its a step in the right direction (this is annoying to do in go for some reason :/ ) |
Will check it out. |
code from #59 is in master. |
Cool. Ive been slammed last couple of days. Will try it out soon |
@whyrusleeping, Finally had a chance to play with this still having the issue of
|
If I do:
I get something like this:
But then doing
This appears to be caused by |
@sterpe okay, so we either need to make gx okay with having As for the keywords and bugs fields, i'm totally okay changing those to objects so that they mesh well with npm stuff. |
I pushed a commit that fixes the keywords and bugs fields. |
Yeah, the only thing i was thinking was long term we don't want to have to be chasing compatibility with npm (or whoever else) on package.json spec. Does it make sense to just do package-gx.json or similar to avoid the overlap entirely? Sent from my iPhone
|
Or namespace all gx fields under gx property object Sent from my iPhone
|
@whyrusleeping I was just looking at the npm docs for
or, and I think you will love this :)
|
…during
gx init
.I'm principally a JS guy, which will probably be obvious :) but this is an attempt at this.
I've modified a few of the
PackageBase
properties to correspond 1-1 withnpm
fields where it made sense to overlap --keywords
,bugs
,repository
.I added a property
PackageBase.NonGxFields
which is just amap[string]interface{}
of any pre-existingpackage.json
.The problem I ran into, that I couldn't solve in the way I would want to in Go is, treating the
Package
struct created in agx-*
tool as{gxutils/pkgfile.go}.Package
. I guess there's no way to 'typeassert' in a really generic way in Go? Anway, I hackily solved the problem by having thegx-*
tool pass the ref to amap[string]interface{}
of the originalpackage.json
to gx.SavePackageFile as a third arg.I made some very minor modification to the
gx-js
tool here to support that change: sterpe/gx-js#1There's probably some way better Go-way to do it.