@slugbugblue/trax-tty 1.1.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,21 @@
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
+
8
+ ## 1.2.0 - 2025-11-07
9
+
10
+ - Update Trax Engine to v1.0
11
+ - Add the version number as `version`
12
+ - Update to latest dev dependencies
13
+ - Address newly added xo rules
14
+
15
+ ## 1.1.0 - 2023-03-24
16
+
17
+ - Update to v0.22 of the Trax engine
18
+
3
19
  ## 1.0.0 - 2023-03-24
4
20
 
5
21
  - Pulled out of `@slugbugblue/trax` into its own repository for an initial
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.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Simple tty graphics for displaying trax games",
5
5
  "keywords": [
6
6
  "trax",
@@ -13,16 +13,27 @@
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": {
21
+ "genversion": "genversion --esm version.js",
22
+ "git-add": "git add version.js",
18
23
  "test": "xo",
24
+ "prepare": "[ -n \"$CI\" ] || husky",
25
+ "preversion": "npm test",
26
+ "version": "npm run genversion ; npm run git-add",
19
27
  "postversion": "git push && git push --tags && npm publish"
20
28
  },
29
+ "dependencies": {
30
+ "@slugbugblue/trax": "^1.0.0"
31
+ },
21
32
  "devDependencies": {
22
- "@slugbugblue/trax": "^0.22.0",
23
- "husky": "^8.0.3",
24
- "prettier": "^2.6.1",
25
- "xo": "0.*"
33
+ "genversion": "^3.2.0",
34
+ "husky": "^9.1.7",
35
+ "prettier": "^3.6.2",
36
+ "xo": "^1.2.3"
26
37
  },
27
38
  "type": "module",
28
39
  "engines": {
@@ -38,6 +49,7 @@
38
49
  },
39
50
  "xo": {
40
51
  "prettier": true,
52
+ "space": true,
41
53
  "rules": {
42
54
  "curly": [
43
55
  "error",
package/tty.js CHANGED
@@ -1,31 +1,31 @@
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.
17
8
 
18
9
  import process from 'node:process'
19
-
20
10
  import { Trax } from '@slugbugblue/trax'
21
11
 
12
+ export { version } from './version.js'
13
+
22
14
  const esc = '\u001B[' // Start of console color escape code
23
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
24
19
  const ENV = process.env
25
- const NERD = ENV.NERDFONT || ENV.NERDFONTS
26
- const POWER = ENV.POWERLINE || ENV.P9K_TTY || ENV.P9K_SSH
27
- const leftBubble = NERD ? '' : POWER ? '' : '▐'
28
- 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
29
29
 
30
30
  /** Colorize a string.
31
31
  * @arg {string} contents
@@ -286,6 +286,8 @@ export const display = (
286
286
  } else if (showMove <= trax.moves.length) {
287
287
  icon = trax.dropsIcon({
288
288
  dropped: Object.values(trax.tiles).filter((t) => t.move > showMove),
289
+ notation: '',
290
+ valid: true,
289
291
  })
290
292
  }
291
293
 
package/version.js ADDED
@@ -0,0 +1,2 @@
1
+ // Generated by genversion.
2
+ export const version = '1.3.0'