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

fixes #4007

Ticket: N8N-4603
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2022-09-12 16:31:49 +02:00 committed by GitHub
parent dd2b55e352
commit 84b56eb48e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 4 deletions

View file

@ -95,7 +95,7 @@ export class ImportCredentialsCommand extends Command {
inputPath = inputPath.replace(/\/$/g, ''); inputPath = inputPath.replace(/\/$/g, '');
const files = await glob(`${inputPath}/*.json`); const files = await glob('*.json', { cwd: inputPath });
totalImported = files.length; totalImported = files.length;

View file

@ -117,7 +117,7 @@ export class ImportWorkflowsCommand extends Command {
inputPath = inputPath.replace(/\/$/g, ''); inputPath = inputPath.replace(/\/$/g, '');
const files = await glob(`${inputPath}/*.json`); const files = await glob('*.json', { cwd: inputPath });
totalImported = files.length; totalImported = files.length;

View file

@ -493,7 +493,9 @@ class LoadNodesAndCredentialsClass {
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
async loadDataFromDirectory(setPackageName: string, directory: string): 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) { for (const filePath of files) {
const [fileName, type] = path.parse(filePath).name.split('.'); const [fileName, type] = path.parse(filePath).name.split('.');

View file

@ -1,7 +1,6 @@
import { IExecuteFunctions } from 'n8n-core'; import { IExecuteFunctions } from 'n8n-core';
import { INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow'; import { INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
import glob from 'fast-glob'; import glob from 'fast-glob';
import path from 'path';
import { readFile as fsReadFile } from 'fs/promises'; import { readFile as fsReadFile } from 'fs/promises';