Socket
Socket
Sign inDemoInstall

@prettier/cli

Package Overview
Dependencies
43
Maintainers
14
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.4 to 0.1.5

27

dist/index.js

@@ -16,8 +16,7 @@ import isBinaryPath from "is-binary-path";

const logger = new Logger(options.logLevel);
if (options.check) {
logger.log("Checking formatting...");
}
const spinner = options.check ? logger.spinner.log() : undefined;
spinner?.start("Checking formatting...");
const rootPath = process.cwd();
const projectPath = getProjectPath(rootPath);
const [filesPaths, filesFoundPaths, foldersFoundPaths] = await getTargetsPaths(projectPath, options.globs);
const [filesPaths, filesFoundPaths, foldersFoundPaths] = await getTargetsPaths(rootPath, options.globs);
const filesPathsTargets = filesPaths.filter(negate(isBinaryPath)).sort();

@@ -53,12 +52,18 @@ const [foldersPathsTargetsUnsorted, foldersExtraPaths] = getExpandedFoldersPaths(foldersFoundPaths, projectPath);

};
if (options.check || options.list) {
return prettier.checkWithPath(filePath, getFormatOptions);
try {
if (options.check || options.list) {
return await prettier.checkWithPath(filePath, getFormatOptions);
}
else if (options.write) {
return await prettier.writeWithPath(filePath, getFormatOptions);
}
else {
return await prettier.formatWithPath(filePath, getFormatOptions);
}
}
else if (options.write) {
return prettier.writeWithPath(filePath, getFormatOptions);
finally {
spinner?.update(fastRelativePath(rootPath, filePath));
}
else {
return prettier.formatWithPath(filePath, getFormatOptions);
}
}));
spinner?.stop("Checking formatting...");
let totalFound = filesResults.length;

@@ -65,0 +70,0 @@ let totalFormatted = 0;

@@ -0,1 +1,2 @@

import Spinner from "tiny-spinner";
import type { FunctionMaybe, LogLevel } from "./types.js";

@@ -24,3 +25,12 @@ declare class Logger {

};
spinner: {
abstract: (strength: number) => Spinner | undefined;
silent: () => Spinner | undefined;
debug: () => Spinner | undefined;
log: () => Spinner | undefined;
warn: () => Spinner | undefined;
error: () => Spinner | undefined;
always: () => Spinner | undefined;
};
}
export default Logger;
import Pioppo from "pioppo";
import { color } from "specialist";
import Spinner from "tiny-spinner";
import { resolve } from "./utils.js";

@@ -63,2 +64,27 @@ class Logger {

};
this.spinner = {
abstract: (strength) => {
if (strength < this.strength)
return;
return new Spinner();
},
silent: () => {
return this.spinner.abstract(0);
},
debug: () => {
return this.spinner.abstract(1);
},
log: () => {
return this.spinner.abstract(2);
},
warn: () => {
return this.spinner.abstract(3);
},
error: () => {
return this.spinner.abstract(4);
},
always: () => {
return this.spinner.abstract(Infinity);
},
};
this.level = level;

@@ -65,0 +91,0 @@ this.strength = this.levels.indexOf(level);

@@ -6,3 +6,3 @@ {

"license": "MIT",
"version": "0.1.4",
"version": "0.1.5",
"type": "module",

@@ -39,2 +39,3 @@ "bin": {

"tiny-readdir-glob": "^1.0.4",
"tiny-spinner": "^2.0.3",
"worktank": "^2.5.2",

@@ -41,0 +42,0 @@ "zeptomatch": "^1.2.2"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc