Skip to content

Commit

Permalink
Merge pull request #1 from dolkensp/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
peter-dolkens authored Jul 27, 2018
2 parents ddb16b0 + 7d8e55e commit bb46a50
Show file tree
Hide file tree
Showing 25 changed files with 192 additions and 168 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,5 @@ publish
# Ignore published packages
*.zip
*.xpi
*.crx
*.crx
package-lock.json
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# ptYou - Star Citizen Contacts Manager
# ptYou - Star Citizen Contacts Manager [![Build status](https://ci.appveyor.com/api/projects/status/84e0no7ecduwkfqu/branch/master?svg=true)](https://ci.appveyor.com/project/dolkensp/ptyou/branch/master)


This project aims to improve the contacts management between PTU and Live websites

Expand Down
64 changes: 64 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

#---------------------------------#
# general configuration #
#---------------------------------#

version: 3.2.{build}

#---------------------------------#
# environment configuration #
#---------------------------------#

#branches:
# only:
# - master

# Start builds on tags only (GitHub and BitBucket)
# skip_non_tags: true
skip_tags: true

#---------------------------------#
# build configuration #
#---------------------------------#

install:
- npm install

build_script:
- node --version
- npm --version
- node build.js %APPVEYOR_BUILD_VERSION%
- node_modules\.bin\eslint src

cache:
- node_modules -> package.json

#---------------------------------#
# artifacts configuration #
#---------------------------------#

artifacts:
# packaging chrome
- path: dist\ptYou-chrome-v$(APPVEYOR_BUILD_VERSION).zip
name: chrome

# packaging firefox
- path: dist\ptYou-firefox-v$(APPVEYOR_BUILD_VERSION).zip
name: firefox

# packaging edge
- path: dist\ptYou-edge-v$(APPVEYOR_BUILD_VERSION).zip
name: edge

deploy:
provider: GitHub
auth_token:
secure: Yi3KGQnx6Ui4ise0Dss0CRYo4FXHnN9xqWfol7mbKk13e13QDPQgNVfjPHGAg0ec
artifact: /.*\.zip/
draft: false
prerelease: false
tag: v$(APPVEYOR_BUILD_VERSION)
release: ptYou Browser Extensions
description: View [ReadMe](https://github.com/dolkensp/ptYou/blob/master/README.md) for more instructions.
on:
branch: master
45 changes: 45 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
var fs = require('fs');
var path = require('path');
var JSZip = require('jszip');

var support = [ 'chrome', 'firefox', 'edge' ];

var manifest_master = JSON.parse(fs.readFileSync('src/manifest.json', 'utf8'));

manifest_master.version = process.argv[2];

support.forEach((browser, index) => {
var zip = new JSZip();

if (!fs.existsSync('dist')) fs.mkdirSync('dist');

var manifest = manifest_master;

if (fs.existsSync('src/manifest.' + browser + '.json', 'utf8')) {
var manifest_browser = JSON.parse(fs.readFileSync('src/manifest.' + browser + '.json', 'utf8'));
manifest = { ...manifest, ...manifest_browser };
}

zip.file('manifest.json', JSON.stringify(manifest, null, 2));

var addFiles = function(filePath) {
var checkPath = path.basename(filePath.toLowerCase());

if (checkPath == 'debug') return;
if (checkPath == 'screenshots') return;
if (checkPath.startsWith('manifest.') && checkPath.endsWith('.json')) return;

if (fs.lstatSync(filePath).isDirectory()) {
files = fs.readdirSync(filePath);
files.forEach(function(file) { addFiles(path.join(filePath, file)) });
} else {
zip.file(filePath.substr(4), fs.readFileSync(filePath, 'binary'), { binary: true });
}
}

addFiles('src');

// TODO: Copy Files In

zip.generateNodeStream({ type:'nodebuffer', compression: 'DEFLATE', streamFiles:true }).pipe(fs.createWriteStream('dist/' + manifest.short_name + '-' + browser + '-v' + manifest.version + '.zip'))
});
Binary file removed icons/icon_128.png
Binary file not shown.
Binary file removed icons/icon_32.png
Binary file not shown.
Binary file removed icons/icon_48.png
Binary file not shown.
Binary file removed icons/icon_64.png
Binary file not shown.
44 changes: 0 additions & 44 deletions manifest_chrome.json

This file was deleted.

53 changes: 0 additions & 53 deletions manifest_edge.json

This file was deleted.

49 changes: 0 additions & 49 deletions manifest_firefox.json

This file was deleted.

38 changes: 38 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "ptYou",
"description": "This extension persists friends between test/live environments on RobertsSpaceIndustries.com",
"repository": {
"type": "git",
"url": "git+https://github.com/dolkensp/ptYou.git"
},
"author": "/u/alluran (Peter Dolkens)",
"bugs": {
"url": "https://github.com/dolkensp/ptYou/issues"
},
"homepage": "https://github.com/dolkensp/ptYou#readme",
"dependencies": {
"jszip": "^3.1.5"
},
"devDependencies": {
"eslint": "^5.0.1"
},
"eslintConfig": {
"env": {
"browser": true,
"es6": true,
"jquery": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
"no-console": "off"
},
"globals": {
"Fuse": true,
"chrome": true
}
},
"eslintIgnore": [ "src/vendor/**/*.js", "*.min.js" ]
}
9 changes: 5 additions & 4 deletions content_scripts/loader.js → src/content_scripts/loader.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

