shenanigans-manager
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -10,4 +10,6 @@ "use strict"; | ||
}; | ||
const fs = require("fs"); | ||
const command_1 = require("../command"); | ||
const createAllRepositories_1 = require("./createAllRepositories"); | ||
const linkAllRepositories_1 = require("./linkAllRepositories"); | ||
const runGulpInAll_1 = require("./runGulpInAll"); | ||
@@ -26,6 +28,9 @@ const updateGulpShenanigansInAll_1 = require("./updateGulpShenanigansInAll"); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (!fs.existsSync(this.settings.codeDir)) { | ||
fs.mkdirSync(this.settings.codeDir); | ||
} | ||
yield this.subroutine(createAllRepositories_1.CreateAllRepositories, { | ||
install: true, | ||
link: true | ||
install: true | ||
}); | ||
yield this.subroutine(linkAllRepositories_1.LinkAllRepositories, {}); | ||
yield this.subroutine(updateGulpShenanigansInAll_1.UpdateGulpShenanigansInAll, {}); | ||
@@ -32,0 +37,0 @@ yield this.subroutine(runGulpInAll_1.RunGulpInAll, {}); |
@@ -10,6 +10,2 @@ import { Command } from "../command"; | ||
install?: boolean; | ||
/** | ||
* Whether to also link the repositories together. | ||
*/ | ||
link?: boolean; | ||
} | ||
@@ -16,0 +12,0 @@ /** |
@@ -19,3 +19,2 @@ "use strict"; | ||
const command_1 = require("../command"); | ||
const shell_1 = require("../shell"); | ||
const createRepository_1 = require("./createRepository"); | ||
@@ -36,16 +35,2 @@ /** | ||
} | ||
if (!this.args.link) { | ||
return; | ||
} | ||
const shell = new shell_1.Shell(this.logger); | ||
for (const target of this.settings.allRepositories) { | ||
for (const external of this.settings.allRepositories) { | ||
if (target === external) { | ||
continue; | ||
} | ||
yield shell | ||
.setCwd(this.settings.codeDir, target) | ||
.execute(`npm link ${target}`); | ||
} | ||
} | ||
}); | ||
@@ -52,0 +37,0 @@ } |
@@ -7,6 +7,2 @@ import { Command } from "../command"; | ||
/** | ||
* Whether to run installs in parallel. | ||
*/ | ||
parallel?: boolean; | ||
/** | ||
* Whether to also install the repository's dependencies. | ||
@@ -24,19 +20,5 @@ */ | ||
* @param args Arguments for the command. | ||
* @returns A Promise for ensuring the repository exists. | ||
* @returns A Promise for running the command. | ||
*/ | ||
execute(): Promise<any>; | ||
/** | ||
* Executes the command in parallel. | ||
* | ||
* @param args Arguments for the command. | ||
* @returns A Promise for ensuring the repository exists. | ||
*/ | ||
executeInParallel(): Promise<any>; | ||
/** | ||
* Executes the command in series. | ||
* | ||
* @param args Arguments for the command. | ||
* @returns A Promise for ensuring the repository exists. | ||
*/ | ||
executeInSeries(): Promise<any>; | ||
} |
@@ -28,30 +28,6 @@ "use strict"; | ||
* @param args Arguments for the command. | ||
* @returns A Promise for ensuring the repository exists. | ||
* @returns A Promise for running the command. | ||
*/ | ||
execute() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.args.parallel ? this.executeInParallel() : this.executeInSeries(); | ||
}); | ||
} | ||
/** | ||
* Executes the command in parallel. | ||
* | ||
* @param args Arguments for the command. | ||
* @returns A Promise for ensuring the repository exists. | ||
*/ | ||
executeInParallel() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield Promise.all(this.settings.allRepositories.map((repository) => __awaiter(this, void 0, void 0, function* () { | ||
yield this.subroutine(ensureRepositoryExists_1.EnsureRepositoryExists, __assign({}, this.args, { repository })); | ||
}))); | ||
}); | ||
} | ||
/** | ||
* Executes the command in series. | ||
* | ||
* @param args Arguments for the command. | ||
* @returns A Promise for ensuring the repository exists. | ||
*/ | ||
executeInSeries() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
for (const repository of this.settings.allRepositories) { | ||
@@ -58,0 +34,0 @@ yield this.subroutine(ensureRepositoryExists_1.EnsureRepositoryExists, __assign({}, this.args, { repository })); |
import { Command } from "../command"; | ||
/** | ||
* Arguments for a RunGulpInAll command. | ||
*/ | ||
export interface IRunGulpInAllArgs { | ||
/** | ||
* Whether to run updates in parallel. | ||
*/ | ||
parallel?: boolean; | ||
} | ||
/** | ||
* Runs Gulp in multiple repositories. | ||
*/ | ||
export declare class RunGulpInAll extends Command<IRunGulpInAllArgs, void> { | ||
export declare class RunGulpInAll extends Command<{}, void> { | ||
/** | ||
@@ -21,14 +12,2 @@ * Executes the command. | ||
execute(): Promise<any>; | ||
/** | ||
* Executes the command in parallel. | ||
* | ||
* @returns A Promise for running the command in parallel. | ||
*/ | ||
executeInParallel(): Promise<any>; | ||
/** | ||
* Executes the command in series. | ||
* | ||
* @returns A Promise for running the command in series. | ||
*/ | ||
executeInSeries(): Promise<any>; | ||
} |
@@ -31,26 +31,2 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.args.parallel | ||
? this.executeInParallel() | ||
: this.executeInSeries(); | ||
}); | ||
} | ||
/** | ||
* Executes the command in parallel. | ||
* | ||
* @returns A Promise for running the command in parallel. | ||
*/ | ||
executeInParallel() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield Promise.all(this.settings.allRepositories.map((repository) => __awaiter(this, void 0, void 0, function* () { | ||
yield this.subroutine(runGulpIn_1.RunGulpIn, __assign({}, this.args, { repository })); | ||
}))); | ||
}); | ||
} | ||
/** | ||
* Executes the command in series. | ||
* | ||
* @returns A Promise for running the command in series. | ||
*/ | ||
executeInSeries() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
for (const repository of this.settings.allRepositories) { | ||
@@ -57,0 +33,0 @@ yield this.subroutine(runGulpIn_1.RunGulpIn, __assign({}, this.args, { repository })); |
import { Command } from "../command"; | ||
/** | ||
* Arguments for an UpdateGulpShenanigansInAll command. | ||
*/ | ||
export interface IUpdateGulpShenanigansInAllArgs { | ||
/** | ||
* Whether to run updates in parallel. | ||
*/ | ||
parallel?: boolean; | ||
} | ||
/** | ||
* Creates a repository locally. | ||
*/ | ||
export declare class UpdateGulpShenanigansInAll extends Command<IUpdateGulpShenanigansInAllArgs, void> { | ||
export declare class UpdateGulpShenanigansInAll extends Command<{}, void> { | ||
/** | ||
@@ -21,16 +12,2 @@ * Executes the command. | ||
execute(): Promise<any>; | ||
/** | ||
* Executes the command in parallel. | ||
* | ||
* @param args Arguments for the command. | ||
* @returns A Promise for executing the command in parallel. | ||
*/ | ||
executeInParallel(): Promise<any>; | ||
/** | ||
* Executes the command in series. | ||
* | ||
* @param args Arguments for the command. | ||
* @returns A Promise for executing the command in series. | ||
*/ | ||
executeInSeries(): Promise<any>; | ||
} |
@@ -31,26 +31,2 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.args.parallel ? this.executeInParallel() : this.executeInSeries(); | ||
}); | ||
} | ||
/** | ||
* Executes the command in parallel. | ||
* | ||
* @param args Arguments for the command. | ||
* @returns A Promise for executing the command in parallel. | ||
*/ | ||
executeInParallel() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield Promise.all(this.settings.allRepositories.map((repository) => __awaiter(this, void 0, void 0, function* () { | ||
yield this.subroutine(updateGulpShenanigansIn_1.UpdateGulpShenanigansIn, __assign({}, this.args, { repository })); | ||
}))); | ||
}); | ||
} | ||
/** | ||
* Executes the command in series. | ||
* | ||
* @param args Arguments for the command. | ||
* @returns A Promise for executing the command in series. | ||
*/ | ||
executeInSeries() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
for (const repository of this.settings.allRepositories) { | ||
@@ -57,0 +33,0 @@ yield this.subroutine(updateGulpShenanigansIn_1.UpdateGulpShenanigansIn, __assign({}, this.args, { repository })); |
@@ -44,3 +44,3 @@ "use strict"; | ||
"prefer global", | ||
"optional Skipping failed optional dependency", | ||
"optional", | ||
"Cloning into", | ||
@@ -47,0 +47,0 @@ "WARN" |
{ | ||
"name": "shenanigans-manager", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "Manages large-scale operations on FullScreenShenanigans project.", | ||
@@ -5,0 +5,0 @@ "bin": { |
@@ -0,3 +1,6 @@ | ||
import * as fs from "fs"; | ||
import { Command } from "../command"; | ||
import { CreateAllRepositories } from "./createAllRepositories"; | ||
import { LinkAllRepositories } from "./linkAllRepositories"; | ||
import { RunGulpInAll } from "./runGulpInAll"; | ||
@@ -16,9 +19,13 @@ import { UpdateGulpShenanigansInAll } from "./updateGulpShenanigansInAll"; | ||
public async execute(): Promise<any> { | ||
if (!fs.existsSync(this.settings.codeDir)) { | ||
fs.mkdirSync(this.settings.codeDir); | ||
} | ||
await this.subroutine( | ||
CreateAllRepositories, | ||
{ | ||
install: true, | ||
link: true | ||
install: true | ||
}); | ||
await this.subroutine(LinkAllRepositories, {}); | ||
await this.subroutine(UpdateGulpShenanigansInAll, {}); | ||
@@ -25,0 +32,0 @@ await this.subroutine(RunGulpInAll, {}); |
import { Command } from "../command"; | ||
import { Shell } from "../shell"; | ||
import { CreateRepository } from "./createRepository"; | ||
@@ -13,7 +12,2 @@ | ||
install?: boolean; | ||
/** | ||
* Whether to also link the repositories together. | ||
*/ | ||
link?: boolean; | ||
} | ||
@@ -39,21 +33,3 @@ | ||
} | ||
if (!this.args.link) { | ||
return; | ||
} | ||
const shell: Shell = new Shell(this.logger); | ||
for (const target of this.settings.allRepositories) { | ||
for (const external of this.settings.allRepositories) { | ||
if (target === external) { | ||
continue; | ||
} | ||
await shell | ||
.setCwd(this.settings.codeDir, target) | ||
.execute(`npm link ${target}`); | ||
} | ||
} | ||
} | ||
} |
@@ -9,7 +9,2 @@ import { Command } from "../command"; | ||
/** | ||
* Whether to run installs in parallel. | ||
*/ | ||
parallel?: boolean; | ||
/** | ||
* Whether to also install the repository's dependencies. | ||
@@ -28,34 +23,5 @@ */ | ||
* @param args Arguments for the command. | ||
* @returns A Promise for ensuring the repository exists. | ||
* @returns A Promise for running the command. | ||
*/ | ||
public async execute(): Promise<any> { | ||
return this.args.parallel ? this.executeInParallel() : this.executeInSeries(); | ||
} | ||
/** | ||
* Executes the command in parallel. | ||
* | ||
* @param args Arguments for the command. | ||
* @returns A Promise for ensuring the repository exists. | ||
*/ | ||
public async executeInParallel(): Promise<any> { | ||
await Promise.all( | ||
this.settings.allRepositories.map( | ||
async (repository: string): Promise<void> => { | ||
await this.subroutine( | ||
EnsureRepositoryExists, | ||
{ | ||
...this.args, | ||
repository | ||
}); | ||
})); | ||
} | ||
/** | ||
* Executes the command in series. | ||
* | ||
* @param args Arguments for the command. | ||
* @returns A Promise for ensuring the repository exists. | ||
*/ | ||
public async executeInSeries(): Promise<any> { | ||
for (const repository of this.settings.allRepositories) { | ||
@@ -62,0 +28,0 @@ await this.subroutine( |
@@ -5,15 +5,5 @@ import { Command } from "../command"; | ||
/** | ||
* Arguments for a RunGulpInAll command. | ||
*/ | ||
export interface IRunGulpInAllArgs { | ||
/** | ||
* Whether to run updates in parallel. | ||
*/ | ||
parallel?: boolean; | ||
} | ||
/** | ||
* Runs Gulp in multiple repositories. | ||
*/ | ||
export class RunGulpInAll extends Command<IRunGulpInAllArgs, void> { | ||
export class RunGulpInAll extends Command<{}, void> { | ||
/** | ||
@@ -25,31 +15,2 @@ * Executes the command. | ||
public async execute(): Promise<any> { | ||
return this.args.parallel | ||
? this.executeInParallel() | ||
: this.executeInSeries(); | ||
} | ||
/** | ||
* Executes the command in parallel. | ||
* | ||
* @returns A Promise for running the command in parallel. | ||
*/ | ||
public async executeInParallel(): Promise<any> { | ||
await Promise.all( | ||
this.settings.allRepositories.map( | ||
async (repository: string): Promise<void> => { | ||
await this.subroutine( | ||
RunGulpIn, | ||
{ | ||
...this.args, | ||
repository | ||
}); | ||
})); | ||
} | ||
/** | ||
* Executes the command in series. | ||
* | ||
* @returns A Promise for running the command in series. | ||
*/ | ||
public async executeInSeries(): Promise<any> { | ||
for (const repository of this.settings.allRepositories) { | ||
@@ -56,0 +17,0 @@ await this.subroutine( |
@@ -5,15 +5,5 @@ import { Command } from "../command"; | ||
/** | ||
* Arguments for an UpdateGulpShenanigansInAll command. | ||
*/ | ||
export interface IUpdateGulpShenanigansInAllArgs { | ||
/** | ||
* Whether to run updates in parallel. | ||
*/ | ||
parallel?: boolean; | ||
} | ||
/** | ||
* Creates a repository locally. | ||
*/ | ||
export class UpdateGulpShenanigansInAll extends Command<IUpdateGulpShenanigansInAllArgs, void> { | ||
export class UpdateGulpShenanigansInAll extends Command<{}, void> { | ||
/** | ||
@@ -25,31 +15,2 @@ * Executes the command. | ||
public async execute(): Promise<any> { | ||
return this.args.parallel ? this.executeInParallel() : this.executeInSeries(); | ||
} | ||
/** | ||
* Executes the command in parallel. | ||
* | ||
* @param args Arguments for the command. | ||
* @returns A Promise for executing the command in parallel. | ||
*/ | ||
public async executeInParallel(): Promise<any> { | ||
await Promise.all( | ||
this.settings.allRepositories.map( | ||
async (repository: string): Promise<void> => { | ||
await this.subroutine( | ||
UpdateGulpShenanigansIn, | ||
{ | ||
...this.args, | ||
repository | ||
}); | ||
})); | ||
} | ||
/** | ||
* Executes the command in series. | ||
* | ||
* @param args Arguments for the command. | ||
* @returns A Promise for executing the command in series. | ||
*/ | ||
public async executeInSeries(): Promise<any> { | ||
for (const repository of this.settings.allRepositories) { | ||
@@ -56,0 +17,0 @@ await this.subroutine( |
@@ -18,3 +18,3 @@ /** | ||
"prefer global", | ||
"optional Skipping failed optional dependency", | ||
"optional", | ||
"Cloning into", | ||
@@ -42,11 +42,11 @@ "WARN" | ||
/** | ||
* @param data Incoming data string. | ||
* @param prefix Prefix to check for on the data string. | ||
* @returns Whether data starts with the prefix. | ||
*/ | ||
private hasPrefix(data: string, prefix: string): boolean { | ||
const index: number = data.indexOf(prefix); | ||
return index >= 0 && index <= 3; | ||
} | ||
/** | ||
* @param data Incoming data string. | ||
* @param prefix Prefix to check for on the data string. | ||
* @returns Whether data starts with the prefix. | ||
*/ | ||
private hasPrefix(data: string, prefix: string): boolean { | ||
const index: number = data.indexOf(prefix); | ||
return index >= 0 && index <= 3; | ||
} | ||
} |
73
82969
2552
4