Skip to content

Commit 4b11fd2

Browse files
committed
fix: normalize inquirer signal-exit compatibility on Windows
1 parent fd0d6ae commit 4b11fd2

18 files changed

Lines changed: 224 additions & 60 deletions

File tree

LICENSE-THIRD-PARTY.txt

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
279279

280280
-----------
281281

282-
The following npm package may be included in this product:
282+
The following npm packages may be included in this product:
283283

284284
285+
285286

286-
This package contains the following license:
287+
These packages each contain the following license:
287288

288289
The MIT License (MIT)
289290

@@ -371,11 +372,12 @@ THE SOFTWARE.
371372

372373
-----------
373374

374-
The following npm package may be included in this product:
375+
The following npm packages may be included in this product:
375376

376377
378+
377379

378-
This package contains the following license:
380+
These packages each contain the following license:
379381

380382
The MIT License (MIT)
381383

@@ -1931,7 +1933,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19311933

19321934
The following npm packages may be included in this product:
19331935

1934-
1936+
19351937
19361938

19371939
These packages each contain the following license:
@@ -2813,7 +2815,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
28132815

28142816
The following npm packages may be included in this product:
28152817

2816-
- @cypress/[email protected].9
2818+
- @cypress/[email protected].10
28172819
28182820
28192821
@@ -3136,12 +3138,11 @@ Apache-2.0
31363138

31373139
-----------
31383140

3139-
The following npm packages may be included in this product:
3141+
The following npm package may be included in this product:
31403142

3141-
3142-
3143+
31433144

3144-
These packages each contain the following license:
3145+
This package contains the following license:
31453146

31463147
BSD 3-Clause License
31473148

@@ -4147,7 +4148,7 @@ OTHER DEALINGS IN THE SOFTWARE.
41474148

41484149
The following npm package may be included in this product:
41494150

4150-
- basic-ftp@5.0.5
4151+
- basic-ftp@5.2.0
41514152

41524153
This package contains the following license:
41534154

@@ -4858,7 +4859,7 @@ IN THE SOFTWARE.
48584859

48594860
The following npm package may be included in this product:
48604861

4861-
4862+
48624863

48634864
This package contains the following license:
48644865

@@ -6719,7 +6720,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
67196720

67206721
The following npm package may be included in this product:
67216722

6722-
6723+
67236724

67246725
This package contains the following license:
67256726

@@ -6906,8 +6907,8 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
69066907

69076908
The following npm packages may be included in this product:
69086909

6909-
6910-
6910+
6911+
69116912

69126913
These packages each contain the following license:
69136914

@@ -7057,7 +7058,7 @@ The following npm packages may be included in this product:
70577058
70587059
70597060
7060-
7061+
70617062
70627063
70637064
@@ -7445,7 +7446,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
74457446

74467447
The following npm package may be included in this product:
74477448

7448-
7449+
74497450

74507451
This package contains the following license:
74517452

@@ -8113,7 +8114,7 @@ THE SOFTWARE.
81138114

81148115
The following npm package may be included in this product:
81158116

8116-
- ajv@6.12.6
8117+
- ajv@6.14.0
81178118

81188119
This package contains the following license:
81198120

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
"nyc": "^17.1.0",
7474
"oclif": "^4.22.38",
7575
"prettier": "^3.6.2",
76+
"signal-exit": "^4.1.0",
7677
"sinon": "^19.0.2",
7778
"standard-version": "^9.5.0",
7879
"typescript": "^5.7.2"

src/box-command.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const BoxCLIError = require('./cli-error');
3232
const CLITokenCache = require('./token-cache');
3333
const utils = require('./util');
3434
const pkg = require('../package.json');
35-
const inquirer = require('inquirer');
35+
const inquirer = require('./inquirer');
3636
const { stringifyStream } = require('@discoveryjs/json-ext');
3737
const progress = require('cli-progress');
3838
let keytar = null;

src/commands/ai/ask.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ AiAskCommand.flags = {
9090
try {
9191
return JSON.parse(input);
9292
} catch (error) {
93-
throw new Error(`Error parsing AI agent JSON: ${error.message}`);
93+
throw new Error(
94+
`Error parsing AI agent JSON: ${error.message}`
95+
);
9496
}
9597
},
9698
}),

src/commands/ai/extract-structured.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ AiExtractStructuredCommand.flags = {
206206
try {
207207
return JSON.parse(input);
208208
} catch (error) {
209-
throw new Error(`Error parsing AI agent JSON: ${error.message}`);
209+
throw new Error(
210+
`Error parsing AI agent JSON: ${error.message}`
211+
);
210212
}
211213
},
212214
}),

