New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

akitainu

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

akitainu - npm Package Compare versions

Comparing version 0.1.0-alpha.6 to 0.1.0-alpha.7

41

dist/cli/index.js
#! /usr/bin/env node
import { cosmiconfig } from "cosmiconfig";
import path from "path";
import yargs from "yargs";
import { runReporters, runRules } from "../core/index.js";

@@ -9,13 +10,20 @@ import { noFilter } from "../filter/noFilter.js";

import { resolvePackage } from "./resolvePackage.js";
main().catch((err) => {
console.error(err);
process.exit(1);
});
async function main() {
var _a;
const explorer = cosmiconfig("akitainu");
const searchResult = await explorer.search();
yargs(process.argv.slice(2))
.command("$0 [configfile]", "Run akitainu", (yargs) => {
return yargs.positional("configfile", {
type: "string",
});
}, (argv) => {
const configFile = argv.configfile;
main(configFile).catch((err) => {
console.error(err);
process.exit(1);
});
})
.help().argv;
async function main(configFile) {
const { configDir, config: rawConfig } = await loadConfig(configFile);
const config = {
...getDefaultConfig(searchResult ? path.dirname(searchResult.filepath) : process.cwd()),
...((_a = searchResult === null || searchResult === void 0 ? void 0 : searchResult.config) !== null && _a !== void 0 ? _a : {}),
...getDefaultConfig(configDir),
...rawConfig,
};

@@ -38,2 +46,15 @@ const [rules, reporters] = await Promise.all([

}
async function loadConfig(configFile) {
var _a;
const explorer = cosmiconfig("akitainu");
const searchResult = configFile === undefined
? await explorer.search()
: await explorer.load(configFile);
return {
configDir: searchResult
? path.dirname(searchResult.filepath)
: process.cwd(),
config: (_a = searchResult === null || searchResult === void 0 ? void 0 : searchResult.config) !== null && _a !== void 0 ? _a : {},
};
}
function getRules(config) {

@@ -40,0 +61,0 @@ return Promise.all(config.rules.map(async (rule) => ({

@@ -6,2 +6,3 @@ import chalk from "chalk";

async run({ errors }) {
console.log(`Found ${errors.length || "no"} error${errors.length > 1 ? "s" : ""}.\n`);
for (const { checker, code, message, location } of errors) {

@@ -8,0 +9,0 @@ const loc = !location

{
"name": "akitainu",
"version": "0.1.0-alpha.6",
"version": "0.1.0-alpha.7",
"description": "Gradual code linting tool",

@@ -31,2 +31,3 @@ "main": "dist/index.js",

"@types/jest": "^26.0.22",
"@types/yargs": "^15.0.13",
"babel-jest": "^26.6.3",

@@ -38,4 +39,5 @@ "jest": "^27.0.0-next.9",

"chalk": "^4.1.0",
"cosmiconfig": "^7.0.0"
"cosmiconfig": "^7.0.0",
"yargs": "^16.2.0"
}
}

@@ -5,2 +5,3 @@ #! /usr/bin/env node

import path from "path";
import yargs from "yargs";
import { Checker } from "../checker/index.js";

@@ -17,15 +18,26 @@ import { runReporters, runRules } from "../core/index.js";

main().catch((err) => {
console.error(err);
process.exit(1);
});
yargs(process.argv.slice(2))
.command(
"$0 [configfile]",
"Run akitainu",
(yargs) => {
return yargs.positional("configfile", {
type: "string",
});
},
(argv) => {
const configFile = argv.configfile;
main(configFile).catch((err) => {
console.error(err);
process.exit(1);
});
}
)
.help().argv;
async function main() {
const explorer = cosmiconfig("akitainu");
const searchResult = await explorer.search();
async function main(configFile: string | undefined) {
const { configDir, config: rawConfig } = await loadConfig(configFile);
const config: CliConfig = {
...getDefaultConfig(
searchResult ? path.dirname(searchResult.filepath) : process.cwd()
),
...(searchResult?.config ?? {}),
...getDefaultConfig(configDir),
...rawConfig,
};

@@ -52,2 +64,16 @@ const [rules, reporters] = await Promise.all([

async function loadConfig(configFile: string | undefined) {
const explorer = cosmiconfig("akitainu");
const searchResult =
configFile === undefined
? await explorer.search()
: await explorer.load(configFile);
return {
configDir: searchResult
? path.dirname(searchResult.filepath)
: process.cwd(),
config: searchResult?.config ?? {},
};
}
function getRules(config: CliConfig): Promise<Rule[]> {

@@ -54,0 +80,0 @@ return Promise.all(

@@ -13,2 +13,5 @@ import chalk from "chalk";

async run({ errors }) {
console.log(
`Found ${errors.length || "no"} error${errors.length > 1 ? "s" : ""}.\n`
);
for (const { checker, code, message, location } of errors) {

@@ -15,0 +18,0 @@ const loc = !location

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