Namespace: tasks

Interfaces

Type Aliases

ColumnIndex

Ƭ ColumnIndex<Key>: { [P in Key]: number }

Mapped type for storing typed key/index pairs for parsing CSV columns to objects.

Type parameters

Name Type
Key extends string

LongPlatform

Ƭ LongPlatform: "facebook" | "vkontakte" | "gamedistribution" | "viber" | "zoom" | "web" | "unknown"

A more human readable version of the target platforms.


Platform

Ƭ Platform: PlayerInfoPlatform | "GD"

Supported build target platforms.


ServerOptions

Ƭ ServerOptions: ServerHttpOptions | ServerHttpsOptions

Local development server options.


Stage

Ƭ Stage: "production" | "staging" | "dev"

Supported build target stages.


TextureFormat

Ƭ TextureFormat: { options?: OptipngOptions ; type: "png" } | { options?: PngquantOptions ; type: "png8" } | { options?: JpegtranOptions ; type: "jpg" } | { options?: WebPOptions ; type: "webp" }

Texture compression type with type specific imagemin plugin options.

Functions

audiosprite

audiosprite(source, dest, options): () => any

Generate an audio sprite from a collection of sounds.

If dest is empty the stream will not be piped to gulp.dest so it can be further piped the by the user.

Parameters

Name Type Description
source string | string[] Glob pattern for source files
dest undefined | string Target directory for output
options AudioSpriteOptions Audio sprite options

Returns

fn

▸ (): any

Returns

any


cacheBust

cacheBust(source, manifest, dest, manifestDest): () => any

Parameters

Name Type
source string | string[]
manifest string
dest string
manifestDest string

Returns

fn

▸ (): any

Returns

any


clean

clean(dest): gulp.TaskFunction

Simple file/directory delete task.

Parameters

Name Type Description
dest string | string[] Glob pattern(s) for matching files

Returns

gulp.TaskFunction


compileSlsGameServer

compileSlsGameServer(source, dest, data): () => ReadWriteStream

Compile game server serverless.yml.

Compile mustache templates in serverless/common.yml, serverless/gameserver.yml and any local yml files. Merge all those yml files into serverless.yml.

Parameters

Name Type Description
source string | string[] Local serverless.yml yml components
dest string Target location of generated serverless.yml
data Object Project specific data required to compile serverless/general.yml

Returns

fn

▸ (): ReadWriteStream

Returns

ReadWriteStream


compileSlsService

compileSlsService(source, dest, data): () => ReadWriteStream

Compile microservice serverless.yml.

Compiles mustache templates in serverless/common.yml, serverless/service.yml and any local yml files. Merge all those yml files into serverless.yml.

Parameters

Name Type Description
source string | string[] Local serverless.yml yml components
dest string Target location of generated serverless.yml
data Object Project specific data required to compile serverless/general.yml

Returns

fn

▸ (): ReadWriteStream

Returns

ReadWriteStream


compileTemplates

compileTemplates(source, dest, data): () => ReadWriteStream

Parameters

Name Type
source string | string[]
dest string
data Object

Returns

fn

▸ (): ReadWriteStream

Returns

ReadWriteStream


copy

copy(source, dest, srcOptions?): () => Promise<void> | ReadWriteStream

Simple file copy task.

Parameters

Name Type Description
source string | string[] Glob pattern(s) for matching files
dest string Destination directory
srcOptions? Partial<SrcOptions> Extra options for gulp.src

Returns

fn

▸ (): Promise<void> | ReadWriteStream

Returns

Promise<void> | ReadWriteStream


copyDependencies

copyDependencies(source, dest): (done: TaskDone) => void

Parameters

Name Type
source string | string[]
dest string

Returns

fn

▸ (done): void

Parameters
Name Type
done TaskDone
Returns

void


copyWatch

copyWatch(source, dest, options?): () => ReadWriteStream

Parameters

Name Type
source string | string[]
dest string
options? Object

Returns

fn

▸ (): ReadWriteStream

Returns

ReadWriteStream


deployEditor

deployEditor(source, bucket, projectShortName, latestWindowsYMLPath, latestMacYMLPath): () => Transform

Deploy an editor.

Parameters

Name Type Description
source string[] Glob pattern for source files
bucket string The name of the target S3 bucket to deploy to
projectShortName string Editor’s short name
latestWindowsYMLPath string The path to the editor’s latest.yml file marking the last released version for Windows
latestMacYMLPath string The path to the editor’s latest-mac.yml file marking the last released version for Mac

Returns

fn

▸ (): Transform

Returns

Transform


deployInstantGame

deployInstantGame(source, config, externalFiles?): () => NodeJS.ReadWriteStream | Transform

Deploy an HTML5 game. Deployment and hosting methods depend on the target platform.

Parameters

Name Type Description
source string | string[] Glob pattern for source files
config Config App configuration
externalFiles? string[] Optional list of non-cachebusted files for web hosting

Returns

fn

▸ (): NodeJS.ReadWriteStream | Transform

Returns

NodeJS.ReadWriteStream | Transform


deployServerless

