Skip to content

Commit e55b071

Browse files
committedNov 16, 2016
Build chrome-extension for gem
1 parent 811c36a commit e55b071

11 files changed

+87
-2
lines changed
 

‎.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ assets/css
88
*.log
99
dist
1010
temp
11-
npm-debug.log.*
11+
npm-debug.log.*
12+
gem-unpacked

‎assets/images/icon_128.png

1.91 KB
Loading

‎assets/images/icon_16.png

377 Bytes
Loading

‎assets/images/icon_32.png

643 Bytes
Loading

‎assets/images/icon_48.png

859 Bytes
Loading

‎chrome-specific/background.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
chrome.browserAction.onClicked.addListener((tab) => {
2+
chrome.browserAction.setPopup({
3+
'popup': 'popup.html'
4+
});
5+
});

‎chrome-specific/manifest.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name":"gem",
3+
"version":"0.0.1",
4+
"icons":{
5+
"16":"site/assets/images/icon_16.png",
6+
"32":"site/assets/images/icon_32.png",
7+
"48":"site/assets/images/icon_48.png",
8+
"128":"site/assets/images/icon_128.png"
9+
},
10+
"background": {
11+
"scripts": [ "background.js" ]
12+
},
13+
"web_accessible_resources": [
14+
"site/index.html"
15+
],
16+
"permissions": ["storage", "system.display", "<all_urls>", "https://appbaseio.auth0.com/*"],
17+
"manifest_version": 2,
18+
"offline_enabled":true,
19+
"browser_action": {
20+
"default_icon": "site/assets/images/icon_32.png",
21+
"default_title": "Gem"
22+
},
23+
"description": "GUI for Elasticsearch Mappings",
24+
"author": "Farhan Chauhan, appbase.io"
25+
}

‎chrome-specific/popup.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Dejavu</title>
6+
</head>
7+
<body>
8+
<div>
9+
Launch Dejavu
10+
</div>
11+
<script src="popup.js"></script>
12+
</body>
13+
</html>

‎chrome-specific/popup.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
chrome.tabs.getSelected(null, function(tab) {
2+
chrome.tabs.create({
3+
url: 'site/index.html'
4+
});
5+
});

‎gulpfile.js

+35
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,41 @@ gulp.task('move_js_depends', function() {
7878
.pipe(gulp.dest('dist/vendor'));
7979
});
8080

81+
82+
gulp.task('chromePreBuild', ['compact', 'chrome-specific_dir'], function() {
83+
});
84+
85+
gulp.task('chromeBuild', ['chromePreBuild'], function() {
86+
var dirs = [
87+
'app',
88+
'assets',
89+
'dist'
90+
];
91+
dirs.forEach(function(dir) {
92+
gulp.src([dir+'/**/*']).pipe(gulp.dest('./gem-unpacked/site/'+dir+'/'));
93+
});
94+
return gulp.src(['index.html']).pipe(gulp.dest('./gem-unpacked/site/'));
95+
});
96+
97+
// Move app director
98+
gulp.task('chrome_app', function() {
99+
return gulp.src(['app/**/*']).pipe(gulp.dest('./gem-unpacked/site/app/'));
100+
});
101+
// Move assets directory
102+
gulp.task('chrome_assets', function() {
103+
return gulp.src(['assets/**/*']).pipe(gulp.dest('./gem-unpacked/site/assets/'));
104+
});
105+
// Move assets directory
106+
gulp.task('chrome_dist', function() {
107+
return gulp.src(['dist/**/*']).pipe(gulp.dest('./gem-unpacked/site/dist/'));
108+
});
109+
110+
111+
// copy chrome-specific dir
112+
gulp.task('chrome-specific_dir', function() {
113+
return gulp.src(['chrome-specific/**/*']).pipe(gulp.dest('./gem-unpacked/'));
114+
});
115+
81116
gulp.task('compact', [
82117
'customcss',
83118
'vendorcss',

‎package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"webpack-server": "webpack-dev-server --hot --inline --progress --colors --port 8000",
99
"web-server": "http-server -p 3000 .",
1010
"start": "concurrently \"npm run webpack-server\" \"gulp watch\"",
11-
"build": "set NODE_ENV=production&& webpack -p && gulp"
11+
"build": "set NODE_ENV=production&& webpack -p && gulp",
12+
"build_chrome_extension": "bower update && npm run build && gulp chromeBuild"
1213
},
1314
"author": "Farhan Chauhan",
1415
"dependencies": {

0 commit comments

Comments
 (0)
Please sign in to comment.