[TIMOB-25418] Android: Module build will fail if documentation folder contains non-markdown files
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | Critical |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2018-05-01T17:13:18.000+0000 |
| Affected Version/s | Release 7.0.1 |
| Fix Version/s | Release 7.3.0 |
| Components | Android |
| Labels | android, build-tools, module |
| Reporter | Michael Gangolf |
| Assignee | Hans Knöchel |
| Created | 2017-09-25T17:26:19.000+0000 |
| Updated | 2018-06-27T14:26:16.000+0000 |
Description
When trying to compile this Android module: https://github.com/nuno/TiCollectionView the current CLI will stop at
[INFO] Packaging the module
because the documentation folder (https://github.com/nuno/TiCollectionView/tree/master/android/documentation) contains images.
The _buildModule.js tries to generate markdown out of the files at
https://github.com/appcelerator/titanium_mobile/blob/b56b146871238abe931333ead44b5b5b027e877f/android/cli/commands/_buildModule.js
Since I'm not sure what files are allowed in this folder a fix would be to exclude images:
if (fs.statSync(currentFile).isFile() &&
currentFile.indexOf(".png") == -1 &&
currentFile.indexOf(".gif") == -1) {
var obj = {},
contents = fs.readFileSync(currentFile).toString();
obj[file] = markdown.toHTML(contents);
this.documentation.push(obj);
}
or only allow .md files (or even .txt)
if (fs.statSync(currentFile).isFile() &&
(currentFile.indexOf(".md") != -1 ||
currentFile.indexOf(".txt") != -1)) {
var obj = {},
contents = fs.readFileSync(currentFile).toString();
obj[file] = markdown.toHTML(contents);
this.documentation.push(obj);
}
Ti 6.2.2.GA
I have different problem. TiCollectionView module works so good in iOS but there is little bug in android version and it doesn't works in Vanilla style project (Alloy version it seems works fine). Can someone try to solve it? I'm not able to do it. Best regards
Ok, so here is the thing. Different to other (meta) directories, the
documentationdirectory is meant to only store markdown files, as module build generates HTML docs based on those, like Michael stated above. So I would either propose to warn/error if there are other files or skip them for generation but include them in the generated docs, because the markdown files may have a reference to assets like images in them.PR: https://github.com/appcelerator/titanium_mobile/pull/9778 Test-case:
Create a new Android module with
appc new -t moduleCreate a "documentation" directory in
<module-name>/android/documentationCreate an "index.md" with the following contents in it:
Copy the "hyperloop-red.png" from this ticket to the directory as well
Package the module with
appc run -p android --build-onlyUnzip the module from dist/ and observe that the
documentationdirectory includes both the index.html and hyperloop-red.png files.*Closing ticket.* Verified fix can be seen in SDK Version:
7.3.0.v20180625114905*FR (Passed) Test Steps:*Created an Android Module through the CLI
Added the following content to the
index.mdin thedocumentationdirectoryAdded a
hyperloop-red.pngin to the same directoryPackaged the module (Android)
Unzipped the module (dist folder) and observed the
documentationdirectoryAble to see an open the
index.md,hyperloop-red.pngfilesAlso able to package the module from https://github.com/nuno/TiCollectionView
*Test Environment*