Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25418] Android: Module build will fail if documentation folder contains non-markdown files

GitHub Issuen/a
TypeImprovement
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2018-05-01T17:13:18.000+0000
Affected Version/sRelease 7.0.1
Fix Version/sRelease 7.3.0
ComponentsAndroid
Labelsandroid, build-tools, module
ReporterMichael Gangolf
AssigneeHans Knöchel
Created2017-09-25T17:26:19.000+0000
Updated2018-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

Comments

  1. Lorenzo Piccinini 2017-10-30

    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
  2. Hans Knöchel 2018-01-28

    Ok, so here is the thing. Different to other (meta) directories, the documentation directory 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.
  3. Hans Knöchel 2018-01-28

    PR: https://github.com/appcelerator/titanium_mobile/pull/9778 Test-case:

    Create a new Android module with appc new -t module

    Create a "documentation" directory in <module-name>/android/documentation

    Create an "index.md" with the following contents in it:

       

    Hello world

    Remote

    ![Image of Yaktocat](https://octodex.github.com/images/yaktocat.png)

    Local

    ![Hyperloop Logo](hyperloop-red.png)

    Copy the "hyperloop-red.png" from this ticket to the directory as well

    Package the module with appc run -p android --build-only

    Unzip the module from dist/ and observe that the documentation directory includes both the index.html and hyperloop-red.png files.

  4. Samir Mohammed 2018-06-27

    *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.md in the documentation directory

       

    Hello world

    Remote

    ![Image of Yaktocat](https://octodex.github.com/images/yaktocat.png)

    Local

    ![Hyperloop Logo](hyperloop-red.png)

    Added a hyperloop-red.png in to the same directory

    Packaged the module (Android)

    Unzipped the module (dist folder) and observed the documentation directory

    Able to see an open the index.md, hyperloop-red.png files

    Also able to package the module from https://github.com/nuno/TiCollectionView

    *Test Environment*
       APPC CLI: 7.0.4
       Operating System Name: Mac OS High Sierra
       Operating System Version: 10.13
       Node.js Version: 8.9.1
       Xcode 9.2
       

JSON Source