/* eslint no-console: "off" */
!function() {
var namespace = 'ptYou';

Expand All @@ -24,7 +25,7 @@
document.body.appendChild(style);
}

for (var i = 0, j = templates.length; i < j; i++) {
for (i = 0, j = templates.length; i < j; i++) {
var templateURL = chrome.extension.getURL(templates[i].url);
console.log('Loading', templateURL);
var script = document.createElement('script');
Expand All @@ -34,7 +35,7 @@
document.body.appendChild(script);
}

var i = 1;
i = 1;

window.addEventListener('message', function(event) {
if (event.source != window) return;
Expand All @@ -45,12 +46,12 @@
case 'storage.sync.get.request': chrome.storage.sync.get(event.data.payload, function(result) { window.postMessage({ type: "storage.get.response", callbackIndex: event.data.callbackIndex, result: result }, "*") }); break;
case 'storage.sync.set.request': chrome.storage.sync.set(event.data.payload, function() { window.postMessage({ type: "storage.set.response", callbackIndex: event.data.callbackIndex }, "*") }); break;
case 'storage.sync.remove.request': chrome.storage.sync.remove(event.data.payload, function() { window.postMessage({ type: "storage.remove.response", callbackIndex: event.data.callbackIndex }, "*") }); break;
case 'storage.sync.clear.request': chrome.storage.sync.clear(function(result) { window.postMessage({ type: "storage.clear.response", callbackIndex: event.data.callbackIndex }, "*") }); break;
case 'storage.sync.clear.request': chrome.storage.sync.clear(function() { window.postMessage({ type: "storage.clear.response", callbackIndex: event.data.callbackIndex }, "*") }); break;

case 'storage.local.get.request': chrome.storage.local.get(event.data.payload, function(result) { window.postMessage({ type: "storage.get.response", callbackIndex: event.data.callbackIndex, result: result }, "*") }); break;
case 'storage.local.set.request': chrome.storage.local.set(event.data.payload, function() { window.postMessage({ type: "storage.set.response", callbackIndex: event.data.callbackIndex }, "*") }); break;
case 'storage.local.remove.request': chrome.storage.local.remove(event.data.payload, function() { window.postMessage({ type: "storage.remove.response", callbackIndex: event.data.callbackIndex }, "*") }); break;
case 'storage.local.clear.request': chrome.storage.local.clear(function(result) { window.postMessage({ type: "storage.clear.response", callbackIndex: event.data.callbackIndex }, "*") }); break;
case 'storage.local.clear.request': chrome.storage.local.clear(function() { window.postMessage({ type: "storage.clear.response", callbackIndex: event.data.callbackIndex }, "*") }); break;
}
});

Expand Down
Binary file added src/icons/icon_128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/icons/icon_48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/manifest.chrome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{

}
6 changes: 6 additions & 0 deletions src/manifest.edge.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"-ms-preload": {
"backgroundScript": "vendor/edge/backgroundScriptsAPIBridge.js",
"contentScript": "vendor/edge/contentScriptsAPIBridge.js"
}
}
7 changes: 7 additions & 0 deletions src/manifest.firefox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"applications": {
"gecko": {
"id": "ptYou@ddrit.com"
}
}
}
Loading

0 comments on commit bb46a50

Please sign in to comment.