@@ -2,8 +2,12 @@ import { existsSync, statSync } from 'fs';
22import { join } from 'path' ;
33import { ExtensionContext , window , commands , Uri } from 'vscode' ;
44import { COMMANDS , TRACKED_EVENTS } from '../constants' ;
5- import { buildStatusBarItem , getRootPath } from '../helpers' ;
6- import { invalidateParentDirectoryCache } from '../helpers' ;
5+ import {
6+ buildStatusBarItem ,
7+ getRootPath ,
8+ invalidateParentDirectoryCache ,
9+ showMissingAccountError ,
10+ } from '../helpers' ;
711import { trackEvent } from '../tracking' ;
812
913const { deleteFile, upload } = require ( '@hubspot/local-dev-lib/api/fileMapper' ) ;
@@ -26,6 +30,7 @@ export const registerCommands = (context: ExtensionContext) => {
2630 commands . registerCommand (
2731 COMMANDS . REMOTE_FS . FETCH ,
2832 async ( clickedFileLink ) => {
33+ showMissingAccountError ( ) ;
2934 const remoteFilePath = clickedFileLink . path ;
3035 // We use showOpenDialog instead of showSaveDialog because the latter has worse support for this use-case
3136 const destPath = await window . showOpenDialog ( {
@@ -67,7 +72,7 @@ export const registerCommands = (context: ExtensionContext) => {
6772 trackEvent ( TRACKED_EVENTS . REMOTE_FS . FETCH ) ;
6873 try {
6974 await downloadFileOrFolder (
70- getAccountId ( ) ,
75+ getAccountId ( ) ! ,
7176 remoteFilePath ,
7277 localFilePath ,
7378 undefined ,
@@ -91,6 +96,7 @@ export const registerCommands = (context: ExtensionContext) => {
9196 commands . registerCommand (
9297 COMMANDS . REMOTE_FS . DELETE ,
9398 async ( clickedFileLink ) => {
99+ showMissingAccountError ( ) ;
94100 console . log ( COMMANDS . REMOTE_FS . DELETE ) ;
95101 const filePath = clickedFileLink . path ;
96102 const selection = await window . showWarningMessage (
@@ -103,7 +109,7 @@ export const registerCommands = (context: ExtensionContext) => {
103109 trackEvent ( TRACKED_EVENTS . REMOTE_FS . DELETE ) ;
104110 const deletingStatus = buildStatusBarItem ( `Deleting...` ) ;
105111 deletingStatus . show ( ) ;
106- deleteFile ( getAccountId ( ) , filePath )
112+ deleteFile ( getAccountId ( ) ! , filePath )
107113 . then ( ( ) => {
108114 window . showInformationMessage ( `Successfully deleted "${ filePath } "` ) ;
109115 invalidateParentDirectoryCache ( filePath ) ;
@@ -126,6 +132,7 @@ export const registerCommands = (context: ExtensionContext) => {
126132 commands . registerCommand (
127133 COMMANDS . REMOTE_FS . UPLOAD ,
128134 async ( clickedFileLink ) => {
135+ showMissingAccountError ( ) ;
129136 let srcPath : string ;
130137 if (
131138 clickedFileLink === undefined ||
@@ -246,7 +253,8 @@ const handleFileUpload = async (srcPath: string, destPath: string) => {
246253 return ;
247254 }
248255 trackEvent ( TRACKED_EVENTS . REMOTE_FS . UPLOAD_FILE ) ;
249- upload ( getAccountId ( ) , srcPath , destPath )
256+ showMissingAccountError ( ) ;
257+ upload ( getAccountId ( ) ! , srcPath , destPath )
250258 . then ( ( ) => {
251259 window . showInformationMessage (
252260 `Uploading files to "${ destPath } " was successful`
@@ -268,16 +276,7 @@ const handleFolderUpload = async (srcPath: string, destPath: string) => {
268276 `Beginning upload of "${ srcPath } " to "${ destPath } "...`
269277 ) ;
270278 trackEvent ( TRACKED_EVENTS . REMOTE_FS . UPLOAD_FOLDER ) ;
271- uploadFolder (
272- getAccountId ( ) ,
273- srcPath ,
274- destPath ,
275- {
276- mode : 'publish' ,
277- } ,
278- { } ,
279- filePaths
280- )
279+ uploadFolder ( getAccountId ( ) ! , srcPath , destPath , { } , { } , filePaths , 'publish' )
281280 . then ( async ( results : any ) => {
282281 if ( ! hasUploadErrors ( results ) ) {
283282 window . showInformationMessage (
0 commit comments