Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
refactor(@angular-devkit/schematics-cli): code formatting
  • Loading branch information
MarvinXu committed Nov 22, 2022
commit 701959e61b4bd4183f6986a6c9f466dae09b9176
14 changes: 7 additions & 7 deletions packages/angular_devkit/schematics_cli/bin/schematics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { NodeWorkflow } from '@angular-devkit/schematics/tools';
import * as ansiColors from 'ansi-colors';
import * as inquirer from 'inquirer';
import yargsParser, { camelCase, decamelize } from 'yargs-parser';
import {existsSync} from 'fs'
import { existsSync } from 'fs';
import * as path from 'path';

/**
Expand Down Expand Up @@ -134,18 +134,18 @@ function findUp(names: string | string[], from: string) {
/**
* return package manager' name by lock file
*/
function getPackageManagerName() {
function getPackageManagerName() {
// order by check priority
const LOCKS: Record<string, string> = {
'package-lock.json': 'npm',
'yarn.lock': 'yarn',
'pnpm-lock.yaml': 'pnpm',
}
const lockPath = findUp(Object.keys(LOCKS), process.cwd())
};
const lockPath = findUp(Object.keys(LOCKS), process.cwd());
if (lockPath) {
return LOCKS[path.basename(lockPath)]
return LOCKS[path.basename(lockPath)];
}
return 'npm'
return 'npm';
}

// eslint-disable-next-line max-lines-per-function
Expand Down Expand Up @@ -195,7 +195,7 @@ export async function main({
dryRun,
resolvePaths: [process.cwd(), __dirname],
schemaValidation: true,
packageManager: getPackageManagerName()
packageManager: getPackageManagerName(),
});

/** If the user wants to list schematics, we simply show all the schematic names. */
Expand Down