Skip to content

Commit

Permalink
refactor: reformat files
Browse files Browse the repository at this point in the history
  • Loading branch information
Kabir-Ivan committed Jul 24, 2024
1 parent d3b9dbb commit 4c7d435
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/constants/packageManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ export const DEFAULT_PM = "npm";

export type PackageManager = "npm" | "yarn" | "pnpm";

export const PMS: Record<PackageManager, { lock: string; init: string; install: string, withRegistry: (command: string, registry: string) => string }> = {
export const PMS: Record<
PackageManager,
{ lock: string; init: string; install: string; withRegistry: (command: string, registry: string) => string }
> = {
npm: {
lock: "package-lock.json",
init: "init -y",
Expand All @@ -22,7 +25,8 @@ export const PMS: Record<PackageManager, { lock: string; init: string; install:
lock: "yarn.lock",
init: "init -y",
install: "add -D",
withRegistry: (command, registry) => `export YARN_REGISTRY=${registry} && export YARN_NPM_REGISTRY_SERVER=${registry} && ${command}`,
withRegistry: (command, registry) =>
`export YARN_REGISTRY=${registry} && export YARN_NPM_REGISTRY_SERVER=${registry} && ${command}`,
},
pnpm: {
lock: "pnpm-lock.yml",
Expand Down
5 changes: 4 additions & 1 deletion src/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ export const installPackages = async (
const pluginsPackages = pluginsToInstall.map(packageNameFromPlugin).join(" ");
return new Promise<string>((resolve, reject) => {
exec(
PMS[packageManager].withRegistry(`${packageManager} ${PMS[packageManager].install} testplane ${pluginsPackages}`, registry),
PMS[packageManager].withRegistry(
`${packageManager} ${PMS[packageManager].install} testplane ${pluginsPackages}`,
registry,
),
{
cwd: dirPath,
env: process.env,
Expand Down

0 comments on commit 4c7d435

Please sign in to comment.