refactor: folder structure in preparation of command based cli
parent
48598c1f73
commit
bb844bcb46
|
|
@ -46,7 +46,7 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@arkweid/lefthook": "^0.7.7",
|
"@arkweid/lefthook": "^0.7.7",
|
||||||
"@types/jest": "^28.1.6",
|
"@types/jest": "^28.1.6",
|
||||||
"@types/node": "^18.6.4",
|
"@types/node": "^18.7.13",
|
||||||
"@types/semver": "^7.3.9",
|
"@types/semver": "^7.3.9",
|
||||||
"@typescript-eslint/parser": "5.32.0",
|
"@typescript-eslint/parser": "5.32.0",
|
||||||
"@vercel/ncc": "^0.33.3",
|
"@vercel/ncc": "^0.33.3",
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import { CommandInterface } from '../command-interface.ts';
|
import { CommandInterface } from '../command-interface.ts';
|
||||||
import { Action, Cache, Docker, ImageTag, Input, Output } from '../../../model/index.ts';
|
import { Action, Cache, Docker, ImageTag, Input, Output } from '../../model/index.ts';
|
||||||
import PlatformSetup from '../../../model/platform-setup.ts';
|
import PlatformSetup from '../../model/platform-setup.ts';
|
||||||
import MacBuilder from '../../../model/mac-builder.ts';
|
import MacBuilder from '../../model/mac-builder.ts';
|
||||||
import { CommandBase } from './command-base.ts';
|
import { CommandBase } from '../command-base.ts';
|
||||||
|
|
||||||
export class BuildCommand extends CommandBase implements CommandInterface {
|
export class UnityBuildCommand extends CommandBase implements CommandInterface {
|
||||||
public async validate() {
|
public async validate() {
|
||||||
await super.validate();
|
await super.validate();
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Options } from '../../../config/options.ts';
|
import { Options } from '../config/options.ts';
|
||||||
import { Input } from '../../../model/index.ts';
|
import { Input } from '../model/index.ts';
|
||||||
import Parameters from '../../../model/parameters.ts';
|
import Parameters from '../model/parameters.ts';
|
||||||
|
|
||||||
export class CommandBase {
|
export class CommandBase {
|
||||||
public readonly name: string;
|
public readonly name: string;
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { NonExistentCommand } from './command/non-existent-command.ts';
|
import { NonExistentCommand } from './null/non-existent-command.ts';
|
||||||
import { BuildCommand } from './command/unity/build-command.ts';
|
import { UnityBuildCommand } from './build/unity-build-command.ts';
|
||||||
import { BuildRemoteCommand } from './command/unity/build-remote-command.ts';
|
import { CommandInterface } from './command-interface.ts';
|
||||||
import { CommandInterface } from './command/command-interface.ts';
|
import { UnityRemoteBuildCommand } from './remote/unity-remote-build-command.ts';
|
||||||
|
|
||||||
export class CommandFactory {
|
export class CommandFactory {
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
@ -25,9 +25,9 @@ export class CommandFactory {
|
||||||
private createUnityCommand(commandName: string) {
|
private createUnityCommand(commandName: string) {
|
||||||
switch (commandName) {
|
switch (commandName) {
|
||||||
case 'build':
|
case 'build':
|
||||||
return new BuildCommand(commandName);
|
return new UnityBuildCommand(commandName);
|
||||||
case 'build-remote':
|
case 'build-remote':
|
||||||
return new BuildRemoteCommand(commandName);
|
return new UnityRemoteBuildCommand(commandName);
|
||||||
default:
|
default:
|
||||||
return new NonExistentCommand(commandName);
|
return new NonExistentCommand(commandName);
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Options } from '../../config/options.ts';
|
import { Options } from '../config/options.ts';
|
||||||
import Parameters from '../../model/parameters.ts';
|
import Parameters from '../model/parameters.ts';
|
||||||
import { Input } from '../../model/index.ts';
|
import { Input } from '../model/index.ts';
|
||||||
|
|
||||||
export interface CommandInterface {
|
export interface CommandInterface {
|
||||||
name: string;
|
name: string;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { CommandInterface } from './command-interface.ts';
|
import { CommandInterface } from '../command-interface.ts';
|
||||||
import { Options } from '../../config/options.ts';
|
import { Options } from '../../config/options.ts';
|
||||||
|
|
||||||
export class NonExistentCommand implements CommandInterface {
|
export class NonExistentCommand implements CommandInterface {
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
import { CommandInterface } from '../command-interface.ts';
|
import { CommandInterface } from '../command-interface.ts';
|
||||||
import { Options } from '../../../config/options.ts';
|
import { Options } from '../../config/options.ts';
|
||||||
import { CloudRunner, ImageTag, Input, Output } from '../../../model/index.ts';
|
import { CloudRunner, ImageTag, Input, Output } from '../../model/index.ts';
|
||||||
import { core, nanoid } from '../../../dependencies.ts';
|
import { core, nanoid } from '../../dependencies.ts';
|
||||||
import Parameters from '../../../model/parameters.ts';
|
import Parameters from '../../model/parameters.ts';
|
||||||
import { GitRepoReader } from '../../../model/input-readers/git-repo.ts';
|
import { GitRepoReader } from '../../model/input-readers/git-repo.ts';
|
||||||
import { Cli } from '../../../model/cli/cli.ts';
|
import { Cli } from '../../model/cli/cli.ts';
|
||||||
import CloudRunnerConstants from '../../../model/cloud-runner/services/cloud-runner-constants.ts';
|
import CloudRunnerConstants from '../../model/cloud-runner/services/cloud-runner-constants.ts';
|
||||||
import CloudRunnerBuildGuid from '../../../model/cloud-runner/services/cloud-runner-guid.ts';
|
import CloudRunnerBuildGuid from '../../model/cloud-runner/services/cloud-runner-guid.ts';
|
||||||
import { GithubCliReader } from '../../../model/input-readers/github-cli.ts';
|
import { GithubCliReader } from '../../model/input-readers/github-cli.ts';
|
||||||
import { CommandBase } from './command-base.ts';
|
import { CommandBase } from '../command-base.ts';
|
||||||
|
|
||||||
// Todo - Verify this entire flow
|
// Todo - Verify this entire flow
|
||||||
export class BuildRemoteCommand extends CommandBase implements CommandInterface {
|
export class UnityRemoteBuildCommand extends CommandBase implements CommandInterface {
|
||||||
public async validate() {
|
public async validate() {
|
||||||
await super.validate();
|
await super.validate();
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { CliArguments } from '../core/cli/cli-arguments.ts';
|
import { CliArguments } from '../core/cli/cli-arguments.ts';
|
||||||
import { Parameters, Input } from '../model/index.ts';
|
import { Parameters, Input } from '../model/index.ts';
|
||||||
import { CommandInterface } from '../commands/command/command-interface.ts';
|
import { CommandInterface } from '../command/command-interface.ts';
|
||||||
import { Environment } from '../core/env/environment.ts';
|
import { Environment } from '../core/env/environment.ts';
|
||||||
|
|
||||||
export class Options {
|
export class Options {
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,9 @@ import { Buffer } from 'https://deno.land/std@0.151.0/io/buffer.ts';
|
||||||
import { config, configSync } from 'https://deno.land/std@0.151.0/dotenv/mod.ts';
|
import { config, configSync } from 'https://deno.land/std@0.151.0/dotenv/mod.ts';
|
||||||
|
|
||||||
// Internally managed packages
|
// Internally managed packages
|
||||||
import waitUntil from './modules/wait-until.ts';
|
import waitUntil from './module/wait-until.ts';
|
||||||
import { core } from './modules/actions/index.ts';
|
import { core } from './module/actions/index.ts';
|
||||||
import { dedent } from './modules/dedent.ts';
|
import { dedent } from './module/dedent.ts';
|
||||||
|
|
||||||
// Polyfill for https://github.com/tc39/proposal-string-dedent
|
// Polyfill for https://github.com/tc39/proposal-string-dedent
|
||||||
String.dedent = dedent;
|
String.dedent = dedent;
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
import { configSync } from './dependencies.ts';
|
import { configSync } from './dependencies.ts';
|
||||||
import { configureLogger } from './core/logger/index.ts';
|
import { configureLogger } from './core/logger/index.ts';
|
||||||
import { Options } from './config/options.ts';
|
import { Options } from './config/options.ts';
|
||||||
import { CommandFactory } from './commands/command-factory.ts';
|
import { CommandFactory } from './command/command-factory.ts';
|
||||||
import { ArgumentsParser } from './core/cli/arguments-parser.ts';
|
import { ArgumentsParser } from './core/cli/arguments-parser.ts';
|
||||||
import { Environment } from './core/env/environment.ts';
|
import { Environment } from './core/env/environment.ts';
|
||||||
import { EngineDetector } from './core/engine/engine-detector.ts';
|
import { EngineDetector } from './core/engine/engine-detector.ts';
|
||||||
import { ParameterOptions } from './model/parameter-options.ts';
|
|
||||||
|
|
||||||
export class GameCI {
|
export class GameCI {
|
||||||
private readonly env: Environment;
|
private readonly env: Environment;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import Platform from './platform.ts';
|
||||||
import UnityVersioning from './unity-versioning.ts';
|
import UnityVersioning from './unity-versioning.ts';
|
||||||
import Versioning from './versioning.ts';
|
import Versioning from './versioning.ts';
|
||||||
import { GitRepoReader } from './input-readers/git-repo.ts';
|
import { GitRepoReader } from './input-readers/git-repo.ts';
|
||||||
import { CommandInterface } from '../commands/command/command-interface.ts';
|
import { CommandInterface } from '../command/command-interface.ts';
|
||||||
import { Environment } from '../core/env/environment.ts';
|
import { Environment } from '../core/env/environment.ts';
|
||||||
import { Parameter } from './parameter.ts';
|
import { Parameter } from './parameter.ts';
|
||||||
|
|
||||||
|
|
@ -168,7 +168,7 @@ class Parameters {
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
static getUnitySerial() {
|
private getUnitySerial() {
|
||||||
let unitySerial = this.get('unitySerial');
|
let unitySerial = this.get('unitySerial');
|
||||||
|
|
||||||
if (!unitySerial && this.env.getOS() === 'windows') {
|
if (!unitySerial && this.env.getOS() === 'windows') {
|
||||||
|
|
@ -180,7 +180,7 @@ class Parameters {
|
||||||
return unitySerial;
|
return unitySerial;
|
||||||
}
|
}
|
||||||
|
|
||||||
static getSerialFromLicense(license) {
|
private getSerialFromLicense(license) {
|
||||||
if (!license) {
|
if (!license) {
|
||||||
throw new Error(String.dedent`
|
throw new Error(String.dedent`
|
||||||
Missing Unity License File and no Unity Serial was found. If this is a personal license,
|
Missing Unity License File and no Unity Serial was found. If this is a personal license,
|
||||||
|
|
|
||||||
|
|
@ -1254,10 +1254,10 @@
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.60.tgz#35f3d6213daed95da7f0f73e75bcc6980e90597b"
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.60.tgz#35f3d6213daed95da7f0f73e75bcc6980e90597b"
|
||||||
integrity sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==
|
integrity sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==
|
||||||
|
|
||||||
"@types/node@^18.6.4":
|
"@types/node@^18.7.13":
|
||||||
version "18.6.4"
|
version "18.7.13"
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.6.4.tgz#fd26723a8a3f8f46729812a7f9b4fc2d1608ed39"
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.13.tgz#23e6c5168333480d454243378b69e861ab5c011a"
|
||||||
integrity sha512-I4BD3L+6AWiUobfxZ49DlU43gtI+FTHSv9pE2Zekg6KjMpre4ByusaljW3vYSLJrvQ1ck1hUaeVu8HVlY3vzHg==
|
integrity sha512-46yIhxSe5xEaJZXWdIBP7GU4HDTG8/eo0qd9atdiL+lFpA03y8KS+lkTN834TWJj5767GbWv4n/P6efyTFt1Dw==
|
||||||
|
|
||||||
"@types/normalize-package-data@^2.4.0":
|
"@types/normalize-package-data@^2.4.0":
|
||||||
version "2.4.0"
|
version "2.4.0"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue