coffee-time 1.2.0-beta.6 → 1.2.0-beta.8

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.
Files changed (2) hide show
  1. package/bin/coffee-time.js +15 -1
  2. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  const { spawn } = require('child_process');
4
+ const os = require('os');
4
5
 
5
6
  const USAGE_ERROR = 2;
6
7
 
@@ -102,10 +103,23 @@ function formatRemaining(remainingMs) {
102
103
  return `${minutes} ${unit}`;
103
104
  }
104
105
 
106
+ function isWindowsLike() {
107
+ return process.platform === 'win32'
108
+ || /microsoft/i.test(os.release());
109
+ }
110
+
105
111
  function supportsEmoji() {
112
+ if (process.env.COFFEE_TIME_FORCE_ASCII === '1') {
113
+ return false;
114
+ }
115
+ if (process.env.COFFEE_TIME_FORCE_EMOJI === '1') {
116
+ return true;
117
+ }
118
+
106
119
  return process.env.TERM_PROGRAM === 'Apple_Terminal'
107
120
  || Boolean(process.env.WT_SESSION)
108
- || process.env.TERM_PROGRAM === 'vscode';
121
+ || process.env.TERM_PROGRAM === 'vscode'
122
+ || isWindowsLike();
109
123
  }
110
124
 
111
125
  function printCoffeeArt() {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.2.0-beta.6",
6
+ "version": "1.2.0-beta.8",
7
7
  "description": "Lightweight CLI to schedule coffee breaks at a fixed interval.",
8
8
  "bin": {
9
9
  "coffee-time": "./bin/coffee-time.js"