deployServerless(dist, stage): () => Promise<void>

Deploy the Serverless app to AWS.

Parameters

Name Type Description
dist string Serverless build directory containing the pre-built app
stage string Stage of the app to deploy

Returns

fn

▸ (): Promise<void>

Returns

Promise<void>


deployServerlessAssets

deployServerlessAssets(dist, stage, isDelete?): () => Promise<void>

Deploy the public Serverless assets to S3.

Parameters

Name Type Default value Description
dist string undefined Serverless build directory containing the pre-built app
stage string undefined Stage of the app to deploy
isDelete boolean false =false. Optionally delete the contents of the bucket before deploying.

Returns

fn

▸ (): Promise<void>

Returns

Promise<void>


generateCI

generateCI(config): () => Promise<void>

Generate the .gitlab-ci.yml file that is used for GitLab CI/CD pipeline tasks. The file is generated based on params available in the *.project file.

Parameters

Name Type Description
config Config Config loaded from the *.project file

Returns

fn

▸ (): Promise<void>

Returns

Promise<void>


generateServerlessEnv

generateServerlessEnv(dist, dest, stage): (done: TaskDone) => void

Generate a dotenv configuration from the compiled serverless.yml template. The filename for the generated configuration is env instead of the traditional .env to allow Serverless to deploy it.

This is meant to be used with environments that do not support regular environment variables, such as AWS Lambda@Edge.

Remember to enable dotenv injection from the Webpack configuration to actually load the environment before any other handler code runs!

Parameters

Name Type Description
dist string Serverless build directory containing the pre-built app
dest string Destination directory to generate the env file into
stage string Stage of the app

Returns

fn

▸ (done): void

Parameters
Name Type
done TaskDone
Returns

void


getColumns

getColumns<Key>(row, ...keys): Partial<ColumnIndex<Key>>

Create a column title/index mapping to parse objects from CSV data. Title to key mapping is case insensitive. If a title field is not found its index will be undefined.

Type parameters

Name Type
Key extends string

Parameters

Name Type Description
row string[] Array of cell values with column titles
...keys Key[] Keys to find the column indices for

Returns

Partial<ColumnIndex<Key>>


getCsvData

getCsvData(url): Promise<string[][]>

Fetch and parse CSV data from an external url.

Parameters

Name Type Description
url string URL to fetch from

Returns

Promise<string[][]>


hostInstantGame

hostInstantGame(source, config, port?): () => Promise<void>

Start a local development server for the client. The hosting style varies depending on the target platform.

Parameters

Name Type Description
source string Directory with the build output files
config Config Project configuration, usually from *.project
port? number Port to use for the server, defaults to 8080 if not set

Returns

fn

▸ (): Promise<void>

Returns

Promise<void>


hostServerless

hostServerless(dist, options): () => Promise<void>

Run Serverless in offline mode locally. Uses a self-signed localhost https certificate.

Parameters

Name Type Description
dist string Serverless build directory containing the pre-built app
options ServerlessOfflineOptions Serverless offline configuration

Returns

fn

▸ (): Promise<void>

Returns

Promise<void>


installDynamoDb

installDynamoDb(): () => Promise<void>

Install local DynamoDB. Needs dynamodb-localhost package installed to work.

Returns

fn

▸ (): Promise<void>

Returns

Promise<void>


invokeAwsLambda

invokeAwsLambda(lambda, eventData, dist, stage): () => Promise<void>

Invoke a Serverless AWS lambda function.

Parameters

Name Type Description
lambda string Lambda name to invoke
eventData string Data to pass to the function
dist string Serverless build directory containing the pre-built app
stage string Stage of the app to invoke

Returns

fn

▸ (): Promise<void>

Returns

Promise<void>


invokeLocalLambda

invokeLocalLambda(lambda, eventData, dist): () => Promise<void>

Invoke a Serverless offline lambda function.

Parameters

Name Type Description
lambda string Lambda name to invoke
eventData string Data to pass to the function
dist string Serverless build directory containing the pre-built app

Returns

fn

▸ (): Promise<void>

Returns

Promise<void>


longPlatform

longPlatform(config?): LongPlatform

Get the long name of the current build target platform. Target platform is determined by command-line arguments. If no argument is defined then the platform is selected based on the availability of the platforms defined in the config file passed as the parameter. If everything else fails, web is returned.

All supported arguments:

  • --fb = facebook
  • --vk = vkontakte
  • --gd = gamedistribution
  • --vbr = viber
  • --zoom = zoom
  • --web = web

Parameters

Name Type
config? Config

Returns

LongPlatform


platform

platform(config?): Platform

Get the current build target platform. Target platform is determined by command-line arguments. If no argument is defined then the platform is selected based on the availability of the platforms defined in the config file passed as the parameter. If everything else fails, WEB is returned.

All supported arguments:

  • --fb = FB
  • --vk = VK
  • --gd = GD
  • --vbr = VBR
  • --zoom = ZOOM
  • --web = WEB

Parameters

Name Type
config? Config

Returns

Platform


postJson

