Fix the code-format
This commit is contained in:
parent
1e6daaacd7
commit
6ecfecbcbd
2 changed files with 42 additions and 16 deletions
56
gulpfile.ts
56
gulpfile.ts
|
@ -1,3 +1,4 @@
|
|||
import { Server, Socket } from "net";
|
||||
import browserSync = require("browser-sync");
|
||||
import browserify = require("browserify");
|
||||
import log = require("fancy-log");
|
||||
|
@ -10,7 +11,6 @@ import sass = require("gulp-sass");
|
|||
import terser = require("gulp-terser");
|
||||
import merge = require("merge-stream");
|
||||
import minimist = require("minimist");
|
||||
import { Server, Socket } from "net";
|
||||
import PromiseQueue = require("promise-queue");
|
||||
import { parseArgsStringToArgv } from "string-argv";
|
||||
import Path = require("upath");
|
||||
|
@ -45,8 +45,11 @@ const incrementalMessage = "File change detected. Starting incremental compilati
|
|||
*
|
||||
* @param errorCount
|
||||
* The number of errors which occurred.
|
||||
*
|
||||
* @returns
|
||||
* The formatted message.
|
||||
*/
|
||||
const watchFinishMessage = (errorCount: number) =>
|
||||
const watchFinishMessage = (errorCount: number): string =>
|
||||
{
|
||||
return `Found ${errorCount} errors. Watching for file changes.`;
|
||||
};
|
||||
|
@ -61,8 +64,11 @@ let options = ParseArgs(process.argv.slice(2));
|
|||
*
|
||||
* @param args
|
||||
* The arguments to parse.
|
||||
*
|
||||
* @returns
|
||||
* The parsed arguments.
|
||||
*/
|
||||
function ParseArgs(args: string[])
|
||||
function ParseArgs(args: string[]): minimist.ParsedArgs
|
||||
{
|
||||
return minimist(
|
||||
args,
|
||||
|
@ -87,7 +93,7 @@ let settings = new Settings(options["target"]);
|
|||
/**
|
||||
* Cleans the project.
|
||||
*/
|
||||
export async function Clean()
|
||||
export async function Clean(): Promise<void>
|
||||
{
|
||||
let directories = [
|
||||
"javascript",
|
||||
|
@ -108,6 +114,7 @@ export async function Clean()
|
|||
|
||||
await FileSystem.mkdirp(settings.TestThemePath());
|
||||
await FileSystem.remove(settings.TestThemePath());
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
await require("create-symlink")(settings.RootPath(), settings.TestThemePath(), { type: "junction" });
|
||||
}
|
||||
|
||||
|
@ -115,6 +122,9 @@ Clean.description = "Cleans the project.";
|
|||
|
||||
/**
|
||||
* Builds the project in watched mode.
|
||||
*
|
||||
* @param done
|
||||
* A callback which is executed once the task has finished.
|
||||
*/
|
||||
export let Watch: TaskFunction = (done) =>
|
||||
{
|
||||
|
@ -153,6 +163,12 @@ Watch.description = "Builds the project in watched mode.";
|
|||
|
||||
/**
|
||||
* Reloads all browsers using `browser-sync`.
|
||||
*
|
||||
* @param filePath
|
||||
* A glob-path which points to the files which must be reloaded.
|
||||
*
|
||||
* @returns
|
||||
* The actual task.
|
||||
*/
|
||||
function BrowserSync(filePath?: string): TaskFunction
|
||||
{
|
||||
|
@ -176,7 +192,7 @@ function BrowserSync(filePath?: string): TaskFunction
|
|||
/**
|
||||
* Builds the project.
|
||||
*/
|
||||
export async function Build()
|
||||
export async function Build(): Promise<void>
|
||||
{
|
||||
if (settings.Watch)
|
||||
{
|
||||
|
@ -204,12 +220,16 @@ export async function Build()
|
|||
|
||||
/**
|
||||
* Builds the TypeScript- and JavaScript-library.
|
||||
*
|
||||
* @returns
|
||||
* The pipeline to execute.
|
||||
*/
|
||||
export async function Library()
|
||||
export async function Library(): Promise<NodeJS.ReadWriteStream>
|
||||
{
|
||||
let streams: Array<Promise<NodeJS.ReadWriteStream>> = [];
|
||||
let queue = new PromiseQueue();
|
||||
let tsConfigFile = settings.TypeScriptProjectRoot("tsconfig.json");
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
let tsConfig = require(tsConfigFile);
|
||||
|
||||
let optionBase: browserify.Options = {
|
||||
|
@ -242,12 +262,13 @@ export async function Library()
|
|||
}
|
||||
|
||||
bundler.plugin(
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
require("tsify"),
|
||||
{
|
||||
project: tsConfigFile
|
||||
});
|
||||
|
||||
let bundle = async () =>
|
||||
let bundle = async (): Promise<NodeJS.ReadWriteStream> =>
|
||||
{
|
||||
return new Promise<NodeJS.ReadWriteStream>(
|
||||
(resolve) =>
|
||||
|
@ -317,7 +338,7 @@ export async function Library()
|
|||
});
|
||||
}
|
||||
|
||||
let build = () => queue.add(bundle);
|
||||
let build = (): Promise<NodeJS.ReadWriteStream> => queue.add(bundle);
|
||||
build.displayName = Build.displayName;
|
||||
build.description = Build.description;
|
||||
streams.push(build());
|
||||
|
@ -331,8 +352,11 @@ Library.description = "Builds the TypeScript- and JavaScript-library.";
|
|||
|
||||
/**
|
||||
* Builds the theme.
|
||||
*
|
||||
* @returns
|
||||
* The pipeline to execute.
|
||||
*/
|
||||
export async function Theme()
|
||||
export async function Theme(): Promise<NodeJS.ReadWriteStream>
|
||||
{
|
||||
if (settings.Watch)
|
||||
{
|
||||
|
@ -378,8 +402,7 @@ export async function Theme()
|
|||
settings.Debug ?
|
||||
{
|
||||
sourcemaps: true
|
||||
}
|
||||
:
|
||||
} :
|
||||
undefined)
|
||||
).on(
|
||||
"end",
|
||||
|
@ -387,7 +410,7 @@ export async function Theme()
|
|||
{
|
||||
if (settings.Watch)
|
||||
{
|
||||
console.log("Rebuilding scss-code finished.")
|
||||
console.log("Rebuilding scss-code finished.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -396,8 +419,11 @@ Theme.description = "Builds the theme.";
|
|||
|
||||
/**
|
||||
* Builds the templates.
|
||||
*
|
||||
* @returns
|
||||
* The pipeline to execute.
|
||||
*/
|
||||
export function Templates()
|
||||
export function Templates(): NodeJS.ReadWriteStream
|
||||
{
|
||||
return gulp.src(
|
||||
settings.TemplateSource("**")).pipe(
|
||||
|
@ -409,7 +435,7 @@ Templates.description = "Builds the templates.";
|
|||
/**
|
||||
* Stops a watch-task.
|
||||
*/
|
||||
export async function Stop()
|
||||
export async function Stop(): Promise<void>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -436,4 +462,4 @@ export async function Stop()
|
|||
}
|
||||
}
|
||||
|
||||
Stop.description = "Stops a watch-task";
|
||||
Stop.description = "Stops a watch-task";
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import "bootstrap";
|
||||
import "jquery";
|
||||
import "popper.js";
|
||||
import "popper.js";
|
||||
|
|
Loading…
Reference in a new issue