Skip to content

k.utils.ninjible

Site import and Lighthouse comparison task (Ninjible)

Overview

k.utils.ninjible Create a remote site migration/optimization task and query the progress.

createTask()

Create a complete task (including optimization process).

ParameterTypeRequiredDescription
urlstringYesOld site URL to migrate/optimize
rootDomainstringYesNew site root domain
orgNamestringYesOrganization name used to determine task ownership

Returns: string, the task Id.

ts
const taskId = k.utils.ninjible.createTask(oldUrl, rootDomain, orgName)

createImportTask()

Import sites only.

ParameterTypeRequiredDescription
urlstringYesOld site URL to import
rootDomainstringYesNew site root domain

Returns: string, the task Id.

ts
const taskId = k.utils.ninjible.createImportTask("https://old.example.com", "new.example.com")

getStatus()

Press taskId to get NinjibleProgress: isDone, percent, oldUrl, newUrl, Lighthouse scores, and more.

ParameterTypeRequiredDescription
taskIdstringYesTask Id returned by createTask() or createImportTask()

Returns: NinjibleProgress \| null.

ts
const status = k.utils.ninjible.getStatus(taskId)
return {
    percent: status?.percent,
    done: status?.isDone,
    newUrl: status?.newUrl
}