Lint tools/*.js

This commit is contained in:
ccd0 2016-04-12 00:13:41 -07:00
parent 5445327302
commit 73bd06389d
5 changed files with 22 additions and 17 deletions

17
.gitignore vendored
View File

@ -2,12 +2,11 @@ node_modules/
*~ *~
*.db *.db
*.DS_Store *.DS_Store
tmp/ /tmp/
testbuilds/ /testbuilds/
test.html /test.html
captchas.html /captchas.html
install.json /install.json
Gruntfile.js /.jshintrc
.jshintrc /.tests_enabled
.tests_enabled /.events
.events

6
tools/.jshintrc Normal file
View File

@ -0,0 +1,6 @@
{
"esnext": true,
"undef": true,
"unused": true,
"node": true
}

View File

@ -1,8 +1,8 @@
var fs = require('fs-extra'); var fs = require('fs-extra');
var installMap = fs.readJsonSync('install.json'); var installMap = fs.readJsonSync('install.json');
for (src in installMap) { for (var src in installMap) {
for (dest of installMap[src]) { for (var dest of installMap[src]) {
fs.copySync(src, dest); fs.copySync(src, dest);
} }
} }

View File

@ -1,14 +1,14 @@
fs = require('fs'); var fs = require('fs');
crx = require('crx'); var crx = require('crx');
var pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); var pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
var channel = process.argv[2] || ''; var channel = process.argv[2] || '';
var privateKey = fs.readFileSync(`../${pkg.meta.path}.keys/${pkg.name}.pem`) var privateKey = fs.readFileSync(`../${pkg.meta.path}.keys/${pkg.name}.pem`);
var archive = fs.readFileSync(`testbuilds/${pkg.name}${channel}.crx.zip`); var archive = fs.readFileSync(`testbuilds/${pkg.name}${channel}.crx.zip`);
var extension = new crx({privateKey, loaded: true}); var extension = new crx({privateKey, loaded: true});
extension.pack(archive).then((data) => extension.pack(archive).then((data) =>
fs.writeFileSync(`testbuilds/${pkg.name}${channel}.crx`, data) fs.writeFileSync(`testbuilds/${pkg.name}${channel}.crx`, data)
).catch(function(err) { ).catch(function() {
process.exit(1); process.exit(1);
}); });

View File

@ -6,14 +6,14 @@ var v = JSON.parse(fs.readFileSync('version.json', 'utf8'));
var channel = process.argv[2] || ''; var channel = process.argv[2] || '';
var zip = new JSZip(); var zip = new JSZip();
for (file of ['eventPage.js', 'icon128.png', 'icon16.png', 'icon48.png', 'manifest.json', 'script.js']) { for (var file of ['eventPage.js', 'icon128.png', 'icon16.png', 'icon48.png', 'manifest.json', 'script.js']) {
zip.file( zip.file(
file, file,
fs.readFileSync(`testbuilds/crx${channel}/${file}`), fs.readFileSync(`testbuilds/crx${channel}/${file}`),
{date: new Date(v.date)} {date: new Date(v.date)}
); );
} }
output = zip.generate({ var output = zip.generate({
type: 'nodebuffer', type: 'nodebuffer',
compression: 'DEFLATE', compression: 'DEFLATE',
compressionOptions: {level: 9}, compressionOptions: {level: 9},