Skip to content

Commit

Permalink
fix(deps): fix usage of glob
Browse files Browse the repository at this point in the history
  • Loading branch information
azlam-abdulsalam committed Aug 8, 2023
1 parent 087b16c commit 48f6bd8
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 16 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/apex/parser/ApexTypeFetcher.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as fs from 'fs-extra';
const path = require('path');
const glob = require('glob');
const { globSync } = require('glob');

import ApexTypeListener from './listeners/ApexTypeListener';

Expand Down Expand Up @@ -33,7 +33,7 @@ export default class ApexTypeFetcher {
public getClassesClassifiedByType(): ApexSortedByType {
let clsFiles: string[];
if (fs.existsSync(this.searchDir)) {
clsFiles = glob.sync(`**/*.cls`, {
clsFiles = globSync(`**/*.cls`, {
cwd: this.searchDir,
absolute: true,
});
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/apextest/ApexTestSuite.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
const glob = require('glob');

const fs = require('fs-extra');
import path from 'path';
import xml2json from '../utils/xml2json';
import { globSync } from 'glob';

export default class ApexTestSuite {
public constructor(private sourceDir: string, private suiteName: string) {}

public async getConstituentClasses(): Promise<string[]> {
let testSuitePaths: string[] = glob.sync(`**${this.suiteName}.testSuite-meta.xml`, {
let testSuitePaths: string[] = globSync(`**${this.suiteName}.testSuite-meta.xml`, {
cwd: this.sourceDir,
absolute: true,
});
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/artifacts/ArtifactFetcher.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path = require('path');
import * as fs from 'fs-extra';
import SFPLogger, { Logger, LoggerLevel } from '@dxatscale/sfp-logger';
const glob = require('glob');
const { globSync } = require('glob');
import AdmZip = require('adm-zip');
import semver = require('semver');
import tar = require('tar');
Expand Down Expand Up @@ -140,7 +140,7 @@ export default class ArtifactFetcher {
pattern = `**/*sfpowerscripts_artifact*.@(zip|tgz)`;
}

let artifacts: string[] = glob.sync(pattern, {
let artifacts: string[] = globSync(pattern, {
cwd: artifactDirectory,
absolute: true,
});
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/metadata/MetadataFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import FileUtils from '../utils/Fileutils';
import * as _ from 'lodash';
import ignore from 'ignore';
import * as fs from 'fs-extra';
import * as glob from 'glob';
import ProjectConfig from '../project/ProjectConfig';
import { globSync } from 'glob';

const SEP = /\/|\\/;

Expand Down Expand Up @@ -259,7 +259,7 @@ export default class MetadataFiles {
let extension = path.parse(filePath).ext;
associatedFilePattern = filePath.replace(extension, '.*');
}
let files = glob.sync(associatedFilePattern);
let files = globSync(associatedFilePattern);
for (let i = 0; i < files.length; i++) {
if (fs.lstatSync(files[i]).isDirectory() == false) {
let oneFilePath = path.join('.', files[i]);
Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/package/components/MetadataCount.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const {
glob
} = require('glob')
const glob = require('glob')
import path from 'path';

export default class MetadataCount {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import DeployDestructiveManifestToOrgImpl from '../components/DeployDestructiveM
import SFPLogger, { COLOR_SUCCESS, COLOR_WARNING, Logger, LoggerLevel } from '@dxatscale/sfp-logger';
import * as fs from 'fs-extra';
const path = require('path');
const glob = require('glob');
const tmp = require('tmp');
import { InstallPackage, SfpPackageInstallationOptions } from './InstallPackage';
import DeploySourceToOrgImpl, { DeploymentOptions } from '../../deployers/DeploySourceToOrgImpl';
Expand All @@ -19,6 +18,7 @@ import DeploymentOptionDisplayer from '../../display/DeploymentOptionDisplayer';
import PackageComponentPrinter from '../../display/PackageComponentPrinter';
import DeployErrorDisplayer from '../../display/DeployErrorDisplayer';
import { COLOR_ERROR } from '@dxatscale/sfp-logger';
import { globSync } from 'glob';

export default class InstallSourcePackageImpl extends InstallPackage {
private pathToReplacementForceIgnore: string;
Expand Down Expand Up @@ -268,7 +268,7 @@ export default class InstallSourcePackageImpl extends InstallPackage {
this.logger
);
//copy the original profiles to temporary location
profileFolders = glob.sync('**/profiles', {
profileFolders = globSync('**/profiles', {
cwd: path.join(sourceDirectoryPath),
});
if (profileFolders.length > 0) {
Expand Down Expand Up @@ -327,7 +327,7 @@ export default class InstallSourcePackageImpl extends InstallPackage {

//Now deploy the profies alone

const profilesDirs = glob.sync('**/profiles/', {
const profilesDirs = globSync('**/profiles/', {
cwd: path.join(sourceDirectoryPath, sourceDirectory),
absolute: true,
});
Expand Down
4 changes: 2 additions & 2 deletions packages/sfprofiles/src/impl/metadata/metadataFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import FileUtils from 'utils/fileutils';
import _ from 'lodash';
import ignore from 'ignore';
import * as fs from 'fs-extra';
import * as glob from 'glob';
import { Sfpowerkit } from 'utils/sfpowerkit';
import SFPLogger, {LoggerLevel } from '@dxatscale/sfp-logger';
import { globSync } from 'glob';

const SEP = /\/|\\/;

Expand Down Expand Up @@ -265,7 +265,7 @@ export default class MetadataFiles {
let extension = path.parse(filePath).ext;
associatedFilePattern = filePath.replace(extension, '.*');
}
let files = glob.sync(associatedFilePattern);
let files = globSync(associatedFilePattern);
for (let i = 0; i < files.length; i++) {
if (fs.lstatSync(files[i]).isDirectory() == false) {
let oneFilePath = path.join('.', files[i]);
Expand Down

0 comments on commit 48f6bd8

Please sign in to comment.