@slugbugblue/trax-tty 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # @slugbugblue/trax-tty
2
2
 
3
+ ## 1.3.0 - 2026-02-22
4
+
5
+ - Update Trax Engine to v1.1
6
+ - Allow special character override via environment variables
7
+
3
8
  ## 1.2.0 - 2025-11-07
4
9
 
5
10
  - Update Trax Engine to v1.0
package/LICENSE CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright © 2021-2023 Chad Transtrum
189
+ Copyright © 2021-2026 Chad Transtrum
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
package/README.md CHANGED
@@ -14,4 +14,24 @@ const players = ['first player', 'player 2']
14
14
  tty.display(game, players)
15
15
  ```
16
16
 
17
+ ## Environment variables
18
+
19
+ The tty display can use fancy characters to separate the player names and moves,
20
+ and tries to determine characters automatically from the environment.
21
+
22
+ It prefers a rounded bubble look, using characters available from the
23
+ [nerdfonts][nerdfonts] collection, and will default to that if it detects either
24
+ `NERDFONT` or `NERDFONTS` set in the environment.
25
+
26
+ If that is not found, it will next choose an angled look using characters from
27
+ [powerline][powerline], and will default to that if it detects any of
28
+ `POWERLINE`, `P9K_TTY`, or `P9K_SSH` set in the environment.
29
+
30
+ Lacking either of those, it will then choose a block look using characters
31
+ available in all terminals.
32
+
33
+ However, if you want to override any of these defaults, you can choose to set
34
+ `TRAX_TTY_LEFT` and `TRAX_TTY_RIGHT` to set the left and right characters. To
35
+ completely disable the fancy printouts, set `TRAX_TTY_PLAIN=true`.
36
+
17
37
  See the [source](tty.js) for more details.
@@ -0,0 +1,5 @@
1
+ ## 1.3.0 - 2026-02-22
2
+
3
+ - Update Trax Engine to v1.1
4
+ - Allow special character override via environment variables
5
+
@@ -0,0 +1 @@
1
+ {"version":"15.2.2","vulnerabilities":[],"scan":{"analyzer":{"id":"semgrep","name":"Semgrep","url":"https://gitlab.com/gitlab-org/security-products/analyzers/semgrep","vendor":{"name":"GitLab"},"version":"6.15.0"},"scanner":{"id":"semgrep","name":"Semgrep","url":"https://github.com/returntocorp/semgrep","vendor":{"name":"GitLab"},"version":"1.127.0"},"type":"sast","start_time":"2026-02-23T01:20:46","end_time":"2026-02-23T01:20:58","status":"success","observability":{"events":[{"event":"collect_sast_scan_metrics_from_pipeline","property":"7dbad01a-500b-462c-ad2c-e4f802a3eb7f","label":"semgrep","value":0,"version":"6.15.0","exit_code":0,"override_count":0,"passthrough_count":0,"custom_exclude_path_count":0,"time_s":11,"file_count":3}]}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slugbugblue/trax-tty",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Simple tty graphics for displaying trax games",
5
5
  "keywords": [
6
6
  "trax",
@@ -13,11 +13,15 @@
13
13
  "exports": {
14
14
  ".": "./tty.js"
15
15
  },
16
- "repository": "gitlab:slugbugblue/trax-tty",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://gitlab.com/slugbugblue/trax-tty.git"
19
+ },
17
20
  "scripts": {
18
21
  "genversion": "genversion --esm version.js",
19
22
  "git-add": "git add version.js",
20
23
  "test": "xo",
24
+ "prepare": "[ -n \"$CI\" ] || husky",
21
25
  "preversion": "npm test",
22
26
  "version": "npm run genversion ; npm run git-add",
23
27
  "postversion": "git push && git push --tags && npm publish"
package/tty.js CHANGED
@@ -1,16 +1,7 @@
1
- /* Copyright 2021-2022 Chad Transtrum
2
- *
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- *
7
- * http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software
10
- * distributed under the License is distributed on an "AS IS" BASIS,
11
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- * See the License for the specific language governing permissions and
13
- * limitations under the License.
1
+ /** Trax tty display.
2
+ * @copyright 2021-2026
3
+ * @author Chad Transtrum <chad@transtrum.net>
4
+ * @license Apache-2.0
14
5
  */
15
6
 
16
7
  // Ever wanted to draw Trax boards on the console? I have.
@@ -22,11 +13,19 @@ export { version } from './version.js'
22
13
 
23
14
  const esc = '\u001B[' // Start of console color escape code
24
15
  const off = esc + 'm' // Color reset code
16
+
17
+ // Set up the bubble characters automatically, with override of
18
+ // TRAX_TTY_LEFT, TRAX_TTY_RIGHT, or set TRAX_TTY_PLAIN=true to disable
25
19
  const ENV = process.env
26
- const NERD = ENV.NERDFONT || ENV.NERDFONTS
27
- const POWER = ENV.POWERLINE || ENV.P9K_TTY || ENV.P9K_SSH
28
- const leftBubble = NERD ? '' : POWER ? '' : '▐'
29
- const rightBubble = NERD ? '' : POWER ? '' : '▌'
20
+ const NERDVAR = ENV.NERDFONT || ENV.NERDFONTS
21
+ const NERD = NERDVAR && NERDVAR !== '0' && NERDVAR.toLowerCase() !== 'false'
22
+ const POWERVAR = ENV.POWERLINE || ENV.P9K_TTY || ENV.P9K_SSH
23
+ const POWER = POWERVAR && POWERVAR !== '0' && POWERVAR.toLowerCase() !== 'false'
24
+ const PLAIN = (ENV.TRAX_TTY_PLAIN || '').toLowerCase() === 'true'
25
+ const LEFT = ENV.TRAX_TTY_LEFT || (NERD ? '' : POWER ? '' : '▐')
26
+ const RIGHT = ENV.TRAX_TTY_RIGHT || (NERD ? '' : POWER ? '' : '▌')
27
+ const leftBubble = PLAIN ? '' : LEFT
28
+ const rightBubble = PLAIN ? '' : RIGHT
30
29
 
31
30
  /** Colorize a string.
32
31
  * @arg {string} contents
package/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '1.2.0'
2
+ export const version = '1.3.0'