Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public createProcessCommandAndArguments(
projectName: string,
baseKarmaConfigFilePath: string,
workspaceRootPath: string,
angularProcessCommand: string,
angularProcessArguments: string[]
) {
const path = require("path");
const resolveGlobal = require("resolve-global");
const isAngularInstalledGlobally = resolveGlobal.silent("@angular/cli") != null;
const isAngularInstalledLocally = this.fileHelper.doesFileExists(path.join(workspaceRootPath, "node_modules", "@angular", "cli", "bin", "ng"));
if (angularProcessCommand) {
return {
cliCommand: angularProcessCommand,
cliArgs: [projectName, `--karma-config="${baseKarmaConfigFilePath}"`, "--progress=false", ...angularProcessArguments],
};
}
const commonArgs = ["test", projectName, `--karma-config="${baseKarmaConfigFilePath}"`, "--progress=false", ...angularProcessArguments];
let cliCommand: string = "";
let cliArgs: string[] = [];
if (isAngularInstalledGlobally) {
cliArgs = commonArgs;
cliCommand = "ng";
function loadFormatter(config, flags) {
const moduleName = flags.format || config.formatter || '@commitlint/format';
const modulePath =
resolveFrom.silent(__dirname, moduleName) ||
resolveFrom.silent(flags.cwd, moduleName) ||
resolveGlobal.silent(moduleName);
if (modulePath) {
const moduleInstance = require(modulePath);
if (isFunction(moduleInstance.default)) {
return moduleInstance.default;
}
return moduleInstance;
}
throw new Error(`Using format ${moduleName}, but cannot find the module.`);
}
function loadFormatter(config, flags) {
const moduleName = flags.format || config.formatter || '@commitlint/format';
const modulePath =
resolveFrom.silent(__dirname, moduleName) ||
resolveFrom.silent(flags.cwd, moduleName) ||
resolveGlobal.silent(moduleName);
if (modulePath) {
const moduleInstance = require(modulePath);
if (isFunction(moduleInstance.default)) {
return moduleInstance.default;
}
return moduleInstance;
}
throw new Error(`Using format ${moduleName}, but cannot find the module.`);
}
function getParcelPath() {
const globalPath = resolveGlobal.silent('parcel-bundler')
return globalPath ? globalPath.substr(0, globalPath.length - 8) : 'parcel-bundler'
}
exports.getParcelPath = getParcelPath
export function loadFormatter(config, flags) {
const moduleName = flags.format || config.formatter || '@commitlint/format';
const modulePath =
resolveFrom.silent(__dirname, moduleName) ||
resolveFrom.silent(flags.cwd, moduleName) ||
resolveGlobal.silent(moduleName);
if (modulePath) {
const moduleInstance = require(modulePath);
if (_.isFunction(moduleInstance.default)) {
return moduleInstance.default;
}
return moduleInstance;
}
throw new Error(`Using format ${moduleName}, but cannot find the module.`);
}