Skip to content

Commit

Permalink
fix(android): exclude JS in HTML files from processing (#11214)
Browse files Browse the repository at this point in the history
  • Loading branch information
janvennemann authored and keerthi1032 committed Sep 16, 2019
1 parent 50c645e commit bc45db4
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 25 deletions.
1 change: 1 addition & 0 deletions android/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2722,6 +2722,7 @@ AndroidBuilder.prototype.copyResources = function copyResources(next) {
const from = jsFiles[relPath];
const to = path.join(this.buildBinAssetsResourcesDir, relPath);
copyFile.call(this, from, to, next);
this.unmarkBuildDirFile(to);
};
}), done);

Expand Down
22 changes: 11 additions & 11 deletions cli/lib/tasks/process-js-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { IncrementalFileTask } = require('appc-tasks');
const crypto = require('crypto');
const fs = require('fs-extra');
const jsanalyze = require('node-titanium-sdk/lib/jsanalyze');
const nodeify = require('nodeify');
const path = require('path');
const pLimit = require('p-limit');
const { promisify } = require('util');
Expand Down Expand Up @@ -116,9 +117,7 @@ class ProcessJsTask extends IncrementalFileTask {

this.jsFiles = this.data.jsFiles;
this.jsBootstrapFiles.splice(0, 0, ...this.data.jsBootstrapFiles);
return Promise.all(Object.keys(this.jsFiles).map(relPath => {
return limit(() => this.processJsFile(this.jsFiles[relPath].src));
}));
return Promise.all(Array.from(this.inputFiles).map(filePath => limit(() => this.processJsFile(filePath))));
}

/**
Expand Down Expand Up @@ -153,16 +152,17 @@ class ProcessJsTask extends IncrementalFileTask {
return done();
}

this.transformAndCopy(source, from, to).then(() => {
this.data.contentHashes[from] = currentHash;
return done();
}).catch(e => {
// if we have a nicely formatted pointer to syntax error from babel, print it!
if (e.codeFrame) {
this.logger.error(e.codeFrame);
nodeify(this.transformAndCopy(source, from, to), (e) => {
if (e) {
// if we have a nicely formatted pointer to syntax error from babel, print it!
if (e.codeFrame) {
this.logger.error(e.codeFrame);
}
done(e);
}

done(e);
this.data.contentHashes[from] = currentHash;
return done();
});
});

Expand Down
62 changes: 49 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"dependencies": {
"adm-zip": "^0.4.11",
"appc-aar-tools": "^1.1.5",
"appc-tasks": "^1.0.1",
"appc-tasks": "^1.0.2",
"archiver": "^3.1.1",
"async": "^2.6.1",
"buffer-equal": "1.0.0",
Expand All @@ -78,6 +78,7 @@
"node-appc": "^0.3.4",
"node-titanium-sdk": "^3.2.1",
"node-uuid": "1.4.8",
"nodeify": "^1.0.1",
"p-limit": "^2.2.0",
"pngjs": "^3.4.0",
"request": "^2.87.0",
Expand Down

0 comments on commit bc45db4

Please sign in to comment.