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

code-info

Package Overview
Dependencies
Maintainers
0
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

code-info - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

dist/render/languages.js

7

dist/__lab__/index.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const app_1 = require("../app");
app_1.default.start([]);
const app_1 = __importDefault(require("../app"));
app_1.default.start(['--ext', 'ts']);
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const noarg_1 = require("noarg");
const path = require("path");
const render_1 = require("./render");
const get_target_files_1 = require("./lib/get-target-files");
const get_file_info_1 = require("./lib/get-file-info");
const map_lang_1 = require("./lib/map-lang");
const noarg_1 = __importDefault(require("noarg"));
const path = __importStar(require("path"));
const render_1 = __importDefault(require("./render"));
const get_target_files_1 = __importDefault(require("./lib/get-target-files"));
const get_file_info_1 = __importDefault(require("./lib/get-file-info"));
const map_lang_1 = __importDefault(require("./lib/map-lang"));
const app = noarg_1.default.create('app', {

@@ -10,0 +36,0 @@ listArgument: {

#!/usr/bin/env node
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const app_1 = require("./app");
const app_1 = __importDefault(require("./app"));
app_1.default.start();
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const fs = require("fs");
const path = require("path");
const ignore_1 = require("ignore");
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const ignore_1 = __importDefault(require("ignore"));
function default_1(rootDir, extraIgnore = []) {

@@ -8,0 +34,0 @@ const gitignorePath = path.resolve(path.join(rootDir, '.gitignore'));

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const fs = require("fs");
const fs = __importStar(require("fs"));
function getInfo(filePath) {

@@ -6,0 +29,0 @@ const stat = fs.statSync(filePath);

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const fs = require("fs");
const path = require("path");
const create_ig_1 = require("./create-ig");
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const create_ig_1 = __importDefault(require("./create-ig"));
const coreIgnore = ['.git', '.DS_Store'];
function default_1(config) {
const ig = (0, create_ig_1.default)(config.cwd, config.exclude);
const ig = (0, create_ig_1.default)(config.cwd, [
...config.exclude,
'package-lock.json',
'yarn.lock',
'pnpm-lock.yaml',
]);
const totalFiles = config.include.map((item) => {

@@ -24,6 +55,4 @@ const fullPath = path.resolve(config.cwd, item);

const childPath = path.join(targetPath, child);
// Ignore core files
if (coreIgnore.includes(child))
return [];
// Ignore gitignore files
const relativePath = path.relative(fullPath, childPath);

@@ -30,0 +59,0 @@ if (relativePath && ig.ignores(relativePath))

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const overview_1 = require("./overview");
const languages_1 = __importDefault(require("./languages"));
const overview_1 = __importDefault(require("./overview"));
function default_1(fileInfo, options) {
if (options.renderOverview) {
(0, overview_1.default)(fileInfo);
console.log('');
}
if (options.renderLanguages) {
(0, languages_1.default)(fileInfo);
console.log('');
}
}
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const ansiColors = require("ansi-colors");
const ansi_colors_1 = __importDefault(require("ansi-colors"));
const size_1 = require("../utils/size");
const utils_1 = require("../utils");
function default_1(fileInfo) {
console.log(ansiColors.bold('Overview:'));
console.log(ansi_colors_1.default.bold.blue('Overview:'));
const totalFiles = Object.values(fileInfo).reduce((acc, val) => acc + val.length, 0);
console.log(`Total files : ${ansiColors.yellow(String(totalFiles))}`);
const totalLines = Object.values(fileInfo).reduce((acc, val) => acc + val.reduce((acc, val) => acc + val.lines, 0), 0);
console.log(`Total lines : ${ansiColors.yellow(String(totalLines))}`);
const totalSize = Object.values(fileInfo).reduce((acc, val) => acc + val.reduce((acc, val) => acc + val.size, 0), 0);
const totalLines = (0, utils_1.getTotalFromMappedLang)('lines', fileInfo);
const totalSize = (0, utils_1.getTotalFromMappedLang)('size', fileInfo);
const size = (0, size_1.bytesToUnit)(totalSize);
console.log(`Total size : ${ansiColors.yellow(String(size.size))} ${size.unit}`);
const topUsedLang = Object.entries(fileInfo).sort(([, a], [, b]) => b.length - a.length);
console.log(`Most used languages:`);
for (const [lang, files] of topUsedLang) {
console.log(` ${ansiColors.cyan(lang)}: ${files.length} files`);
}
console.log(`Total files : ${ansi_colors_1.default.yellow(String(totalFiles))}`);
console.log(`Total lines : ${ansi_colors_1.default.yellow(String(totalLines))}`);
console.log(`Total size : ${ansi_colors_1.default.yellow(String(size.size))} ${size.unit}`);
}
{
"name": "code-info",
"version": "2.0.0",
"version": "2.0.1",
"type": "commonjs",

@@ -18,2 +18,3 @@ "bin": "./dist/index.js",

"ansi-colors": "^4.1.3",
"cli-table3": "^0.6.5",
"ignore": "^5.3.2",

@@ -20,0 +21,0 @@ "lskit": "^1.0.0",

import app from '../app'
app.start([])
app.start(['--ext', 'ts'])

@@ -14,3 +14,8 @@ import * as fs from 'fs'

export default function (config: GetTargetFiles) {
const ig = createIg(config.cwd, config.exclude)
const ig = createIg(config.cwd, [
...config.exclude,
'package-lock.json',
'yarn.lock',
'pnpm-lock.yaml',
])

@@ -17,0 +22,0 @@ const totalFiles = config.include.map((item) => {

import { MappedLang } from '../lib/map-lang'
import languages from './languages'
import overview from './overview'

@@ -14,3 +15,9 @@

overview(fileInfo)
console.log('')
}
if (options.renderLanguages) {
languages(fileInfo)
console.log('')
}
}

@@ -1,7 +0,8 @@

import ansiColors = require('ansi-colors')
import ansiColors from 'ansi-colors'
import { MappedLang } from '../lib/map-lang'
import { bytesToUnit } from '../utils/size'
import { getTotalFromMappedLang } from '../utils'
export default function (fileInfo: MappedLang) {
console.log(ansiColors.bold('Overview:'))
console.log(ansiColors.bold.blue('Overview:'))

@@ -12,26 +13,11 @@ const totalFiles = Object.values(fileInfo).reduce(

)
const totalLines = getTotalFromMappedLang('lines', fileInfo)
const totalSize = getTotalFromMappedLang('size', fileInfo)
const size = bytesToUnit(totalSize)
console.log(`Total files : ${ansiColors.yellow(String(totalFiles))}`)
const totalLines = Object.values(fileInfo).reduce(
(acc, val) => acc + val.reduce((acc, val: any) => acc + val.lines, 0),
0
)
console.log(`Total lines : ${ansiColors.yellow(String(totalLines))}`)
const totalSize = Object.values(fileInfo).reduce(
(acc, val) => acc + val.reduce((acc, val: any) => acc + val.size, 0),
0
)
const size = bytesToUnit(totalSize)
console.log(
`Total size : ${ansiColors.yellow(String(size.size))} ${size.unit}`
)
const topUsedLang = Object.entries(fileInfo).sort(
([, a], [, b]) => b.length - a.length
)
console.log(`Most used languages:`)
for (const [lang, files] of topUsedLang) {
console.log(` ${ansiColors.cyan(lang)}: ${files.length} files`)
}
}

@@ -7,5 +7,6 @@ {

"skipLibCheck": true,
"removeComments": true
"removeComments": true,
"esModuleInterop": true
},
"include": ["./src"]
}
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