diff --git a/.eslintignore b/.eslintignore index bcd9b4b15..6adde250f 100644 --- a/.eslintignore +++ b/.eslintignore @@ -96,6 +96,9 @@ packages/app-cli/app/command-sync.js.map packages/app-cli/app/command-testing.d.ts packages/app-cli/app/command-testing.js packages/app-cli/app/command-testing.js.map +packages/app-cli/app/gui/StatusBarWidget.d.ts +packages/app-cli/app/gui/StatusBarWidget.js +packages/app-cli/app/gui/StatusBarWidget.js.map packages/app-cli/app/services/plugins/PluginRunner.d.ts packages/app-cli/app/services/plugins/PluginRunner.js packages/app-cli/app/services/plugins/PluginRunner.js.map diff --git a/.gitignore b/.gitignore index 1dc986ce9..b52d461f9 100644 --- a/.gitignore +++ b/.gitignore @@ -84,6 +84,9 @@ packages/app-cli/app/command-sync.js.map packages/app-cli/app/command-testing.d.ts packages/app-cli/app/command-testing.js packages/app-cli/app/command-testing.js.map +packages/app-cli/app/gui/StatusBarWidget.d.ts +packages/app-cli/app/gui/StatusBarWidget.js +packages/app-cli/app/gui/StatusBarWidget.js.map packages/app-cli/app/services/plugins/PluginRunner.d.ts packages/app-cli/app/services/plugins/PluginRunner.js packages/app-cli/app/services/plugins/PluginRunner.js.map diff --git a/packages/app-cli/app/app-gui.js b/packages/app-cli/app/app-gui.js index e475e127e..3f468aebe 100644 --- a/packages/app-cli/app/app-gui.js +++ b/packages/app-cli/app/app-gui.js @@ -33,7 +33,7 @@ const ResourceServer = require('./ResourceServer.js'); const NoteMetadataWidget = require('./gui/NoteMetadataWidget.js'); const FolderListWidget = require('./gui/FolderListWidget.js'); const NoteListWidget = require('./gui/NoteListWidget.js'); -const StatusBarWidget = require('./gui/StatusBarWidget.js'); +const StatusBarWidget = require('./gui/StatusBarWidget').default; const ConsoleWidget = require('./gui/ConsoleWidget.js'); const LinkSelector = require('./LinkSelector.js').default; diff --git a/packages/app-cli/app/gui/StatusBarWidget.js b/packages/app-cli/app/gui/StatusBarWidget.ts similarity index 94% rename from packages/app-cli/app/gui/StatusBarWidget.js rename to packages/app-cli/app/gui/StatusBarWidget.ts index 70e6788f2..b67b34286 100644 --- a/packages/app-cli/app/gui/StatusBarWidget.js +++ b/packages/app-cli/app/gui/StatusBarWidget.ts @@ -1,10 +1,10 @@ const BaseWidget = require('tkwidgets/BaseWidget.js'); const chalk = require('chalk'); const termutils = require('tkwidgets/framework/termutils.js'); -const stripAnsi = require('strip-ansi'); +import stripAnsi from 'strip-ansi'; const { handleAutocompletion } = require('../autocompletion.js'); -class StatusBarWidget extends BaseWidget { +export default class StatusBarWidget extends BaseWidget { constructor() { super(); @@ -27,7 +27,7 @@ class StatusBarWidget extends BaseWidget { this.invalidate(); } - async prompt(initialText = '', promptString = null, options = null) { + async prompt(initialText = '', promptString: any = null, options: any = null) { if (this.promptState_) throw new Error('Another prompt already active'); if (promptString === null) promptString = ':'; if (options === null) options = {}; @@ -36,7 +36,7 @@ class StatusBarWidget extends BaseWidget { this.promptState_ = { promise: null, - initialText: stripAnsi(initialText), + initialText: (initialText), promptString: stripAnsi(promptString), }; @@ -106,7 +106,7 @@ class StatusBarWidget extends BaseWidget { const isSecurePrompt = !!this.promptState_.secure; - const options = { + const options: any = { cancelable: true, history: this.history, default: this.promptState_.initialText, @@ -161,5 +161,3 @@ class StatusBarWidget extends BaseWidget { if (doSaveCursor) this.term.restoreCursor(); } } - -module.exports = StatusBarWidget; diff --git a/packages/app-cli/package.json b/packages/app-cli/package.json index 6c35744e6..dd69720e5 100644 --- a/packages/app-cli/package.json +++ b/packages/app-cli/package.json @@ -59,7 +59,7 @@ "sprintf-js": "1.1.2", "sqlite3": "5.1.2", "string-padding": "1.0.2", - "strip-ansi": "7.0.1", + "strip-ansi": "6.0.0", "tcp-port-used": "1.0.2", "terminal-kit": "1.49.4", "tkwidgets": "0.5.27", diff --git a/yarn.lock b/yarn.lock index 1a477fb1f..8eaa1cad1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -20848,7 +20848,7 @@ __metadata: sprintf-js: 1.1.2 sqlite3: 5.1.2 string-padding: 1.0.2 - strip-ansi: 7.0.1 + strip-ansi: 6.0.0 tcp-port-used: 1.0.2 temp: 0.9.4 terminal-kit: 1.49.4 @@ -30549,12 +30549,12 @@ __metadata: languageName: node linkType: hard -"strip-ansi@npm:7.0.1, strip-ansi@npm:^7.0.1": - version: 7.0.1 - resolution: "strip-ansi@npm:7.0.1" +"strip-ansi@npm:6.0.0": + version: 6.0.0 + resolution: "strip-ansi@npm:6.0.0" dependencies: - ansi-regex: ^6.0.1 - checksum: 257f78fa433520e7f9897722731d78599cb3fce29ff26a20a5e12ba4957463b50a01136f37c43707f4951817a75e90820174853d6ccc240997adc5df8f966039 + ansi-regex: ^5.0.0 + checksum: 04c3239ede44c4d195b0e66c0ad58b932f08bec7d05290416d361ff908ad282ecdaf5d9731e322c84f151d427436bde01f05b7422c3ec26dd927586736b0e5d0 languageName: node linkType: hard @@ -30594,6 +30594,15 @@ __metadata: languageName: node linkType: hard +"strip-ansi@npm:^7.0.1": + version: 7.0.1 + resolution: "strip-ansi@npm:7.0.1" + dependencies: + ansi-regex: ^6.0.1 + checksum: 257f78fa433520e7f9897722731d78599cb3fce29ff26a20a5e12ba4957463b50a01136f37c43707f4951817a75e90820174853d6ccc240997adc5df8f966039 + languageName: node + linkType: hard + "strip-bom-buf@npm:^1.0.0": version: 1.0.0 resolution: "strip-bom-buf@npm:1.0.0"