src/commands/ai/extract.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ AiExtractCommand.flags = {
9191
try {
9292
return JSON.parse(input);
9393
} catch (error) {
94-
throw new Error(`Error parsing AI agent JSON: ${error.message}`);
94+
throw new Error(
95+
`Error parsing AI agent JSON: ${error.message}`
96+
);
9597
}
9698
},
9799
}),

src/commands/configure/environments/delete.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const { Args } = require('@oclif/core');
44
const BoxCommand = require('../../../box-command');
55
const BoxCLIError = require('../../../cli-error');
6-
const inquirer = require('inquirer');
6+
const inquirer = require('../../../inquirer');
77

88
class EnvironmentsDeleteCommand extends BoxCommand {
99
async run() {

src/commands/configure/environments/set-current.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const { Args } = require('@oclif/core');
44
const BoxCommand = require('../../../box-command');
5-
const inquirer = require('inquirer');
5+
const inquirer = require('../../../inquirer');
66

77
class EnvironmentsSetCurrentCommand extends BoxCommand {
88
async run() {

src/commands/files/upload.js

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,20 @@ const { Flags, Args } = require('@oclif/core');
55
const fs = require('node:fs');
66
const path = require('node:path');
77
const BoxCLIError = require('../../cli-error');
8-
const { createReadStream, uploadFile, uploadNewFileVersion } = require('../../modules/upload');
8+
const {
9+
createReadStream,
10+
uploadFile,
11+
uploadNewFileVersion,
12+
} = require('../../modules/upload');
913
const DEBUG = require('../../debug');
1014

1115
class FilesUploadCommand extends BoxCommand {
1216
async run() {
1317
const { flags, args } = await this.parse(FilesUploadCommand);
1418
if (!fs.existsSync(args.path)) {
15-
throw new BoxCLIError(`File not found: ${args.path}. Please check the file path and try again.`);
19+
throw new BoxCLIError(
20+
`File not found: ${args.path}. Please check the file path and try again.`
21+
);
1622
}
1723
let size = fs.statSync(args.path).size;
1824
let folderID = flags['parent-id'];
@@ -41,8 +47,16 @@ class FilesUploadCommand extends BoxCommand {
4147
const { statusCode, response } = error;
4248
const body = response?.body;
4349

44-
if (!flags.overwrite || statusCode !== 409 || body?.code !== 'item_name_in_use') {
45-
if (!flags.overwrite && statusCode === 409 && body?.code === 'item_name_in_use') {
50+
if (
51+
!flags.overwrite ||
52+
statusCode !== 409 ||
53+
body?.code !== 'item_name_in_use'
54+
) {
55+
if (
56+
!flags.overwrite &&
57+
statusCode === 409 &&
58+
body?.code === 'item_name_in_use'
59+
) {
4660
throw new BoxCLIError(
4761
'A file with the same name already exists in the destination folder. Use --overwrite to replace it with a new version.',
4862
error
@@ -62,7 +76,9 @@ class FilesUploadCommand extends BoxCommand {
6276
);
6377
}
6478

65-
DEBUG.output(`File already exists in folder; uploading as new version of file ${existingFileID}`);
79+
DEBUG.output(
80+
`File already exists in folder; uploading as new version of file ${existingFileID}`
81+
);
6682

6783
// Re-create the stream since the first attempt consumed it
6884
const versionStream = createReadStream(args.path);
@@ -79,7 +95,8 @@ class FilesUploadCommand extends BoxCommand {
7995
}
8096
}
8197

82-
FilesUploadCommand.description = 'Upload a file to a folder. Use --overwrite to automatically replace an existing file with the same name by uploading a new version';
98+
FilesUploadCommand.description =
99+
'Upload a file to a folder. Use --overwrite to automatically replace an existing file with the same name by uploading a new version';
83100
FilesUploadCommand.examples = [
84101
'box files:upload /path/to/file.pdf --parent-id 22222',
85102
'box files:upload /path/to/file.pdf --parent-id 22222 --overwrite',

src/commands/files/versions/upload.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
const BoxCommand = require('../../../box-command');
44
const { Flags, Args } = require('@oclif/core');
55
const fs = require('node:fs');
6-
const { createReadStream, uploadNewFileVersion } = require('../../../modules/upload');
6+
const {
7+
createReadStream,
8+
uploadNewFileVersion,
9+
} = require('../../../modules/upload');
710

811
class FilesUploadVersionsCommand extends BoxCommand {
912
async run() {

0 commit comments

Comments
 (0)