Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): avoid scanning unnecessary directories on windows #4082

Merged
merged 1 commit into from
Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/cli/commands/import/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class ImportCredentialsCommand extends Command {

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

const files = await glob(`${inputPath}/*.json`);
const files = await glob('*.json', { cwd: inputPath });

totalImported = files.length;

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/commands/import/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class ImportWorkflowsCommand extends Command {

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

const files = await glob(`${inputPath}/*.json`);
const files = await glob('*.json', { cwd: inputPath });

totalImported = files.length;

Expand Down
4 changes: 3 additions & 1 deletion packages/cli/src/LoadNodesAndCredentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,9 @@ class LoadNodesAndCredentialsClass {
* @returns {Promise<void>}
*/
async loadDataFromDirectory(setPackageName: string, directory: string): Promise<void> {
const files = await glob(path.join(directory, '**/*.@(node|credentials).js'));
const files = await glob('**/*.@(node|credentials).js', {
cwd: directory,
});

for (const filePath of files) {
const [fileName, type] = path.parse(filePath).name.split('.');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { IExecuteFunctions } from 'n8n-core';
import { INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
import glob from 'fast-glob';
import path from 'path';

import { readFile as fsReadFile } from 'fs/promises';

Expand Down