Skip to content
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

fix(android): exclude JS in HTML files from processing #11214

Merged
merged 2 commits into from
Sep 16, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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