Skip to content

Commit 4415b6f

Browse files
committed
fix terminal clear
1 parent 2da0968 commit 4415b6f

File tree

6 files changed

+20
-10
lines changed

6 files changed

+20
-10
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
### Yalc changelog
22

3+
## 1.0.0-pre.60 (2020-08-26)
4+
5+
- fix terminal clear
6+
37
## 1.0.0-pre.60 (2020-08-22)
48

59
- full migration to typescript src

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ts-node-dev",
3-
"version": "1.0.0-pre.60",
3+
"version": "1.0.0-pre.61",
44
"description": "Compiles your TS app and restarts when files are modified.",
55
"keywords": [
66
"restart",
@@ -39,7 +39,7 @@
3939
"test-docker": "docker-compose up",
4040
"ci": "yarn test",
4141
"ci-local": "docker run --name travis-debug -dit quay.io/travisci/ci-nodejs",
42-
"manual": "ts-node test/manual/run.ts"
42+
"manual": "yarn ts-node test/manual/run.ts"
4343
},
4444
"dependencies": {
4545
"chokidar": "^3.4.0",

src/cfg.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import fs from 'fs'
22
import path from 'path'
33
import { Options } from './bin'
4+
import { type } from 'os'
45

56
function read(dir: string) {
67
const f = path.resolve(dir, '.node-dev.json')
@@ -41,11 +42,14 @@ export const makeCfg = (main: string, opts: Partial<Options>): Config => {
4142
if (opts.notify === false) c.notify = false
4243
if (opts.clear || opts.cls) c.clear = true
4344
}
45+
4446
const ignoreWatchItems: string[] = opts['ignore-watch']
45-
? opts['ignore-watch'].split(/,/).map((_) => _.trim())
47+
? ([] as string[])
48+
.concat(opts['ignore-watch'] as string)
49+
.map((_) => _.trim())
4650
: []
4751

48-
const ignoreWatch: string[] = ignoreWatchItems.concat(c.ignore || [])
52+
const ignoreWatch: string[] = ignoreWatchItems.concat(c.ignore || [])
4953
opts.debug && console.log('Ignore watch:', ignoreWatch)
5054
const ignore = ignoreWatch.concat(ignoreWatch.map(resolvePath))
5155
return {

src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,9 @@ module.exports = function (
216216
compiler.init()
217217
}
218218
compiler.clearErrorCompile()
219-
/* eslint-disable no-octal-escape */
220-
if (cfg.clear) process.stdout.write('\\033[2J\\033[H')
219+
220+
//if (cfg.clear) process.stdout.write("\u001b[2J\u001b[0;0H")
221+
if (cfg.clear) process.stdout.write("\u001bc")
221222
if (isManualRestart === true) {
222223
notify('Restarting', 'manual restart from user')
223224
} else {

test/manual/run.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { execSync } from 'child_process'
22

33
const cmd = [
4-
'node bin/ts-node-dev',
4+
'node lib/bin',
55
'--exit-child',
66
'--tree-kill',
77
'--clear',
88
'-r tsconfig-paths/register',
99
'-r ./test/manual/add-require',
1010
'-r ./test/manual/add-require-2',
11-
'-r esm -O "{\\"module\\": \\"es6\\"}"',
11+
'-r esm',
12+
'-O "{\\"module\\": \\"es6\\"}"',
1213
'--preserve-symlinks',
1314
'--respawn',
1415
'--ignore-watch',

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
"noEmit": true,
1111
"resolveJsonModule": true,
1212
"esModuleInterop": true,
13-
"newLine": "LF",
14-
}
13+
"newLine": "LF"
14+
}
1515
}

0 commit comments

Comments
 (0)