repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
healer1064/Gimbal
packages/gimbal/src/module/registry.ts
<gh_stars>100-1000 import { ModuleInfo, Module } from '@/typings/module/registry'; import { Meta } from '@/typings/module'; const registry = new Map<string, ModuleInfo>(); export const register = (name: string, meta: Meta, mod: Module): void => { registry.set(name, { fn: mod, meta, }); }; export const un...
healer1064/Gimbal
packages/gimbal-core/src/utils/env.ts
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */ const envOrDefault = (variableName: string, defaultValue?: any): any => { const envValue = process.env[variableName]; // parse booleans by default if (envValue === 'true') { return true; } if (envValue === 'false') { return false; }...
healer1064/Gimbal
packages/gimbal/src/module/size/output.ts
import checkThreshold from '@modus/gimbal-core/lib/utils/threshold'; import bytes from 'bytes'; import { relative } from 'path'; import { Report, ReportItem } from '@/typings/command'; import { FileResult } from '@/typings/module/size'; import { CommandOptions } from '@/typings/utils/command'; const bytesConfig = { un...
healer1064/Gimbal
packages/gimbal/src/output/markdown/index.ts
<reponame>healer1064/Gimbal import { TableInstanceOptions } from 'cli-table3'; import { createTable } from '../cli'; import EventEmitter from '@/event'; import { Report, ReportItem } from '@/typings/command'; import { Config } from '@/typings/components/Table'; import { CliOutputOptions } from '@/typings/output/cli'; i...
healer1064/Gimbal
packages/gimbal/src/event/Event.spec.ts
<gh_stars>100-1000 import Event from './Event'; describe('@modus/gimbal-core/event/Event', (): void => { describe('fire', (): void => { it('should fire an event', (): void => { const fn = jest.fn().mockReturnValue('returned'); const instance = new Event('foo', fn); const ret = instance.fire('f...
healer1064/Gimbal
packages/plugin-last-value/src/util.ts
<gh_stars>100-1000 import checkThreshold, { isPercentage, percentToNumber } from '@modus/gimbal-core/lib/utils/threshold'; import { Meta, Types } from '@/typings/module'; import { Config, ItemFailReasons, LastReportItem } from '@/typings/plugin/last-value'; import { DiffRet } from '@/typings/plugin/last-value/util'; im...
healer1064/Gimbal
packages/typings/module/chrome/index.d.ts
<filename>packages/typings/module/chrome/index.d.ts import { Browser, LaunchOptions, Page } from 'puppeteer'; export interface LaunchStartEvent { config: LaunchOptions; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ mod: any; // would cause circular dependency if imported the command class } ...
healer1064/Gimbal
packages/plugin-source-map-explorer/src/index.ts
<reponame>healer1064/Gimbal import deepmerge from 'deepmerge'; import { PluginOptions } from '@/typings/config/plugin'; import { BundleObject, BundleType, Config, defaultConfig } from './config'; import { registerModule } from './mod'; const arrayMerge = (destinationArray: BundleType[], sourceArray: BundleType[]): Bun...
healer1064/Gimbal
packages/gimbal/src/ci/GitHubActions/index.ts
<reponame>healer1064/Gimbal import env from '@modus/gimbal-core/lib/utils/env'; import { CIMode } from '@/typings/ci'; import { VCS as VCSTypes } from '@/typings/vcs'; import GitHub from '@/vcs/GitHub'; export default class GitHubActions { private $vcs?: VCSTypes; public static is(): boolean { return env('GIT...
healer1064/Gimbal
packages/gimbal-core/src/utils/Queue.ts
<reponame>healer1064/Gimbal import { Data, Mode } from '@/typings/utils/Queue'; interface Config { mode?: Mode; } class Queue { private mode: Mode = 'sequential'; private queue: Data[] = []; public constructor(config: Config = {}) { if (config.mode) { this.mode = config.mode; } } public a...
healer1064/Gimbal
packages/gimbal/src/module/chrome/index.ts
import deepmerge from 'deepmerge'; import puppeteer, { Browser, Page } from 'puppeteer'; import { URL } from 'url'; import Config from '@/config'; import EventEmitter from '@/event'; import { LaunchStartEvent, LaunchEndEvent, KillStartEvent, KillEndEvent, NewPageStartEvent, NewPageEndEvent, } from '@/typing...
healer1064/Gimbal
packages/gimbal/src/config/loader/js.ts
<reponame>healer1064/Gimbal<filename>packages/gimbal/src/config/loader/js.ts import { Config } from '@/typings/config'; const jsLoader = async (file: string): Promise<Config> => { const config = await import(file); if (typeof config === 'function') { return config(); } return config; }; export default j...
healer1064/Gimbal
packages/gimbal/src/module/chrome/default-config.ts
<filename>packages/gimbal/src/module/chrome/default-config.ts import { LaunchOptions } from 'puppeteer'; // can accept anything from: https://github.com/GoogleChrome/puppeteer/blob/v1.14.0/docs/api.md#puppeteerlaunchoptions const defaultConfig: LaunchOptions = { // args useful for headless CI instances args: ['--n...
healer1064/Gimbal
packages/typings/vcs/GitHub/index.d.ts
import { IssuesCreateCommentParams, IssuesCreateCommentResponse, ReposCreateCommitCommentParams, ReposCreateCommitCommentResponse, Response, } from '@octokit/rest'; export interface CommitCommentStartEvent { comment: ReposCreateCommitCommentParams; /* eslint-disable-next-line @typescript-eslint/no-explic...
healer1064/Gimbal
packages/gimbal/src/config/jobs.ts
import spawn from '@modus/gimbal-core/lib/utils/spawn'; import { splitOnWhitespace } from '@modus/gimbal-core/lib/utils/string'; import EventEmitter from '@/event'; import Logger from '@/logger'; import { ArrayJob, Job, JobRet, JobStartEvent, JobEndEvent, JobsStartEvent, JobsEndEvent } from '@/typings/config/jobs'; imp...
healer1064/Gimbal
packages/gimbal/src/config/resolver/index.ts
import { resolvePath } from '@modus/gimbal-core/lib/utils/fs'; import { existsSync } from 'fs'; import path from 'path'; const IS_FILE_RE = /^[./]/; const IS_GIMBAL_RE = /^@\//; const IS_USER_HOME_RE = /^~/; const GIMBAL_ROOT = resolvePath(__dirname, '../..'); const resolver = (requested: string, dir: string, dirPre...
healer1064/Gimbal
packages/gimbal-core/src/utils/port.ts
<reponame>healer1064/Gimbal<gh_stars>100-1000 import getPort from 'get-port'; const findPort = async (): Promise<number> => { const port = await getPort({ port: getPort.makeRange(3000, 3100), }); return port; }; export default findPort;
healer1064/Gimbal
packages/typings/ci/index.d.ts
<filename>packages/typings/ci/index.d.ts export interface Cls { is: () => boolean; name: string; } export type CIMode = 'commit' | 'pr';
healer1064/Gimbal
packages/gimbal/src/output/cli/index.ts
<gh_stars>100-1000 import TableComp from '@modus/gimbal-core/lib/components/Table'; import { sectionHeading, successOrFailure } from '@modus/gimbal-core/lib/utils/colors'; import { Report, ReportItem } from '@/typings/command'; import { Config, Data, Table } from '@/typings/components/Table'; import { CliOutputOptions ...
healer1064/Gimbal
packages/gimbal/src/output/index.ts
import { mkdirp, resolvePath, writeFile } from '@modus/gimbal-core/lib/utils/fs'; import path from 'path'; import Config from '@/config'; import EventEmitter from '@/event'; import Logger from '@/logger'; import { Report } from '@/typings/command'; import { FileWriteStartEvent, FileWriteEndEvent, CliReportStartEv...
healer1064/Gimbal
packages/gimbal/src/event/index.spec.ts
beforeEach((): void => { jest.resetModules(); }); describe('@modus/gimbal-core/event/index', (): void => { describe('on', (): void => { it('should add a callback', async (): Promise<void> => { const { default: Emitter } = await import('./index'); const fn = jest.fn().mockResolvedValue('returned'); ...
healer1064/Gimbal
packages/typings/utils/threshold.d.ts
<reponame>healer1064/Gimbal export interface LighthouseThreshold { accessibility?: number; 'best-practices'?: number; performance?: number; pwa?: number; seo?: number; [key: string]: number | void; } export interface AdvancedThreshold extends LighthouseThreshold { // heap-snapshot module Documents?: nu...
healer1064/Gimbal
packages/gimbal/src/utils/constants.ts
<reponame>healer1064/Gimbal /* eslint-disable-next-line import/prefer-default-export */ export const CHILD_GIMBAL_PROCESS = 'CHILD_GIMBAL_PROCESS';
healer1064/Gimbal
packages/gimbal-core/src/components/Table/renderer/cli.ts
import Table, { Cell, HorizontalTable } from 'cli-table3'; import { Column, Data, RendererArgs } from '@/typings/components/Table'; import { sectionHeading } from '../../../utils/colors'; import Queue from '../../../utils/Queue'; const defaultConfig = { style: { head: ['white'] }, }; const renderItem = async (table...
healer1064/Gimbal
packages/gimbal-core/src/utils/Process.ts
import pidusage from 'pidusage'; interface ProcessConfig { autoStart?: boolean; } interface Stat { cpu: number; // percentage (from 0 to 100*vcore) memory: number; // bytes ppid: number; // PPID pid: number; // PID ctime: number; // ms user + system time elapsed: number; // ms since the start of the pro...
healer1064/Gimbal
packages/gimbal/src/module/heap-snapshot/default-config.ts
import { Config } from '@/typings/module/heap-snapshot'; const defaultConfig: Config = { threshold: { Documents: 5, Frames: 2, LayoutCount: 5, Nodes: 75, RecalcStyleCount: 6, }, }; export default defaultConfig;
healer1064/Gimbal
packages/gimbal/src/module/lighthouse/default-config.ts
<filename>packages/gimbal/src/module/lighthouse/default-config.ts import { Config } from '@/typings/module/lighthouse'; const defaultConfig: Config = { extends: 'lighthouse:default', settings: { skipAudits: ['uses-http2', 'redirects-http', 'uses-long-cache-ttl'], }, threshold: { accessibility: 75, ...
healer1064/Gimbal
packages/typings/module/heap-snapshot/index.d.ts
<filename>packages/typings/module/heap-snapshot/index.d.ts import { Metrics, Page } from 'puppeteer'; import { Report } from '@/typings/command'; import { CommandOptions } from '@/typings/utils/command'; import { AdvancedThreshold } from '@/typings/utils/threshold'; export interface Config { threshold: AdvancedThres...
healer1064/Gimbal
packages/typings/command/index.d.ts
import { CommandOptions } from '@/typings/utils/command'; export type ReportThresholdLimit = 'lower' | 'upper'; export interface ReportError { message: string; stack: string[]; } export interface ReportItem { data?: ReportItem[]; label: string; lastValue?: number | string; /* eslint-disable-next-line @ty...
healer1064/Gimbal
packages/typings/config/jobs.d.ts
import { CommandOptions } from '@/typings/utils/command'; import { CmdSpawnRet } from '@/typings/utils/spawn'; export interface Options { [key: string]: string; } export interface OptionsCt { options: Options; } export type ArrayJob = [string, OptionsCt]; export type Job = string | ArrayJob; export type JobRet =...
healer1064/Gimbal
packages/plugin-mysql/src/index.ts
import envOrDefault from '@modus/gimbal-core/lib/utils/env'; import deepmerge from 'deepmerge'; import mysqlMod, { Connection, MysqlError } from 'mysql'; import { PluginOptions } from '@/typings/config/plugin'; import { GetEvent, SaveEvent } from '@/typings/plugin/last-value'; import { EnvOrDefault } from '@/typings/ut...
healer1064/Gimbal
packages/typings/utils/command.d.ts
export interface CommandOptions { cwd: string; comment: boolean; config?: string; outputHtml?: string; outputJson?: string; outputMarkdown?: string; verbose: boolean; [name: string]: string | number | boolean | undefined; } /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ export type G...
healer1064/Gimbal
packages/typings/output/cli.d.ts
<filename>packages/typings/output/cli.d.ts import { Table } from '@/typings/components/Table'; /* eslint-disable-next-line import/prefer-default-export */ export interface CliOutputOptions { table?: Table; }
healer1064/Gimbal
packages/gimbal/src/module/unused-source/reconcile.ts
import { ReportItem } from '@/typings/command'; import { checkThreshold, getEntryUsed } from './index'; interface Range { end: number; start: number; } const mergeRanges = (source: Range[], ranges: Range[]): Range[] => { ranges.forEach(({ start, end }: Range): void => { let foundMatch = false; let needS...
healer1064/Gimbal
packages/gimbal/src/module/unused-source/default-config.ts
<reponame>healer1064/Gimbal<gh_stars>100-1000 import { SizeConfigs } from '@/typings/module/size'; import { UnusedSourceConfig } from '@/typings/module/unused-source'; const defaultConfig: UnusedSourceConfig = { /** * A `threshold` value can be a number or string or an array of size thresholds: * * If a str...
healer1064/Gimbal
packages/typings/plugin/last-value/util.d.ts
import { Meta } from '@/typings/module'; export interface DiffRet { change: number; diff: number; } export interface Metas { [label: string]: Meta; }
healer1064/Gimbal
packages/gimbal-core/src/components/Table/renderer/html.ts
import renderMarkdown from './markdown'; import { RendererArgs } from '@/typings/components/Table'; // one day make this more powerful and create real html from a template maybe const renderHtml = (args: RendererArgs): Promise<string> => renderMarkdown(args); export default renderHtml;
healer1064/Gimbal
packages/plugin-axe/src/index.spec.ts
import realdeepmerge from 'deepmerge'; import { Meta } from '@/typings/module'; import { Module } from '@/typings/module/registry'; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ type Deepmerge = (x: any, y: any) => any; beforeEach((): void => { jest.resetModules(); }); describe('@modus/gimbal-p...
healer1064/Gimbal
packages/gimbal/src/command/reconcile.ts
import deepmerge from 'deepmerge'; import reconcile from '@/module/reconcile'; import { Report, ReportItem } from '@/typings/command'; const findMatches = (item: ReportItem, type: string, rest: Report[]): ReportItem[] => { const matches: ReportItem[] = [item]; rest.forEach((report: Report): void => { if (repo...
healer1064/Gimbal
packages/plugin-sqlite/src/index.spec.ts
<reponame>healer1064/Gimbal import realdeepmerge from 'deepmerge'; import sqlite3 from 'sqlite3'; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ type Deepmerge = (x: any, y: any) => any; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ type Mkdirp = (filepath: string) => Promise<any...
healer1064/Gimbal
packages/typings/utils/fs.d.ts
<filename>packages/typings/utils/fs.d.ts<gh_stars>100-1000 /* eslint-disable-next-line import/prefer-default-export */ export type ResolvePath = (...paths: string[]) => string;
healer1064/Gimbal
packages/gimbal/src/modules.ts
import audit from '@/command/audit'; import { preparseOptions } from '@/command'; import Config from '@/config'; (async (): Promise<void> => { // Parse config. Audits will consume config automatically const options = preparseOptions(); await Config.load(options.cwd, options); })(); // eslint-disable-next-line i...
healer1064/Gimbal
packages/gimbal/src/command/audit/program.ts
<gh_stars>100-1000 import action from './index'; import Command from '@/command'; // eslint-disable-next-line no-new export default new Command({ action, command: 'audit', });
healer1064/Gimbal
packages/gimbal/src/module/heap-snapshot/meta.ts
<filename>packages/gimbal/src/module/heap-snapshot/meta.ts import { Meta } from '@/typings/module'; const meta: Meta = { thresholdLimit: 'upper', thresholdTypes: { Documents: 'number', Frames: 'number', JSHeapTotalSize: 'size', JSHeapUsedSize: 'size', LayoutCount: 'number', Nodes: 'number',...
healer1064/Gimbal
packages/plugin-last-value/src/index.spec.ts
<reponame>healer1064/Gimbal<gh_stars>100-1000 beforeEach((): void => { jest.resetModules(); }); describe('@modus/gimbal-plugin-last-value', (): void => { it('should add option to commander', async (): Promise<void> => { const option = jest.fn(); const bus = jest .fn() .mockResolvedValueOnce({ ...
healer1064/Gimbal
packages/gimbal/src/config/audits.ts
<gh_stars>100-1000 import program, { Command } from 'commander'; import audit from '@/command/audit/program'; const processAudits = (): Promise<void> => audit.run(program.commands.find((cmd: Command): boolean => cmd.name() === 'audit')); export default processAudits;
healer1064/Gimbal
packages/typings/output/index.d.ts
<filename>packages/typings/output/index.d.ts<gh_stars>100-1000 import { Table } from '@/typings/components/Table'; import { Report } from '@/typings/command'; import { CliOutputOptions } from '@/typings/output/cli'; import { CommandOptions } from '@/typings/utils/command'; export interface FileWriteStartEvent { cont...
healer1064/Gimbal
packages/gimbal/src/module/unused-source/index.ts
import deepmerge from 'deepmerge'; import minimatch from 'minimatch'; import { CoverageEntry, Page } from 'puppeteer'; import { URL } from 'url'; import Config from '@/config'; import EventEmitter from '@/event'; import { Report } from '@/typings/command'; import { SizeConfigs } from '@/typings/module/size'; import { ...
healer1064/Gimbal
packages/gimbal/src/output/filter.ts
<reponame>healer1064/Gimbal import { Report, ReportItem } from '@/typings/command'; export const filterReportItemsFailures = (item: ReportItem): ReportItem | undefined => { if (item.success) { return undefined; } if (item.data) { // recursive const data = item.data.map(filterReportItemsFailures).fil...
healer1064/Gimbal
packages/gimbal/src/event/Event.ts
import { Callback, CreatedCallback, Config } from '@/typings/event/Event'; import { Data } from '@/typings/utils/Queue'; class Event { private event: string; private fn: Callback; public priority = 0; public constructor(event: string, config: Callback | Config) { this.event = event; if (typeof conf...
healer1064/Gimbal
packages/plugin-source-map-explorer/src/index.spec.ts
import realdeepmerge from 'deepmerge'; import { PluginOptions } from '@/typings/config/plugin'; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ type Deepmerge = (x: any, y: any, opts?: any) => any; const pluginOptions: PluginOptions = { bus: (): string => '', dir: 'foo', }; beforeEach((): void ...
healer1064/Gimbal
packages/plugin-mysql/src/last-value/index.ts
import { Connection, MysqlError } from 'mysql'; import { Report } from '@/typings/command'; interface Config { commandPrefix?: string | string[]; database: string; table: string; } /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ type Row = any; const VAR_RE = /\${(.+?):(.+?)(?:,\s*(.+?))?(?:,...
healer1064/Gimbal
packages/plugin-source-map-explorer/src/mod.ts
<gh_stars>100-1000 import { resolvePath } from '@modus/gimbal-core/lib/utils/fs'; import bytes from 'bytes'; import globby from 'globby'; import minimatch from 'minimatch'; // @ts-ignore import explore from 'source-map-explorer'; // looks like their types are nested in the src dir of dist... import { ExploreBundleResul...
healer1064/Gimbal
packages/gimbal-core/src/utils/colors.spec.ts
import { sectionHeading, successOrFailure } from './colors'; describe('@modus/gimbal-core/utils/colors', (): void => { describe('sectionHeading', (): void => { it('should bold text', (): void => { const ret = sectionHeading('this should be bold'); expect(ret).toBe('this should be bold'); ...
healer1064/Gimbal
packages/gimbal-core/src/utils/threshold.spec.ts
<gh_stars>100-1000 import checkThreshold, { checkPercentage, checkValue, isPercentage, percentToNumber } from './threshold'; describe('@modus/gimbal-core/utils/threshold', (): void => { describe('checkPercentage', (): void => { describe('lower mode', (): void => { it('should succeed', (): void => { ...
healer1064/Gimbal
packages/gimbal/src/module/reconcile.ts
import { ReportItem } from '@/typings/command'; import HeapSnapshotReconcile from './heap-snapshot/reconcile'; import LighthouseReconcile from './lighthouse/reconcile'; import UnusedSourceReconcile from './unused-source/reconcile'; const reconcile = (matches: ReportItem[], type: string): ReportItem => { switch (type...
healer1064/Gimbal
packages/gimbal/src/vcs/comment/index.ts
<filename>packages/gimbal/src/vcs/comment/index.ts import whichCI from '@/ci'; import Config from '@/config'; import EventEmitter from '@/event'; import { namedLogger } from '@/logger'; import { outputTable } from '@/output/markdown'; import { filterReportItemsFailures } from '@/output/filter'; import { Report, ReportI...
healer1064/Gimbal
packages/typings/module/lighthouse/index.d.ts
<filename>packages/typings/module/lighthouse/index.d.ts<gh_stars>100-1000 import { Report } from '@/typings/command'; import { Threshold } from '@/typings/utils/threshold'; export interface AuditRef { group?: string; id: string; weight: number; } export interface Category { auditRefs: AuditRef[]; descriptio...
healer1064/Gimbal
packages/typings/components/Table/index.d.ts
<reponame>healer1064/Gimbal import { TableInstanceOptions } from 'cli-table3'; export type Alignments = 'left' | 'center' | 'right'; export interface Column { align?: Alignments; header: string; key: string; maxWidth?: number; renderer?: Renderer; } export interface Config { columns?: Column[]; data?: ...
healer1064/Gimbal
packages/gimbal/src/logger/index.ts
<reponame>healer1064/Gimbal import { pad } from '@modus/gimbal-core/lib/utils/string'; import colors from 'colors/safe'; import Config from '@/config'; import { Logger, LoggerArgs, LoggerFunction, LoggerGroupFunction } from '@/typings/logger'; const colorsArray = ['red', 'green', 'yellow', 'blue', 'magenta', 'cyan', '...
healer1064/Gimbal
packages/gimbal/src/module/unused-source/meta.ts
<filename>packages/gimbal/src/module/unused-source/meta.ts<gh_stars>100-1000 import { Meta } from '@/typings/module'; const meta: Meta = { thresholdLimit: 'upper', thresholdType: 'percentage', }; export default meta;
healer1064/Gimbal
packages/typings/utils/Queue.d.ts
<filename>packages/typings/utils/Queue.d.ts /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ export type Data = any; export type Mode = 'sequential' | 'parallel';
healer1064/Gimbal
packages/typings/vcs/index.d.ts
<gh_stars>100-1000 import { URL } from 'url'; import GitHub from '@/vcs/GitHub'; export interface Cls { is: (url: URL) => boolean; name: string; } export type VCS = GitHub;
healer1064/Gimbal
packages/gimbal/src/output/html/index.ts
import { readFile } from '@modus/gimbal-core/lib/utils/fs'; import marked from 'marked'; import path from 'path'; import generateMarkdown from '@/output/markdown'; import { Report } from '@/typings/command'; import { CommandOptions } from '@/typings/utils/command'; // use table's html render type when we get to buildi...
healer1064/Gimbal
packages/gimbal/src/module/serve/index.ts
<gh_stars>100-1000 import deepmerge from 'deepmerge'; import { existsSync } from 'fs'; import http from 'http'; // @ts-ignore import handler from 'serve-handler'; import Config from '@/config'; import EventEmitter from '@/event'; import { CloseStartEvent, CloseEndEvent, CreateServerStartEvent, CreateServerEndEv...
healer1064/Gimbal
packages/gimbal/src/module/lighthouse/reconcile.ts
import checkThreshold from '@modus/gimbal-core/lib/utils/threshold'; import { ReportItem } from '@/typings/command'; const reconcile = (matches: ReportItem[]): ReportItem => { const [first] = matches; if (matches.length > 1) { const item: ReportItem = { ...first, }; const totalScore = matches.re...
healer1064/Gimbal
packages/gimbal/src/output/json/index.ts
<filename>packages/gimbal/src/output/json/index.ts import { Report } from '@/typings/command'; const JsonOutput = (report: Report): string => JSON.stringify(report, null, 2); export default JsonOutput;
healer1064/Gimbal
packages/typings/config/index.d.ts
// @ts-ignore import lighthouse from 'lighthouse'; import { Plugin } from '@/typings/config/plugin'; import { Modules } from '@/typings/module'; import { Config as HeapSnapshotConfig } from '@/typings/module/heap-snapshot'; import { SizeConfigs } from '@/typings/module/size'; import { UnusedSourceConfig } from '@/typin...
healer1064/Gimbal
packages/typings/plugin/last-value/index.d.ts
<filename>packages/typings/plugin/last-value/index.d.ts import { ReportItem, Report } from '@/typings/command'; import { PluginConfig } from '@/typings/config/plugin'; export type InspectCallback = () => void | Promise<void>; export type ItemFailReasons = string | false; export interface Config { failOnBreach: bool...
healer1064/Gimbal
packages/typings/utils/spawn.d.ts
<reponame>healer1064/Gimbal import { StdioOptions } from 'child_process'; export interface CmdSpawnOptions { cwd?: string; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ env?: any; // cannot get ProcessEnv to work stdio?: StdioOptions; timeout?: number; } export interface CmdSpawnRet { ...
healer1064/Gimbal
packages/plugin-source-map-explorer/src/config.spec.ts
<filename>packages/plugin-source-map-explorer/src/config.spec.ts import { defaultConfig, meta, type } from './config'; describe('@modus/gimbal-plugin-source-map-explorer/config', (): void => { it('should export properly', (): void => { expect(defaultConfig).toEqual({ bundles: ['**/*.js'], }); expe...
healer1064/Gimbal
packages/gimbal-core/src/utils/spawn.ts
<reponame>healer1064/Gimbal<filename>packages/gimbal-core/src/utils/spawn.ts import { spawn } from 'child_process'; import { CmdSpawnOptions, CmdSpawnRet } from '@/typings/utils/spawn'; import OS from './Process'; interface CmdSpawnConfig { noUsage?: boolean; } const cmdSpawn = (args: string[], options?: CmdSpawnOp...
healer1064/Gimbal
packages/gimbal-core/src/logger/ci.ts
<filename>packages/gimbal-core/src/logger/ci.ts<gh_stars>100-1000 /* eslint-disable-next-line no-console */ export const startSpinner = (name: string): void => console.log(` [ ${name} ] starting...`); export const finishSpinner = (name: string, success: boolean, output: string): void => /* eslint-disable-next-line ...
healer1064/Gimbal
packages/gimbal/src/event/index.ts
<filename>packages/gimbal/src/event/index.ts import Queue from '@modus/gimbal-core/lib/utils/Queue'; import minimatch from 'minimatch'; import { FireRet } from '@/typings/event'; import { Callback, CreatedCallback, Config } from '@/typings/event/Event'; import { Data } from '@/typings/utils/Queue'; import Event from '....
healer1064/Gimbal
packages/plugin-last-value/src/storage.spec.ts
import { PluginOptions } from '@/typings/config/plugin'; import { Emitter } from '@/typings/event'; const pluginOptions: PluginOptions = { bus(): void {}, dir: 'foo', }; beforeEach((): void => { jest.resetModules(); }); describe('@modus/gimbal-plugin-last-value/storage', (): void => { describe('getLastReport...
healer1064/Gimbal
packages/gimbal-core/src/utils/string.spec.ts
import { pad, splitOnWhitespace } from './string'; describe('@modus/gimbal-core/utils/string', (): void => { describe('pad', (): void => { it('should pad a string', (): void => { const ret = pad(4); expect(ret).toBe(' '); }); it('should pad a string with a character', (): void => { ...
healer1064/Gimbal
packages/gimbal-core/src/utils/fs.ts
import fs from 'fs'; import mkdirpMod from 'mkdirp'; import path from 'path'; import { promisify } from 'util'; import getSize from 'get-folder-size'; export const getDirectorySize = promisify(getSize); export const mkdirp = promisify(mkdirpMod); export const readDir = promisify(fs.readdir); export const readFile = pr...
healer1064/Gimbal
packages/typings/utils/env.d.ts
/* eslint-disable-next-line import/prefer-default-export,@typescript-eslint/no-explicit-any */ export type EnvOrDefault = (variableName: string, defaultValue?: any) => any;
healer1064/Gimbal
packages/gimbal-core/src/utils/string.ts
export const pad = (amount: number, character = ' '): string => new Array(amount).fill(character).join(''); export const splitOnWhitespace = (str: string): string[] => str.trim().split(/\s+/);
healer1064/Gimbal
packages/gimbal-core/src/components/index.ts
/* eslint-disable-next-line import/prefer-default-export */ export { default as Table } from './Table';
healer1064/Gimbal
packages/gimbal-core/src/utils/colors.ts
<filename>packages/gimbal-core/src/utils/colors.ts import { green, red, bold } from 'colors'; export const sectionHeading = (text: string): string => bold(text); export const successOrFailure = (item: string, success: boolean): string => (success ? green(item) : red(item));
healer1064/Gimbal
packages/typings/logger/index.d.ts
export interface SpinniesConfig { color?: string; disableSpins?: boolean; failColor?: string; failPrefix?: string; spinnerColor?: string; succeedColor?: string; succeedPrefix?: string; spinner?: { frames: string[]; interval: number; }; } export interface SpinniesOptions { color?: string; ...
healer1064/Gimbal
packages/typings/output/markdown/index.d.ts
<gh_stars>100-1000 import { Report } from '@/typings/command'; import { Table } from '@/typings/components/Table'; import { CliOutputOptions } from '@/typings/output/cli'; import { CommandOptions } from '@/typings/utils/command'; export interface MarkdownRenderTableStartEvent { commandOptions: CommandOptions; opti...
healer1064/Gimbal
packages/gimbal/src/config/plugin/index.ts
<reponame>healer1064/Gimbal import program from 'commander'; import deepmerge from 'deepmerge'; import resolver from '@/config/resolver'; import EventEmitter from '@/event'; import { PluginConfig, Plugin, PluginOptions } from '@/typings/config/plugin'; import { CommandOptions } from '@/typings/utils/command'; import { ...
healer1064/Gimbal
packages/gimbal/src/module/size/register.ts
<reponame>healer1064/Gimbal import { register } from '@/module/registry'; import Size from '@/module/size'; import { Report } from '@/typings/command'; import { Options } from '@/typings/module/registry'; import meta from './meta'; register('size', meta, ({ commandOptions }: Options): Promise<Report> => Size(commandOp...
healer1064/Gimbal
packages/plugin-last-value/src/render.ts
import bytes from 'bytes'; import { doesItemFail } from './util'; import { Table } from '@/typings/components/Table'; import { Config, LastReportItem } from '@/typings/plugin/last-value'; import { PluginOptions } from '@/typings/config/plugin'; type Renderer = (lastValue: number | string | void, item: LastReportItem) ...
healer1064/Gimbal
packages/gimbal/src/utils/command.ts
<reponame>healer1064/Gimbal<gh_stars>100-1000 import { resolvePath } from '@modus/gimbal-core/lib/utils/fs'; import program, { Command } from 'commander'; import { existsSync } from 'fs'; import { CommandOptions } from '@/typings/utils/command'; const defaultConfig: CommandOptions = { cwd: resolvePath(), comment: ...
healer1064/Gimbal
packages/gimbal/src/config/loader/yaml.ts
import env from '@modus/gimbal-core/lib/utils/env'; import { readFile } from '@modus/gimbal-core/lib/utils/fs'; import yaml from 'js-yaml'; import { Config } from '@/typings/config'; const VAR_RE = /\${(.+?):(.+?)(?:,\s*(.+?))?(?:,\s*(.+?))?}/gm; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ const...
healer1064/Gimbal
packages/typings/module/serve/index.d.ts
import http from 'http'; export interface CreateServerStartEvent { dir: string; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ mod: any; // would cause circular dependency if imported the command class port: number; } export interface CreateServerEndEvent { dir: string; /* eslint-disabl...
healer1064/Gimbal
packages/gimbal/src/module/heap-snapshot/index.ts
<reponame>healer1064/Gimbal<gh_stars>100-1000 import { Metrics, Page } from 'puppeteer'; import Config from '@/config'; import EventEmitter from '@/event'; import { Report } from '@/typings/command'; import { Config as HeapSnapshotConfig, HeapMetrics, AuditStartEvent, AuditEndEvent, NavigationStartEvent, Na...
healer1064/Gimbal
packages/gimbal-core/src/utils/threshold.ts
<gh_stars>100-1000 type Modes = 'lower' | 'upper'; const PERCENTAGE_RE = /^(\d+(?:\.\d+)?)\s*%$/; export const isPercentage = (value: number | string): boolean => String(value).match(PERCENTAGE_RE) != null; export const percentToNumber = (value: string): number => Number(value.replace(PERCENTAGE_RE, '$1')); export c...
healer1064/Gimbal
packages/gimbal/src/module/lighthouse/meta.ts
import { Meta } from '@/typings/module'; const meta: Meta = { thresholdLimit: 'lower', thresholdTypes: { Accessibility: 'number', 'Best Practices': 'number', Performance: 'number', pwa: 'number', seo: 'number', }, }; export default meta;
healer1064/Gimbal
packages/gimbal/src/vcs/index.ts
<reponame>healer1064/Gimbal import { URL } from 'url'; import Config from '@/config'; import { Cls, VCS as VCSTypes } from '@/typings/vcs'; import GitHubCls from './GitHub'; const GIT_URL_RE = /((git|ssh|http(s)?)|(git@[\w.]+))(:(\/\/)?)([\w.@:/\-~]+)(\.git)(\/)?/; export const GitHub = 'GitHub'; interface Tests { ...
healer1064/Gimbal
packages/gimbal/src/module/heap-snapshot/reconcile.ts
import checkThreshold from '@modus/gimbal-core/lib/utils/threshold'; import { ReportItem } from '@/typings/command'; const reconcile = (matches: ReportItem[]): ReportItem => { const [first] = matches; if (matches.length > 1) { const item: ReportItem = { ...first, }; const number = matches.reduce...
healer1064/Gimbal
packages/gimbal-core/src/components/Table/renderer/markdown.ts
<reponame>healer1064/Gimbal // @ts-ignore import stripAnsi from 'strip-ansi'; import { Column, RendererArgs } from '@/typings/components/Table'; import renderCli from './cli'; type AlignmentValues = '----' | ':---:' | '---:'; interface Alignment { center: AlignmentValues; left: AlignmentValues; right: Alignment...
healer1064/Gimbal
packages/gimbal/src/ci/TravisCI/index.ts
<reponame>healer1064/Gimbal<gh_stars>100-1000 import env from '@modus/gimbal-core/lib/utils/env'; import { CIMode } from '@/typings/ci'; import { VCS as VCSTypes } from '@/typings/vcs'; import GitHub from '@/vcs/GitHub'; export default class TravisCI { private $vcs?: VCSTypes; private get slugSplit(): string[] { ...
healer1064/Gimbal
packages/gimbal-core/src/utils/env.spec.ts
import envOrDefault from './env'; const ORIG_ENV = process.env; beforeEach((): void => { process.env = {}; }); afterEach((): void => { process.env = { ...ORIG_ENV }; }); describe('@modus/gimbal-core/utils/env', (): void => { describe('envOrDefault', (): void => { test('should return the value', (): void =...
healer1064/Gimbal
packages/plugin-last-value/src/index.ts
<reponame>healer1064/Gimbal<filename>packages/plugin-last-value/src/index.ts import deepmerge from 'deepmerge'; import { addColumn } from './render'; import { getLastReport, saveReport } from './storage'; import { ActionEndEvent, EndEvent } from '@/typings/command'; import { PluginOptions } from '@/typings/config/plugi...
Jarvie8176/valheim-ec2-dashboard
packages/api/src/index.ts
import Bluebird from "bluebird"; import express from "express"; import helmet from "helmet"; import cors from "cors"; import AWS from "aws-sdk"; const app = express(); app.use(helmet()); app.use(cors()); const port = process.env.API_PORT; const instanceId = <string>process.env.INSTANCE_ID; app.get("/api/server/start...
Jarvie8176/valheim-ec2-dashboard
packages/ui/src/components/mainPage/serverStatus.ui.tsx
<reponame>Jarvie8176/valheim-ec2-dashboard import { Fragment, FunctionComponent } from "react"; import { ServerStatusDto } from "./serverStatus.dto"; import { Grid } from "@material-ui/core"; import { InfoCard } from "./infoCard.ui"; import { isNil } from "lodash"; type Props = { serverStatus: ServerStatusDto; }; e...