postJson(url, data, headers?): (done: TaskDone) => void

POST an object as JSON to url.

Parameters

Name Type Description
url string Target url
data any Object to convert to JSON and send
headers? IncomingHttpHeaders Optional headerData used in headers

Returns

fn

▸ (done): void

Parameters
Name Type
done TaskDone
Returns

void


printServerless

printServerless(dist, stage): () => Promise<void>

Print the compiled serverless.yml for debug purposes.

Parameters

Name Type Description
dist string Serverless build directory containing the pre-built app
stage string Stage of the app

Returns

fn

▸ (): Promise<void>

Returns

Promise<void>


requireColumns

requireColumns<Key>(row, ...keys): ColumnIndex<Key>

Create a column title/index mapping to parse objects from CSV data. Title to key mapping is case insensitive. If title fields are not found an error is thrown with the list of all missing fields.

Type parameters

Name Type
Key extends string

Parameters

Name Type Description
row string[] Array of cell values with column titles
...keys Key[] Keys to find the column indices for

Returns

ColumnIndex<Key>


select

select<T1, T2, T3>(values): T1 | T2 | T3

Select an option based on build target stage. Target stage is determined by command-line arguments. If --production is specified, the production value is returned. Similarly if --staging is specified, the staging value is returned. If neither of these is specified dev stage is assumed as the default one.

Type parameters

Name
T1
T2
T3

Parameters

Name Type Description
values Object Option for each stage
values.dev T3 -
values.production T1 -
values.staging T2 -

Returns

T1 | T2 | T3


sequence

sequence(gulp, ...tasks): gulp.TaskFunction

Run gulp tasks in a sequence. Pass in arrays to fork and join the execution of the sequence.

Parameters

Name Type Description
gulp Gulp Gulp instance of the main gulpfile
...tasks (string | string[])[] -

Returns

gulp.TaskFunction


server

server(source, options?): () => Promise<void>

Host a local development server. The task requires the http-server package to be installed globally.

Parameters

Name Type Description
source string Asset root path
options ServerOptions Options for the server

Returns

fn

▸ (): Promise<void>

Returns

Promise<void>


stage

stage(): Stage

Get the current build target stage. Target stage is determined by command-line arguments. If --production is specified the stage is production. Similarly if --staging is specified the stage is staging. If neither of these is specified dev stage is assumed as the default one.

Returns

Stage


texturePacker

texturePacker(source, dest, options): () => any

Build sprite sheets.

If dest is empty the stream will not be piped to gulp.dest so it can be further piped the by the user.

Parameters

Name Type Description
source string | string[] Glob pattern for source files
dest undefined | string Target directory for output
options TexturePackerOptions Texture packing options

Returns

fn

▸ (): any

Returns

any


typescript

typescript(dest): () => Promise<void>

Very simple wrapper task for running tsc from a gulpfile.

Parameters

Name Type Description
dest string Target directory for output

Returns

fn

▸ (): Promise<void>

Returns

Promise<void>


watch

watch(gulp, source, tasks): () => void

Watch source files for changes and trigger gulp tasks when changes are detected.

Parameters

Name Type Description
gulp Gulp Gulp instance of the main gulpfile
source string | string[] Glob pattern for files to watch
tasks string | string[] Task or list of tasks to trigger

Returns

fn

▸ (): void

Returns

void


webpack

webpack(source, dest, options, projectConfig?): gulp.TaskFunction

Build a JavaScript bundle for Node or web.

Parameters

Name Type Description
source string | string[] Glob pattern for source files
dest string Target directory for output
options WebpackConfig Webpack options
projectConfig? Config -

Returns

gulp.TaskFunction


writeConstJsonData

writeConstJsonData(data, dirname, relativePath): Promise<void>

Write JSON data to a relative path. Pass __dirname to the dirname parameter to write to a relative path from the caller location.

The data will be stringified using stable stringify to ensure the order of object keys stays the same on subsequent calls for better diff management.

The JSON data will be written in a TypeScript format exported as the default export with as const appended to the end.

This task is a workaround for TypeScript issue #32063 and can be deleted once that is implemented on the language level.

Parameters

Name Type Description
data any JSON data to write
dirname string Root path to calculate the relative path from
relativePath string Relative path of the target file

Returns

Promise<void>


writeJsonData

writeJsonData(data, dirname, relativePath): Promise<void>

Write JSON data to a relative path. Pass __dirname to the dirname parameter to write to a relative path from the caller location.

The data will be stringified using stable stringify to ensure the order of object keys stays the same on subsequent calls for better diff management.

Parameters

Name Type Description
data any JSON data to write
dirname string Root path to calculate the relative path from
relativePath string Relative path of the target file

Returns

Promise<void>


writeTsData

writeTsData(data, dirname, relativePath): Promise<void>

Write a .ts file with exported variables and JSDoc descriptions. Pass __dirname to the dirname parameter to write to a relative path from the caller location.

Parameters

Name Type Description
data TsVariable[] Array of the variables
dirname string Root path to calculate the relative path from
relativePath string Relative path of the target file

Returns

Promise<void>