Moved all the files around and added livereloading to the extension.

test-unit-sauce
Frost 10 years ago committed by Brian Ford
parent 4741ed559f
commit a68c9b7724

@ -4,17 +4,28 @@ var markdown = require('marked'),
module.exports = function(grunt) { module.exports = function(grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
// Configurable paths
var config = {
app: 'app',
dist: 'dist',
manifest: grunt.file.readJSON('app/manifest.json')
};
grunt.initConfig({ grunt.initConfig({
pkg: grunt.file.readJSON('manifest.json'), config: config,
pkg: grunt.file.readJSON('app/manifest.json'),
changelog: { changelog: {
options: { options: {
dest: 'CHANGELOG.md', dest: 'CHANGELOG.md',
versionFile: 'manifest.json' versionFile: 'app/manifest.json'
} }
}, },
bump: { bump: {
options: { options: {
file: 'manifest.json' file: 'app/manifest.json'
} }
}, },
markdown: { markdown: {
@ -29,27 +40,74 @@ module.exports = function(grunt) {
tagName: 'v<%= version %>', tagName: 'v<%= version %>',
bump: false, // we have out own bump bump: false, // we have out own bump
npm: false, npm: false,
file: 'manifest.json' file: 'app/manifest.json'
} }
}, },
stage: { stage: {
files: ['CHANGELOG.md', 'pane/help.html'] files: ['CHANGELOG.md', 'panes/help.html']
}, },
zip: { zip: {
release: { release: {
src: [ src: [
'devtools-panel/css/*.css', 'app/devtools-panel/css/*.css',
'devtools-panel/img/**', 'app/devtools-panel/img/**',
'devtools-panel/js/**', 'app/devtools-panel/js/**',
'devtools-panel/panes/*.html', 'app/devtools-panel/panes/*.html',
'devtools-panel/panel.html', 'app/devtools-panel/panel.html',
'LICENSE', 'LICENSE',
'manifest.json', 'app/manifest.json',
'background.html', 'app/background/**',
'devtoolsBackground.html' '!app/background/chromereload.js',
'app/content-scripts/inject.build.js',
'app/bower_components/angular/angular.js',
'app/bower_components/angular-mocks/angular-mocks.js',
'app/bower_components/jquery/jquery.js',,
'app/bower_components/d3/d3.min.js'
], ],
dest: 'batarang-release-' + Date.now() + '.zip' dest: 'batarang-release-' + Date.now() + '.zip'
} }
},
watch: {
inline: {
options: {
livereload: true
},
files: ['scripts/inline.js','app/content-scripts/**/*.js', '!app/content-scripts/inject.build.js'],
tasks: ['inline']
},
scripts: {
options: {
livereload: true
},
files: ['app/devtools-panel/**/*.*','app/content-scripts/inject.build.js','app/background/**','app/content-scripts/**'],
tasks: []
}
},
// Grunt server and debug server setting
connect: {
options: {
port: 9000,
livereload: 35729,
// change this to '0.0.0.0' to access the server from outside
hostname: 'localhost'
},
chrome: {
options: {
open: false,
base: [
'<%= config.app %>'
]
}
},
test: {
options: {
open: false,
base: [
'test',
'<%= config.app %>'
]
}
}
} }
}); });
@ -103,12 +161,10 @@ module.exports = function(grunt) {
grunt.registerTask('inline', '...', require('./scripts/inline')); grunt.registerTask('inline', '...', require('./scripts/inline'));
grunt.loadNpmTasks('grunt-release');
grunt.loadNpmTasks('grunt-zip');
grunt.loadNpmTasks('grunt-conventional-changelog');
grunt.registerTask('release', ['bump', 'markdown', 'changelog', 'release', 'zip']); grunt.registerTask('release', ['bump', 'markdown', 'changelog', 'release', 'zip']);
grunt.registerTask('build', ['markdown', 'inline']); grunt.registerTask('build', ['markdown', 'inline']);
grunt.registerTask('default', ['build']); grunt.registerTask('default', ['build']);
grunt.registerTask('debug', ['connect:chrome', 'watch'])
}; };

@ -1,5 +1,6 @@
<html> <html>
<body> <body>
<script src="background.js"></script> <script src="background.js"></script>
<script src="chromereload.js"></script>
</body> </body>
</html> </html>

@ -1,4 +1,4 @@
console.log("LOADING BATARANG BACKGROUND.JS");
// scopes need to be cached here so that if the devtools connects, // scopes need to be cached here so that if the devtools connects,
// the list of scopes can be immediately populated // the list of scopes can be immediately populated
// TODO: clear this on refresh ? // TODO: clear this on refresh ?

@ -0,0 +1,23 @@
'use strict';
// Reload client for Chrome Apps & Extensions.
// The reload client has a compatibility with livereload.
// WARNING: only supports reload command.
var LIVERELOAD_HOST = 'localhost:';
var LIVERELOAD_PORT = 35729;
var connection = new WebSocket('ws://' + LIVERELOAD_HOST + LIVERELOAD_PORT + '/livereload');
connection.onerror = function (error) {
console.log('reload connection got error' + JSON.stringify(error));
};
connection.onmessage = function (e) {
if (e.data) {
var data = JSON.parse(e.data);
if (data && data.command === 'reload') {
chrome.runtime.reload();
}
}
};

