You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by audreyso <gi...@git.apache.org> on 2017/05/26 16:47:36 UTC
[GitHub] cordova-browser pull request #30: CB-12804 : manifest.json added to browser ...
GitHub user audreyso opened a pull request:
https://github.com/apache/cordova-browser/pull/30
CB-12804 : manifest.json added to browser during create
<!--
Please make sure the checklist boxes are all checked before submitting the PR. The checklist
is intended as a quick reference, for complete details please see our Contributor Guidelines:
http://cordova.apache.org/contribute/contribute_guidelines.html
Thanks!
-->
### Platforms affected
### What does this PR do?
manifest.json added to browser during create
### What testing has been done on this change?
### Checklist
- [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database
- [X] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
- [X] Added automated test coverage as appropriate for this change.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/audreyso/cordova-browser CB-12804
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cordova-browser/pull/30.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #30
----
commit b63e9416fe7a1533f637987c3048994455059a37
Author: Audrey So <au...@apache.org>
Date: 2017-05-26T16:38:09Z
CB-12804 : manifest.json added to browser during create
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org
[GitHub] cordova-browser pull request #30: CB-12804 : manifest.json added to browser ...
Posted by macdonst <gi...@git.apache.org>.
Github user macdonst commented on a diff in the pull request:
https://github.com/apache/cordova-browser/pull/30#discussion_r119261228
--- Diff: bin/template/cordova/Api.js ---
@@ -96,6 +96,42 @@ Api.createPlatform = function (dest, config, options, events) {
events.emit('error','createPlatform is not callable from the browser project API.');
throw(e);
}
+
+ // Create manifest.json
+ var manifestJson;
+ var manifestJsonPath = path.join(dest,'manifest.json');
+
+ // Check if path exists and require manifestJsonPath.
+ if(fs.existsSync(manifestJsonPath)) {
+ try {
+ manifestJson = require(manifestJsonPath);
+ }
+ catch (e) {
+ console.log("error : " + e);
+ events.emit('error', 'unable to require manifest.json path.');
+ }
+ } else if (manifestJson === undefined) {
+ manifestJson = {};
+ if(config){
+ if(config.name()) {
+ manifestJson.name = config.name();
+ }
+ if(config.shortName()) {
+ manifestJson.short_name = config.shortName();
+ }
+ if(config.packageName()) {
+ manifestJson.version = config.packageName();
+ }
+ if(config.description()) {
+ manifestJson.description = config.description();
+ }
+ if(config.author()) {
+ manifestJson.author = config.author();
+ }
+ }
--- End diff --
Also, it may make sense to pull `manifest.theme_color` from `<preference name="StatusBarBackgroundColor" value="#000000" />`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org
[GitHub] cordova-browser pull request #30: CB-12804 : manifest.json added to browser ...
Posted by macdonst <gi...@git.apache.org>.
Github user macdonst commented on a diff in the pull request:
https://github.com/apache/cordova-browser/pull/30#discussion_r118943490
--- Diff: bin/template/cordova/Api.js ---
@@ -96,6 +96,40 @@ Api.createPlatform = function (dest, config, options, events) {
events.emit('error','createPlatform is not callable from the browser project API.');
throw(e);
}
+
+ // Create manifest.json
+ var manifestJson;
+ var manifestJsonPath = path.join(dest,'manifest.json');
+
+ // Check if path exists and require manifestJsonPath.
+ if(fs.existsSync(manifestJsonPath)) {
+ try {
+ manifestJson = require(manifestJsonPath);
+ }
+ catch (e) {
+ console.log("error : " + e);
+ events.emit('error', 'unable to require manifest.json path.');
+ }
+ } else if (manifestJson === undefined) {
+ manifestJson = {};
+ if(config){
+ if(config.name()) {
+ manifestJson.name = config.name();
+ }
+ if(config.packageName()) {
+ manifestJson.version = config.packageName();
+ }
+ if(config.description()) {
+ manifestJson.description = config.description();
+ }
+
+ if(config.author()) {
+ manifestJson.author = config.author();
+ }
+ }
--- End diff --
Should also add start url.
```
manifestJson.start_url = config.content();
```
I know the helper method content doesn't exist but getting the value of the src attribute of the content tag should be pretty easy.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org
[GitHub] cordova-browser issue #30: CB-12804 : manifest.json added to browser during ...
Posted by macdonst <gi...@git.apache.org>.
Github user macdonst commented on the issue:
https://github.com/apache/cordova-browser/pull/30
@audreyso looks good. Is there a follow up issue to read the `icon` tag from config.xml and add it to the manifest?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org
[GitHub] cordova-browser pull request #30: CB-12804 : manifest.json added to browser ...
Posted by macdonst <gi...@git.apache.org>.
Github user macdonst commented on a diff in the pull request:
https://github.com/apache/cordova-browser/pull/30#discussion_r119261009
--- Diff: bin/template/cordova/Api.js ---
@@ -96,6 +96,42 @@ Api.createPlatform = function (dest, config, options, events) {
events.emit('error','createPlatform is not callable from the browser project API.');
throw(e);
}
+
+ // Create manifest.json
+ var manifestJson;
+ var manifestJsonPath = path.join(dest,'manifest.json');
+
+ // Check if path exists and require manifestJsonPath.
+ if(fs.existsSync(manifestJsonPath)) {
+ try {
+ manifestJson = require(manifestJsonPath);
+ }
+ catch (e) {
+ console.log("error : " + e);
+ events.emit('error', 'unable to require manifest.json path.');
+ }
+ } else if (manifestJson === undefined) {
+ manifestJson = {};
+ if(config){
+ if(config.name()) {
+ manifestJson.name = config.name();
+ }
+ if(config.shortName()) {
+ manifestJson.short_name = config.shortName();
+ }
+ if(config.packageName()) {
+ manifestJson.version = config.packageName();
+ }
+ if(config.description()) {
+ manifestJson.description = config.description();
+ }
+ if(config.author()) {
+ manifestJson.author = config.author();
+ }
+ }
--- End diff --
For some reason, my review lost comments. I mentioned that we should add `manifest.start_url` which can be pulled from the `<content src="index.html" />` tag in config.xml
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org
[GitHub] cordova-browser pull request #30: CB-12804 : manifest.json added to browser ...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/cordova-browser/pull/30
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org
[GitHub] cordova-browser pull request #30: CB-12804 : manifest.json added to browser ...
Posted by macdonst <gi...@git.apache.org>.
Github user macdonst commented on a diff in the pull request:
https://github.com/apache/cordova-browser/pull/30#discussion_r118941014
--- Diff: bin/template/cordova/Api.js ---
@@ -96,6 +96,40 @@ Api.createPlatform = function (dest, config, options, events) {
events.emit('error','createPlatform is not callable from the browser project API.');
throw(e);
}
+
+ // Create manifest.json
+ var manifestJson;
+ var manifestJsonPath = path.join(dest,'manifest.json');
+
+ // Check if path exists and require manifestJsonPath.
+ if(fs.existsSync(manifestJsonPath)) {
+ try {
+ manifestJson = require(manifestJsonPath);
+ }
+ catch (e) {
+ console.log("error : " + e);
+ events.emit('error', 'unable to require manifest.json path.');
+ }
+ } else if (manifestJson === undefined) {
+ manifestJson = {};
+ if(config){
+ if(config.name()) {
+ manifestJson.name = config.name();
+ }
--- End diff --
We should add short name as well.
```
manifestJson.short_name = config.shortName();
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org