dalek-browser-chrome-canary
Advanced tools
Comparing version 0.0.5-2013-10-08-16-30-48 to 0.0.5-2013-10-17-09-22-01
@@ -104,11 +104,2 @@ DalekJS has a few very specific guidelines in addition | ||
### Branch from "wip" not "master" | ||
The "master" branch of the DalekJS repository is for | ||
production release code, and documentation updates only. Never | ||
create a pull request from the master branch. Always create | ||
a branch for your work from the "wip" branch. This will | ||
facilitate easier pull request management for the continuous | ||
work that is done in the dev branch. | ||
### Submit Specs With Your Pull Request | ||
@@ -115,0 +106,0 @@ |
354
Gruntfile.js
@@ -1,2 +0,1 @@ | ||
/* jshint camelcase: false */ | ||
module.exports = function (grunt) { | ||
@@ -8,2 +7,6 @@ 'use strict'; | ||
// load generic configs | ||
var configs = require('dalek-build-tools'); | ||
// project config | ||
grunt.initConfig({ | ||
@@ -23,84 +26,19 @@ | ||
// clean automatically generated helper files & docs | ||
clean: { | ||
coverage: ['coverage', 'report/coverage'], | ||
report: ['report/complexity', 'report/api', 'report/docs'], | ||
reportZip: ['report.zip'] | ||
}, | ||
clean: configs.clean, | ||
// speed up build by defining concurrent tasks | ||
concurrent: { | ||
test: ['lint', 'mochaTest', 'complexity'], | ||
docs: ['plato', 'documantix', 'yuidoc'] | ||
}, | ||
concurrent: configs.concurrent, | ||
// linting | ||
jshint: { | ||
options: { | ||
jshintrc: '.jshintrc' | ||
}, | ||
all: '<%= src.lint %>' | ||
}, | ||
jshint: configs.jshint, | ||
// testing | ||
mochaTest: { | ||
test: { | ||
options: { | ||
reporter: 'spec', | ||
require: 'coverage/blanket' | ||
}, | ||
src: '<%= src.test %>' | ||
}, | ||
coverage: { | ||
options: { | ||
reporter: 'html-cov', | ||
quiet: true, | ||
captureFile: 'report/coverage/index.html' | ||
}, | ||
src: '<%= src.test %>' | ||
}, | ||
jsoncoverage: { | ||
options: { | ||
reporter: 'json-cov', | ||
quiet: true, | ||
captureFile: 'report/coverage/coverage.json' | ||
}, | ||
src: '<%= src.test %>' | ||
} | ||
}, | ||
mochaTest: configs.mocha, | ||
// code metrics | ||
complexity: { | ||
generic: { | ||
src: '<%= src.complexity %>', | ||
options: { | ||
cyclomatic: 5, | ||
halstead: 20, | ||
maintainability: 100 | ||
} | ||
} | ||
}, | ||
plato: { | ||
generic: { | ||
options : { | ||
jshint : grunt.file.readJSON('.jshintrc') | ||
}, | ||
files: { | ||
'report/complexity': '<%= src.complexity %>', | ||
} | ||
} | ||
}, | ||
complexity: configs.complexity, | ||
plato: configs.plato(grunt.file.readJSON('.jshintrc')), | ||
// api docs | ||
yuidoc: { | ||
compile: { | ||
name: '<%= pkg.name %>', | ||
description: '<%= pkg.description %>', | ||
version: '<%= pkg.version %>', | ||
url: '<%= pkg.homepage %>', | ||
options: { | ||
paths: '.', | ||
outdir: 'report/api' | ||
} | ||
} | ||
}, | ||
yuidoc: configs.yuidocs(), | ||
@@ -136,245 +74,69 @@ // user docs | ||
// up version, tag & commit | ||
bump: { | ||
options: { | ||
files: ['package.json'], | ||
commit: true, | ||
commitMessage: 'Release v%VERSION%', | ||
commitFiles: ['package.json'], | ||
createTag: true, | ||
tagName: '%VERSION%', | ||
tagMessage: '%VERSION%', | ||
push: true, | ||
pushTo: 'git@github.com:dalekjs/dalek-browser-chrome.git' | ||
} | ||
}, | ||
bump: configs.bump({ | ||
pushTo: 'git@github.com:dalekjs/dalek-browser-chrome.git', | ||
files: ['package.json', 'CONTRIBUTORS.md', 'CHANGELOG.md'] | ||
}), | ||
// generate contributors file | ||
contributors: configs.contributors, | ||
// compress artifacts | ||
compress: { | ||
main: { | ||
options: { | ||
archive: 'report.zip' | ||
}, | ||
compress: configs.compress, | ||
// prepare files for grunt-plato to | ||
// avoid error messages (weird issue...) | ||
preparePlato: { | ||
options: { | ||
folders: [ | ||
'coverage', | ||
'report', | ||
'report/coverage', | ||
'report/complexity', | ||
'report/complexity/files', | ||
'report/complexity/files/index_js' | ||
], | ||
files: [ | ||
{src: ['report/**'], dest: '/'} | ||
'report.history.json', | ||
'files/index_js/report.history.json' | ||
] | ||
} | ||
} | ||
}, | ||
}); | ||
// prepare files & folders for grunt:plato & coverage | ||
grunt.registerTask('preparePlato', function () { | ||
var fs = require('fs'); | ||
var platoDummyFolders = ['report', 'report/coverage', 'report/complexity', 'report/complexity/files', 'report/complexity/files/test', 'report/complexity/files/index_js', 'report/complexity/files/install_js', 'report/complexity/files/lib_chromedriver_js']; | ||
var platoDummyFiles = ['/report/complexity/report.history.json', '/report/complexity/files/report.history.json', '/report/complexity/files/index_js/report.history.json', '/report/complexity/files/install_js/report.history.json', '/report/complexity/files/lib_chromedriver_js/report.history.json']; | ||
// loopy loop | ||
['/test/'].forEach(function (folder) { | ||
fs.readdirSync(__dirname + folder).forEach(function (file) { | ||
var platoFolder = '/report/complexity/files/' + folder.substring(1).replace(/\//g, '_') + file.replace('.js', '_js'); | ||
platoDummyFolders.push(platoFolder); | ||
platoDummyFiles.push(platoFolder + '/report.history.json'); | ||
}); | ||
}); | ||
// generate dirs for docs & reports | ||
platoDummyFolders.forEach(function (path) { | ||
if (!fs.existsSync(__dirname + '/' + path)) { | ||
fs.mkdirSync(__dirname + '/' + path); | ||
// prepare files & folders for coverage | ||
prepareCoverage: { | ||
options: { | ||
folders: ['coverage', 'report', 'report/coverage'], | ||
pattern: '[require("fs").realpathSync(__dirname + "/../index.js")]' | ||
} | ||
}); | ||
}, | ||
// store some dummy reports, so that grunt plato doesnt complain | ||
platoDummyFiles.forEach(function (file) { | ||
if (!fs.existsSync(__dirname + file)) { | ||
fs.writeFileSync(__dirname + file, '{}'); | ||
// list requires that need to be changed | ||
// for generating a canary build | ||
'release-canary': { | ||
options: { | ||
files: ['index.js'] | ||
} | ||
}); | ||
}); | ||
// prepare files & folders for coverage | ||
grunt.registerTask('prepareCoverage', function () { | ||
var fs = require('fs'); | ||
// generate folders | ||
['coverage', 'report', 'report/coverage'].forEach(function (folder) { | ||
if (!fs.existsSync(__dirname + '/' + folder)) { | ||
fs.mkdirSync(__dirname + '/' + folder); | ||
} | ||
}); | ||
// generate code coverage helper file | ||
var coverageHelper = 'require("blanket")({pattern: [require("fs").realpathSync(__dirname + "/../index.js"), require("fs").realpathSync(__dirname + "/../lib/")]});'; | ||
if (!fs.existsSync(__dirname + '/coverage/blanket.js')) { | ||
fs.writeFileSync(__dirname + '/coverage/blanket.js', coverageHelper); | ||
} | ||
}); | ||
// generates a coverage badge | ||
grunt.registerTask('generateCoverageBadge', function () { | ||
var fs = require('fs'); | ||
if (fs.existsSync(__dirname + '/node_modules/coverage-badge')) { | ||
if (fs.existsSync(__dirname + '/report/coverage/coverage.json')) { | ||
var green = [147,188,59]; | ||
var yellow = [166,157,0]; | ||
var red = [189,0,2]; | ||
var getColor = function (coverage) { | ||
if (coverage > 90) { | ||
return mixColors(yellow, green, (coverage-90)/10); | ||
} | ||
if (coverage > 80) { | ||
return mixColors(red, yellow, (coverage-80)/10); | ||
} | ||
return createColor(red); | ||
}; | ||
var mixColors = function (from, to, ratio) { | ||
var result = [], i; | ||
for (i=0; i<3; i++) { | ||
result[i] = Math.round(from[i] + (ratio * (to[i]-from[i]))); | ||
} | ||
return createColor(result); | ||
}; | ||
var createColor = function (values) { | ||
return 'rgba('+values[0]+','+values[1]+','+values[2]+',1)'; | ||
}; | ||
var Badge = require(__dirname + '/node_modules/coverage-badge/lib/Badge.js'); | ||
var badgeFn = function(coverage) { | ||
coverage = Math.floor(Number(coverage)); | ||
var badge = new Badge({ | ||
box_color: getColor(coverage), | ||
box_text: coverage+'%', | ||
label_text: 'cov', | ||
height: 18, | ||
width: 49, | ||
box_width: 25, | ||
rounding: 0, | ||
padding: 0, | ||
label_font: '7pt DejaVu Sans', | ||
box_font: 'bold 7pt DejaVu Sans' | ||
}); | ||
return badge.stream(); | ||
}; | ||
var coverage = JSON.parse(fs.readFileSync(__dirname + '/report/coverage/coverage.json')).coverage; | ||
var file = fs.createWriteStream(__dirname + '/report/coverage/coverage.png'); | ||
badgeFn(coverage).pipe(file); | ||
} | ||
} | ||
}); | ||
// archives the docs if a new version appears | ||
grunt.registerTask('archive', function () { | ||
var done = this.async(); | ||
grunt.util.spawn({cmd: 'git', args: ['describe', '--abbrev=0', '--tags']}, function (error, result) { | ||
var lastTag = result.toString(); | ||
if (grunt.file.isFile('_raw/docs/' + lastTag + '/chrome.html')) { | ||
grunt.log.ok('Nothing to archive'); | ||
done(); | ||
return true; | ||
} | ||
if (!grunt.file.isDir('_raw/docs/' + lastTag)) { | ||
grunt.file.mkdir('_raw/docs/' + lastTag); | ||
} | ||
grunt.file.copy('report/docs/chrome.html', '_raw/docs/' + lastTag + '/chrome.html'); | ||
grunt.log.ok('Archived document with version: ' + lastTag); | ||
done(); | ||
}); | ||
}); | ||
// releases a new canary build | ||
grunt.registerTask('release-canary', function () { | ||
var done = this.async(); | ||
var pkg = grunt.config.get('pkg'); | ||
var canaryPkg = grunt.util._.clone(pkg); | ||
Object.keys(canaryPkg.dependencies).forEach(function (pack) { | ||
if (pack.search('dalek') !== -1) { | ||
delete canaryPkg.dependencies[pack]; | ||
canaryPkg.dependencies[pack + '-canary'] = 'latest'; | ||
} | ||
}); | ||
canaryPkg.name = canaryPkg.name + '-canary'; | ||
canaryPkg.version = canaryPkg.version + '-' + grunt.template.today('yyyy-mm-dd-HH-MM-ss'); | ||
grunt.file.write('package.json', JSON.stringify(canaryPkg, true, 2)); | ||
var npm = require('npm'); | ||
npm.load({}, function() { | ||
npm.registry.adduser(process.env.npmuser, process.env.npmpass, process.env.npmmail, function(err) { | ||
if (err) { | ||
grunt.log.error(err); | ||
grunt.file.write('package.json', JSON.stringify(pkg, true, 2)); | ||
done(false); | ||
} else { | ||
npm.config.set('email', process.env.npmmail, 'user'); | ||
npm.commands.publish([], function(err) { | ||
grunt.file.write('package.json', JSON.stringify(pkg, true, 2)); | ||
grunt.log.ok('Published canary build to registry'); | ||
done(!err); | ||
}); | ||
} | ||
}); | ||
}); | ||
}); | ||
// release a new version | ||
grunt.registerTask('release-package', function () { | ||
var done = this.async(); | ||
var http = require('http'); | ||
var pkg = grunt.config.get('pkg'); | ||
var body = ''; | ||
http.get('http://registry.npmjs.org/' + pkg.name, function(res) { | ||
res.on('data', function (data) { | ||
body += data; | ||
}); | ||
res.on('end', function () { | ||
var versions = grunt.util._.pluck(JSON.parse(body).versions, 'version'); | ||
var currVersion = parseInt(pkg.version.replace(/\./gi, ''), 10); | ||
var availableVersions = versions.map(function (version) { | ||
return parseInt(version.replace(/\./gi, ''), 10); | ||
}); | ||
if (!grunt.util._.contains(availableVersions, currVersion)) { | ||
var npm = require('npm'); | ||
npm.load({}, function() { | ||
npm.registry.adduser(process.env.npmuser, process.env.npmpass, process.env.npmmail, function(err) { | ||
if (err) { | ||
grunt.log.error(err); | ||
done(false); | ||
} else { | ||
npm.config.set('email', process.env.npmmail, 'user'); | ||
npm.commands.publish([], function(err) { | ||
grunt.log.ok('Released new version: ', pkg.version); | ||
done(!err); | ||
}); | ||
} | ||
}); | ||
}); | ||
} else { | ||
done(); | ||
} | ||
}); | ||
}); | ||
}); | ||
// load 3rd party tasks | ||
require('load-grunt-tasks')(grunt); | ||
grunt.loadTasks('./node_modules/dalek-build-tools/tasks'); | ||
// define runner tasks | ||
grunt.registerTask('lint', 'jshint'); | ||
// split test & docs for speed | ||
grunt.registerTask('test', ['clean:coverage', 'prepareCoverage', 'concurrent:test', 'generateCoverageBadge']); | ||
grunt.registerTask('docs', ['clean:reportZip', 'clean:report', 'preparePlato', 'concurrent:docs', 'includereplace', 'compress']); | ||
grunt.registerTask('docs', ['clean:reportZip', 'clean:report', 'preparePlato', 'concurrent:docs', 'compress']); | ||
// release tasks | ||
grunt.registerTask('releasePatch', ['test', 'bump-before:patch', 'contributors', 'changelog', 'bump-release:patch']); | ||
grunt.registerTask('releaseMinor', ['test', 'bump-before:minor', 'contributors', 'changelog', 'bump-release:minor']); | ||
grunt.registerTask('releaseMajor', ['test', 'bump-before:major', 'contributors', 'changelog', 'bump-release:major']); | ||
// clean, test, generate docs (the CI task) | ||
grunt.registerTask('all', ['clean', 'test', 'docs']); | ||
}; |
{ | ||
"name": "dalek-browser-chrome-canary", | ||
"version": "0.0.5-2013-10-08-16-30-48", | ||
"version": "0.0.5-2013-10-17-09-22-01", | ||
"description": "Google Chrome bindings for DalekJS", | ||
@@ -9,3 +9,3 @@ "homepage": "http://dalekjs.com", | ||
"adm-zip": "~0.4.3", | ||
"kew": "~0.1.7", | ||
"kew": "~0.2.2", | ||
"ncp": "~0.4.2", | ||
@@ -22,3 +22,3 @@ "npmconf": "~0.1.3", | ||
"grunt-contrib-yuidoc": "~0.5.0", | ||
"grunt-contrib-compress": "~0.5.1", | ||
"grunt-contrib-compress": "~0.5.2", | ||
"grunt-mocha-test": "~0.7.0", | ||
@@ -28,10 +28,12 @@ "grunt-complexity": "~0.1.3", | ||
"grunt-documantix": "~0.0.3", | ||
"grunt-include-replace": "~1.1.0", | ||
"grunt-include-replace": "~1.1.1", | ||
"grunt-git-contributors": "~0.1.4", | ||
"grunt-conventional-changelog": "~1.0.0", | ||
"grunt-concurrent": "~0.3.1", | ||
"grunt-concurrent": "~0.4.1", | ||
"grunt-bump": "~0.0.11", | ||
"load-grunt-tasks": "~0.1.0", | ||
"load-grunt-tasks": "~0.1.3", | ||
"dalek-build-tools": "~0.0.1", | ||
"time-grunt": "~0.1.1", | ||
"blanket": "~1.1.5", | ||
"chai": "~1.8.0" | ||
"chai": "~1.8.1" | ||
}, | ||
@@ -38,0 +40,0 @@ "scripts": { |
@@ -39,7 +39,7 @@ dalek-browser-chrome | ||
You can use the browser plugin by adding a config option to the your Dalekfile | ||
You can use the browser plugin by adding a config option to the your [Dalekfile](/pages/config.html) | ||
```js | ||
"browsers": ["chrome"] | ||
``` | ||
"browser": ["chrome"] | ||
``` | ||
@@ -52,2 +52,63 @@ Or you can tell Dalek that it should test in this browser via the command line: | ||
The Webdriver Server tries to open Port 9002 by default, | ||
if this port is blocked, it tries to use a port between 9003 & 9092 | ||
You can specifiy a different port from within your [Dalekfile](/pages/config.html) like so: | ||
``` | ||
"browsers": { | ||
"chrome": { | ||
"port": 5555 | ||
} | ||
} | ||
``` | ||
It is also possible to specify a range of ports: | ||
``` | ||
"browsers": { | ||
"chrome": { | ||
"portRange": [6100, 6120] | ||
} | ||
} | ||
``` | ||
If you would like to test Chrome Canary oder Chromium releases, you can simply apply a snd. argument, | ||
which defines the browser type: | ||
``` | ||
$ dalek mytest.js -b chrome:canary | ||
``` | ||
for canary, and if you would like to use chromium, just append `:chromium`: | ||
``` | ||
$ dalek mytest.js -b chrome:chromium | ||
``` | ||
This will only work if you installed your browser in the default locations, | ||
if the browsers binary is located in a non default location, you are able to specify | ||
its location in your [Dalekfile](/pages/config.html): | ||
```javascript | ||
"browsers": { | ||
"chrome": { | ||
"binary": "/Applications/Custom Located Chrome.app/MacOS/Contents/Chrome" | ||
} | ||
} | ||
``` | ||
This also works for the canary & chromium builds | ||
```javascript | ||
"browsers": { | ||
"chrome": { | ||
"binary": "/Applications/Custom Located Chrome.app/MacOS/Contents/Chrome" | ||
} | ||
} | ||
``` | ||
``` | ||
$ dalek mytest.js -b chrome | ||
``` | ||
## Help Is Just A Click Away | ||
@@ -54,0 +115,0 @@ |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
17
153
5
3
48818
19
1026
+ Addedkew@0.2.2(transitive)
- Removedkew@0.1.7(transitive)
Updatedkew@~0.2.2