Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

myst-cli-utils

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

myst-cli-utils - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

19

dist/cjs/logger.js

@@ -8,2 +8,3 @@ "use strict";

const chalk_1 = __importDefault(require("chalk"));
const path_1 = require("path");
var LogLevel;

@@ -60,3 +61,13 @@ (function (LogLevel) {

exports.silentLogger = silentLogger;
function chalkLogger(level) {
function replaceCwd(cwd, args) {
if (!cwd)
return args;
return args.map((a) => {
if (typeof a === 'string') {
return a.replace(new RegExp(cwd + path_1.sep, 'g'), '');
}
return a;
});
}
function chalkLogger(level, cwd) {
return {

@@ -71,3 +82,3 @@ debug(...args) {

return;
console.log(chalk_1.default.reset(...args));
console.log(chalk_1.default.reset(...replaceCwd(cwd, args)));
},

@@ -77,3 +88,3 @@ warn(...args) {

return;
console.warn(chalk_1.default.yellow(...args));
console.warn(chalk_1.default.yellow(...replaceCwd(cwd, args)));
},

@@ -83,3 +94,3 @@ error(...args) {

return;
console.error(chalk_1.default.red(...args));
console.error(chalk_1.default.red(...replaceCwd(cwd, args)));
},

@@ -86,0 +97,0 @@ };

@@ -8,3 +8,3 @@ "use strict";

var _a;
this.log = (_a = opts === null || opts === void 0 ? void 0 : opts.logger) !== null && _a !== void 0 ? _a : (0, logger_1.chalkLogger)(logger_1.LogLevel.debug);
this.log = (_a = opts === null || opts === void 0 ? void 0 : opts.logger) !== null && _a !== void 0 ? _a : (0, logger_1.chalkLogger)(logger_1.LogLevel.debug, process.cwd());
}

@@ -11,0 +11,0 @@ }

import chalk from 'chalk';
import { sep } from 'path';
export var LogLevel;

@@ -51,3 +52,13 @@ (function (LogLevel) {

}
export function chalkLogger(level) {
function replaceCwd(cwd, args) {
if (!cwd)
return args;
return args.map((a) => {
if (typeof a === 'string') {
return a.replace(new RegExp(cwd + sep, 'g'), '');
}
return a;
});
}
export function chalkLogger(level, cwd) {
return {

@@ -62,3 +73,3 @@ debug(...args) {

return;
console.log(chalk.reset(...args));
console.log(chalk.reset(...replaceCwd(cwd, args)));
},

@@ -68,3 +79,3 @@ warn(...args) {

return;
console.warn(chalk.yellow(...args));
console.warn(chalk.yellow(...replaceCwd(cwd, args)));
},

@@ -74,3 +85,3 @@ error(...args) {

return;
console.error(chalk.red(...args));
console.error(chalk.red(...replaceCwd(cwd, args)));
},

@@ -77,0 +88,0 @@ };

@@ -5,3 +5,3 @@ import { chalkLogger, LogLevel } from './logger';

var _a;
this.log = (_a = opts === null || opts === void 0 ? void 0 : opts.logger) !== null && _a !== void 0 ? _a : chalkLogger(LogLevel.debug);
this.log = (_a = opts === null || opts === void 0 ? void 0 : opts.logger) !== null && _a !== void 0 ? _a : chalkLogger(LogLevel.debug, process.cwd());
}

@@ -8,0 +8,0 @@ }

@@ -12,5 +12,5 @@ import type { ISession, Logger, LoggerDE } from './types';

export declare function silentLogger(): Logger;
export declare function chalkLogger(level: LogLevel): Logger;
export declare function chalkLogger(level: LogLevel, cwd?: string): Logger;
export declare function createGitLogger(session: ISession): LoggerDE;
export declare function createNpmLogger(session: ISession): LoggerDE;
//# sourceMappingURL=logger.d.ts.map
{
"name": "myst-cli-utils",
"version": "0.0.7",
"version": "0.0.8",
"sideEffects": false,
"license": "MIT",

@@ -34,3 +35,2 @@ "description": "Utils for logging, error messages and session management",

"declarations": "tsc --project ./tsconfig.json --declaration --emitDeclarationOnly --declarationMap --outDir dist/types",
"prepublishOnly": "npm run build",
"build": "npm-run-all -l clean -p build:cjs build:esm declarations"

@@ -37,0 +37,0 @@ },

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc