From a4eed5da59b198580e6df6f507845c3bfdc4d5ba Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Tue, 3 Jan 2017 10:42:48 -0700 Subject: [PATCH] Get gulp working --- .gitignore | 2 +- .gitmodules | 3 + gulpfile.js | 24 ++++++- manifest.json | 3 +- package.json | 134 +++++++++++++++++------------------ popup.html | 1 + vendor/webextension-polyfill | 1 + 7 files changed, 97 insertions(+), 71 deletions(-) create mode 100644 .gitmodules create mode 160000 vendor/webextension-polyfill diff --git a/.gitignore b/.gitignore index bd899bf..12046f0 100644 --- a/.gitignore +++ b/.gitignore @@ -26,7 +26,7 @@ node_modules .DS_Store -vendor/ +vendor/bower_components .idea diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..ec32671 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vendor/webextension-polyfill"] + path = vendor/webextension-polyfill + url = https://github.com/mozilla/webextension-polyfill.git diff --git a/gulpfile.js b/gulpfile.js index 3df2b22..0858b21 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,6 +1,8 @@ var del = require('del'); var gulp = require('gulp'); var elixir = require('laravel-elixir'); +var exec = require('child_process').exec; +var fs = require('fs'); /* |-------------------------------------------------------------------------- @@ -16,6 +18,19 @@ gulp.task('postinstall', function (cb) { //so we remove them on postinstall del('node_modules/**/*.pem', cb); }); +gulp.task('webextension',function(cb){ + exec('npm install',{ + cwd: 'vendor/webextension-polyfill/' + },function(){ + exec('grunt',{ + cwd: 'vendor/webextension-polyfill/' + },function(){ + var stream = fs.createWriteStream('public/js/browser-polyfill.min.js'); + stream.on('done',cb); + fs.createReadStream('vendor/webextension-polyfill/dist/browser-polyfill.min.js').pipe(stream); + }); + }); +}); /* |-------------------------------------------------------------------------- @@ -30,14 +45,19 @@ gulp.task('postinstall', function (cb) { elixir.config.assetsPath = 'assets/'; +elixir.extend('webextension', function(){ + return gulp.start('webextension'); +}); + elixir(function (mix) { + mix.webextension(); mix.copy('vendor/bower_components/bootstrap/less', 'assets/less/bootstrap'); - mix.copy('vendor/bower_components/bootstrap/fonts', 'public/fonts'); + /*mix.copy('vendor/bower_components/bootstrap/fonts', 'public/fonts'); mix.copy('vendor/bower_components/font-awesome/less', 'assets/less/font-awesome'); mix.copy('vendor/bower_components/font-awesome/fonts', 'public/fonts'); mix.less('app.less'); mix.browserify('app.jsx', 'public/js/app.js', 'assets/js'); mix.browserify('events.js', 'public/js/events.js', 'assets/js'); mix.browserify('options.jsx', 'public/js/options.js', 'assets/js'); - mix.browserify('devtools.js', 'public/js/devtools.js', 'assets/js'); + mix.browserify('devtools.js', 'public/js/devtools.js', 'assets/js');*/ }); diff --git a/manifest.json b/manifest.json index 04007b7..69e9b77 100644 --- a/manifest.json +++ b/manifest.json @@ -20,6 +20,7 @@ ], "background": { "scripts": [ + "public/js/browser-polyfill.min.js" "public/js/events.js" ], "persistent": false @@ -36,7 +37,7 @@ "page": "options.html", "chrome_style": false }, - "applicaitons": { + "applications": { "gecko": { "id": "addon@wakatime.com" } diff --git a/package.json b/package.json index 96a72fc..73b3c54 100644 --- a/package.json +++ b/package.json @@ -1,67 +1,67 @@ -{ - "scripts": { - "test": "jest --verbose --coverage && mocha --compilers js:mocha-traceur tests/**/*.spec.js", - "test-react": "jest --verbose --coverage", - "test-js": "node_modules/.bin/phantomjs tests/run.js", - "start": "npm install && bower install && gulp", - "gulp": "gulp", - "watch": "gulp watch", - "lint": "jsxhint --jsx-only .", - "postinstall": "gulp postinstall", - "validate": "npm ls" - }, - "pre-commit": [ - "lint" - ], - "jest": { - "testFileExtensions": [ - "jest.js" - ], - "scriptPreprocessor": "/node_modules/babel-jest", - "testDirectoryName": "tests", - "unmockedModulePathPatterns": [ - "/node_modules/react" - ] - }, - "private": true, - "devDependencies": { - "babel-jest": "^13.0.0", - "bower": "^1.7.9", - "chai": "^3.5.0", - "del": "^2.2.1", - "gulp": "^3.9.1", - "jest-cli": "^13.0.0", - "jshint": "^2.9.2", - "jsxhint": "^0.15.1", - "laravel-elixir": "^5.0.0", - "mocha": "^2.5.3", - "mocha-sinon": "^1.1.5", - "mocha-traceur": "^2.1.0", - "precommit-hook": "^3.0.0", - "sinon": "^1.17.4", - "sinon-chai": "^2.8.0", - "sinon-chrome": "^1.1.2", - "traceur": "^0.0.111" - }, - "dependencies": { - "bootstrap": "^3.3.6", - "classnames": "^2.2.5", - "jquery": "^3.0.0", - "moment": "^2.13.0", - "react": "^15.1.0", - "react-addons-css-transition-group": "^15.1.0", - "react-dom": "^15.1.0" - }, - "jshintConfig": { - "asi": false, - "browser": true, - "curly": false, - "expr": true, - "indent": 4, - "loopfunc": true, - "node": true, - "trailing": true, - "undef": true, - "white": true - } -} +{ + "scripts": { + "test": "jest --verbose --coverage && mocha --compilers js:mocha-traceur tests/**/*.spec.js", + "test-react": "jest --verbose --coverage", + "test-js": "node_modules/.bin/phantomjs tests/run.js", + "start": "npm install && bower install && gulp", + "gulp": "gulp", + "watch": "gulp watch", + "lint": "jsxhint --jsx-only .", + "postinstall": "gulp postinstall", + "validate": "npm ls" + }, + "pre-commit": [ + "lint" + ], + "jest": { + "testFileExtensions": [ + "jest.js" + ], + "scriptPreprocessor": "/node_modules/babel-jest", + "testDirectoryName": "tests", + "unmockedModulePathPatterns": [ + "/node_modules/react" + ] + }, + "private": true, + "devDependencies": { + "babel-jest": "^13.0.0", + "bower": "^1.7.9", + "chai": "^3.5.0", + "del": "^2.2.1", + "gulp": "^3.9.1", + "jest-cli": "^13.0.0", + "jshint": "^2.9.2", + "jsxhint": "^0.15.1", + "laravel-elixir": "^5.0.0", + "mocha": "^2.5.3", + "mocha-sinon": "^1.1.5", + "mocha-traceur": "^2.1.0", + "precommit-hook": "^3.0.0", + "sinon": "^1.17.4", + "sinon-chai": "^2.8.0", + "sinon-chrome": "^1.1.2", + "traceur": "^0.0.111" + }, + "dependencies": { + "bootstrap": "^3.3.6", + "classnames": "^2.2.5", + "jquery": "^3.0.0", + "moment": "^2.13.0", + "react": "^15.1.0", + "react-addons-css-transition-group": "^15.1.0", + "react-dom": "^15.1.0" + }, + "jshintConfig": { + "asi": false, + "browser": true, + "curly": false, + "expr": true, + "indent": 4, + "loopfunc": true, + "node": true, + "trailing": true, + "undef": true, + "white": true + } +} diff --git a/popup.html b/popup.html index 4c33949..d08c704 100644 --- a/popup.html +++ b/popup.html @@ -7,6 +7,7 @@ WakaTime + diff --git a/vendor/webextension-polyfill b/vendor/webextension-polyfill new file mode 160000 index 0000000..77af627 --- /dev/null +++ b/vendor/webextension-polyfill @@ -0,0 +1 @@ +Subproject commit 77af627d051e4a61273c65ef0272830feabbab45