@@ -34,6 +34,7 @@ import { spinner } from "../utilities/windows.js";
34
34
import { login } from "./login.js" ;
35
35
import { updateTriggerPackages } from "./update.js" ;
36
36
import { setGithubActionsOutputAndEnvVars } from "../utilities/githubActions.js" ;
37
+ import { isDirectory } from "../utilities/fileSystem.js" ;
37
38
38
39
const DeployCommandOptions = CommonCommandOptions . extend ( {
39
40
dryRun : z . boolean ( ) . default ( false ) ,
@@ -168,7 +169,24 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
168
169
await updateTriggerPackages ( dir , { ...options } , true , true ) ;
169
170
}
170
171
171
- const projectPath = resolve ( process . cwd ( ) , dir ) ;
172
+ const cwd = process . cwd ( ) ;
173
+ const projectPath = resolve ( cwd , dir ) ;
174
+
175
+ if ( dir !== "." && ! isDirectory ( projectPath ) ) {
176
+ if ( dir === "staging" || dir === "prod" ) {
177
+ throw new Error ( `To deploy to ${ dir } , you need to pass "--env ${ dir } ", not just "${ dir } ".` ) ;
178
+ }
179
+
180
+ if ( dir === "production" ) {
181
+ throw new Error ( `To deploy to production, you need to pass "--env prod", not "production".` ) ;
182
+ }
183
+
184
+ if ( dir === "stg" ) {
185
+ throw new Error ( `To deploy to staging, you need to pass "--env staging", not "stg".` ) ;
186
+ }
187
+
188
+ throw new Error ( `Directory "${ dir } " not found at ${ projectPath } ` ) ;
189
+ }
172
190
173
191
const authorization = await login ( {
174
192
embedded : true ,
0 commit comments