Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal: Moved main logger in @batch-flask #1110

Merged
merged 10 commits into from
Mar 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ipcRenderer } from "electron";

import "@batch-flask/extensions";

import { log } from "app/utils";
import { log } from "@batch-flask/utils";
import { AppModule } from "./app.module";
import { handleCoreError } from "./error-handler";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from "@angu
import { FormBuilder, FormGroup, Validators } from "@angular/forms";

import { HttpCode, autobind } from "@batch-flask/core";
import { log } from "@batch-flask/utils";
import { AccountResource, RoleDefinition, ServerError } from "app/models";
import { AADApplication, PasswordCredential, ServicePrincipal } from "app/models/ms-graph";
import { ResourceAccessService } from "app/services";
import { AADApplicationService, ServicePrincipalService } from "app/services/ms-graph";
import { log } from "app/utils";
import { Observable } from "rxjs";
import "./create-new-aad-app.scss";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { Subscription } from "rxjs";

import { BackgroundTaskService } from "@batch-flask/ui/background-task";
import { NotificationService } from "@batch-flask/ui/notifications";
import { log } from "@batch-flask/utils";
import { BlobFilesBrowserComponent } from "app/components/file/browse";
import { FileDropEvent } from "app/components/file/browse/file-explorer";
import { BlobContainer, File } from "app/models";
import { StorageService } from "app/services";
import { log } from "app/utils";

