@smkit/tools
Advanced tools
Comparing version 0.0.1-beta.11 to 0.0.1-beta.13
@@ -1,2 +0,2 @@ | ||
export * as vault from './vault/index.js'; | ||
export declare function doSomeStuff(withThis: string, andThat: string, andThose: string[]): boolean; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,3 +0,22 @@ | ||
export * as vault from './vault/index.js'; | ||
console.log('🛠️ SberMarketing tools'); | ||
console.log("Try npm run lint/fix!"); | ||
const longString = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ut aliquet diam.'; | ||
const trailing = 'Semicolon'; | ||
const why = { am: 'I tabbed?' }; | ||
const iWish = "I didn't have a trailing space..."; | ||
const sicilian = true; | ||
; | ||
const vizzini = (!!sicilian) ? !!!sicilian : sicilian; | ||
const re = /foo bar/; | ||
export function doSomeStuff(withThis, andThat, andThose) { | ||
//function on one line | ||
if (!Boolean(andThose.length)) { | ||
return false; | ||
} | ||
console.log(withThis); | ||
console.log(andThat); | ||
console.dir(andThose); | ||
console.log(longString, trailing, why, iWish, vizzini, re); | ||
return; | ||
} | ||
// TODO: more examples | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,1 @@ | ||
export {}; | ||
//# sourceMappingURL=cli.d.ts.map |
@@ -5,3 +5,2 @@ // import yargs from 'yargs'; | ||
// import fs from 'fs'; | ||
export {}; | ||
// const ENV_SCOPE_PATTERN = '# --scope:' | ||
@@ -8,0 +7,0 @@ // async function pull() { |
// import | ||
import dotenv from 'dotenv'; | ||
import c from 'chalk'; | ||
import { Vault } from './index.js'; | ||
import { Vault } from '.'; | ||
export async function injectSecrets() { | ||
@@ -6,0 +6,0 @@ const vault = new Vault(); |
import VaultInstance from 'hashi-vault-js'; | ||
import type { Config } from './types.js'; | ||
import type { Config } from './types'; | ||
export declare class KV { | ||
@@ -4,0 +4,0 @@ kv: string; |
import VaultInstance from 'hashi-vault-js'; | ||
import { getConfig } from './parser.js'; | ||
import { getConfig } from './parser'; | ||
import c from 'chalk'; | ||
export class KV { | ||
kv; | ||
vault; | ||
token; | ||
constructor({ kv, vault, token }) { | ||
@@ -39,7 +36,4 @@ this.kv = kv; | ||
export class Vault { | ||
config; | ||
connection; | ||
token; | ||
constructor(config) { | ||
this.config = config ?? getConfig(); | ||
this.config = config !== null && config !== void 0 ? config : getConfig(); | ||
} | ||
@@ -46,0 +40,0 @@ async init() { |
@@ -1,4 +0,4 @@ | ||
import type { Config } from './types.js'; | ||
import type { Config } from './types'; | ||
export declare function getConfig(configFile?: string): Config | never; | ||
export declare function envStringify(obj: Record<string, unknown>): string; | ||
//# sourceMappingURL=parser.d.ts.map |
@@ -20,23 +20,24 @@ import fs from 'fs'; | ||
function validateConfig(config) { | ||
var _a, _b; | ||
const problems = []; | ||
if (!config?.host) { | ||
if (!(config === null || config === void 0 ? void 0 : config.host)) { | ||
problems.push(`No ${c.bold('host')} specified`); | ||
} | ||
if (!config?.auth?.username) { | ||
if (!((_a = config === null || config === void 0 ? void 0 : config.auth) === null || _a === void 0 ? void 0 : _a.username)) { | ||
problems.push(`No ${c.bold('auth.username')} specified`); | ||
} | ||
if (!config?.auth?.password) { | ||
if (!((_b = config === null || config === void 0 ? void 0 : config.auth) === null || _b === void 0 ? void 0 : _b.password)) { | ||
problems.push(`No ${c.bold('auth.password')} specified`); | ||
} | ||
if (!config?.scopes) { | ||
if (!(config === null || config === void 0 ? void 0 : config.scopes)) { | ||
problems.push(`No ${c.bold('scopes')} specified`); | ||
} | ||
for (const [key, value] of Object.entries(config.scopes)) { | ||
if (!value?.kv) { | ||
if (!(value === null || value === void 0 ? void 0 : value.kv)) { | ||
problems.push(`No ${c.bold('kv')} specified for scope ${c.underline(key)}`); | ||
} | ||
if (!value?.path) { | ||
if (!(value === null || value === void 0 ? void 0 : value.path)) { | ||
problems.push(`No ${c.bold('path')} specified for scope ${c.underline(key)}`); | ||
} | ||
if (!value?.target) { | ||
if (!(value === null || value === void 0 ? void 0 : value.target)) { | ||
problems.push(`No ${c.bold('target')} specified for scope ${c.underline(key)}`); | ||
@@ -43,0 +44,0 @@ } |
{ | ||
"type": "module", | ||
"name": "@smkit/tools", | ||
"version": "0.0.1-beta.11", | ||
"version": "0.0.1-beta.13", | ||
"description": "Tools and cool stuff of SberMarketing", | ||
@@ -56,4 +56,6 @@ "license": "MIT", | ||
"tsup": "^8.1.0", | ||
"tsx": "^4.16.2", | ||
"typescript": "^5.5.3", | ||
"typescript-eslint": "^7.15.0" | ||
"typescript-eslint": "^7.15.0", | ||
"vitest": "^1.6.0" | ||
}, | ||
@@ -68,8 +70,10 @@ "dependencies": { | ||
"scripts": { | ||
"dev": "nodemon --exec npx ts-node src/tests.ts", | ||
"dev": "nodemon --exec tsx src/tests.ts", | ||
"format": "prettier --write ./src/**/*.{js,json,html,ts}", | ||
"lint": "eslint . --fix", | ||
"build": "tsc", | ||
"prepublish": "pnpm run build" | ||
"prepublish": "pnpm run build", | ||
"test": "vitest", | ||
"coverage": "vitest run --coverage" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
89292
63
1652
10
8