mirror of
https://github.com/dscalzi/HeliosLauncher.git
synced 2024-12-22 11:42:14 -08:00
Move code to common.
Renderer will be only react/redux code. Common code can be used in both main and renderer.
This commit is contained in:
parent
5944f70a2a
commit
9a67087766
@ -1,14 +1,14 @@
|
|||||||
import { IndexProcessor } from '../model/engine/IndexProcessor'
|
import { IndexProcessor } from '../model/engine/IndexProcessor'
|
||||||
import got, { HTTPError, RequestError, ParseError, TimeoutError } from 'got'
|
import got, { HTTPError, RequestError, ParseError, TimeoutError } from 'got'
|
||||||
import { LoggerUtil } from '../../logging/loggerutil'
|
import { LoggerUtil } from 'common/logging/loggerutil'
|
||||||
import { pathExists, readFile, ensureDir, writeFile, readJson } from 'fs-extra'
|
import { pathExists, readFile, ensureDir, writeFile, readJson } from 'fs-extra'
|
||||||
import { MojangVersionManifest } from '../model/mojang/VersionManifest'
|
import { MojangVersionManifest } from '../model/mojang/VersionManifest'
|
||||||
import { calculateHash, getVersionJsonPath, validateLocalFile, getLibraryDir, getVersionJarPath } from '../../util/FileUtils'
|
import { calculateHash, getVersionJsonPath, validateLocalFile, getLibraryDir, getVersionJarPath } from 'common/util/FileUtils'
|
||||||
import { dirname, join } from 'path'
|
import { dirname, join } from 'path'
|
||||||
import { VersionJson, AssetIndex, LibraryArtifact } from '../model/mojang/VersionJson'
|
import { VersionJson, AssetIndex, LibraryArtifact } from '../model/mojang/VersionJson'
|
||||||
import { AssetGuardError } from '../model/engine/AssetGuardError'
|
import { AssetGuardError } from '../model/engine/AssetGuardError'
|
||||||
import { Asset } from '../model/engine/Asset'
|
import { Asset } from '../model/engine/Asset'
|
||||||
import { isLibraryCompatible, getMojangOS } from '../../util/MojangUtils'
|
import { isLibraryCompatible, getMojangOS } from 'common/util/MojangUtils'
|
||||||
|
|
||||||
export class MojangIndexProcessor extends IndexProcessor {
|
export class MojangIndexProcessor extends IndexProcessor {
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
import { Rule, Natives } from "../asset/model/mojang/VersionJson"
|
import { Rule, Natives } from "../../main/asset/model/mojang/VersionJson"
|
||||||
|
|
||||||
export function getMojangOS(): string {
|
export function getMojangOS(): string {
|
||||||
const opSys = process.platform
|
const opSys = process.platform
|
@ -4,7 +4,7 @@ import { join } from "path"
|
|||||||
import { readdirSync } from "fs-extra"
|
import { readdirSync } from "fs-extra"
|
||||||
import { format } from "url"
|
import { format } from "url"
|
||||||
import { autoUpdater } from 'electron-updater'
|
import { autoUpdater } from 'electron-updater'
|
||||||
import isdev from "./util/isdev"
|
import isdev from "../common/util/isdev"
|
||||||
|
|
||||||
const installExtensions = async () => {
|
const installExtensions = async () => {
|
||||||
const installer = require('electron-devtools-installer');
|
const installer = require('electron-devtools-installer');
|
||||||
|
@ -4,16 +4,16 @@ import { join } from 'path'
|
|||||||
import { pathExistsSync, pathExists, readdir, exists, readFileSync, createWriteStream, ensureDirSync, readFile, writeFileSync, unlink, createReadStream, readJsonSync } from 'fs-extra'
|
import { pathExistsSync, pathExists, readdir, exists, readFileSync, createWriteStream, ensureDirSync, readFile, writeFileSync, unlink, createReadStream, readJsonSync } from 'fs-extra'
|
||||||
import Registry from 'winreg'
|
import Registry from 'winreg'
|
||||||
import { exec, spawn } from 'child_process'
|
import { exec, spawn } from 'child_process'
|
||||||
import { LauncherJson } from '../asset/model/mojang/LauncherJson'
|
import { LauncherJson } from 'common/asset/model/mojang/LauncherJson'
|
||||||
import { createHash } from 'crypto'
|
import { createHash } from 'crypto'
|
||||||
import AdmZip from 'adm-zip'
|
import AdmZip from 'adm-zip'
|
||||||
import { forEachOfLimit, eachLimit } from 'async'
|
import { forEachOfLimit, eachLimit } from 'async'
|
||||||
import { extract } from 'tar-fs'
|
import { extract } from 'tar-fs'
|
||||||
import { createGunzip } from 'zlib'
|
import { createGunzip } from 'zlib'
|
||||||
import { VersionJson, AssetIndex, Rule, Natives, Library } from '../asset/model/mojang/VersionJson'
|
import { VersionJson, AssetIndex, Rule, Natives, Library } from 'common/asset/model/mojang/VersionJson'
|
||||||
|
|
||||||
import { ConfigManager } from '../config/configmanager'
|
import { ConfigManager } from 'common/config/configmanager'
|
||||||
import isDev from '../util/isdev'
|
import isDev from 'common/util/isdev'
|
||||||
const DistroManager = require('./distromanager')
|
const DistroManager = require('./distromanager')
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { LoggerUtil } from './loggerutil'
|
import { LoggerUtil } from './loggerutil'
|
||||||
import { ConfigManager } from '../config/configmanager'
|
import { ConfigManager } from '../../common/config/configmanager'
|
||||||
import { Mojang } from '../mojang/mojang'
|
import { Mojang } from '../../common/mojang/mojang'
|
||||||
import { SavedAccount } from '../config/model/SavedAccount'
|
import { SavedAccount } from '../../common/config/model/SavedAccount'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AuthManager
|
* AuthManager
|
||||||
|
@ -3,7 +3,7 @@ import { Distribution, Module, Type, TypeMetadata, Server } from 'helios-distrib
|
|||||||
import { readJson, writeJson } from 'fs-extra'
|
import { readJson, writeJson } from 'fs-extra'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { LoggerUtil } from './loggerutil'
|
import { LoggerUtil } from './loggerutil'
|
||||||
import { ConfigManager } from '../config/configmanager'
|
import { ConfigManager } from '../../common/config/configmanager'
|
||||||
|
|
||||||
const logger = new LoggerUtil('%c[DistroManager]', 'color: #a02d2a; font-weight: bold')
|
const logger = new LoggerUtil('%c[DistroManager]', 'color: #a02d2a; font-weight: bold')
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { ConfigManager } from '../config/configmanager'
|
import { ConfigManager } from '../../common/config/configmanager'
|
||||||
import { DistroManager, DistributionWrapper } from './distromanager'
|
import { DistroManager, DistributionWrapper } from './distromanager'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { remove } from 'fs-extra'
|
import { remove } from 'fs-extra'
|
||||||
|
@ -4,11 +4,11 @@ import { join, basename } from 'path'
|
|||||||
import { ModuleWrapper, ServerWrapper } from './distromanager'
|
import { ModuleWrapper, ServerWrapper } from './distromanager'
|
||||||
import { Type, Required } from 'helios-distribution-types'
|
import { Type, Required } from 'helios-distribution-types'
|
||||||
import { LoggerUtil } from './loggerutil'
|
import { LoggerUtil } from './loggerutil'
|
||||||
import { ConfigManager } from '../config/configmanager'
|
import { ConfigManager } from '../../common/config/configmanager'
|
||||||
import { spawn } from 'child_process'
|
import { spawn } from 'child_process'
|
||||||
import { SavedAccount } from '../config/model/SavedAccount'
|
import { SavedAccount } from '../../common/config/model/SavedAccount'
|
||||||
import { tmpdir, release } from 'os'
|
import { tmpdir, release } from 'os'
|
||||||
import { SubModConfig } from '../config/model/ModConfig'
|
import { SubModConfig } from '../../common/config/model/ModConfig'
|
||||||
import { pseudoRandomBytes } from 'crypto'
|
import { pseudoRandomBytes } from 'crypto'
|
||||||
import { Util, LibraryInternal } from './assetguard'
|
import { Util, LibraryInternal } from './assetguard'
|
||||||
import { VersionJson, Rule } from '../asset/model/mojang/VersionJson'
|
import { VersionJson, Rule } from '../asset/model/mojang/VersionJson'
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import nock from 'nock'
|
import nock from 'nock'
|
||||||
import { URL } from 'url'
|
import { URL } from 'url'
|
||||||
import { MojangIndexProcessor } from '../../src/main/asset/processor/MojangIndexProcessor'
|
import { MojangIndexProcessor } from 'common/asset/processor/MojangIndexProcessor'
|
||||||
import { dirname, join } from 'path'
|
import { dirname, join } from 'path'
|
||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
import { remove, pathExists } from 'fs-extra'
|
import { remove, pathExists } from 'fs-extra'
|
||||||
import { getVersionJsonPath } from '../../src/main/util/FileUtils'
|
import { getVersionJsonPath } from 'common/util/FileUtils'
|
||||||
|
|
||||||
// @ts-ignore (JSON Modules enabled in tsconfig.test.json)
|
// @ts-ignore (JSON Modules enabled in tsconfig.test.json)
|
||||||
import versionManifest from './files/version_manifest.json'
|
import versionManifest from './files/version_manifest.json'
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { Mojang } from "../../src/main/mojang/mojang"
|
import { Mojang } from "common/mojang/mojang"
|
||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
import nock from 'nock'
|
import nock from 'nock'
|
||||||
import { Session } from "../../src/main/mojang/model/auth/Session"
|
import { Session } from "common/mojang/model/auth/Session"
|
||||||
import { MojangResponseCode } from "../../src/main/mojang/model/internal/Response"
|
import { MojangResponseCode } from "common/mojang/model/internal/Response"
|
||||||
|
|
||||||
function expectMojangResponse(res: any, responseCode: MojangResponseCode, negate = false) {
|
function expectMojangResponse(res: any, responseCode: MojangResponseCode, negate = false) {
|
||||||
expect(res).to.not.be.an('error')
|
expect(res).to.not.be.an('error')
|
||||||
|
@ -16,10 +16,11 @@
|
|||||||
// *"sourceMap": true, /* Generates corresponding '.map' file. */
|
// *"sourceMap": true, /* Generates corresponding '.map' file. */
|
||||||
// *"outDir": "dist", /* Redirect output structure to the directory. */
|
// *"outDir": "dist", /* Redirect output structure to the directory. */
|
||||||
// *"strict": true,
|
// *"strict": true,
|
||||||
// "baseUrl": ".", /* Base directory to resolve non-absolute module names. */
|
"baseUrl": ".", /* Base directory to resolve non-absolute module names. */
|
||||||
// "paths": { /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
"paths": {
|
||||||
// "*": ["node_modules/*"]
|
"@/*": ["src/main/*"],
|
||||||
// },
|
"common/*": ["src/common/*"]
|
||||||
|
},
|
||||||
// *"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
// *"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||||
},
|
},
|
||||||
// *"include": [
|
// *"include": [
|
||||||
|
Loading…
Reference in New Issue
Block a user