Skip to content

Commit

Permalink
Fix module aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Synowiec committed Apr 22, 2019
1 parent f8a671f commit 8f5d9ff
Show file tree
Hide file tree
Showing 22 changed files with 32 additions and 30 deletions.
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ gulp.task('build:html:release', () => {

gulp.task('build:styles', () => {
return gulp
.src('src/index.less')
.src('src/**/index.less')
.pipe(less())
.pipe(gulp.dest('build'));
});
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@
"winston": "~3.2.1"
},
"_moduleAliases": {
"@root": "out",
"app": "out/src/app",
"common": "out/src/common",
"data": "out/src/data"
"@root": ".",
"app": "build/app",
"common": "build/common",
"data": "build/data"
}
}
2 changes: 1 addition & 1 deletion src/app/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ipcRenderer, remote } from 'electron';
import * as React from 'react';

import { TrayWindow } from 'app/tray-window';
import TrayWindow from 'app/tray-window/TrayWindow';
import { getVisitor } from 'common/analytics';
import { getCAQIMeta } from 'common/caqi';
import { getLocation, Location } from 'common/geolocation';
Expand Down
2 changes: 1 addition & 1 deletion src/index.html → src/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<link
rel="stylesheet"
href="../node_modules/photon/dist/css/photon.css"
href="../../node_modules/photon/dist/css/photon.css"
media="screen"
charset="utf-8"
/>
Expand Down
2 changes: 2 additions & 0 deletions src/app/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import '../base.less';
@import 'tray-window/TrayWindow.less';
2 changes: 2 additions & 0 deletions src/index.tsx → src/app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'module-alias/register';

import * as React from 'react';
import { render } from 'react-dom';

Expand Down
4 changes: 2 additions & 2 deletions src/app/preferences-window/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<meta charset="utf-8" />
<link
rel="stylesheet"
href="../../node_modules/photon/dist/css/photon.css"
href="../../../node_modules/photon/dist/css/photon.css"
media="screen"
charset="utf-8"
/>
<link rel="stylesheet" href="../index.css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="./index.css" media="screen" charset="utf-8" />
</head>
<body>
<div id="preferences"></div>
Expand Down
2 changes: 2 additions & 0 deletions src/app/preferences-window/index.less
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '../../base.less';

.preferences-window {
font-size: 9pt;
background-color: #theme.light.background.color() [primary];
Expand Down
2 changes: 2 additions & 0 deletions src/app/preferences-window/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'module-alias/register';

import * as React from 'react';
import { render } from 'react-dom';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import 'Loader';
@import 'measurement/index';
@import 'air-quality/index';
@import 'measurement/Measurement';
@import 'air-quality/AirQuality';

.error-message {
.summary;
Expand Down
File renamed without changes.
3 changes: 0 additions & 3 deletions src/app/tray-window/index.tsx

This file was deleted.

File renamed without changes.
3 changes: 0 additions & 3 deletions src/index.less → src/base.less
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,3 @@
}
}
}

@import 'tray-window/index';
@import 'preferences-window/index';
2 changes: 1 addition & 1 deletion src/common/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as uuid from 'uuid';
import * as isDev from 'electron-is-dev';
import { userSettings } from 'common/user-settings';

const keys = require('../keys.json');
const keys = require('@root/keys.json');

let clientID: string = null;
let visitor: ua.Visitor = null;
Expand Down
4 changes: 2 additions & 2 deletions src/common/error-handler.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as Rollbar from 'rollbar';

const keys = require('../keys.json');
const keys = require('@root/keys.json');

const version: string = require('../package.json').version;
const version: string = require('@root/package.json').version;

const errorHandler: Rollbar = new Rollbar({
accessToken: keys.rollbar,
Expand Down
7 changes: 2 additions & 5 deletions src/common/geolocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import getLogger from 'common/logger';

const execFile = promisify(_execFile);

const keys = require('../keys.json');
const keys = require('@root/keys.json');

const logger = getLogger('geolocation');

Expand Down Expand Up @@ -99,10 +99,7 @@ export async function getLocation(): Promise<Location> {
const wifiAccessPoints = await getwifiAccessPoints();

if (wifiAccessPoints.length > 0) {
const {
location: { lat: latitude, lng: longitude },
accuracy,
} = await geolocate(
const { location: { lat: latitude, lng: longitude }, accuracy } = await geolocate(
wifiAccessPoints.reduce((acc, wifi) => [...acc, omit(wifi, ['ssid'])], []),
);

Expand Down
4 changes: 2 additions & 2 deletions src/data/update-checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const CHECK_INTERVAL = 2 * 60 * 60 * 1000; // 2 hours
const GITHUB_BASE_URL = 'https://api.github.com';
const GITHUB_REPO = 'jsynowiec/airqmon';

const currentVer: string = require('../package.json').version;
const appName: string = require('../package.json').name;
const currentVer: string = require('@root/package.json').version;
const appName: string = require('@root/package.json').name;

interface IGitHubRelease {
// https://developer.github.com/v3/repos/releases/
Expand Down
4 changes: 3 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'module-alias/register';

import { app, ipcMain, shell, powerMonitor } from 'electron';
import * as isDev from 'electron-is-dev';

Expand All @@ -9,7 +11,7 @@ import { Measurements } from 'data/airqmon-api';
import TrayWindowManager from './tray-window-manager';
import PreferencesWindowManager from './preferences-window-manager';

const keys = require('../keys.json');
const keys = require('@root/keys.json');

let trayWindowManager: TrayWindowManager;
let preferencesWindowManager: PreferencesWindowManager;
Expand Down
2 changes: 1 addition & 1 deletion src/preferences-window-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class PreferencesWindowManager {
maximizable: false,
});

this._window.loadURL(`file://${path.join(__dirname, 'preferences-window/index.html')}`);
this._window.loadURL(`file://${path.join(__dirname, 'app/preferences-window/index.html')}`);

if (isDev) {
this._window.webContents.openDevTools({ mode: 'detach' });
Expand Down
2 changes: 1 addition & 1 deletion src/tray-window-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class TrayWindowManager {
transparent: true,
...config,
});
this._window.loadURL(`file://${path.join(__dirname, 'index.html')}`);
this._window.loadURL(`file://${path.join(__dirname, 'app/index.html')}`);

if (isDev) {
this._window.webContents.openDevTools({ mode: 'detach' });
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"outDir": "build",
"baseUrl": "./src",
"paths": {
"@root": ["../*"],
"app/*": ["app/*"],
"common/*": ["common/*"],
"data/*": ["data/*"]
Expand Down

0 comments on commit 8f5d9ff

Please sign in to comment.