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

🐛 CLI: Add windows support to import:credentials --separate #3589

Merged
merged 1 commit into from
Jul 27, 2022
Merged
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
13 changes: 9 additions & 4 deletions packages/cli/commands/import/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { LoggerProxy } from 'n8n-workflow';

import fs from 'fs';
import glob from 'fast-glob';
import path from 'path';
import { EntityManager, getConnection } from 'typeorm';
import { getLogger } from '../../src/Logger';
import { Db } from '../../src';
Expand Down Expand Up @@ -88,9 +87,15 @@ export class ImportCredentialsCommand extends Command {
const encryptionKey = await UserSettings.getEncryptionKey();

if (flags.separate) {
const files = await glob(
`${flags.input.endsWith(path.sep) ? flags.input : flags.input + path.sep}*.json`,
);
let { input: inputPath } = flags;

if (process.platform === 'win32') {
inputPath = inputPath.replace(/\\/g, '/');
}

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

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

totalImported = files.length;

Expand Down