Skip to content

Commit

Permalink
Use dprint
Browse files Browse the repository at this point in the history
  • Loading branch information
hubol committed Sep 21, 2024
1 parent 3da08e3 commit 3493d2e
Show file tree
Hide file tree
Showing 221 changed files with 3,327 additions and 2,235 deletions.
4 changes: 4 additions & 0 deletions .vscode/settings.default.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"[typescript]": {
"editor.defaultFormatter": "dprint.dprint",
"editor.formatOnSave": true
},
"typescript.tsdk": "./node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"search.exclude": {
Expand Down
23 changes: 23 additions & 0 deletions dprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"typescript": {
"indentWidth": 4,
"importDeclaration.forceSingleLine": true,
"module.sortImportDeclarations": "maintain",
"importDeclaration.sortNamedImports": "maintain",
"importDeclaration.sortTypeOnlyImports": "none",
"nextControlFlowPosition": "nextLine",
"functionExpression.spaceBeforeParentheses": true
},
"includes": [
"src/**/*.ts",
"test/**/*.ts",
"tools/**/*.ts",
],
"excludes": [
"**/generated",
"**/node_modules",
],
"plugins": [
"https://plugins.dprint.dev/typescript-0.93.0.wasm"
]
}
197 changes: 197 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"devDependencies": {
"@hubol/smooch": "^1.0.0-beta.12",
"@types/node": "^20.8.8",
"dprint": "^0.47.2",
"esbuild": "0.19.8",
"esbuild-plugin-import-glob": "^0.1.1",
"tsx": "^4.7.1",
Expand Down
14 changes: 7 additions & 7 deletions src/assets/fonts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ import { intervalWait } from "../lib/browser/interval-wait";
type Style = Partial<Omit<IBitmapTextStyle, "fontName">>;

export const objText = {
Small(text = '', style: Style = {}) {
Small(text = "", style: Style = {}) {
return new BitmapText(text, { fontName: Fonts.Flaccid.font, ...style });
},
MediumDigits(text = '', style: Style = {}) {
MediumDigits(text = "", style: Style = {}) {
return new BitmapText(text, { fontName: Fonts.Diggit.font, ...style });
},
Large(text = '', style: Style = {}) {
Large(text = "", style: Style = {}) {
return new BitmapText(text, { fontName: Fonts.ErotixLight.font, ...style });
},
LargeBold(text = '', style: Style = {}) {
LargeBold(text = "", style: Style = {}) {
return new BitmapText(text, { fontName: Fonts.Erotix.font, ...style });
},
};
Expand All @@ -30,7 +30,7 @@ const Fonts = {
Flaccid: Force<BitmapFont>(),
};

type TxFontKey = keyof typeof Tx['Font'];
type TxFontKey = keyof typeof Tx["Font"];

export async function loadFontAssets(progress: JobProgress) {
const load = async (fontKey: keyof typeof Fonts, fntUrl: string, txFontKey: TxFontKey) => {
Expand All @@ -49,11 +49,11 @@ export async function loadFontAssets(progress: JobProgress) {
async function loadBitmapFontAndTrackProgress(fntUrl: string, txFontKey: TxFontKey, progress: JobProgress) {
progress.increaseTotalJobsCount(1);

const [ createBitmapFont ] = await Promise.all([
const [createBitmapFont] = await Promise.all([
createBitmapFontFactory(fntUrl),
intervalWait(() => !!Tx?.Font?.[txFontKey]),
]);

progress.increaseCompletedJobsCount(1);
return createBitmapFont(Tx.Font[txFontKey]);
}
}
7 changes: 4 additions & 3 deletions src/assets/music.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { GeneratedMusicData } from "./generated/music/generated-music-data";

type MusicId = keyof typeof GeneratedMusicData;

export const Mzk: Record<MusicId, MusicTrack> = <any>{};
export const Mzk: Record<MusicId, MusicTrack> = <any> {};

for (const key in GeneratedMusicData)
Mzk[key] = GeneratedMusicData[key].ogg;
for (const key in GeneratedMusicData) {
Mzk[key] = GeneratedMusicData[key].ogg;
}
8 changes: 4 additions & 4 deletions src/assets/no-atlas-textures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ async function createNoAtlasTx(tx: typeof Tx) {
Terrain: {
Pipe: {
Gray: await repeat(tx.Terrain.Pipe.Gray),
}
},
},
}
};
}

function repeat(tx: Texture) {
return TextureProcessing.extractFromAtlas(tx, { wrapMode: WRAP_MODES.REPEAT })
return TextureProcessing.extractFromAtlas(tx, { wrapMode: WRAP_MODES.REPEAT });
}

export async function loadNoAtlasTextures(tx: typeof Tx) {
NoAtlasTx = await createNoAtlasTx(tx);
}
}
4 changes: 2 additions & 2 deletions src/assets/sounds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ const { sfxs } = GeneratedSfxData;
type Sfxs = typeof sfxs<Sound>;
type Sounds = Awaited<ReturnType<Sfxs>>;

export let Sfx: Sounds = <any>{};
export let Sfx: Sounds = <any> {};

export async function loadSoundAssets(progress: JobProgress) {
RequireCapability('oggSupport');
RequireCapability("oggSupport");

const soundsToLoadCount = Object.keys(GeneratedSfxData).length;
progress.increaseTotalJobsCount(soundsToLoadCount * 2);
Expand Down
Loading

0 comments on commit 3493d2e

Please sign in to comment.