mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-12 00:41:29 +01:00
Cleanup src
folder for web and move ts code into src/app
per angular convention (#3127)
This commit is contained in:
parent
5c57b5e663
commit
478de90d45
@ -1,9 +0,0 @@
|
||||
import { StateService as BaseStateService } from "@bitwarden/common/abstractions/state.service";
|
||||
import { StorageOptions } from "@bitwarden/common/models/domain/storageOptions";
|
||||
|
||||
import { Account } from "src/models/account";
|
||||
|
||||
export abstract class StateService extends BaseStateService<Account> {
|
||||
getRememberEmail: (options?: StorageOptions) => Promise<boolean>;
|
||||
setRememberEmail: (value: boolean, options?: StorageOptions) => Promise<void>;
|
||||
}
|
@ -19,8 +19,8 @@ import { Policy } from "@bitwarden/common/models/domain/policy";
|
||||
import { ListResponse } from "@bitwarden/common/models/response/listResponse";
|
||||
import { PolicyResponse } from "@bitwarden/common/models/response/policyResponse";
|
||||
|
||||
import { StateService } from "../../abstractions/state.service";
|
||||
import { RouterService } from "../services/router.service";
|
||||
import { StateService } from "../services/state.service";
|
||||
|
||||
@Component({
|
||||
selector: "app-login",
|
||||
|
@ -17,7 +17,7 @@ import { ContainerService } from "@bitwarden/common/services/container.service";
|
||||
import { EventService as EventLoggingService } from "@bitwarden/common/services/event.service";
|
||||
import { VaultTimeoutService as VaultTimeoutService } from "@bitwarden/common/services/vaultTimeout.service";
|
||||
|
||||
import { I18nService as I18nService } from "../../services/i18n.service";
|
||||
import { I18nService } from "./i18n.service";
|
||||
|
||||
@Injectable()
|
||||
export class InitService {
|
||||
|
@ -2,7 +2,7 @@ import { Injectable } from "@angular/core";
|
||||
|
||||
import { PasswordRepromptService as BasePasswordRepromptService } from "@bitwarden/angular/services/passwordReprompt.service";
|
||||
|
||||
import { PasswordRepromptComponent } from "../app/components/password-reprompt.component";
|
||||
import { PasswordRepromptComponent } from "../components/password-reprompt.component";
|
||||
|
||||
@Injectable()
|
||||
export class PasswordRepromptService extends BasePasswordRepromptService {
|
@ -13,7 +13,6 @@ import {
|
||||
import { ModalService as ModalServiceAbstraction } from "@bitwarden/angular/services/modal.service";
|
||||
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
||||
import { I18nService as I18nServiceAbstraction } from "@bitwarden/common/abstractions/i18n.service";
|
||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||
import { MessagingService as MessagingServiceAbstraction } from "@bitwarden/common/abstractions/messaging.service";
|
||||
import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
||||
import { PlatformUtilsService as PlatformUtilsServiceAbstraction } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||
@ -23,26 +22,25 @@ import { AbstractStorageService } from "@bitwarden/common/abstractions/storage.s
|
||||
import { StateFactory } from "@bitwarden/common/factories/stateFactory";
|
||||
import { MemoryStorageService } from "@bitwarden/common/services/memoryStorage.service";
|
||||
|
||||
import { StateService as StateServiceAbstraction } from "../../abstractions/state.service";
|
||||
import { Account } from "../../models/account";
|
||||
import { GlobalState } from "../../models/globalState";
|
||||
import { BroadcasterMessagingService } from "../../services/broadcasterMessaging.service";
|
||||
import { HtmlStorageService } from "../../services/htmlStorage.service";
|
||||
import { I18nService } from "../../services/i18n.service";
|
||||
import { PasswordRepromptService } from "../../services/passwordReprompt.service";
|
||||
import { StateService } from "../../services/state.service";
|
||||
import { StateMigrationService } from "../../services/stateMigration.service";
|
||||
import { WebPlatformUtilsService } from "../../services/webPlatformUtils.service";
|
||||
import { HomeGuard } from "../guards/home.guard";
|
||||
import { Account } from "../models/account";
|
||||
import { GlobalState } from "../models/globalState";
|
||||
import { PermissionsGuard as OrgPermissionsGuard } from "../organizations/guards/permissions.guard";
|
||||
import { NavigationPermissionsService as OrgPermissionsService } from "../organizations/services/navigation-permissions.service";
|
||||
|
||||
import { BroadcasterMessagingService } from "./broadcasterMessaging.service";
|
||||
import { EventService } from "./event.service";
|
||||
import { HtmlStorageService } from "./htmlStorage.service";
|
||||
import { I18nService } from "./i18n.service";
|
||||
import { InitService } from "./init.service";
|
||||
import { ModalService } from "./modal.service";
|
||||
import { PasswordRepromptService } from "./passwordReprompt.service";
|
||||
import { PolicyListService } from "./policy-list.service";
|
||||
import { RouterService } from "./router.service";
|
||||
import { StateService } from "./state.service";
|
||||
import { StateMigrationService } from "./stateMigration.service";
|
||||
import { WebFileDownloadService } from "./webFileDownload.service";
|
||||
import { WebPlatformUtilsService } from "./webPlatformUtils.service";
|
||||
|
||||
@NgModule({
|
||||
imports: [ToastrModule, JslibServicesModule],
|
||||
@ -95,22 +93,10 @@ import { WebFileDownloadService } from "./webFileDownload.service";
|
||||
useClass: StateMigrationService,
|
||||
deps: [AbstractStorageService, SECURE_STORAGE, STATE_FACTORY],
|
||||
},
|
||||
{
|
||||
provide: StateServiceAbstraction,
|
||||
useClass: StateService,
|
||||
deps: [
|
||||
AbstractStorageService,
|
||||
SECURE_STORAGE,
|
||||
MEMORY_STORAGE,
|
||||
LogService,
|
||||
StateMigrationServiceAbstraction,
|
||||
STATE_FACTORY,
|
||||
STATE_SERVICE_USE_CACHE,
|
||||
],
|
||||
},
|
||||
StateService,
|
||||
{
|
||||
provide: BaseStateServiceAbstraction,
|
||||
useExisting: StateServiceAbstraction,
|
||||
useExisting: StateService,
|
||||
},
|
||||
{
|
||||
provide: PasswordRepromptServiceAbstraction,
|
||||
|
@ -1,3 +1,15 @@
|
||||
import { Inject, Injectable } from "@angular/core";
|
||||
|
||||
import {
|
||||
MEMORY_STORAGE,
|
||||
SECURE_STORAGE,
|
||||
STATE_FACTORY,
|
||||
STATE_SERVICE_USE_CACHE,
|
||||
} from "@bitwarden/angular/services/jslib-services.module";
|
||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||
import { StateMigrationService } from "@bitwarden/common/abstractions/stateMigration.service";
|
||||
import { AbstractStorageService } from "@bitwarden/common/abstractions/storage.service";
|
||||
import { StateFactory } from "@bitwarden/common/factories/stateFactory";
|
||||
import { CipherData } from "@bitwarden/common/models/data/cipherData";
|
||||
import { CollectionData } from "@bitwarden/common/models/data/collectionData";
|
||||
import { FolderData } from "@bitwarden/common/models/data/folderData";
|
||||
@ -5,14 +17,31 @@ import { SendData } from "@bitwarden/common/models/data/sendData";
|
||||
import { StorageOptions } from "@bitwarden/common/models/domain/storageOptions";
|
||||
import { StateService as BaseStateService } from "@bitwarden/common/services/state.service";
|
||||
|
||||
import { StateService as StateServiceAbstraction } from "../abstractions/state.service";
|
||||
import { Account } from "../models/account";
|
||||
import { GlobalState } from "../models/globalState";
|
||||
|
||||
export class StateService
|
||||
extends BaseStateService<GlobalState, Account>
|
||||
implements StateServiceAbstraction
|
||||
{
|
||||
@Injectable()
|
||||
export class StateService extends BaseStateService<GlobalState, Account> {
|
||||
constructor(
|
||||
storageService: AbstractStorageService,
|
||||
@Inject(SECURE_STORAGE) secureStorageService: AbstractStorageService,
|
||||
@Inject(MEMORY_STORAGE) memoryStorageService: AbstractStorageService,
|
||||
logService: LogService,
|
||||
stateMigrationService: StateMigrationService,
|
||||
@Inject(STATE_FACTORY) stateFactory: StateFactory<GlobalState, Account>,
|
||||
@Inject(STATE_SERVICE_USE_CACHE) useAccountCache = true
|
||||
) {
|
||||
super(
|
||||
storageService,
|
||||
secureStorageService,
|
||||
memoryStorageService,
|
||||
logService,
|
||||
stateMigrationService,
|
||||
stateFactory,
|
||||
useAccountCache
|
||||
);
|
||||
}
|
||||
|
||||
async addAccount(account: Account) {
|
||||
// Apply web overides to default account values
|
||||
account = new Account(account);
|
@ -6,7 +6,7 @@ import { OrganizationService } from "@bitwarden/common/abstractions/organization
|
||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||
import { TokenService } from "@bitwarden/common/abstractions/token.service";
|
||||
|
||||
import { StateService } from "../../abstractions/state.service";
|
||||
import { StateService } from "../services/state.service";
|
||||
|
||||
const BroadcasterSubscriptionId = "SettingsComponent";
|
||||
|
||||
|
@ -5,10 +5,10 @@ import "bootstrap";
|
||||
import "jquery";
|
||||
import "popper.js";
|
||||
|
||||
require("../scss/styles.scss");
|
||||
require("../scss/tailwind.css");
|
||||
require("./scss/styles.scss");
|
||||
require("./scss/tailwind.css");
|
||||
|
||||
import { AppModule } from "./app.module";
|
||||
import { AppModule } from "./app/app.module";
|
||||
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
enableProdMode();
|
@ -14,16 +14,6 @@
|
||||
"angularCompilerOptions": {
|
||||
"preserveWhitespaces": true
|
||||
},
|
||||
"files": [
|
||||
"src/app/polyfills.ts",
|
||||
"src/app/main.ts",
|
||||
"../../bitwarden_license/bit-web/src/app/main.ts"
|
||||
],
|
||||
"include": [
|
||||
"src/connectors/*.ts",
|
||||
"src/models/*.ts",
|
||||
"src/services/*.ts",
|
||||
"src/abstractions/*.ts",
|
||||
"src/**/*.stories.ts"
|
||||
]
|
||||
"files": ["src/polyfills.ts", "src/main.ts", "../../bitwarden_license/bit-web/src/main.ts"],
|
||||
"include": ["src/connectors/*.ts", "src/**/*.stories.ts"]
|
||||
}
|
||||
|
@ -282,8 +282,8 @@ const webpackConfig = {
|
||||
devtool: "source-map",
|
||||
devServer: devServer,
|
||||
entry: {
|
||||
"app/polyfills": "./src/app/polyfills.ts",
|
||||
"app/main": "./src/app/main.ts",
|
||||
"app/polyfills": "./src/polyfills.ts",
|
||||
"app/main": "./src/main.ts",
|
||||
"connectors/webauthn": "./src/connectors/webauthn.ts",
|
||||
"connectors/webauthn-fallback": "./src/connectors/webauthn-fallback.ts",
|
||||
"connectors/duo": "./src/connectors/duo.ts",
|
||||
|
@ -8,7 +8,7 @@ import "popper.js";
|
||||
require("src/scss/styles.scss");
|
||||
require("src/scss/tailwind.css");
|
||||
|
||||
import { AppModule } from "./app.module";
|
||||
import { AppModule } from "./app/app.module";
|
||||
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
enableProdMode();
|
@ -2,7 +2,7 @@ const { AngularWebpackPlugin } = require("@ngtools/webpack");
|
||||
|
||||
const webpackConfig = require("../../apps/web/webpack.config");
|
||||
|
||||
webpackConfig.entry["app/main"] = "../../bitwarden_license/bit-web/src/app/main.ts";
|
||||
webpackConfig.entry["app/main"] = "../../bitwarden_license/bit-web/src/main.ts";
|
||||
webpackConfig.plugins[webpackConfig.plugins.length - 1] = new AngularWebpackPlugin({
|
||||
tsConfigPath: "tsconfig.json",
|
||||
entryModule: "bitwarden_license/src/app/app.module#AppModule",
|
||||
|
@ -14,7 +14,7 @@
|
||||
"homepage": "https://bitwarden.com",
|
||||
"scripts": {
|
||||
"prepare": "husky install",
|
||||
"lint": "eslint . || prettier --check .",
|
||||
"lint": "eslint . && prettier --check .",
|
||||
"lint:fix": "eslint . --fix",
|
||||
"prettier": "prettier --write .",
|
||||
"test": "jest",
|
||||
|
Loading…
Reference in New Issue
Block a user