Deployed the page to Github Pages.
This commit is contained in:
parent
1d79754e93
commit
2c89899458
62797 changed files with 6551425 additions and 15279 deletions
28
node_modules/karma/lib/init/color_schemes.js
generated
vendored
Normal file
28
node_modules/karma/lib/init/color_schemes.js
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
const COLORS_ON = {
|
||||
RESET: '\x1B[39m',
|
||||
ANSWER: '\x1B[36m', // NYAN
|
||||
SUCCESS: '\x1B[32m', // GREEN
|
||||
QUESTION: '\x1B[1m', // BOLD
|
||||
question: function (str) {
|
||||
return this.QUESTION + str + '\x1B[22m'
|
||||
},
|
||||
success: function (str) {
|
||||
return this.SUCCESS + str + this.RESET
|
||||
}
|
||||
}
|
||||
|
||||
const COLORS_OFF = {
|
||||
RESET: '',
|
||||
ANSWER: '',
|
||||
SUCCESS: '',
|
||||
QUESTION: '',
|
||||
question: function (str) {
|
||||
return str
|
||||
},
|
||||
success: function (str) {
|
||||
return str
|
||||
}
|
||||
}
|
||||
|
||||
exports.ON = COLORS_ON
|
||||
exports.OFF = COLORS_OFF
|
116
node_modules/karma/lib/init/formatters.js
generated
vendored
Normal file
116
node_modules/karma/lib/init/formatters.js
generated
vendored
Normal file
|
@ -0,0 +1,116 @@
|
|||
'use strict'
|
||||
|
||||
const path = require('path')
|
||||
const FileUtils = require('../utils/file-utils')
|
||||
|
||||
function quote (value) {
|
||||
return `'${value}'`
|
||||
}
|
||||
|
||||
function formatLine (items) {
|
||||
return items.map(quote).join(', ')
|
||||
}
|
||||
|
||||
function formatMultiLines (items) {
|
||||
return items
|
||||
.map((file) => '\n ' + file)
|
||||
.join(',')
|
||||
}
|
||||
|
||||
function formatFiles (includedFiles, onlyServedFiles) {
|
||||
const lines = []
|
||||
.concat(includedFiles.map(quote))
|
||||
.concat(onlyServedFiles.map((file) => `{ pattern: ${quote(file)}, included: false }`))
|
||||
|
||||
return formatMultiLines(lines)
|
||||
}
|
||||
|
||||
function formatPreprocessors (preprocessors) {
|
||||
const lines = Object.keys(preprocessors)
|
||||
.map((pattern) => `${quote(pattern)}: [${formatLine(preprocessors[pattern])}]`)
|
||||
|
||||
return formatMultiLines(lines)
|
||||
}
|
||||
|
||||
function getConfigPath (file) {
|
||||
return path.join(__dirname, `/../../${file}`)
|
||||
}
|
||||
|
||||
class JavaScriptFormatter {
|
||||
constructor () {
|
||||
this.TEMPLATE_FILE_PATH = getConfigPath('config.tpl.js')
|
||||
this.REQUIREJS_TEMPLATE_FILE = getConfigPath('requirejs.config.tpl.js')
|
||||
}
|
||||
|
||||
generateConfigFile (answers) {
|
||||
const replacements = this.formatAnswers(answers)
|
||||
|
||||
return FileUtils
|
||||
.readFile(this.TEMPLATE_FILE_PATH)
|
||||
.replace(/%(.*)%/g, (a, key) => replacements[key])
|
||||
}
|
||||
|
||||
writeConfigFile (path, answers) {
|
||||
FileUtils.saveFile(path, this.generateConfigFile(answers))
|
||||
}
|
||||
|
||||
writeRequirejsConfigFile (path) {
|
||||
FileUtils.copyFile(this.REQUIREJS_TEMPLATE_FILE, path)
|
||||
}
|
||||
|
||||
formatAnswers (answers) {
|
||||
return {
|
||||
DATE: new Date(),
|
||||
BASE_PATH: answers.basePath,
|
||||
FRAMEWORKS: formatLine(answers.frameworks),
|
||||
FILES: formatFiles(answers.files, answers.onlyServedFiles),
|
||||
EXCLUDE: formatFiles(answers.exclude, []),
|
||||
AUTO_WATCH: answers.autoWatch ? 'true' : 'false',
|
||||
BROWSERS: formatLine(answers.browsers),
|
||||
PREPROCESSORS: formatPreprocessors(answers.preprocessors)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CoffeeFormatter extends JavaScriptFormatter {
|
||||
constructor () {
|
||||
super()
|
||||
this.TEMPLATE_FILE_PATH = getConfigPath('config.tpl.coffee')
|
||||
this.REQUIREJS_TEMPLATE_FILE = getConfigPath('requirejs.config.tpl.coffee')
|
||||
}
|
||||
}
|
||||
|
||||
class LiveFormatter extends JavaScriptFormatter {
|
||||
constructor () {
|
||||
super()
|
||||
this.TEMPLATE_FILE_PATH = getConfigPath('config.tpl.ls')
|
||||
}
|
||||
}
|
||||
|
||||
class TypeFormatter extends JavaScriptFormatter {
|
||||
constructor () {
|
||||
super()
|
||||
this.TEMPLATE_FILE_PATH = getConfigPath('config.tpl.ts')
|
||||
}
|
||||
}
|
||||
|
||||
exports.JavaScript = JavaScriptFormatter
|
||||
exports.Coffee = CoffeeFormatter
|
||||
exports.Live = LiveFormatter
|
||||
exports.Type = TypeFormatter
|
||||
|
||||
exports.createForPath = function (path) {
|
||||
if (/\.coffee$/.test(path)) {
|
||||
return new CoffeeFormatter()
|
||||
}
|
||||
|
||||
if (/\.ls$/.test(path)) {
|
||||
return new LiveFormatter()
|
||||
}
|
||||
|
||||
if (/\.ts$/.test(path)) {
|
||||
return new TypeFormatter()
|
||||
}
|
||||
|
||||
return new JavaScriptFormatter()
|
||||
}
|
15
node_modules/karma/lib/init/log-queue.js
generated
vendored
Normal file
15
node_modules/karma/lib/init/log-queue.js
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
'use strict'
|
||||
|
||||
const logQueue = []
|
||||
function printLogQueue () {
|
||||
logQueue.forEach((log) => log())
|
||||
logQueue.length = 0
|
||||
}
|
||||
|
||||
function push (log) {
|
||||
logQueue.push(log)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
printLogQueue, push
|
||||
}
|
143
node_modules/karma/lib/init/state_machine.js
generated
vendored
Normal file
143
node_modules/karma/lib/init/state_machine.js
generated
vendored
Normal file
|
@ -0,0 +1,143 @@
|
|||
'use strict'
|
||||
|
||||
const logQueue = require('./log-queue')
|
||||
|
||||
let questions
|
||||
let currentQuestion
|
||||
let answers
|
||||
let currentOptions
|
||||
let currentOptionsPointer
|
||||
let currentQuestionId
|
||||
let done
|
||||
|
||||
class StateMachine {
|
||||
constructor (rli, colors) {
|
||||
this.rli = rli
|
||||
this.colors = colors
|
||||
}
|
||||
|
||||
showPrompt () {
|
||||
this.rli.write(this.colors.ANSWER)
|
||||
this.rli.prompt()
|
||||
}
|
||||
|
||||
onKeypress (key) {
|
||||
if (!currentOptions || !key) {
|
||||
return
|
||||
}
|
||||
|
||||
if (key.name === 'tab' || key.name === 'right' || key.name === 'down') {
|
||||
this.suggestOption(currentOptionsPointer + 1)
|
||||
} else if (key.name === 'left' || key.name === 'up') {
|
||||
this.suggestOption(currentOptionsPointer - 1)
|
||||
}
|
||||
|
||||
if (!key.ctrl && !key.meta && key.name !== 'enter' && key.name !== 'return') {
|
||||
key.name = 'escape'
|
||||
}
|
||||
}
|
||||
|
||||
suggestOption (index) {
|
||||
if (!currentOptions) {
|
||||
return
|
||||
}
|
||||
|
||||
if (index === -1) {
|
||||
currentOptionsPointer = currentOptions.length - 1
|
||||
} else if (index === currentOptions.length) {
|
||||
currentOptionsPointer = 0
|
||||
} else {
|
||||
currentOptionsPointer = index
|
||||
}
|
||||
|
||||
this.rli._deleteLineLeft()
|
||||
this.rli._deleteLineRight()
|
||||
this.rli.write(currentOptions[currentOptionsPointer])
|
||||
}
|
||||
|
||||
kill () {
|
||||
currentOptions = null
|
||||
currentQuestionId = null
|
||||
this.rli.write('\n' + this.colors.RESET + '\n')
|
||||
this.rli.close()
|
||||
}
|
||||
|
||||
onLine (line) {
|
||||
if (currentQuestionId) {
|
||||
this.rli.write(this.colors.RESET)
|
||||
line = line.trim().replace(this.colors.ANSWER, '').replace(this.colors.RESET, '')
|
||||
|
||||
if (currentOptions) {
|
||||
currentOptionsPointer = currentOptions.indexOf(line)
|
||||
if (currentOptionsPointer === -1) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (line === '') {
|
||||
line = null
|
||||
}
|
||||
|
||||
if (currentQuestion.boolean) {
|
||||
line = (line === 'yes' || line === 'true' || line === 'on')
|
||||
}
|
||||
|
||||
if (line !== null && currentQuestion.validate) {
|
||||
currentQuestion.validate(line)
|
||||
}
|
||||
|
||||
if (currentQuestion.multiple) {
|
||||
answers[currentQuestionId] = answers[currentQuestionId] || []
|
||||
if (line !== null) {
|
||||
answers[currentQuestionId].push(line)
|
||||
this.showPrompt()
|
||||
|
||||
if (currentOptions) {
|
||||
currentOptions.splice(currentOptionsPointer, 1)
|
||||
currentOptionsPointer = -1
|
||||
}
|
||||
} else {
|
||||
this.nextQuestion()
|
||||
}
|
||||
} else {
|
||||
answers[currentQuestionId] = line
|
||||
this.nextQuestion()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nextQuestion () {
|
||||
currentQuestion = questions.shift()
|
||||
|
||||
while (currentQuestion && currentQuestion.condition && !currentQuestion.condition(answers)) {
|
||||
currentQuestion = questions.shift()
|
||||
}
|
||||
|
||||
logQueue.printLogQueue()
|
||||
|
||||
if (currentQuestion) {
|
||||
currentQuestionId = null
|
||||
|
||||
this.rli.write('\n' + this.colors.question(currentQuestion.question) + '\n')
|
||||
this.rli.write(currentQuestion.hint + '\n')
|
||||
this.showPrompt()
|
||||
|
||||
currentOptions = currentQuestion.options || null
|
||||
currentQuestionId = currentQuestion.id
|
||||
this.suggestOption(0)
|
||||
} else {
|
||||
this.kill()
|
||||
done(answers)
|
||||
}
|
||||
}
|
||||
|
||||
process (_questions, _done) {
|
||||
questions = _questions
|
||||
answers = {}
|
||||
done = _done
|
||||
|
||||
this.nextQuestion()
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = StateMachine
|
Loading…
Add table
Add a link
Reference in a new issue