Get gulp working

This commit is contained in:
Nathaniel van Diepen
2017-01-03 10:42:48 -07:00
parent 62de58d1ef
commit a4eed5da59
7 changed files with 97 additions and 71 deletions

2
.gitignore vendored
View File

@@ -26,7 +26,7 @@ node_modules
.DS_Store .DS_Store
vendor/ vendor/bower_components
.idea .idea

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "vendor/webextension-polyfill"]
path = vendor/webextension-polyfill
url = https://github.com/mozilla/webextension-polyfill.git

View File

@@ -1,6 +1,8 @@
var del = require('del'); var del = require('del');
var gulp = require('gulp'); var gulp = require('gulp');
var elixir = require('laravel-elixir'); 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 //so we remove them on postinstall
del('node_modules/**/*.pem', cb); 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.config.assetsPath = 'assets/';
elixir.extend('webextension', function(){
return gulp.start('webextension');
});
elixir(function (mix) { elixir(function (mix) {
mix.webextension();
mix.copy('vendor/bower_components/bootstrap/less', 'assets/less/bootstrap'); 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/less', 'assets/less/font-awesome');
mix.copy('vendor/bower_components/font-awesome/fonts', 'public/fonts'); mix.copy('vendor/bower_components/font-awesome/fonts', 'public/fonts');
mix.less('app.less'); mix.less('app.less');
mix.browserify('app.jsx', 'public/js/app.js', 'assets/js'); mix.browserify('app.jsx', 'public/js/app.js', 'assets/js');
mix.browserify('events.js', 'public/js/events.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('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');*/
}); });

View File

@@ -20,6 +20,7 @@
], ],
"background": { "background": {
"scripts": [ "scripts": [
"public/js/browser-polyfill.min.js"
"public/js/events.js" "public/js/events.js"
], ],
"persistent": false "persistent": false
@@ -36,7 +37,7 @@
"page": "options.html", "page": "options.html",
"chrome_style": false "chrome_style": false
}, },
"applicaitons": { "applications": {
"gecko": { "gecko": {
"id": "addon@wakatime.com" "id": "addon@wakatime.com"
} }

View File

@@ -1,67 +1,67 @@
{ {
"scripts": { "scripts": {
"test": "jest --verbose --coverage && mocha --compilers js:mocha-traceur tests/**/*.spec.js", "test": "jest --verbose --coverage && mocha --compilers js:mocha-traceur tests/**/*.spec.js",
"test-react": "jest --verbose --coverage", "test-react": "jest --verbose --coverage",
"test-js": "node_modules/.bin/phantomjs tests/run.js", "test-js": "node_modules/.bin/phantomjs tests/run.js",
"start": "npm install && bower install && gulp", "start": "npm install && bower install && gulp",
"gulp": "gulp", "gulp": "gulp",
"watch": "gulp watch", "watch": "gulp watch",
"lint": "jsxhint --jsx-only .", "lint": "jsxhint --jsx-only .",
"postinstall": "gulp postinstall", "postinstall": "gulp postinstall",
"validate": "npm ls" "validate": "npm ls"
}, },
"pre-commit": [ "pre-commit": [
"lint" "lint"
], ],
"jest": { "jest": {
"testFileExtensions": [ "testFileExtensions": [
"jest.js" "jest.js"
], ],
"scriptPreprocessor": "<rootDir>/node_modules/babel-jest", "scriptPreprocessor": "<rootDir>/node_modules/babel-jest",
"testDirectoryName": "tests", "testDirectoryName": "tests",
"unmockedModulePathPatterns": [ "unmockedModulePathPatterns": [
"<rootDir>/node_modules/react" "<rootDir>/node_modules/react"
] ]
}, },
"private": true, "private": true,
"devDependencies": { "devDependencies": {
"babel-jest": "^13.0.0", "babel-jest": "^13.0.0",
"bower": "^1.7.9", "bower": "^1.7.9",
"chai": "^3.5.0", "chai": "^3.5.0",
"del": "^2.2.1", "del": "^2.2.1",
"gulp": "^3.9.1", "gulp": "^3.9.1",
"jest-cli": "^13.0.0", "jest-cli": "^13.0.0",
"jshint": "^2.9.2", "jshint": "^2.9.2",
"jsxhint": "^0.15.1", "jsxhint": "^0.15.1",
"laravel-elixir": "^5.0.0", "laravel-elixir": "^5.0.0",
"mocha": "^2.5.3", "mocha": "^2.5.3",
"mocha-sinon": "^1.1.5", "mocha-sinon": "^1.1.5",
"mocha-traceur": "^2.1.0", "mocha-traceur": "^2.1.0",
"precommit-hook": "^3.0.0", "precommit-hook": "^3.0.0",
"sinon": "^1.17.4", "sinon": "^1.17.4",
"sinon-chai": "^2.8.0", "sinon-chai": "^2.8.0",
"sinon-chrome": "^1.1.2", "sinon-chrome": "^1.1.2",
"traceur": "^0.0.111" "traceur": "^0.0.111"
}, },
"dependencies": { "dependencies": {
"bootstrap": "^3.3.6", "bootstrap": "^3.3.6",
"classnames": "^2.2.5", "classnames": "^2.2.5",
"jquery": "^3.0.0", "jquery": "^3.0.0",
"moment": "^2.13.0", "moment": "^2.13.0",
"react": "^15.1.0", "react": "^15.1.0",
"react-addons-css-transition-group": "^15.1.0", "react-addons-css-transition-group": "^15.1.0",
"react-dom": "^15.1.0" "react-dom": "^15.1.0"
}, },
"jshintConfig": { "jshintConfig": {
"asi": false, "asi": false,
"browser": true, "browser": true,
"curly": false, "curly": false,
"expr": true, "expr": true,
"indent": 4, "indent": 4,
"loopfunc": true, "loopfunc": true,
"node": true, "node": true,
"trailing": true, "trailing": true,
"undef": true, "undef": true,
"white": true "white": true
} }
} }

View File

@@ -7,6 +7,7 @@
<title>WakaTime</title> <title>WakaTime</title>
<link href="public/css/app.css" rel="stylesheet"> <link href="public/css/app.css" rel="stylesheet">
<script src="public/js/browser-polyfill.min.js"></script>
</head> </head>
<body> <body>

1
vendor/webextension-polyfill vendored Submodule