Skip to content

Commit

Permalink
Merge pull request #1034 from imolorhe/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
imolorhe committed Oct 26, 2019
2 parents 57fc34c + a28c399 commit ab79bff
Show file tree
Hide file tree
Showing 40 changed files with 783 additions and 3,098 deletions.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@
"contributions": [
"doc"
]
},
{
"login": "vladshcherbin",
"name": "Vlad Shcherbin",
"avatar_url": "https://avatars1.githubusercontent.com/u/6711845?v=4",
"profile": "https://github.com/vladshcherbin",
"contributions": [
"bug"
]
}
],
"contributorsPerLine": 7
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Build](https://travis-ci.org/imolorhe/altair.svg?branch=master "Travis CI")](https://travis-ci.org/imolorhe/altair)
[![All Contributors](https://img.shields.io/badge/all_contributors-12-orange.svg?style=flat-square)](#contributors)
[![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors)
[![Build status](https://ci.appveyor.com/api/projects/status/qp69kxnlxntsumdj/branch/staging?svg=true)](https://ci.appveyor.com/project/imolorhe/altair/branch/staging)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fimolorhe%2Faltair.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fimolorhe%2Faltair?ref=badge_shield)
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/altair-gql/localized.svg)](https://crowdin.com/project/altair-gql)
Expand Down Expand Up @@ -132,7 +132,7 @@ To get more help on working with the project, check out the [Angular CLI README]

### Contributors

This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
This project exists thanks to all the people who contribute. [[Contribute](.github/CONTRIBUTING.md)].
<a href="graphs/contributors"><img src="https://opencollective.com/altair/contributors.svg?width=890" /></a>

## Backers
Expand Down Expand Up @@ -175,6 +175,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/all-contri
<td align="center"><a href="https://github.com/juca-cruz"><img src="https://avatars1.githubusercontent.com/u/5823011?v=4" width="100px;" alt="Juan Cruz"/><br /><sub><b>Juan Cruz</b></sub></a><br /><a href="#translation-juca-cruz" title="Translation">🌍</a></td>
<td align="center"><a href="https://github.com/victormihaita"><img src="https://avatars0.githubusercontent.com/u/43206741?v=4" width="100px;" alt="Victor Mihaita"/><br /><sub><b>Victor Mihaita</b></sub></a><br /><a href="#translation-victormihaita" title="Translation">🌍</a></td>
<td align="center"><a href="https://github.com/qonn"><img src="https://avatars1.githubusercontent.com/u/43688724?v=4" width="100px;" alt="Furqan Anas"/><br /><sub><b>Furqan Anas</b></sub></a><br /><a href="https://github.com/imolorhe/altair/commits?author=qonn" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/vladshcherbin"><img src="https://avatars1.githubusercontent.com/u/6711845?v=4" width="100px;" alt="Vlad Shcherbin"/><br /><sub><b>Vlad Shcherbin</b></sub></a><br /><a href="https://github.com/imolorhe/altair/issues?q=author%3Avladshcherbin" title="Bug reports">🐛</a></td>
</tr>
</table>

Expand Down
2 changes: 1 addition & 1 deletion chrome-ext-files/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Altair GraphQL Client",
"short_name": "Altair",
"description": "The only graphQL client you'll ever need.",
"version": "2.3.5",
"version": "2.3.6",
"icons": {
"16": "assets/img/altair_logo_128.png",
"48": "assets/img/altair_logo_128.png",
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"packages": [
"packages/*"
],
"version": "2.3.5",
"version": "2.3.6",
"registry": "https://registry.npmjs.org/",
"npmClient": "yarn"
}
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "altair",
"productName": "Altair GraphQL Client",
"version": "2.3.5",
"version": "2.3.6",
"license": "MIT",
"author": "Samuel Imolorhe <samuelimolo4real@gmail.com> (https://sirmuel.design/)",
"description": "The best graphQL client you will ever need",
Expand All @@ -27,15 +27,15 @@
"lint": "ng lint",
"e2e": "ng e2e",
"heroku-postbuild": "npm run build",
"build-electron": "npm run build && lerna bootstrap && lerna run --scope altair-electron build --stream",
"build-electron": "npm run build && lerna bootstrap && lerna run --scope altair build --stream",
"build-ext": "npm run build && ./bin/chrome_ext.sh",
"postinstall": "npm run generate-settings-schema-validator && opencollective postinstall",
"lerna-publish": "lerna publish from-git --force-publish=* --yes",
"publish-packages": "npm run build && lerna bootstrap && npm run lerna-publish",
"generate-settings-schema": "./node_modules/.bin/typescript-json-schema --ignoreErrors src/app/reducers/settings/settings.ts State > src/app/utils/settings.schema.json",
"compile-settings-schema-validator": "ajv compile -s src/app/utils/settings.schema.json -o src/app/utils/validate_settings_schema.js",
"generate-settings-schema-validator": "npm run generate-settings-schema && npm run compile-settings-schema-validator",
"webdriver-update-ci": "webdriver-manager update --standalone false --gecko false --versions.chrome=76.0.3809.68",
"webdriver-update-ci": "webdriver-manager update --standalone false --gecko false --versions.chrome=78.0.3904.70",
"snyk-protect": "snyk protect"
},
"engines": {
Expand Down Expand Up @@ -83,10 +83,11 @@
"graphql": "^14.4.2",
"graphql-query-compress": "^1.2.2",
"marked": "^0.7.0",
"memoizee": "^0.4.14",
"mousetrap": "^1.6.3",
"mousetrap-global-bind": "^1.1.0",
"new-github-issue-url": "^0.2.1",
"ng-zorro-antd": "8.3.1",
"ng-zorro-antd": "8.4.1",
"ngrx-store-localstorage": "^8.0.0",
"ngx-contextmenu": "^5.2.0",
"ngx-cookie-service": "^2.2.0",
Expand All @@ -112,7 +113,7 @@
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.801.2",
"@types/chrome": "^0.0.89",
"@types/chrome": "^0.0.90",
"@types/electron": "^1.6.10",
"@types/graphql": "^14.2.2",
"@types/jasmine": "3.4.1",
Expand Down
10 changes: 9 additions & 1 deletion packages/altair-electron/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ const app = new Application({
},
startTimeout: 20000,
requireName: 'electronRequire',

// Uncomment this line to debug
// chromeDriverArgs: [ 'remote-debugging-port=' + Math.floor(Math.random() * (9999 - 9000) + 9000) ]
});

const selectors = {
Expand Down Expand Up @@ -68,7 +71,12 @@ describe('Altair electron', function() {

await app.client.pause(500);
});
afterEach(() => app.stop());
afterEach(async () => {
if (app.isRunning()) {
await app.client.pause(1000);
return app.stop();
}
});

it('load window successfully', () => {
return app.browserWindow.isVisible().should.eventually.equal(true);
Expand Down
20 changes: 10 additions & 10 deletions packages/altair-electron/package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
{
"name": "altair-electron",
"version": "2.3.5",
"name": "altair",
"version": "2.3.6",
"description": "Electron wrapper for Altair",
"main": "index.js",
"author": "Samuel Imolorhe <samuelimolo4real@gmail.com> (https://sirmuel.design/)",
"license": "MIT",
"private": true,
"scripts": {
"test": "mocha --full-trace __tests__",
"build": "electron-builder",
"dev": "electron ."
},
"dependencies": {
"altair-static": "^2.3.5",
"altair-static": "^2.3.6",
"electron-debug": "^3.0.1",
"electron-is-dev": "^1.1.0",
"electron-log": "^3.0.6",
"electron-squirrel-startup": "^1.0.0",
"electron-store": "^5.0.0",
"electron-updater": "^4.1.2",
"electron-util": "^0.12.1",
"electron-window-state": "^5.0.3",
Expand All @@ -24,15 +26,12 @@
"devDependencies": {
"devtron": "^1.4.0",
"dotenv": "^8.1.0",
"electron": "4.2.9",
"electron-builder": "^21.1.1",
"electron-chromedriver": "^6.0.0-beta.3",
"electron-compile": "^6.4.4",
"electron": "^7.0.0",
"electron-builder": "^21.2.0",
"electron-notarize": "^0.1.1",
"electron-prebuilt-compile": "^4.0.0",
"electron-reloader": "^0.3.0",
"mocha": "^6.2.0",
"spectron": "6.0.0"
"spectron": "^9.0.0"
},
"repository": {
"type": "git",
Expand All @@ -45,5 +44,6 @@
"type": "opencollective",
"url": "https://opencollective.com/altair",
"logo": "https://opencollective.com/altair/logo.txt"
}
},
"gitHead": "e5ce60f5a14997f1471a961ac76efacbb044df46"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
const ElectronStore = require('electron-store');

// An interface between localStorage and electron-store
class ElectronStoreAdapter {
constructor() {
this.store = new ElectronStore();
}

/**
* Returns the number of key/value pairs currently present in the list associated with the object.
*/
// readonly length: number;
get length() {
return this.store.size;
}

/**
* Empties the list associated with the object of all key/value pairs, if there are any.
*/
// clear(): void;
clear() {
return this.store.clear();
}
/**
* Returns the current value associated with the given key, or null if the given key does not exist in the list associated with the object.
*/
// getItem(key: string): string | null;
getItem(key) {
return this.store.get(key);
}
/**
* Returns the name of the nth key in the list, or null if n is greater than or equal to the number of key/value pairs in the object.
*/
// key(index: number): string | null;
key(index) {
const key = Object.keys(this.store.store)[index];
return key || null;
}
/**
* Removes the key/value pair with the given key from the list associated with the object, if a key/value pair with the given key exists.
*/
// removeItem(key: string): void;
removeItem(key) {
return this.store.delete(key);
}
/**
* Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
*
* Throws a "QuotaExceededError" DOMException exception if the new value couldn't be set. (Setting could fail if, e.g., the user has disabled storage for the site, or if the quota has been exceeded.)
*/
// setItem(key: string, value: string): void;
setItem(key, value) {
return this.store.set(key, value);
}

*[Symbol.iterator]() {
for (const [key, value] of Object.entries(this.store)) {
yield [key, value];
}
}
}

module.exports = ElectronStoreAdapter;
8 changes: 4 additions & 4 deletions packages/altair-electron/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ const { getStore } = require('./store');
let win = getInstance();

console.log(protocol);
protocol.registerStandardSchemes(['altair'], { secure: true });
// protocol.registerSchemesAsPrivileged([
// { scheme: 'altair', privileges: { standard: true, secure: true, corsEnabled: true, supportFetchAPI: true } }
// ]);
// protocol.registerStandardSchemes(['altair'], { secure: true });
protocol.registerSchemesAsPrivileged([
{ scheme: 'altair', privileges: { standard: true, secure: true, corsEnabled: true, supportFetchAPI: true } }
]);

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
Expand Down
5 changes: 5 additions & 0 deletions packages/altair-electron/src/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ const createMenu = (actions) => {
submenu: [
{ role: "about" },
{ label: 'Check for Updates...', click: actions.checkForUpdates },
{
label: 'Preferences',
accelerator: 'Cmd+,',
click: actions.showSettings
},
{ type: "separator" },
{ role: "services", submenu: [] },
{ type: "separator" },
Expand Down
28 changes: 25 additions & 3 deletions packages/altair-electron/src/preload/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,30 @@
// window.bar = 'bar'

window.ipc = require('electron').ipcRenderer;
const { getCurrentWindow } = require('electron').remote;
const ElectronStoreAdapter = require('../electron-store-adapter/electron-store-adapter');

// Giving access to spectron to run tests successfully
if (process.env.NODE_ENV === 'test') {
window.electronRequire = require;
const reload = () => {
getCurrentWindow().reload();
}

process.once('loaded', () => {
// Giving access to spectron to run tests successfully
if (process.env.NODE_ENV === 'test') {
window.electronRequire = require;
}

// console.log(allStorage());
const store = new ElectronStoreAdapter();
// Check if data is stored in electron store
if (!store.length) {
// Else, copy content of localstorage into electron store and reload.
Object.keys(localStorage).forEach(key => {
store.setItem(key, localStorage.getItem(key));
});
return reload();
}
// If so, then add electron localstorage to window and continue
global.electronLocalStorage = store;
global.localStorage = store;
});

0 comments on commit ab79bff

Please sign in to comment.