diff --git a/cli/src/commands/app/lint.ts b/cli/src/commands/app/lint.ts index 97f11f81e6..02422553ab 100644 --- a/cli/src/commands/app/lint.ts +++ b/cli/src/commands/app/lint.ts @@ -2,12 +2,15 @@ import * as fs from "node:fs"; import * as path from "node:path"; import process from "node:process"; -import { Command, colors, log, yamlParseFile } from "../../../deps.ts"; +import { colors, Command, log, yamlParseFile } from "../../../deps.ts"; import { GlobalOptions } from "../../types.ts"; import { createBundle } from "./bundle.ts"; import { APP_BACKEND_FOLDER } from "./app_metadata.ts"; import { loadRunnablesFromBackend } from "./raw_apps.ts"; -import { hasFolderSuffix, getFolderSuffix } from "../../utils/resource_folders.ts"; +import { + getFolderSuffix, + hasFolderSuffix, +} from "../../utils/resource_folders.ts"; interface LintOptions extends GlobalOptions { fix?: boolean; @@ -47,7 +50,7 @@ function validateRawAppYaml(appData: any): { */ async function validateRunnables( appDir: string, - appData: any + appData: any, ): Promise<{ errors: string[]; warnings: string[] }> { const errors: string[] = []; const warnings: string[] = []; @@ -59,8 +62,7 @@ async function validateRunnables( const hasBackendRunnables = Object.keys(runnablesFromBackend).length > 0; // Check for runnables in raw_app.yaml (old format) - const hasYamlRunnables = - appData.runnables && + const hasYamlRunnables = appData.runnables && typeof appData.runnables === "object" && !Array.isArray(appData.runnables) && Object.keys(appData.runnables).length > 0; @@ -69,22 +71,26 @@ async function validateRunnables( errors.push( "No runnables found. Expected either:\n" + " - Runnable YAML files in the 'backend/' folder (e.g., backend/myRunnable.yaml)\n" + - " - Or a 'runnables' field in raw_app.yaml (legacy format)" + " - Or a 'runnables' field in raw_app.yaml (legacy format)", ); } else if (hasBackendRunnables) { log.info( colors.gray( - ` Found ${Object.keys(runnablesFromBackend).length} runnable(s) in backend folder` - ) + ` Found ${ + Object.keys(runnablesFromBackend).length + } runnable(s) in backend folder`, + ), ); } else if (hasYamlRunnables) { log.info( colors.gray( - ` Found ${Object.keys(appData.runnables).length} runnable(s) in raw_app.yaml (legacy format)` - ) + ` Found ${ + Object.keys(appData.runnables).length + } runnable(s) in raw_app.yaml (legacy format)`, + ), ); warnings.push( - "Using legacy format with runnables in raw_app.yaml. Consider migrating to separate files in backend/" + "Using legacy format with runnables in raw_app.yaml. Consider migrating to separate files in backend/", ); } @@ -95,7 +101,7 @@ async function validateRunnables( * Checks if the app can be built successfully */ async function validateBuild( - appDir: string + appDir: string, ): Promise<{ errors: string[]; warnings: string[] }> { const errors: string[] = []; const warnings: string[] = []; @@ -122,7 +128,7 @@ async function validateBuild( */ async function lintRawApp( appDir: string, - opts: LintOptions + opts: LintOptions, ): Promise { const errors: string[] = []; const warnings: string[] = []; @@ -131,7 +137,9 @@ async function lintRawApp( const currentDirName = path.basename(appDir); if (!hasFolderSuffix(currentDirName, "raw_app")) { errors.push( - `Not a raw app folder: '${currentDirName}' does not end with '${getFolderSuffix("raw_app")}'` + `Not a raw app folder: '${currentDirName}' does not end with '${ + getFolderSuffix("raw_app") + }'`, ); return { valid: false, errors, warnings }; } diff --git a/cli/src/commands/instance/instance.ts b/cli/src/commands/instance/instance.ts index 640a989262..462ba3d3e7 100644 --- a/cli/src/commands/instance/instance.ts +++ b/cli/src/commands/instance/instance.ts @@ -9,6 +9,7 @@ import { yamlStringify, } from "../../../deps.ts"; import * as wmill from "../../../gen/services.gen.ts"; +import process from "node:process"; import { colors, Input, log } from "../../../deps.ts"; import { loginInteractive } from "../../core/login.ts"; @@ -515,7 +516,7 @@ async function instancePush(opts: InstanceSyncOptions) { try { const workspaceSettings = (await yamlParseFile( - "settings.yaml", + path.join(process.cwd(), "settings.yaml"), )) as SimplifiedSettings; await workspaceSetup( {