-
Notifications
You must be signed in to change notification settings - Fork 28
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
Breaking changes in cordova-create #89
Comments
A few quick thoughts from skimming this, will try to give it a full read-through over the weekend. §2 Drop support for reading configuration from
|
@dpogue Regarding §8 I have used the Regarding maintenance: For its apparent use it's too much code IMO. With §7 it would be better and an implementation that just links the whole template would be even nicer of course. |
It seems it was planned to remove The reporter's requirements are to create a cordova project with $ cordova create bin com.example.domain APPNAME
$ rm -r bin/www && ln -sr www bin/www instead of $ cordova create bin com.example.domain APPNAME --link-to=www |
Right now, §7 and §8 are major impediments to a sane implementation of #69. Even if we cannot reduce the existing functionality as much as I would want to, I would really appreciate some kind of consensus on these items before continuing with apache/cordova-create#8. Especially the need for renaming to |
Agreed on my part.
Agreed, yes |
If we're doing this as a major version bump (which we would be for dropping node 4 support), then I'm in favour of saying we only support one template layout. We should also require template to have |
I just updated §4. Should I make this a PR document to make it easier to track changes? |
+1 on my part |
Closed in favor of separate proposals |
This reduces pollution of user's home directory and definitely makes the previously performed makeshift cache-busting obsolete since we fetch into a fresh temp directory every time. Addresses §6 of apache/cordova-discuss#89 Co-authored-by: Christopher J. Brody <[email protected]>
This reduces pollution of user's home directory and definitely makes the previously performed makeshift cache-busting obsolete since we fetch into a fresh temp directory every time. Addresses §6 of apache/cordova-discuss#89 Co-authored-by: Christopher J. Brody <[email protected]>
Recently I've done quite a lot of cleanup work in
cordova-create
(see apache/cordova-create/pull/13). This PR includes only non-breaking changes. However, IMHO there is still a lot of technical debt that can only be addressed by making some breaking changes.For most of these changes I already have some code in my local repo, so all of this could probably be implemented in short to no time. I'd just have to get it done before work hits again.
In what follows, let
cordovaCreate
be the anonymous function that is the main export of thecordova-create
package.TOC
cordovaCreate
([cordova-create] Simplify interface of main export (§1) #99)<dir>/.cordova/config.json
§1 Simplify arguments accepted by
cordovaCreate
Current situation
Arguments
Properties of
cfg
used incordovaCreate
¹¹: neither the
cfg
object nor parts larger than single leaf properties arepassed outside the scope of this module, so a local view on this is all we need.
Pain Points
Proposal
Arguments
Structure of
opts
§2 Drop support for reading configuration from
<dir>/.cordova/config.json
Current situation
Before doing anything interesting,
cordovaCreate
looks for the file<dir>/.cordova/config.json
. If it exists, its contents are parsed as JSON andmerged with
cfg
.Pain Points
cordova-create
)Proposal
Drop it like it's hot!
§3 New logic for setting attributes in package.json & config.xml
I'm talking about the logic behind setting the appropriate fields for App ID,
App Name and App Version in the files
package.json
andconfig.xml
.Current situation
The most common strategy is to set the attribute in both files iff a value for
it was given to
cordovaCreate
. Exceptions arepackage.json
: set attribute if value given else set tohelloworld
1.0.0
Pain Points
0.1.0
)Proposal
For every file
f
and every attributeattr
, do the followingwhere
isRequired
would have to be defined adequatelyand
handleMissingRequiredAttribute
could either:f
(possibly warn thatf
is invalid)Related issues
CB-12274 - widget version number not copied from template config.xml file
§4 Do not subscribe CordovaLogger to Cordova events
Current situation
Right at the start,
cordovaCreate
calls the following function with theextEvents
argument passed to it.Pain Points
cordovaCreate
w/outextEvents
subscribesCordovaLogger
toevents
again w/ no possibility to unsubscribe it.cordovaCreate
is tightly coupled to the Cordova event bus singleton.Proposal
I don't know much about the established patterns to use the Cordova event bus,
but the following would make sense to me as replacements for
setupEvents
incordovaCreate
:1. Send events to
cordova-common
'sevents
Forwarding events makes no sense in this case. If we emit events to a global event bus, we don't need to provide the service to setup event forwarding for callers. The callers could just call
events.forwardEventsTo(extEvents)
themselves. The forwarding we setup isn't scoped tocordovaCreate
either.2. Only emit events if an
EventEmitter
was passed tocordovaCreate
This would break the coupling to the global event bus and enable callers to subscribe to
cordovaCreate
events only.§5 Update required template files/dirs
Some files and dirs are copied to
dest
fromcordova-app-hello-world
if theyare not present in the used template.
Current situation
These files and dirs are:
www
hooks
config.xml
Pain Points
hooks
dir has been deprecated for a long time and is created w/ every new cordova apppackage.json
could initially be missing from an appProposal
A: Remove this behavior (Preferred)
cordovaCreate
more agnostic to the template layoutB: Update this behavior
Update required files and dirs to:
www
(not even sure if this is necessary)config.xml
package.json
Related
#78
§6 Fetch templates to system temp dir
Current situation
cordovaCreate
usescordova-fetch
to save any remote templates to$HOME/.cordova
before copying the assets to the created app.Pain Points
Proposal
Fetch templates to system temp dir w/ cleanup on process exit (provided by
tmp
package).This functionality might even be provided by
cordova-fetch
itself.I don't even think this one would be a breaking change, but I'm not sure so it is included here.
§7 Reduce supported template layouts
Current situation
cordovaCreate
supports handling of at least three different layouts for thetemplates that are referenced by
url
. LetTEMPLATE
be the directory on disk thatcontains the resolved template. Then there are these three cases:
TEMPLATE
contains a proper template as documented in the template docscordovaCreate
will copy all contents ofTEMPLATE/template_src
todir
(simplified)cordovaCreate
will copy all contents ofTEMPLATE
except for some blacklisted² files todir
basename(TEMPLATE) === 'www'
cordovaCreate
will copyTEMPLATE
todir/www
Additionally
cordovaCreate
still handles (and corrects) the case thatconfig.xml
is located inTEMPLATE/www
instead ofTEMPLATE
.²:
package.json
,RELEASENOTES.md
,.git
,NOTICE
,LICENSE
,COPYRIGHT
,.npmignore
Pain Points
Proposal
www/config.xml
.§8 Drop support for linking
I'm not so sure about this one, but after all this is called cordova-discuss, right?
Current situation
Ignoring all special cases of §7,
cordovaCreate
w/ enabledlink
option willwww
,merges
andhooks
config.xml
Pain Points
Even if there are some, this does not seem like something that is used often.
Is there any telemetry data on this?
hooks
is deprecatedProposal
Drop it.
Conclusion
Let me break all the things! 😉
The text was updated successfully, but these errors were encountered: