Skip to content
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
127 changes: 60 additions & 67 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"version": "2.43.0",
"bugs": "https://github.com/Lightning-Flow-Scanner/lightning-flow-scanner-sfdx/issues",
"dependencies": {
"@oclif/core": "^4.2.4",
"@oclif/core": "^4.2.5",
"@salesforce/core": "^8.8.2",
"@salesforce/sf-plugins-core": "^12.1.3",
"chalk": "^5.4.1",
"cosmiconfig": "^9.0.0",
"fs-extra": "^11.3.0",
"glob": "^11.0.1",
"lightning-flow-scanner-core": "4.15.0"
"lightning-flow-scanner-core": "4.16.0"
},
"devDependencies": {
"@oclif/plugin-help": "^6.2.23",
Expand All @@ -21,18 +21,18 @@
"@types/chai": "^5",
"@types/jsforce": "^1.11.5",
"@types/mocha": "^10.0.10",
"@types/node": "^22.10.10",
"@types/node": "^22.13.0",
"@types/sinon": "^17.0.3",
"@types/sinonjs__fake-timers": "^8.1.5",
"@typescript-eslint/eslint-plugin": "^8.21.0",
"@typescript-eslint/parser": "^8.21.0",
"@typescript-eslint/eslint-plugin": "^8.22.0",
"@typescript-eslint/parser": "^8.22.0",
"chai": "^5",
"eslint": "^9.19.0",
"eslint-config-prettier": "^10.0.1",
"globby": "^14.0.2",
"mocha": "^11.1.0",
"nyc": "^17",
"oclif": "^4.17.19",
"oclif": "^4.17.21",
"prettier": "^3.4.2",
"sinon": "^19.0.2",
"ts-node": "^10.9.2",
Expand Down
11 changes: 6 additions & 5 deletions src/commands/flow/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import { loadScannerOptions } from "../../libs/ScannerConfig.js";
import { FindFlows } from "../../libs/FindFlows.js";
import { ScanResult } from "../../models/ScanResult.js";

import pkg, {
import {
ScanResult as ScanResults,
RuleResult,
ResultDetails,
parse as parseFlows,
scan as scanFlows,
ParsedFlow,
} from "lightning-flow-scanner-core";
const { parse: parseFlows, scan: scanFlows } = pkg;
import type { ParsedFlow } from "lightning-flow-scanner-core/main/models/ParsedFlow.js";

Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);

Expand All @@ -28,7 +29,7 @@ export default class Scan extends SfCommand<ScanResult> {
"sf flow scan -c path/to/config.json",
"sf flow scan -c path/to/config.json --failon warning",
"sf flow scan -d path/to/flows/directory",
"sf flow scan -p path/to/single/file.flow-meta.xml,path/to/another/file.flow-meta.xml",
"[DEPRECATION WARNING USE --files] sf flow scan -p path/to/single/file.flow-meta.xml,path/to/another/file.flow-meta.xml",
"sf flow scan --files path/to/single/file.flow-meta.xml path/to/another/file.flow-meta.xml",
];

Expand All @@ -37,7 +38,7 @@ export default class Scan extends SfCommand<ScanResult> {
public static requiresProject = false;
protected static supportsUsername = true;

protected userConfig;
protected userConfig: object;
protected failOn = "error";
protected errorCounters: Map<string, number> = new Map<string, number>();

Expand Down
21 changes: 11 additions & 10 deletions src/libs/CoreFixService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { writeFileSync } from "node:fs";

import { FindFlows } from "./FindFlows.js";

import pkg from "lightning-flow-scanner-core";
const { fix: fixFlows, parse: parseFlows, scan: scanFlows } = pkg;
import { scan, parse, fix as fixFlows } from "lightning-flow-scanner-core";

import type { ScanResult as FlowScanResults } from "lightning-flow-scanner-core";

Expand All @@ -17,13 +16,8 @@ export default class CoreFixService {

public async fix(): Promise<string[]> {
//find flow file(s)
let flowFiles;
if (this.dir) {
flowFiles = this.findFlowsByDir(this.dir);
} else {
flowFiles = this.findFlowsByPath(this.file);
}
const parsedFlows = await parseFlows(flowFiles);
const flowFiles = this.findFlows();
const parsedFlows = await parse(flowFiles);

// make on the fly rule
const flatRules = this.rules
Expand All @@ -39,7 +33,7 @@ export default class CoreFixService {
) as IRulesConfig;

// scan
const scanResults: FlowScanResults[] = scanFlows(parsedFlows, flatRules);
const scanResults: FlowScanResults[] = scan(parsedFlows, flatRules);

// fix
const fixFlow: FlowScanResults[] = fixFlows(scanResults);
Expand All @@ -50,6 +44,13 @@ export default class CoreFixService {
return fixFlow.map((fixedOut) => fixedOut.flow.fsPath);
}

private findFlows(): string[] {
if (this.dir) {
return this.findFlowsByDir(this.dir);
}
return this.findFlowsByPath(this.file);
}

private findFlowsByDir(dir: string[]): string[] {
return dir
.map((dirName) => {
Expand Down