Skip to content

Commit

Permalink
fix: automate after upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
npenin committed Aug 10, 2024
1 parent a0f3b80 commit 02e0707
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/automate/src/akala.mts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function (config, cli: NamespaceMiddleware)
context.logger.level = LogLevels[levelEntry[0]];
}
}
const container: workflow.container & Container<CliContext> = await use.call(context, null, 'workflow', require.resolve('../../workflow.json'));
const container: workflow.container & Container<CliContext> = await use.call(context, null, 'workflow', new URL('../../workflow.json', import.meta.url));
var loader: Container<CliContext>;

if (context.options.loader)
Expand Down
2 changes: 1 addition & 1 deletion packages/automate/src/workflow-commands/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function UsesMiddleware(container: Container<unknown>): MiddlewareRunner<
{
return new MiddlewareRunner('uses', (context: CliContext<{ file: string }>, step) =>
{
return use.call(context, container, step.with?.name, path.join(path.dirname(context.options.file), step.uses));
return use.call(context, container as any, step.with?.name as string, path.join(path.dirname(context.options.file), step.uses));
});
}

Expand Down
5 changes: 3 additions & 2 deletions packages/automate/src/workflow-commands/use.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import { Container, Processors } from "@akala/commands";
import { isAbsolute, basename } from 'path'
import { pathToFileURL, fileURLToPath } from 'url'

export default async function use(this: CliContext, self: Container<CliContext>, name: string, pathToCommands: string)
export default async function use(this: CliContext, self: Container<CliContext>, name: string, pathToCommands: string | URL)
{
if (!name)
var container = self;
else
var container = new Container(name, this);
if (pathToCommands.startsWith('./') || isAbsolute(pathToCommands))
if (pathToCommands instanceof URL || pathToCommands.startsWith('./') || isAbsolute(pathToCommands))
{
pathToCommands = fileURLToPath(pathToCommands);
if (basename(pathToCommands) == 'package.json')
await Processors.FileSystem.discoverCommands(pathToCommands.substring(0, pathToCommands.length - 'package.json'.length), container);
else
Expand Down

0 comments on commit 02e0707

Please sign in to comment.