@ -0,0 +1,5 @@
<html>
<body>
<script type="text/javascript" src="devtoolsBackground.js"></script>
</body>
</html>

@ -7,6 +7,8 @@
* *
*/ */
console.log('Test')
var panels = chrome.devtools.panels; var panels = chrome.devtools.panels;
// The function below is executed in the context of the inspected page. // The function below is executed in the context of the inspected page.

@ -3,6 +3,7 @@
// but injects an 'instrumentation' script tag into the app context // but injects an 'instrumentation' script tag into the app context
// confusing, right? // confusing, right?
var instument = function instument (window) { var instument = function instument (window) {
// Helper to determine if the root 'ng' module has been loaded // Helper to determine if the root 'ng' module has been loaded
// window.angular may be available if the app is bootstrapped asynchronously, but 'ng' might // window.angular may be available if the app is bootstrapped asynchronously, but 'ng' might

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

Before

Width:  |  Height:  |  Size: 235 KiB

After

Width:  |  Height:  |  Size: 235 KiB

Before

Width:  |  Height:  |  Size: 155 KiB

After

Width:  |  Height:  |  Size: 155 KiB

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before

Width:  |  Height:  |  Size: 248 KiB

After

Width:  |  Height:  |  Size: 248 KiB

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 87 KiB

Before

Width:  |  Height:  |  Size: 200 KiB

After

Width:  |  Height:  |  Size: 200 KiB

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

@ -16,8 +16,8 @@
<!-- libs --> <!-- libs -->
<script src="/bower_components/angular/angular.js"></script> <script src="/bower_components/angular/angular.js"></script>
<script src="/bower_components/jquery/jquery.js"></script> <script src="/bower_components/jquery/jquery.js"></script>
<script src="js/lib/jquery-ui-1.8.21.custom.min.js"></script>
<script src="/bower_components/d3/d3.min.js"></script> <script src="/bower_components/d3/d3.min.js"></script>
<script src="js/lib/jquery-ui-1.8.21.custom.min.js"></script>
<script src="js/panelApp.js"></script> <script src="js/panelApp.js"></script>

@ -1,11 +1,11 @@
{ {
"name": "AngularJS Batarang", "name": "AngularJS Batarang",
"version": "0.4.3", "version": "0.5.0",
"description": "Extends the Developer Tools, adding tools for debugging and profiling AngularJS applications.", "description": "Extends the Developer Tools, adding tools for debugging and profiling AngularJS applications.",
"background": { "background": {
"page": "background.html" "page": "background/background.html"
}, },
"devtools_page": "devtoolsBackground.html", "devtools_page": "background/devtoolsBackground.html",
"manifest_version": 2, "manifest_version": 2,
"permissions": [ "permissions": [
"tabs", "tabs",

@ -1,5 +0,0 @@
<html>
<body>
<script src="devtoolsBackground.js"></script>
</body>
</html>

@ -9,9 +9,9 @@ module.exports = function (config) {
files: [ files: [
'test/inject/mock/*.js', 'test/inject/mock/*.js',
'content-scripts/inject.build.js', 'app/content-scripts/inject.build.js',
'bower_components/angular/angular.js', 'app/bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js', 'app/bower_components/angular-mocks/angular-mocks.js',
'test/inject/*.js' 'test/inject/*.js'
], ],

@ -2,19 +2,34 @@
"name": "angularjs-batarang", "name": "angularjs-batarang",
"devDependencies": { "devDependencies": {
"grunt": "~0.4.1", "grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.1.1",
"grunt-conventional-changelog": "~0.1.2", "grunt-conventional-changelog": "~0.1.2",
"grunt-karma": "~0.4.3", "grunt-karma": "~0.4.3",
"grunt-bower-install": "~1.0.0",
"grunt-chrome-manifest": "~0.2.0",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-compress": "~0.5.3",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-cssmin": "~0.7.0",
"grunt-contrib-htmlmin": "~0.1.3",
"grunt-contrib-imagemin": "~0.5.0",
"grunt-contrib-jshint": "~0.7.0",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-watch": "~0.5.2",
"grunt-usemin": "~0.1.10",
"grunt-mocha": "~0.4.0",
"grunt-svgmin": "~0.2.0",
"grunt-concurrent": "~0.4.0",
"grunt-release": "https://github.com/btford/grunt-release/archive/feat-tag-name.tar.gz", "grunt-release": "https://github.com/btford/grunt-release/archive/feat-tag-name.tar.gz",
"marked": "~0.2.8",
"grunt-zip": "~0.7.0", "grunt-zip": "~0.7.0",
"marked": "~0.2.8",
"semver": "~1.1.4", "semver": "~1.1.4",
"rewire": "~2.0.0", "rewire": "~2.0.0",
"karma-phantomjs-launcher": "^0.1.3", "karma-phantomjs-launcher": "^0.1.3",
"karma-coverage": "^0.2.1", "load-grunt-tasks": "~0.2.0",
"karma": "^0.12.3", "time-grunt": "~0.2.0",
"karma-jasmine": "^0.1.5", "jshint-stylish": "~0.1.3"
"karma-chrome-launcher": "^0.1.3"
}, },
"scripts": { "scripts": {
"test": "echo 'write them'" "test": "echo 'write them'"

Some files were not shown because too many files have changed in this diff Show More