@Component({
selector: "bl-data-container-files",
Expand Down
2 changes: 1 addition & 1 deletion app/components/file/details/file-content.component.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Component, Input, OnChanges, SimpleChanges } from "@angular/core";

import { log } from "@batch-flask/utils";
import { SettingsService } from "app/services";
import { FileLoader } from "app/services/file";
import { log } from "app/utils";
import "./file-content.scss";

enum FileType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { AfterViewInit, Component, ElementRef, Input, OnChanges, OnDestroy, View
import { Subscription } from "rxjs";

import { ScrollableComponent, ScrollableService } from "@batch-flask/ui/scrollable";
import { log } from "@batch-flask/utils";
import { File, ServerError } from "app/models";
import { TaskService } from "app/services";
import { FileLoader } from "app/services/file";
import { log } from "app/utils";

import { HttpCode } from "@batch-flask/core";
import { EditorComponent, EditorConfig } from "@batch-flask/ui/editor";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import * as path from "path";
import { Observable } from "rxjs";

import { FilterBuilder, autobind } from "@batch-flask/core";
import { log } from "@batch-flask/utils";
import { tasksToCsv } from "app/components/job/graphs/job-graphs-home/helpers";
import { Job, Task, TaskState } from "app/models";
import { CacheDataService, ElectronShell, FileSystemService, JobParams, JobService, TaskService } from "app/services";
import { EntityView } from "app/services/core";
import { log } from "app/utils";
import "./job-graphs-home.scss";

enum AvailableGraph {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { Component, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router";
import { Observable } from "rxjs";

import { log } from "@batch-flask/utils";
import { NcjJobTemplate, NcjPoolTemplate, NcjTemplateMode } from "app/models";
import { NcjTemplateService } from "app/services";
import { log } from "app/utils";
import "./submit-market-application.scss";

@Component({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { Observable, Subscription } from "rxjs";

import { DialogService } from "@batch-flask/ui/dialogs";
import { EditorConfig } from "@batch-flask/ui/editor";
import { log } from "@batch-flask/utils";
import { AutoscaleFormula, Pool } from "app/models";
import { AutoscaleFormulaService, PoolService } from "app/services";
import { PredefinedFormulaService } from "app/services/predefined-formula.service";
import { log } from "app/utils";
import "./autoscale-formula-picker.scss";

@Component({
Expand Down
2 changes: 1 addition & 1 deletion app/error-handler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ErrorHandler } from "@angular/core";
import { log } from "app/utils";
import { log } from "@batch-flask/utils";
import { remote } from "electron";

function extractMessage(error: any): string {
Expand Down
2 changes: 1 addition & 1 deletion app/services/core/data/entity-getter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { Type } from "@angular/core";
import { Observable } from "rxjs";

import { HttpCode } from "@batch-flask/core";
import { log } from "@batch-flask/utils";
import { ServerError } from "app/models";
import { DataCache } from "app/services/core/data-cache";
import { log } from "app/utils";
import { GenericGetter, GenericGetterConfig } from "./generic-getter";

export interface FetchOptions {
Expand Down
2 changes: 1 addition & 1 deletion app/services/core/data/list-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { List, OrderedSet } from "immutable";
import { BehaviorSubject, Observable } from "rxjs";

import { LoadingStatus } from "@batch-flask/ui/loading/loading-status";
import { log } from "app/utils";
import { log } from "@batch-flask/utils";
import { GenericView, GenericViewConfig } from "./generic-view";
import { ListGetter, ListResponse } from "./list-getter";
import { ContinuationToken, ListOptions, ListOptionsAttributes } from "./list-options";
Expand Down
2 changes: 1 addition & 1 deletion app/services/local-file-storage.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from "@angular/core";
import { Observable } from "rxjs";

import { log } from "app/utils";
import { log } from "@batch-flask/utils";
import { LocalFileStorage as NodeLocalFileStorage } from "client/core";
import { ElectronRemote } from "./electron";

Expand Down
2 changes: 1 addition & 1 deletion app/services/node-user.service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Injectable } from "@angular/core";
import { Observable } from "rxjs";

import { log } from "@batch-flask/utils";
import { ServerError } from "app/models";
import { log } from "app/utils";
import { BatchClientService } from "./batch-client.service";
import { ServiceBase } from "./service-base";

Expand Down
2 changes: 1 addition & 1 deletion app/services/predefined-formula.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from "@angular/core";
import { Response } from "@angular/http";
import { log } from "@batch-flask/utils";
import { AutoscaleFormula } from "app/models";
import { log } from "app/utils";
import { BehaviorSubject, Observable } from "rxjs";
import { GithubDataService } from "./github-data.service";

Expand Down
2 changes: 1 addition & 1 deletion app/services/settings.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { BehaviorSubject, Observable } from "rxjs";
// tslint:disable-next-line:no-var-requires
const stripJsonComments = require("strip-json-comments");

import { log } from "@batch-flask/utils";
import { KeyBindings, Settings, defaultKeybindings } from "app/models";
import { log } from "app/utils";
import { LocalFileStorage } from "./local-file-storage.service";

// tslint:disable-next-line:no-var-requires
Expand Down
2 changes: 1 addition & 1 deletion app/services/themes/theme-core.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { log } from "app/utils";
import { log } from "@batch-flask/utils";

const attrMetadataKey = "csscolor:attrs";

Expand Down
2 changes: 1 addition & 1 deletion app/styles/base/forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fieldset {
}

p {
padding: 4px 0;;
padding: 4px 0;
}

mat-radio-group {
Expand Down
2 changes: 1 addition & 1 deletion app/utils/arm-resource-utils/arm-resource-utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { log } from "@batch-flask/utils";
import { ResourceDescriptor } from "app/models";
import { log } from "app/utils";

// tslint:disable:max-line-length
/**
Expand Down
1 change: 0 additions & 1 deletion app/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export * from "./color";
export * from "./cloud-path-utils";
export * from "./component-utils";
export * from "./file-url-utils";
export * from "./logger";
export * from "./observable";
export * from "./misc";
export * from "./model-utils";
Expand Down
12 changes: 0 additions & 12 deletions app/utils/logger/bunyan-logger.ts

This file was deleted.

1 change: 0 additions & 1 deletion app/utils/logger/index.ts

This file was deleted.

37 changes: 0 additions & 37 deletions app/utils/logger/logger.ts

This file was deleted.

13 changes: 13 additions & 0 deletions config/webpack.common.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const helpers = require("./helpers");
const { DefinePlugin } = require("webpack");

const rules = {
html: {
Expand All @@ -25,5 +26,17 @@ const commonRules = [
rules.html, rules.json, rules.file, rules.font,
];

exports.defineEnv = function(env) {
return new DefinePlugin({
"ENV": JSON.stringify(env),
"process.env": {
"ENV": JSON.stringify(env),
"NODE_ENV": JSON.stringify(env),
"RENDERER": JSON.stringify(true),
"HOT": helpers.hasProcessFlag("hot"),
},
});
};

exports.rules = rules;
exports.commonRules = commonRules;
6 changes: 3 additions & 3 deletions config/webpack.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const CheckerPlugin = require("awesome-typescript-loader").CheckerPlugin;
const CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin;
const CopyWebpackPlugin = require("copy-webpack-plugin");
const ngcWebpack = require("ngc-webpack");
const {commonRules} = require("./webpack.common");
const { commonRules } = require("./webpack.common");

const isDevServer = helpers.isWebpackDevServer();
const AOT = !isDevServer;
Expand All @@ -30,7 +30,7 @@ const baseConfig = {
rules: [
{
test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
use: [ "@ngtools/webpack" ],
use: ["@ngtools/webpack"],
exclude: [/\.spec\.ts/, /src\/test\//]
},
...commonRules,
Expand All @@ -48,7 +48,7 @@ const baseConfig = {
{ context: "src/client/splash-screen", from: "**/*", to: "client/splash-screen" },
{ context: "src/client/proxy", from: "**/*", to: "client/proxy" },
{ context: "app/assets", from: "**/*", to: "assets" },
{ from: "node_modules/monaco-editor/min/vs", to: "vendor/vs", },
{ from: "node_modules/monaco-editor/min/vs", to: "vendor/vs", },
]),
new CommonsChunkPlugin({
name: "polyfills",
Expand Down
5 changes: 2 additions & 3 deletions config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const DefinePlugin = require("webpack/lib/DefinePlugin");
const DllBundlesPlugin = require("webpack-dll-bundles-plugin").DllBundlesPlugin;
const AddAssetHtmlPlugin = require("add-asset-html-webpack-plugin");
const WriteFilePlugin = require("write-file-webpack-plugin");
const { defineEnv } = require("./webpack.common");

const webpackMergeDll = merge.strategy({ plugins: "replace" });
const CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin;
Expand Down Expand Up @@ -58,9 +59,7 @@ module.exports = merge(config, {
],
},
plugins: [
new DefinePlugin({
"ENV": JSON.stringify(ENV),
}),
defineEnv(ENV),
new WriteFilePlugin({
test: /vendor\/vs.*/
}),
Expand Down
10 changes: 2 additions & 8 deletions config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const LoaderOptionsPlugin = require("webpack/lib/LoaderOptionsPlugin");
const merge = require("webpack-merge");
const OptimizeJsPlugin = require("optimize-js-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const { defineEnv } = require("./webpack.common");

const ENV = "production";
const UglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
Expand Down Expand Up @@ -88,14 +89,7 @@ module.exports = merge(config, {
* @see https://github.com/webpack/extract-text-webpack-plugin
*/
new ExtractTextPlugin("[name].[contenthash].css"),

new DefinePlugin({
"ENV": JSON.stringify(ENV),
"process.env": {
"ENV": JSON.stringify(ENV),
"NODE_ENV": JSON.stringify(ENV),
}
}),
defineEnv(ENV),

/**
* Plugin: UglifyJsPlugin
Expand Down
8 changes: 2 additions & 6 deletions config/webpack.config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ const DefinePlugin = require("webpack/lib/DefinePlugin");
const config = require("./webpack.config.base");
const webpack = require("webpack");
const helpers = require("./helpers");
const { commonRules, defineEnv } = require("./webpack.common");
const CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin;
const {
commonRules
} = require("./webpack.common");

const ENV = "test";

Expand All @@ -16,9 +14,7 @@ config.devtool = "inline-source-map";

// Karma webpack doesn't support CommonChunkPlugin yet https://github.com/webpack-contrib/karma-webpack/issues/24
config.plugins = [
new DefinePlugin({
"ENV": JSON.stringify(ENV),
}),
defineEnv(ENV),
];
config.module.rules = config.module.rules = [{
test: /\.ts$/,
Expand Down
1 change: 1 addition & 0 deletions definitions/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ declare module "mousetrap" {
}

declare type Environment = "production" | "development" | "test";
declare const ELECTRON_ENV: "renderer" | "main";

// Gloval variables set by webpack
declare const ENV: Environment;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"electron": "electron build/client/main.js",
"electron:prod": "cross-env NODE_ENV=production electron build/client/main.js",
"dev": "concurrently --kill-others \"npm run -s dev-server\" \"npm run -s dev-electron\"",
"dev-electron": "cross-env HOT=1 electron build/client/main.js",
"dev-electron": "cross-env electron build/client/main.js",
"dev-server": "npm run webpack-dev-server -- --hot --inline --colors --content-base app/",
"tslint": "tslint --project tsconfig.json -c tslint.json \"app/**/*.ts\" \"src/**/*.ts\" \"test/**/*.ts\" \"./*.js\" \"config/**/*.js\"",
"stylelint": "stylelint --syntax scss \"app/**/*.scss\"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Observable } from "rxjs";

import { BreadcrumbService } from "@batch-flask/ui/breadcrumbs";
import { ContextMenuService } from "@batch-flask/ui/context-menu";
import { log } from "app/utils";
import { log } from "@batch-flask/utils";
import { ContextMenu } from "../context-menu";
import { AbstractListBase } from "./abstract-list-base";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, Input, OnChanges } from "@angular/core";
import { ActivatedRoute } from "@angular/router";
import { Subscription } from "rxjs";

import { log } from "app/utils";
import { log } from "@batch-flask/utils";
import { AdvancedFilter } from "./advanced-filter";

@Component({
Expand Down
Loading