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

fixes minor code problems, such as missing semicolons, etc. #26

Merged
merged 2 commits into from
Dec 18, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"curly": true,
"eqeqeq": true,
"undef": true,
"node": true
}
6 changes: 3 additions & 3 deletions bin/crx.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var join = path.join;

var cwd = process.cwd();

program.version(pkg.version)
program.version(pkg.version);
// coming soon
// .option("-x, --xml", "output autoupdate xml instead of extension ")

Expand Down Expand Up @@ -52,8 +52,8 @@ function keygen (dir, program) {
}

console.log('%s has been generated in %s', 'key.pem', dir);
})
})
});
});
}

function pack (dir, program) {
Expand Down
7 changes: 4 additions & 3 deletions src/crx.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require, process, Buffer, module */
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it for jshint purpose?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it tells JSHint that these symbols exist in the global namespace

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I see. Thanks 👍

I will add a .jshintrc with a node flag set to true once I merge this PR :-)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, as the branch is on this repo, you can also just reuse it and add the .jshintrc in here and close it together.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, just saw, the branch needs rebasing before anyway...

'use strict';

var fs = require("fs");
Expand Down Expand Up @@ -180,7 +181,7 @@ ChromeExtension.prototype = {
var allFiles = [];

if (!selfie.loaded) {
throw new Error('crx.load needs to be called first in order to prepare the workspace.')
throw new Error('crx.load needs to be called first in order to prepare the workspace.');
}

// the callback is called many times
Expand Down Expand Up @@ -243,7 +244,7 @@ ChromeExtension.prototype = {

var crx = new Buffer(length);

crx.write("Cr24" + Array(13).join("\x00"), "binary");
crx.write("Cr24" + new Array(13).join("\x00"), "binary");

crx[4] = 2;
crx.writeUInt32LE(keyLength, 8);
Expand Down Expand Up @@ -290,7 +291,7 @@ ChromeExtension.prototype = {
throw new Error("No URL provided for update.xml.");
}

return Buffer(
return new Buffer(
"<?xml version='1.0' encoding='UTF-8'?>\n" +
"<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>\n" +
" <app appid='" + (this.appId || this.generateAppId()) + "'>\n" +
Expand Down
3 changes: 3 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* global require, __dirname, Buffer */
'use strict';

var fs = require("fs");
var test = require("tape");
var ChromeExtension = require("../");
Expand Down