@oclif/core
Advanced tools
Comparing version 1.8.2 to 1.9.0
@@ -5,2 +5,9 @@ # Changelog | ||
## [1.9.0](https://github.com/oclif/core/compare/v1.8.2...v1.9.0) (2022-05-20) | ||
### Features | ||
* support TS directory imports for ESM ([#422](https://github.com/oclif/core/issues/422)) ([4c58e78](https://github.com/oclif/core/commit/4c58e782e86dd7ecf91294bac0d2c759b4454596)) | ||
### [1.8.2](https://github.com/oclif/core/compare/v1.8.1...v1.8.2) (2022-05-18) | ||
@@ -7,0 +14,0 @@ |
@@ -5,3 +5,3 @@ "use strict"; | ||
exports.renderList = void 0; | ||
const maxBy_1 = require("lodash/maxBy"); | ||
const util_1 = require("../util"); | ||
const deps_1 = require("./deps"); | ||
@@ -15,6 +15,7 @@ function linewrap(length, s) { | ||
function renderList(items) { | ||
var _a, _b; | ||
if (items.length === 0) { | ||
return ''; | ||
} | ||
const maxLength = (0, maxBy_1.default)(items, '[0].length')[0].length; | ||
const maxLength = (_b = (_a = (0, util_1.maxBy)(items, item => item[0].length)) === null || _a === void 0 ? void 0 : _a[0].length) !== null && _b !== void 0 ? _b : 0; | ||
const lines = items.map(i => { | ||
@@ -21,0 +22,0 @@ let left = i[0]; |
@@ -5,3 +5,2 @@ "use strict"; | ||
const childProcess = require("child_process"); | ||
const _ = require("lodash"); | ||
const isWsl = require('is-wsl'); | ||
@@ -63,3 +62,3 @@ function open(target, opts = {}) { | ||
cp.once('close', code => { | ||
if (_.isNumber(code) && code > 0) { | ||
if (Number.isInteger(code) && code > 0) { | ||
reject(new Error('Exited with code ' + code)); | ||
@@ -66,0 +65,0 @@ return; |
@@ -7,5 +7,5 @@ "use strict"; | ||
const chalk = require("chalk"); | ||
const lodash_1 = require("lodash"); | ||
const util_1 = require("../../util"); | ||
const js_yaml_1 = require("js-yaml"); | ||
const util_1 = require("util"); | ||
const util_2 = require("util"); | ||
const sw = require('string-width'); | ||
@@ -21,3 +21,3 @@ const { orderBy } = require('natural-orderby'); | ||
const get = col.get || ((row) => row[key]); | ||
const header = typeof col.header === 'string' ? col.header : (0, lodash_1.capitalize)(key.replace(/_/g, ' ')); | ||
const header = typeof col.header === 'string' ? col.header : (0, util_1.capitalize)(key.replace(/_/g, ' ')); | ||
const minWidth = Math.max(col.minWidth || 0, sw(header) + 1); | ||
@@ -54,3 +54,3 @@ return { | ||
if (typeof val !== 'string') | ||
val = (0, util_1.inspect)(val, { breakLength: Number.POSITIVE_INFINITY }); | ||
val = (0, util_2.inspect)(val, { breakLength: Number.POSITIVE_INFINITY }); | ||
row[col.key] = val; | ||
@@ -189,3 +189,3 @@ } | ||
// don't shorten if there is enough screen width | ||
const dataMaxWidth = (0, lodash_1.sumBy)(columns, c => c.width); | ||
const dataMaxWidth = (0, util_1.sumBy)(columns, c => c.width); | ||
const overWidth = dataMaxWidth - maxWidth; | ||
@@ -201,3 +201,3 @@ if (overWidth <= 0) | ||
// display all as minWidth | ||
const dataMinWidth = (0, lodash_1.sumBy)(columns, c => c.minWidth); | ||
const dataMinWidth = (0, util_1.sumBy)(columns, c => c.minWidth); | ||
if (dataMinWidth >= maxWidth) | ||
@@ -204,0 +204,0 @@ return; |
@@ -13,3 +13,3 @@ "use strict"; | ||
// eslint-disable-next-line camelcase | ||
const s_EXTENSIONS = ['.js', '.mjs', '.cjs']; | ||
const s_EXTENSIONS = ['.ts', '.js', '.mjs', '.cjs']; | ||
/** | ||
@@ -105,2 +105,4 @@ * Provides a mechanism to use dynamic import / import() with tsconfig -> module: commonJS as otherwise import() gets | ||
return getPackageType.sync(filePath) === 'module'; | ||
case '.ts': | ||
return getPackageType.sync(filePath) === 'module'; | ||
case '.mjs': | ||
@@ -149,3 +151,3 @@ return true; | ||
if (!foundPath && isDirectory) { | ||
// Since filePath is a directory, try looking for index.js file. | ||
// Since filePath is a directory, try looking for index file. | ||
foundPath = ModuleLoader.findFile(path.join(filePath, 'index')); | ||
@@ -152,0 +154,0 @@ } |
@@ -7,2 +7,5 @@ export declare function compact<T>(a: (T | undefined)[]): T[]; | ||
export declare function isProd(): boolean; | ||
export declare function maxBy<T>(arr: T[], fn: (i: T) => number): T | undefined; | ||
export declare function sumBy<T>(arr: T[], fn: (i: T) => number): number; | ||
export declare function capitalize(s: string): string; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isProd = exports.castArray = exports.sortBy = exports.uniqBy = exports.compact = void 0; | ||
exports.capitalize = exports.sumBy = exports.maxBy = exports.isProd = exports.castArray = exports.sortBy = exports.uniqBy = exports.compact = void 0; | ||
function compact(a) { | ||
@@ -47,1 +47,20 @@ return a.filter((a) => Boolean(a)); | ||
exports.isProd = isProd; | ||
function maxBy(arr, fn) { | ||
if (arr.length === 0) { | ||
return undefined; | ||
} | ||
return arr.reduce((maxItem, i) => { | ||
const curr = fn(i); | ||
const max = fn(maxItem); | ||
return curr > max ? i : maxItem; | ||
}); | ||
} | ||
exports.maxBy = maxBy; | ||
function sumBy(arr, fn) { | ||
return arr.reduce((sum, i) => sum + fn(i), 0); | ||
} | ||
exports.sumBy = sumBy; | ||
function capitalize(s) { | ||
return s ? s.charAt(0).toUpperCase() + s.slice(1).toLowerCase() : ''; | ||
} | ||
exports.capitalize = capitalize; |
{ | ||
"name": "@oclif/core", | ||
"description": "base library for oclif CLIs", | ||
"version": "1.8.2", | ||
"version": "1.9.0", | ||
"author": "Salesforce", | ||
@@ -25,3 +25,2 @@ "bugs": "https://github.com/oclif/core/issues", | ||
"js-yaml": "^3.14.1", | ||
"lodash": "^4.17.21", | ||
"natural-orderby": "^2.0.3", | ||
@@ -53,3 +52,2 @@ "object-treeify": "^1.1.33", | ||
"@types/js-yaml": "^3.12.7", | ||
"@types/lodash": "^4.14.182", | ||
"@types/mocha": "^8.2.3", | ||
@@ -56,0 +54,0 @@ "@types/nock": "^11.1.0", |
304877
28
40
7634
- Removedlodash@^4.17.21
- Removedlodash@4.17.21(transitive)