workshopper-adventure
Advanced tools
Comparing version 4.3.1 to 4.4.0
@@ -7,3 +7,4 @@ { | ||
"language": "SPRACHE WÄHLEN (CHOOSE LANGUAGE)", | ||
"cancel": "ABBRECHEN" | ||
"cancel": "ABBRECHEN", | ||
"update": "AUF UPDATE PRÜFEN" | ||
}, | ||
@@ -72,3 +73,7 @@ "language": { | ||
"user": "GitHub User" | ||
}, | ||
"update": { | ||
"latest_version": "{{name}}**@{{version}}** ist die neueste Version.\n\n**Super!**", | ||
"now": "{{name}}_@{{current}}_ ist veraltet. Starte automatisches update auf **{{latest}}** mit dem Befehl \n\n```bash\n{{cmd}}\n```\n" | ||
} | ||
} |
@@ -9,3 +9,4 @@ { | ||
"language": "CHOOSE LANGUAGE", | ||
"cancel": "CANCEL" | ||
"cancel": "CANCEL", | ||
"update": "CHECK FOR UPDATE" | ||
}, | ||
@@ -75,3 +76,7 @@ "language": { | ||
"user": "GitHub Username" | ||
}, | ||
"update": { | ||
"latest_version": "{{name}}**@{{version}}** is already at the latest version.\n\n**Congratulations!**", | ||
"now": "{{name}}_@{{current}}_ is out-of-date, updating to **{{latest}}** with \n\n```bash\n{{cmd}}\n```\n" | ||
} | ||
} |
@@ -9,3 +9,4 @@ { | ||
"language": "ELEGIR IDIOMA (CHOOSE LANGUAGE)", | ||
"cancel": "CANCELAR" | ||
"cancel": "CANCELAR", | ||
"update": "BUSCAR ACTUALIZACIONES" | ||
}, | ||
@@ -74,3 +75,7 @@ "language": { | ||
"user": "GitHub Username" | ||
}, | ||
"update": { | ||
"latest_version": "{{name}}**@{{version}}** ya está ATT y la última versión.\n\n**Congratulations!**", | ||
"now": "{{name}}_@{{current}}_ está fuera de- Dart, la actualización a **{{latest}}** con \n\n```bash\n{{cmd}}\n```\n" | ||
} | ||
} |
@@ -9,3 +9,4 @@ { | ||
"language": "CHOISIR LA LANGUE (CHOOSE LANGUAGE)", | ||
"cancel": "ANNULER" | ||
"cancel": "ANNULER", | ||
"update": "VÉRIFIER LA MISE À JOUR" | ||
}, | ||
@@ -73,3 +74,7 @@ "language": { | ||
"user": "Compte GitHub" | ||
}, | ||
"update": { | ||
"latest_version": "{{name}}**@{{version}}** est déjà à la dernière version.\n\n**Félicitations à vous!**", | ||
"now": "{{name}}_@{{current}}_ est de jour en dehors, la mise à jour à **{{latest}}** avec \n\n```bash\n{{cmd}}\n```\n" | ||
} | ||
} |
@@ -9,3 +9,4 @@ { | ||
"language": "CAMBIA LA LINGUA (CHOOSE LANGUAGE)", | ||
"cancel": "ANNULLA" | ||
"cancel": "ANNULLA", | ||
"update": "RICERCA AGGIORNAMENTI" | ||
}, | ||
@@ -69,3 +70,7 @@ "language": { | ||
} | ||
}, | ||
"update": { | ||
"latest_version": "{{name}}**@{{version}}** è già al l'ultima versione.\n\n**Congratulazioni!**", | ||
"now": "{{name}}_@{{current}}_ è out-of-date, l'aggiornamento a **{{latest}}** con \n\n```bash\n{{cmd}}\n```\n" | ||
} | ||
} |
@@ -9,3 +9,4 @@ { | ||
"language": "言語を選択する (CHOOSE LANGUAGE)", | ||
"cancel": "キャンセル" | ||
"cancel": "キャンセル", | ||
"update": "アップデート チェック" | ||
}, | ||
@@ -74,3 +75,7 @@ "language": { | ||
"user": "GitHub Username" | ||
}, | ||
"update": { | ||
"latest_version": "{{name}}**@{{version}}** は一番新しいバーションです。\n\n**おめでとうございます!**", | ||
"now": "{{name}}_@{{current}}_ は古いです、**{{latest}}** にアップデートをします。このコマンドを使っています:\n\n```bash\n{{cmd}}\n```\n" | ||
} | ||
} |
@@ -9,3 +9,4 @@ { | ||
"language": "언어를 선택 (CHOOSE LANGUAGE)", | ||
"cancel": "취소" | ||
"cancel": "취소", | ||
"update": "업데이트를 확인" | ||
}, | ||
@@ -75,3 +76,7 @@ "language": { | ||
"user": "GitHub Username" | ||
}, | ||
"update": { | ||
"latest_version": "{{name}}**@{{version}}** 는 최신 버전에서 이미.\n\n**치하!**", | ||
"now": "{{name}}_@{{current}}_ 는 다음 명령을 **{{latest}}**하는 업데이트, 오래된이다로 업데이트:\n\n```bash\n{{cmd}}\n```\n" | ||
} | ||
} |
@@ -9,3 +9,4 @@ { | ||
"language": "VELG SPRÅK (CHOOSE LANGUAGE)", | ||
"cancel": "AVBRYT" | ||
"cancel": "AVBRYT", | ||
"update": "SE ETTER OPPDATERING" | ||
}, | ||
@@ -75,3 +76,7 @@ "language": { | ||
"user": "GitHub Brukernavn" | ||
}, | ||
"update": { | ||
"latest_version": "{{name}}**@{{version}}** is already at the latest version.\n\n**Congratulations!**", | ||
"now": "{{name}}_@{{current}}_ is out-of-date, updating to **{{latest}}** with \n\n```bash\n{{cmd}}\n```\n" | ||
} | ||
} |
@@ -9,3 +9,4 @@ { | ||
"language": "WYBIERZ JĘZYK (CHOOSE LANGUAGE)", | ||
"cancel": "ANULUJ" | ||
"cancel": "ANULUJ", | ||
"update": "SPRAWDŹ AKTUALIZACJE" | ||
}, | ||
@@ -75,3 +76,7 @@ "language": { | ||
"user": "GitHub" | ||
}, | ||
"update": { | ||
"latest_version": "{{name}}**@{{version}}** is already at the latest version.\n\n**Congratulations!**", | ||
"now": "{{name}}_@{{current}}_ is out-of-date, updating to **{{latest}}** with \n\n```bash\n{{cmd}}\n```\n" | ||
} | ||
} |
@@ -9,3 +9,4 @@ { | ||
"language": "SELECIONE O IDIOMA (CHOOSE LANGUAGE)", | ||
"cancel": "CANCELAR" | ||
"cancel": "CANCELAR", | ||
"update": "VERIFIQUE ATUALIZAÇÕES" | ||
}, | ||
@@ -74,3 +75,7 @@ "language": { | ||
"user": "GitHub Username" | ||
}, | ||
"update": { | ||
"latest_version": "{{name}}**@{{version}}** is already at the latest version.\n\n**Congratulations!**", | ||
"now": "{{name}}_@{{current}}_ is out-of-date, updating to **{{latest}}** with \n\n```bash\n{{cmd}}\n```\n" | ||
} | ||
} |
@@ -9,3 +9,4 @@ { | ||
"language": "ВЫБРАТЬ ЯЗЫК (CHOOSE LANGUAGE)", | ||
"cancel": "ОТМЕНА" | ||
"cancel": "ОТМЕНА", | ||
"update": "ПРОВЕРИТЬ ОБНОВЛЕНИЯ" | ||
}, | ||
@@ -73,3 +74,7 @@ "language": { | ||
"user": "GitHub аккаунт" | ||
}, | ||
"update": { | ||
"latest_version": "{{name}}**@{{version}}** is already at the latest version.\n\n**Congratulations!**", | ||
"now": "{{name}}_@{{current}}_ is out-of-date, updating to **{{latest}}** with \n\n```bash\n{{cmd}}\n```\n" | ||
} | ||
} |
@@ -9,3 +9,4 @@ { | ||
"language": "ОБРАТИ МОВУ (CHOOSE LANGUAGE)", | ||
"cancel": "ВІДМІНИТИ" | ||
"cancel": "ВІДМІНИТИ", | ||
"update": "ПЕРЕВІРИТИ ОНОВЛЕННЯ" | ||
}, | ||
@@ -75,3 +76,7 @@ "language": { | ||
"user": "GitHub Аккаунт" | ||
}, | ||
"update": { | ||
"latest_version": "{{name}}**@{{version}}** is already at the latest version.\n\n**Congratulations!**", | ||
"now": "{{name}}_@{{current}}_ is out-of-date, updating to **{{latest}}** with \n\n```bash\n{{cmd}}\n```\n" | ||
} | ||
} |
{ | ||
"subtitle": "\u001b[23mChọn một bài tập và ấn \u001b[3mEnter\u001b[23m để bắt đầu", | ||
"menu": { | ||
"credits": "Đóng góp", | ||
"credits": "ĐÓNG GÓP", | ||
"exit": "THOÁT", | ||
@@ -9,3 +9,4 @@ "help": "TRỢ GIÚP", | ||
"language": "CHỌN NGÔN NGỮ (CHOOSE LANGUAGE)", | ||
"cancel": "HỦY BỎ" | ||
"cancel": "HỦY BỎ", | ||
"update": "KIỂM TRA CẬP NHẬT" | ||
}, | ||
@@ -74,3 +75,7 @@ "language": { | ||
"user": "GitHub Username" | ||
}, | ||
"update": { | ||
"latest_version": "{{name}}**@{{version}}** is already at the latest version.\n\n**Congratulations!**", | ||
"now": "{{name}}_@{{current}}_ is out-of-date, updating to **{{latest}}** with \n\n```bash\n{{cmd}}\n```\n" | ||
} | ||
} |
@@ -9,3 +9,4 @@ { | ||
"language": "选择语言 (CHOOSE LANGUAGE)", | ||
"cancel": "取消" | ||
"cancel": "取消", | ||
"update": "检查更新" | ||
}, | ||
@@ -74,3 +75,7 @@ "language": { | ||
"user": "GitHub 用户名" | ||
}, | ||
"update": { | ||
"latest_version": "{{name}}**@{{version}}** is already at the latest version.\n\n**Congratulations!**", | ||
"now": "{{name}}_@{{current}}_ is out-of-date, updating to **{{latest}}** with \n\n```bash\n{{cmd}}\n```\n" | ||
} | ||
} |
@@ -9,3 +9,4 @@ { | ||
"language": "CHOOSE LANGUAGE", | ||
"cancel": "CANCEL" | ||
"cancel": "CANCEL", | ||
"update": "UPDATE" | ||
}, | ||
@@ -74,3 +75,7 @@ "language": { | ||
"user": "GitHub Username" | ||
}, | ||
"update": { | ||
"latest_version": "{{name}}**@{{version}}** is already at the latest version.\n\n**Congratulations!**", | ||
"now": "{{name}}_@{{current}}_ is out-of-date, updating to **{{latest}}** with \n\n```bash\n{{cmd}}\n```\n" | ||
} | ||
} |
31
index.js
@@ -146,2 +146,17 @@ const fs = require('fs') | ||
WA.prototype.getNext = function () { | ||
var current = this.appStorage.get('current') | ||
var remainingAfterCurrent = this.exercises.slice(this.exercises.indexOf(current) + 1) | ||
var completed = this.appStorage.get('completed') || [] | ||
var incompleteAfterCurrent = remainingAfterCurrent.filter(function (elem) { | ||
return completed.indexOf(elem) < 0 | ||
}) | ||
if (incompleteAfterCurrent.length === 0) | ||
return new Error('error.no_uncomplete_left') | ||
return incompleteAfterCurrent[0] | ||
} | ||
WA.prototype.onComplete = function (cb) { | ||
@@ -183,3 +198,3 @@ setImmediate(cb) | ||
'{bold}{green}# {solution.pass.title}{/green}{/bold}\n' + | ||
'{bold}{solution.pass.message}{/bold}\n', 'txt') | ||
'{bold}{solution.pass.message}{/bold}\n') | ||
@@ -237,6 +252,16 @@ if (!exercise.hideSolutions) { | ||
exercise.on('pass', function (message) { | ||
stream.append(require('chalk').green.bold('\u2713 ') + message) | ||
stream.append({ | ||
text: require('chalk').green.bold('\u2713 '), | ||
type: (message && message.type) || 'md', | ||
skipNewline: true | ||
}) | ||
stream.append(message) | ||
}) | ||
exercise.on('fail', function (message) { | ||
stream.append(require('chalk').red.bold('\u2717 ') + message) | ||
stream.append({ | ||
text: require('chalk').red.bold('\u2717 '), | ||
type: (message && message.type) || 'md', | ||
skipNewline: true | ||
}) | ||
stream.append(message) | ||
}) | ||
@@ -243,0 +268,0 @@ exercise.on('pass', this.emit.bind(this, 'pass', exercise, mode)) |
@@ -32,3 +32,3 @@ function renderNonTty (shop, menuOptions) { | ||
return { | ||
label: chalk.bold('»') + ' ' + __('language.' + language), | ||
label: chalk.bold('» ' + __('language.' + language)), | ||
marker: (shop.i18n.lang() === language) ? ' [' + __('language._current') + ']' : '', | ||
@@ -35,0 +35,0 @@ handler: function () { |
@@ -32,6 +32,6 @@ function getExtras (shop) { | ||
}) | ||
stream.append('\n---\n', 'md') | ||
stream | ||
.pipe(require('../mseePipe')()) | ||
.pipe(process.stdout) | ||
stream.append('\n---\n', 'md') | ||
stream | ||
.pipe(require('../mseePipe')()) | ||
.pipe(process.stdout) | ||
} | ||
@@ -43,3 +43,5 @@ | ||
var __ = shop.i18n.__, | ||
__n = shop.i18n.__n, | ||
completed = shop.appStorage.get('completed') || [], | ||
current = shop.appStorage.get('current'), | ||
menuOptions = { | ||
@@ -50,3 +52,3 @@ title: __('title'), | ||
return { | ||
label: chalk.bold('»') + ' ' + __('exercise.' + exercise), | ||
label: chalk.bold('» ' + __('exercise.' + exercise)), | ||
marker: (completed.indexOf(exercise) >= 0) ? '[' + __('menu.completed') + ']' : '', | ||
@@ -56,6 +58,6 @@ handler: shop.execute.bind(shop, ['select', exercise]) | ||
}), | ||
extras: getExtras(shop) | ||
extras: getExtras(shop) | ||
.map(function (command) { | ||
return { | ||
label: chalk.bold(__('menu.' + command.aliases[0])), | ||
label: chalk.bold(__n('menu.' + command.aliases[0], command.info)), | ||
handler: command.handler.bind(command, shop, []) | ||
@@ -70,4 +72,10 @@ } | ||
if (completed.indexOf(current) >= 0) { | ||
current = shop.getNext() | ||
} | ||
shop.options.menuFactory.options.selected = shop.exercises.reduce(function (selected, exercise, count) { | ||
return exercise === current ? count : selected | ||
}, undefined) | ||
shop.options.menuFactory.create(menuOptions) || renderNonTty(shop, menuOptions) | ||
} | ||
exports.menu = false |
exports.menu = false | ||
exports.handler = function next(shop) { | ||
var remainingAfterCurrent = shop.exercises.slice(shop.exercises.indexOf(shop.appStorage.get('current')) + 1) | ||
var completed = shop.appStorage.get('completed') || [] | ||
if (!completed) | ||
return error(shop.__('error.exercise.none_active') + '\n') | ||
var incompleteAfterCurrent = remainingAfterCurrent.filter(function (elem) { | ||
return completed.indexOf(elem) < 0 | ||
}) | ||
if (incompleteAfterCurrent.length === 0) | ||
return console.log(shop.__('error.no_uncomplete_left') + '\n') | ||
shop.execute(['print', incompleteAfterCurrent[0]]) | ||
var next = shop.getNext() | ||
if (next instanceof Error) { | ||
return console.log(shop.__('error.' + next.message) + '\n') | ||
} | ||
shop.execute(['print', next]) | ||
} |
const fs = require('fs') | ||
, path = require('path') | ||
, colorsTmpl = require('colors-tmpl') | ||
, through = require('through2') | ||
, through2 = require('through2') | ||
, split = require('split') | ||
, inherits = require('util').inherits | ||
, CombinedStream = require('combined-stream') | ||
, strToStream = require('string-to-stream') | ||
@@ -72,2 +73,3 @@ function getText (i18n, contents) { | ||
this.lang = lang | ||
this.typeOpen = 'md' | ||
} | ||
@@ -78,2 +80,10 @@ | ||
PrintStream.prototype._append = CombinedStream.prototype.append | ||
PrintStream.prototype._end = CombinedStream.prototype.end | ||
PrintStream.prototype.end = function () { | ||
if (this.typeOpen) { | ||
this.typeOpen = null | ||
this.emit('data', '```') | ||
} | ||
this._end() | ||
} | ||
@@ -112,3 +122,3 @@ PrintStream.prototype.append = function (content, contentType) { | ||
if (files.length > 1) | ||
stream.append('_' + file + '_ :') | ||
stream.append('`_' + file + '_` :') | ||
stream.append({file: file}) | ||
@@ -134,5 +144,5 @@ }) | ||
contentType = content.type | ||
stream = new require('string-to-stream')(content.text + '\n') | ||
stream = new strToStream(content.text + (content.skipNewline ? '' : '\n')) | ||
} else { | ||
stream = new require('string-to-stream')(content + '\n') | ||
stream = new strToStream(content + '\n') | ||
} | ||
@@ -144,3 +154,3 @@ | ||
if (!contentType) | ||
contentType = 'raw' | ||
contentType = 'md' | ||
@@ -150,16 +160,14 @@ var i18n = this.i18n | ||
var parent = this | ||
this._append( | ||
stream | ||
.pipe(split()) | ||
.pipe(through(function (contents, encoding, done) { | ||
.pipe(through2({objectMode: true}, function (contents, encoding, done) { | ||
buffer.push(getText(i18n, contents.toString())) | ||
done() | ||
}, function (done) { | ||
var contents = buffer.join('\n') | ||
if (contentType === 'md') | ||
// convert Markdown to ANSI | ||
this.push(contents) | ||
else | ||
// code fencing is necessary for msee to render the solution as code | ||
this.push('```' + contentType + '\n' + contents.replace(/^\n/m, '').replace(/\n$/m, '') + '\n```\n') | ||
this.push({ | ||
text: buffer.join('\n'), | ||
type: contentType | ||
}) | ||
done() | ||
@@ -170,2 +178,25 @@ })) | ||
} | ||
PrintStream.prototype.write = function (data) { | ||
if (typeof data === 'string') { | ||
this.emit('data', data) | ||
return | ||
} | ||
if (this.typeOpen != data.type) { | ||
if (data.type !== 'md') { | ||
data.text = '```' + data.type + '\n' + data.text | ||
} | ||
if (this.typeOpen !== 'md') { | ||
data.text = '\n```\n' + data.text | ||
} | ||
this.typeOpen = data.type | ||
} | ||
this.emit('data', data.text) | ||
} | ||
PrintStream.prototype._end = CombinedStream.prototype.end | ||
PrintStream.prototype.end = function () { | ||
if (this.typeOpen !== 'md') { | ||
this.emit('data', '```') | ||
} | ||
this._end() | ||
} | ||
@@ -172,0 +203,0 @@ PrintStream.prototype.appendChain = function (content, type) { |
{ | ||
"name": "workshopper-adventure", | ||
"version": "4.3.1", | ||
"version": "4.4.0", | ||
"description": "A terminal workshop runner framework (adventure compatible)", | ||
@@ -13,9 +13,10 @@ "main": "./index.js", | ||
"dependencies": { | ||
"chalk": "~0.4.0", | ||
"colors-tmpl": "~0.1.0", | ||
"combined-stream": "0.0.7", | ||
"chalk": "~1.1.1", | ||
"colors-tmpl": "~1.0.0", | ||
"combined-stream": "1.0.5", | ||
"commandico": "^2.0.0", | ||
"concat-stream": "^1.5.0", | ||
"i18n-core": "^2.1.1", | ||
"mkdirp": "~0.3.5", | ||
"latest-version": "^2.0.0", | ||
"mkdirp": "~0.5.1", | ||
"msee-preview": "^0.4.0", | ||
@@ -28,3 +29,3 @@ "rimraf": "^2.4.3", | ||
"visualwidth": "^0.1.0", | ||
"xtend": "~3.0.0" | ||
"xtend": "~4.0.1" | ||
}, | ||
@@ -39,3 +40,3 @@ "bugs": { | ||
"devDependencies": { | ||
"workshopper-exercise": "^1.1.0" | ||
"workshopper-exercise": "^2.5.3" | ||
}, | ||
@@ -42,0 +43,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
130333
98
2493
16
16
1
+ Addedlatest-version@^2.0.0
+ Addedcapture-stack-trace@1.0.2(transitive)
+ Addedcolors@1.0.3(transitive)
+ Addedcolors-tmpl@1.0.0(transitive)
+ Addedcombined-stream@1.0.5(transitive)
+ Addedcreate-error-class@3.0.2(transitive)
+ Addeddeep-extend@0.6.0(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedduplexer2@0.1.4(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedgot@5.7.1(transitive)
+ Addedini@1.3.8(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-redirect@1.0.0(transitive)
+ Addedis-retry-allowed@1.2.0(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedlatest-version@2.0.0(transitive)
+ Addedlowercase-keys@1.0.1(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addednode-status-codes@1.0.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedpackage-json@2.4.0(transitive)
+ Addedparse-json@2.2.0(transitive)
+ Addedpinkie@2.0.4(transitive)
+ Addedpinkie-promise@2.0.1(transitive)
+ Addedprepend-http@1.0.4(transitive)
+ Addedrc@1.2.8(transitive)
+ Addedread-all-stream@3.1.0(transitive)
+ Addedregistry-auth-token@3.4.0(transitive)
+ Addedregistry-url@3.1.0(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedstrip-json-comments@2.0.1(transitive)
+ Addedtimed-out@3.1.3(transitive)
+ Addedunzip-response@1.0.2(transitive)
+ Addedurl-parse-lax@1.0.0(transitive)
- Removedansi-styles@1.0.0(transitive)
- Removedchalk@0.4.0(transitive)
- Removedcolors@0.6.2(transitive)
- Removedcolors-tmpl@0.1.1(transitive)
- Removedcombined-stream@0.0.7(transitive)
- Removeddelayed-stream@0.0.5(transitive)
- Removedhas-color@0.1.7(transitive)
- Removedmkdirp@0.3.5(transitive)
- Removedstrip-ansi@0.1.1(transitive)
- Removedxtend@3.0.0(transitive)
Updatedchalk@~1.1.1
Updatedcolors-tmpl@~1.0.0
Updatedcombined-stream@1.0.5
Updatedmkdirp@~0.5.1
Updatedxtend@~4.0.1