Skip to content

Commit

Permalink
fix(cli): use absolute paths for loading custom nodes and credentials (
Browse files Browse the repository at this point in the history
…n8n-io#4099)

custom-node loading broke because of this change, as we started using relative paths for the files returned by `glob` n8n-io#4082
  • Loading branch information
netroy authored Sep 14, 2022
1 parent f6de5c8 commit f748c9b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
7 changes: 4 additions & 3 deletions packages/cli/commands/import/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ export class ImportCredentialsCommand extends Command {
inputPath = inputPath.replace(/\\/g, '/');
}

inputPath = inputPath.replace(/\/$/g, '');

const files = await glob('*.json', { cwd: inputPath });
const files = await glob('*.json', {
cwd: inputPath,
absolute: true,
});

totalImported = files.length;

Expand Down
7 changes: 4 additions & 3 deletions packages/cli/commands/import/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,10 @@ export class ImportWorkflowsCommand extends Command {
inputPath = inputPath.replace(/\\/g, '/');
}

inputPath = inputPath.replace(/\/$/g, '');

const files = await glob('*.json', { cwd: inputPath });
const files = await glob('*.json', {
cwd: inputPath,
absolute: true,
});

totalImported = files.length;

Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/LoadNodesAndCredentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ class LoadNodesAndCredentialsClass {
async loadDataFromDirectory(setPackageName: string, directory: string): Promise<void> {
const files = await glob('**/*.@(node|credentials).js', {
cwd: directory,
absolute: true,
});

for (const filePath of files) {
Expand Down

0 comments on commit f748c9b

Please sign in to comment.