Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re authored and astrobot-houston committed Dec 4, 2023
1 parent 5428b3d commit 5d566cf
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 14 deletions.
31 changes: 21 additions & 10 deletions packages/astro/src/cli/preferences/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import { resolveConfig } from '../../core/config/config.js';
import { createSettings } from '../../core/config/settings.js';
import * as msg from '../../core/messages.js';
import { DEFAULT_PREFERENCES } from '../../preferences/defaults.js';
import { coerce, isValidKey, type PreferenceKey, type PreferenceLocation } from '../../preferences/index.js';
import {
coerce,
isValidKey,
type PreferenceKey,
type PreferenceLocation,
} from '../../preferences/index.js';
import { createLoggerFromFlags, flagsToAstroInlineConfig } from '../flags.js';
// @ts-expect-error flattie types are mispackaged
import { flattie } from 'flattie';
Expand Down Expand Up @@ -300,15 +305,21 @@ function formatTable(
b
)} ${space(colBLength - b.toString().length - 3)} ${dim(chars.v)}`;
}
const top = dim(`${chars.topLeft}${chars.h.repeat(colALength + 1)}${chars.hBottom}${chars.h.repeat(
colBLength
)}${chars.topRight}`);
const bottom = dim(`${chars.bottomLeft}${chars.h.repeat(colALength + 1)}${chars.hTop}${chars.h.repeat(
colBLength
)}${chars.bottomRight}`);
const divider = dim(`${chars.vRightThick}${chars.hThick.repeat(colALength + 1)}${
chars.hThickCross
}${chars.hThick.repeat(colBLength)}${chars.vLeftThick}`);
const top = dim(
`${chars.topLeft}${chars.h.repeat(colALength + 1)}${chars.hBottom}${chars.h.repeat(
colBLength
)}${chars.topRight}`
);
const bottom = dim(
`${chars.bottomLeft}${chars.h.repeat(colALength + 1)}${chars.hTop}${chars.h.repeat(
colBLength
)}${chars.bottomRight}`
);
const divider = dim(
`${chars.vRightThick}${chars.hThick.repeat(colALength + 1)}${
chars.hThickCross
}${chars.hThick.repeat(colBLength)}${chars.vLeftThick}`
);
const rows: string[] = [top, formatRow(-1, colA, colB, bold), divider];
let i = 0;
for (const [key, value] of Object.entries(object)) {
Expand Down
15 changes: 11 additions & 4 deletions packages/astro/src/preferences/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ export interface PreferenceOptions {
location?: PreferenceLocation;
}

type DeepPartial<T> = T extends object ? {
[P in keyof T]?: DeepPartial<T[P]>;
} : T;
type DeepPartial<T> = T extends object
? {
[P in keyof T]?: DeepPartial<T[P]>;
}
: T;

export type PreferenceKey = DotKeys<Preferences>;
export interface PreferenceList extends Record<PreferenceLocation, DeepPartial<Preferences>> {
Expand Down Expand Up @@ -82,7 +84,12 @@ export default function createPreferences(config: AstroConfig): AstroPreferences
stores[location].set(key, value);
},
async getAll() {
return Object.assign({}, DEFAULT_PREFERENCES, stores['global'].getAll(), stores['project'].getAll());
return Object.assign(
{},
DEFAULT_PREFERENCES,
stores['global'].getAll(),
stores['project'].getAll()
);
},
async list() {
return {
Expand Down

0 comments on commit 5d566cf

Please sign in to comment.