File tree 3 files changed +22
-0
lines changed
3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import * as yargs from 'yargs'
8
8
import * as globby from 'globby'
9
9
10
10
import createDebug from 'debug'
11
+ import { question } from 'readline-sync'
11
12
12
13
import builtInTransformations from '../transformations'
13
14
import { excludedTransformations } from '../transformations'
@@ -59,6 +60,15 @@ const {
59
60
60
61
// TODO: port the `Runner` interface of jscodeshift
61
62
async function main ( ) {
63
+ // Remind user to back up files
64
+ const answer = question ( 'Warning!!\n ' +
65
+ 'This tool may overwrite files.\n' +
66
+ 'Enter yes to continue:'
67
+ )
68
+ if ( answer . trim ( ) !== 'yes' ) {
69
+ return
70
+ }
71
+
62
72
const resolvedPaths = globby . sync ( files as string [ ] )
63
73
if ( transformationName != undefined ) {
64
74
const transformationModule = loadTransformationModule ( transformationName )
Original file line number Diff line number Diff line change 36
36
"globby" : " ^11.0.2" ,
37
37
"jscodeshift" : " ^0.11.0" ,
38
38
"lru-cache" : " ^6.0.0" ,
39
+ "readline-sync" : " ^1.4.10" ,
39
40
"source-map" : " ^0.6.1" ,
40
41
"vue-eslint-parser" : " ^7.6.0" ,
41
42
"yargs" : " ^16.2.0"
47
48
"@types/jest" : " ^26.0.3" ,
48
49
"@types/lodash" : " ^4.14.170" ,
49
50
"@types/node" : " ^12.12.47" ,
51
+ "@types/readline-sync" : " ^1.4.3" ,
50
52
"@types/yargs" : " ^15.0.4" ,
51
53
"@typescript-eslint/parser" : " ^4.27.0" ,
52
54
"eslint" : " ^7.29.0" ,
Original file line number Diff line number Diff line change 1273
1273
resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.1.6.tgz#f4b1efa784e8db479cdb8b14403e2144b1e9ff03"
1274
1274
integrity sha512-6gOkRe7OIioWAXfnO/2lFiv+SJichKVSys1mSsgyrYHSEjk8Ctv4tSR/Odvnu+HWlH2C8j53dahU03XmQdd5fA==
1275
1275
1276
+ " @types/readline-sync@^1.4.3 " :
1277
+ version "1.4.3"
1278
+ resolved "https://registry.yarnpkg.com/@types/readline-sync/-/readline-sync-1.4.3.tgz#eac55a39d5a349912062c9e5216cd550c07fd9c8"
1279
+ integrity sha512-YP9NVli96E+qQLAF2db+VjnAUEeZcFVg4YnMgr8kpDUFwQBnj31rPLOVHmazbKQhaIkJ9cMHsZhpKdzUeL0KTg==
1280
+
1276
1281
" @types/stack-utils@^2.0.0 " :
1277
1282
version "2.0.0"
1278
1283
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.0.tgz#7036640b4e21cc2f259ae826ce843d277dad8cff"
@@ -4383,6 +4388,11 @@ read-pkg@^5.2.0:
4383
4388
parse-json "^5.0.0"
4384
4389
type-fest "^0.6.0"
4385
4390
4391
+ readline-sync@^1.4.10 :
4392
+ version "1.4.10"
4393
+ resolved "https://registry.yarnpkg.com/readline-sync/-/readline-sync-1.4.10.tgz#41df7fbb4b6312d673011594145705bf56d8873b"
4394
+ integrity sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==
4395
+
4386
4396
4387
4397
version "0.17.2"
4388
4398
resolved "https://registry.yarnpkg.com/recast/-/recast-0.17.2.tgz#f18f18cf20bf3fad4522621a7f9c2ada37276814"
You can’t perform that action at this time.
0 commit comments