From c74d163bda039edce79b0f0ad3dd1192697f7844 Mon Sep 17 00:00:00 2001 From: Zyie <24736175+Zyie@users.noreply.github.com> Date: Mon, 29 Apr 2024 14:13:40 +0100 Subject: [PATCH] fix(core): linting (#18) * - add spine cache buster - add sprite sheet cache buster - tests * cache id is now takes into account all pipe options add test * docs * Update packages/spine/test/spineAtlasAll.test.ts * remove only * fix test and merge bits * rename * - update manifest plugin to remove specific logic - add a manifest modifier for texture packer - add a manifest modifier for spine atlas * fix options * fix options * fin name * fix tests * fix:(core): linting * merge --------- Co-authored-by: Mat Groves --- package.json | 1 + packages/cache-buster/rollup.config.mjs | 1 - packages/cache-buster/src/cacheBuster.ts | 3 ++- .../cache-buster/test/cacheBuster.test.ts | 2 +- packages/cli/src/index.ts | 5 ++-- packages/core/rollup.config.mjs | 1 - packages/core/src/Asset.ts | 4 +-- packages/core/src/AssetCache.ts | 3 ++- packages/core/src/AssetPack.ts | 19 +++++++------- packages/core/src/AssetWatcher.ts | 11 ++++---- packages/core/src/index.ts | 12 +++------ packages/core/src/logger/Logger.ts | 3 ++- packages/core/src/logger/Reporter.ts | 3 ++- packages/core/src/logger/render.ts | 6 ++--- packages/core/src/pipes/PipeSystem.ts | 5 ++-- packages/core/src/pipes/finalCopyPipe.ts | 3 ++- packages/core/src/pipes/multiPipe.ts | 3 ++- .../core/src/utils/applySettingToAsset.ts | 5 ++-- packages/core/src/utils/generateCacheName.ts | 3 ++- packages/core/src/utils/logAssetGraph.ts | 3 ++- packages/core/src/utils/path.ts | 1 + .../core/src/utils/syncAssetsWithCache.ts | 1 + packages/core/test/AssetWatcher.test.ts | 2 +- packages/core/test/Assetpack.test.ts | 5 ++-- packages/core/test/PipeSystem.test.ts | 3 ++- packages/core/test/Utils.test.ts | 7 +++--- packages/core/test/config.test.ts | 1 + packages/ffmpeg/rollup.config.mjs | 1 - packages/ffmpeg/src/audio.ts | 5 ++-- packages/ffmpeg/src/ffmpeg.ts | 7 +++--- packages/ffmpeg/src/index.ts | 2 +- packages/ffmpeg/test/Audio.test.ts | 4 +-- packages/image/rollup.config.mjs | 1 - packages/image/src/compress.ts | 9 ++++--- packages/image/src/mipmap.ts | 9 ++++--- packages/image/src/utils/compressSharp.ts | 2 +- packages/image/test/Compress.test.ts | 2 +- packages/image/test/Mipmap.test.ts | 2 +- packages/json/rollup.config.mjs | 1 - packages/json/src/index.ts | 3 ++- packages/json/test/Json.test.ts | 4 +-- packages/manifest/rollup.config.mjs | 1 - packages/manifest/src/pixiManifest.ts | 9 +++---- packages/manifest/test/Manifest.test.ts | 25 ++++++++++--------- packages/spine/rollup.config.mjs | 1 - packages/spine/src/index.ts | 4 +-- packages/spine/src/spineAtlasCacheBuster.ts | 9 ++++--- packages/spine/src/spineAtlasCompress.ts | 5 ++-- packages/spine/src/spineAtlasManifestMod.ts | 7 +++--- packages/spine/src/spineAtlasMipmap.ts | 3 ++- packages/spine/test/spineAtlasAll.test.ts | 6 ++--- .../spine/test/spineAtlasCacheBuster.test.ts | 4 +-- .../spine/test/spineAtlasCompress.test.ts | 4 +-- .../spine/test/spineAtlasManifest.test.ts | 4 +-- packages/spine/test/spineAtlasMipmap.test.ts | 4 +-- packages/texture-packer/rollup.config.mjs | 1 - packages/texture-packer/src/index.ts | 2 +- .../texture-packer/src/packer/createJsons.ts | 3 ++- .../src/packer/createTextureData.ts | 7 +++--- .../texture-packer/src/packer/packTextures.ts | 5 ++-- packages/texture-packer/src/texturePacker.ts | 7 +++--- .../src/texturePackerCacheBuster.ts | 7 +++--- .../src/texturePackerCompress.ts | 3 ++- .../src/texturePackerManifestMod.ts | 5 ++-- .../texture-packer/test/texturePacker.test.ts | 11 ++++---- .../test/texturePackerAll.test.ts | 11 ++++---- .../test/texturePackerCacheBuster.test.ts | 9 ++++--- .../test/texturePackerCompress.test.ts | 5 ++-- .../test/texturePackerManifest.test.ts | 7 +++--- packages/webfont/rollup.config.mjs | 1 - packages/webfont/src/sdf.ts | 7 +++--- packages/webfont/src/webfont.ts | 5 ++-- packages/webfont/test/Webfont.test.ts | 2 +- shared/rollup.config.mjs | 2 +- shared/test/index.ts | 1 + 75 files changed, 193 insertions(+), 162 deletions(-) diff --git a/package.json b/package.json index cadad5f..2a7341f 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "build:force": "nx run-many --target=build --all --parallel --skip-nx-cache", "clean": "rimraf packages/*/{dist,.testInput,.testOutput,.assetpack}", "lint": "eslint --cache packages shared --ext .js,.ts,.mjs --max-warnings 0", + "lint:fix": "npm run lint -- --fix", "prepare": "husky install", "prerelease": "npm run lint && npm run build:force", "release": "lerna publish --no-private --exact --force-publish", diff --git a/packages/cache-buster/rollup.config.mjs b/packages/cache-buster/rollup.config.mjs index d68789d..c213586 100644 --- a/packages/cache-buster/rollup.config.mjs +++ b/packages/cache-buster/rollup.config.mjs @@ -1,5 +1,4 @@ import { readFileSync } from 'fs'; - import { createConfig } from '../../shared/rollup.config.mjs'; export default createConfig({ diff --git a/packages/cache-buster/src/cacheBuster.ts b/packages/cache-buster/src/cacheBuster.ts index 592099a..cc30d18 100644 --- a/packages/cache-buster/src/cacheBuster.ts +++ b/packages/cache-buster/src/cacheBuster.ts @@ -1,6 +1,7 @@ -import type { AssetPipe, Asset } from '@play-co/assetpack-core'; import { createNewAssetAt, swapExt } from '@play-co/assetpack-core'; +import type { Asset, AssetPipe } from '@play-co/assetpack-core'; + /** * Cache buster asset pipe. This pipe will add a hash to the end of the filename * the hash is calculated from the contents of the file. diff --git a/packages/cache-buster/test/cacheBuster.test.ts b/packages/cache-buster/test/cacheBuster.test.ts index 4e67d81..fb07e8f 100644 --- a/packages/cache-buster/test/cacheBuster.test.ts +++ b/packages/cache-buster/test/cacheBuster.test.ts @@ -1,7 +1,7 @@ -import { Asset, AssetPack, path } from '@play-co/assetpack-core'; import { existsSync } from 'fs-extra'; import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test'; import { cacheBuster } from '../src'; +import { Asset, AssetPack, path } from '@play-co/assetpack-core'; const pkg = 'cache-buster'; diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index 081eb4b..127af0a 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -1,11 +1,12 @@ /* eslint-disable no-console */ -import type { AssetPackConfig } from '@play-co/assetpack-core'; import chalk from 'chalk'; import { Command } from 'commander'; import findUp from 'find-up'; +import { createRequire } from 'module'; import path from 'path'; import { pathToFileURL } from 'url'; -import { createRequire } from 'module'; + +import type { AssetPackConfig } from '@play-co/assetpack-core'; const require = createRequire(import.meta.url); diff --git a/packages/core/rollup.config.mjs b/packages/core/rollup.config.mjs index d68789d..c213586 100644 --- a/packages/core/rollup.config.mjs +++ b/packages/core/rollup.config.mjs @@ -1,5 +1,4 @@ import { readFileSync } from 'fs'; - import { createConfig } from '../../shared/rollup.config.mjs'; export default createConfig({ diff --git a/packages/core/src/Asset.ts b/packages/core/src/Asset.ts index 13bb264..550ed23 100644 --- a/packages/core/src/Asset.ts +++ b/packages/core/src/Asset.ts @@ -1,7 +1,7 @@ -import { extractTagsFromFileName } from './utils/extractTagsFromFileName'; -import { getHash } from './utils/getHash'; import fs from 'fs-extra'; import { Logger } from './logger/Logger'; +import { extractTagsFromFileName } from './utils/extractTagsFromFileName'; +import { getHash } from './utils/getHash'; import { path } from './utils/path'; export interface AssetOptions diff --git a/packages/core/src/AssetCache.ts b/packages/core/src/AssetCache.ts index 7e72c28..e4accc0 100644 --- a/packages/core/src/AssetCache.ts +++ b/packages/core/src/AssetCache.ts @@ -1,7 +1,8 @@ -import type { Asset } from './Asset'; import fs from 'fs-extra'; import { path } from './utils/path'; +import type { Asset } from './Asset'; + export interface AssetCacheOptions { cacheName?: string; diff --git a/packages/core/src/AssetPack.ts b/packages/core/src/AssetPack.ts index 7222fa0..b7daa80 100644 --- a/packages/core/src/AssetPack.ts +++ b/packages/core/src/AssetPack.ts @@ -1,17 +1,18 @@ import fs from 'fs-extra'; -import type { Asset } from './Asset'; -import type { AssetPipe } from './pipes/AssetPipe'; +import merge from 'merge'; import { AssetCache } from './AssetCache'; import { AssetWatcher } from './AssetWatcher'; -import type { AssetSettings } from './pipes/PipeSystem'; -import { PipeSystem } from './pipes/PipeSystem'; -import { finalCopyPipe } from './pipes/finalCopyPipe'; -import type { AssetPackConfig } from './config'; import { Logger } from './logger/Logger'; -import { promiseAllConcurrent } from './utils/promiseAllConcurrent'; -import { path } from './utils/path'; -import merge from 'merge'; +import { finalCopyPipe } from './pipes/finalCopyPipe'; +import { PipeSystem } from './pipes/PipeSystem'; import { generateCacheName } from './utils/generateCacheName'; +import { path } from './utils/path'; +import { promiseAllConcurrent } from './utils/promiseAllConcurrent'; + +import type { Asset } from './Asset'; +import type { AssetPackConfig } from './config'; +import type { AssetPipe } from './pipes/AssetPipe'; +import type { AssetSettings } from './pipes/PipeSystem'; export class AssetPack { diff --git a/packages/core/src/AssetWatcher.ts b/packages/core/src/AssetWatcher.ts index c1bc4f7..3bca844 100644 --- a/packages/core/src/AssetWatcher.ts +++ b/packages/core/src/AssetWatcher.ts @@ -1,13 +1,14 @@ +import chokidar from 'chokidar'; import fs from 'fs-extra'; import { Asset } from './Asset'; -import chokidar from 'chokidar'; -import type { CachedAsset } from './AssetCache'; -import { syncAssetsWithCache } from './utils/syncAssetsWithCache'; import { AssetIgnore } from './AssetIgnore'; -import type { AssetSettings } from './pipes/PipeSystem'; +import { Logger } from './logger/Logger'; import { applySettingToAsset } from './utils/applySettingToAsset'; import { path } from './utils/path'; -import { Logger } from './logger/Logger'; +import { syncAssetsWithCache } from './utils/syncAssetsWithCache'; + +import type { CachedAsset } from './AssetCache'; +import type { AssetSettings } from './pipes/PipeSystem'; export interface AssetWatcherOptions { diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index e6a99c1..316b639 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,19 +1,15 @@ -// export * from './AssetPack'; -export * from './config'; -export * from './logger/Logger'; -// export * from './Plugin'; -// export * from './Processor'; -// export * from './utils'; export * from './Asset'; export * from './AssetPack'; export * from './config'; +export * from './config'; +export * from './logger/Logger'; export * from './pipes/AssetPipe'; -export * from './pipes/PipeSystem'; export * from './pipes/multiPipe'; +export * from './pipes/PipeSystem'; export * from './utils/checkExt'; export * from './utils/createNewAssetAt'; +export * from './utils/findAssets'; export * from './utils/merge'; export * from './utils/path'; export * from './utils/stripTags'; export * from './utils/swapExt'; -export * from './utils/findAssets'; diff --git a/packages/core/src/logger/Logger.ts b/packages/core/src/logger/Logger.ts index 8fde31c..b7358d2 100644 --- a/packages/core/src/logger/Logger.ts +++ b/packages/core/src/logger/Logger.ts @@ -1,6 +1,7 @@ -import type { ReporterEvent } from './Reporter'; import { Reporter } from './Reporter'; + import type { LogLevelKeys } from './logLevel'; +import type { ReporterEvent } from './Reporter'; export interface LoggerOptions { diff --git a/packages/core/src/logger/Reporter.ts b/packages/core/src/logger/Reporter.ts index ea3fad1..6a4fdb1 100644 --- a/packages/core/src/logger/Reporter.ts +++ b/packages/core/src/logger/Reporter.ts @@ -1,9 +1,10 @@ import chalk from 'chalk'; -import type { LogLevelKeys } from './logLevel'; import { LogLevel } from './logLevel'; import { persistMessage, resetWindow, startProgress, stopProgress, updateProgress } from './render'; import { prettifyTime } from './utils'; +import type { LogLevelKeys } from './logLevel'; + export interface LogEvent { type: 'log'; diff --git a/packages/core/src/logger/render.ts b/packages/core/src/logger/render.ts index 453d6c4..a2d4c69 100644 --- a/packages/core/src/logger/render.ts +++ b/packages/core/src/logger/render.ts @@ -1,9 +1,9 @@ -import type { Writable } from 'stream'; +import chalk from 'chalk'; import cliProgress from 'cli-progress'; - import readline from 'readline'; import { countLines } from './utils'; -import chalk from 'chalk'; + +import type { Writable } from 'stream'; const stdout = process.stdout; const stderr = process.stderr; diff --git a/packages/core/src/pipes/PipeSystem.ts b/packages/core/src/pipes/PipeSystem.ts index 00025db..88c6590 100644 --- a/packages/core/src/pipes/PipeSystem.ts +++ b/packages/core/src/pipes/PipeSystem.ts @@ -1,8 +1,9 @@ -import type { Asset } from '../Asset'; -import type { AssetPipe } from './AssetPipe'; import { mergePipeOptions } from './mergePipeOptions'; import { multiPipe } from './multiPipe'; +import type { Asset } from '../Asset'; +import type { AssetPipe } from './AssetPipe'; + export interface PipeSystemOptions { pipes: (AssetPipe | AssetPipe[])[]; diff --git a/packages/core/src/pipes/finalCopyPipe.ts b/packages/core/src/pipes/finalCopyPipe.ts index 6fd8735..5588737 100644 --- a/packages/core/src/pipes/finalCopyPipe.ts +++ b/packages/core/src/pipes/finalCopyPipe.ts @@ -1,6 +1,7 @@ import fs from 'fs-extra'; -import type { Asset } from '../Asset'; import { createNewAssetAt } from '../utils/createNewAssetAt'; + +import type { Asset } from '../Asset'; import type { AssetPipe } from './AssetPipe'; export const finalCopyPipe: AssetPipe = { diff --git a/packages/core/src/pipes/multiPipe.ts b/packages/core/src/pipes/multiPipe.ts index 60416be..d98b171 100644 --- a/packages/core/src/pipes/multiPipe.ts +++ b/packages/core/src/pipes/multiPipe.ts @@ -1,7 +1,8 @@ +import { mergePipeOptions } from './mergePipeOptions'; + import type { Asset } from '../Asset'; import type { AssetPipe } from './AssetPipe'; import type { PipeSystem } from './PipeSystem'; -import { mergePipeOptions } from './mergePipeOptions'; export interface MultiPipeOptions { diff --git a/packages/core/src/utils/applySettingToAsset.ts b/packages/core/src/utils/applySettingToAsset.ts index ee11aa4..7177cdf 100644 --- a/packages/core/src/utils/applySettingToAsset.ts +++ b/packages/core/src/utils/applySettingToAsset.ts @@ -1,9 +1,10 @@ -import type { Asset } from '../Asset'; -import type { AssetSettings } from '../pipes/PipeSystem'; import minimatch from 'minimatch'; import { merge } from './merge'; import { path } from './path'; +import type { Asset } from '../Asset'; +import type { AssetSettings } from '../pipes/PipeSystem'; + export function applySettingToAsset(asset: Asset, settings: AssetSettings[], entryPath: string) { const relativePath = path.relative(entryPath, asset.path); diff --git a/packages/core/src/utils/generateCacheName.ts b/packages/core/src/utils/generateCacheName.ts index 1e8ed69..23febed 100644 --- a/packages/core/src/utils/generateCacheName.ts +++ b/packages/core/src/utils/generateCacheName.ts @@ -1,6 +1,7 @@ -import type { AssetPackConfig } from '../config'; import objectHash from 'object-hash'; +import type { AssetPackConfig } from '../config'; + /** * Returns a unique name based on the hash generated from the config * this takes into account the following: diff --git a/packages/core/src/utils/logAssetGraph.ts b/packages/core/src/utils/logAssetGraph.ts index 6b3810c..7c5343e 100644 --- a/packages/core/src/utils/logAssetGraph.ts +++ b/packages/core/src/utils/logAssetGraph.ts @@ -1,6 +1,7 @@ -import type { Asset } from '../Asset'; import { path } from './path'; +import type { Asset } from '../Asset'; + const stateColorMap = { normal: 'white', added: 'green', diff --git a/packages/core/src/utils/path.ts b/packages/core/src/utils/path.ts index 5eebd75..d117ea9 100644 --- a/packages/core/src/utils/path.ts +++ b/packages/core/src/utils/path.ts @@ -1,2 +1,3 @@ import upath from 'upath'; + export const path = upath; diff --git a/packages/core/src/utils/syncAssetsWithCache.ts b/packages/core/src/utils/syncAssetsWithCache.ts index b7be8b8..dd3813b 100644 --- a/packages/core/src/utils/syncAssetsWithCache.ts +++ b/packages/core/src/utils/syncAssetsWithCache.ts @@ -1,4 +1,5 @@ import { Asset } from '../Asset'; + import type { CachedAsset } from '../AssetCache'; export function syncAssetsWithCache(assetHash: Record, cachedData: Record) diff --git a/packages/core/test/AssetWatcher.test.ts b/packages/core/test/AssetWatcher.test.ts index 967d1a1..6967711 100644 --- a/packages/core/test/AssetWatcher.test.ts +++ b/packages/core/test/AssetWatcher.test.ts @@ -1,7 +1,7 @@ import { assetPath, createFolder, getInputDir } from '../../../shared/test'; import { Asset } from '../src/Asset'; -import { AssetWatcher } from '../src/AssetWatcher'; import { AssetCache } from '../src/AssetCache'; +import { AssetWatcher } from '../src/AssetWatcher'; import { logAssetGraph } from '../src/utils/logAssetGraph'; const pkg = 'core'; diff --git a/packages/core/test/Assetpack.test.ts b/packages/core/test/Assetpack.test.ts index 38d5c9b..da7f72f 100644 --- a/packages/core/test/Assetpack.test.ts +++ b/packages/core/test/Assetpack.test.ts @@ -1,9 +1,10 @@ import { existsSync, removeSync, writeJSONSync } from 'fs-extra'; import { join } from 'path'; -import type { MockAssetPipe } from '../../../shared/test/index'; -import { assetPath, createFolder, createAssetPipe, getInputDir, getOutputDir } from '../../../shared/test/index'; +import { assetPath, createAssetPipe, createFolder, getInputDir, getOutputDir } from '../../../shared/test/index'; import { AssetPack } from '../src/AssetPack'; import { logAssetGraph } from '../src/utils/logAssetGraph'; + +import type { MockAssetPipe } from '../../../shared/test/index'; import type { AssetPipe } from '../src/pipes/AssetPipe'; const pkg = 'core'; diff --git a/packages/core/test/PipeSystem.test.ts b/packages/core/test/PipeSystem.test.ts index b4328b2..25e796e 100644 --- a/packages/core/test/PipeSystem.test.ts +++ b/packages/core/test/PipeSystem.test.ts @@ -1,7 +1,8 @@ import { Asset } from '../src/Asset'; -import type { AssetPipe } from '../src/pipes/AssetPipe'; import { PipeSystem } from '../src/pipes/PipeSystem'; +import type { AssetPipe } from '../src/pipes/AssetPipe'; + describe('PipeSystem', () => { it('should transform an asset', async () => diff --git a/packages/core/test/Utils.test.ts b/packages/core/test/Utils.test.ts index 63fe755..9a29169 100644 --- a/packages/core/test/Utils.test.ts +++ b/packages/core/test/Utils.test.ts @@ -1,10 +1,11 @@ -import type { MockAssetPipe } from '../../../shared/test/index'; -import { createFolder, createAssetPipe, getInputDir, getOutputDir } from '../../../shared/test/index'; -import type { Asset } from '../src/Asset'; +import { createAssetPipe, createFolder, getInputDir, getOutputDir } from '../../../shared/test/index'; import { AssetPack } from '../src/AssetPack'; import { extractTagsFromFileName } from '../src/utils/extractTagsFromFileName'; import { generateCacheName } from '../src/utils/generateCacheName'; +import type { MockAssetPipe } from '../../../shared/test/index'; +import type { Asset } from '../src/Asset'; + describe('Utils', () => { const pkg = 'core'; diff --git a/packages/core/test/config.test.ts b/packages/core/test/config.test.ts index 9746b8e..bc8fb79 100644 --- a/packages/core/test/config.test.ts +++ b/packages/core/test/config.test.ts @@ -1,5 +1,6 @@ import { createAssetPipe } from '../../../shared/test'; import { AssetPack } from '../src'; + import type { AssetPackConfig } from '../src/config'; describe('AssetPack Config', () => diff --git a/packages/ffmpeg/rollup.config.mjs b/packages/ffmpeg/rollup.config.mjs index d68789d..c213586 100644 --- a/packages/ffmpeg/rollup.config.mjs +++ b/packages/ffmpeg/rollup.config.mjs @@ -1,5 +1,4 @@ import { readFileSync } from 'fs'; - import { createConfig } from '../../shared/rollup.config.mjs'; export default createConfig({ diff --git a/packages/ffmpeg/src/audio.ts b/packages/ffmpeg/src/audio.ts index 6615260..160e16d 100644 --- a/packages/ffmpeg/src/audio.ts +++ b/packages/ffmpeg/src/audio.ts @@ -1,7 +1,8 @@ +import { ffmpeg } from './ffmpeg'; import { merge } from '@play-co/assetpack-core'; -import type { AssetPipe } from '@play-co/assetpack-core'; + import type { FfmpegOptions } from './ffmpeg'; -import { ffmpeg } from './ffmpeg'; +import type { AssetPipe } from '@play-co/assetpack-core'; export function audio(_options?: FfmpegOptions): AssetPipe { diff --git a/packages/ffmpeg/src/ffmpeg.ts b/packages/ffmpeg/src/ffmpeg.ts index e952b9b..20d7098 100644 --- a/packages/ffmpeg/src/ffmpeg.ts +++ b/packages/ffmpeg/src/ffmpeg.ts @@ -1,8 +1,9 @@ -import type { AssetPipe, Asset } from '@play-co/assetpack-core'; -import { checkExt, createNewAssetAt, path } from '@play-co/assetpack-core'; import fluentFfmpeg from 'fluent-ffmpeg'; -import ffmpegPath from '@ffmpeg-installer/ffmpeg'; import fs from 'fs-extra'; +import ffmpegPath from '@ffmpeg-installer/ffmpeg'; +import { checkExt, createNewAssetAt, path } from '@play-co/assetpack-core'; + +import type { Asset, AssetPipe } from '@play-co/assetpack-core'; fluentFfmpeg.setFfmpegPath(ffmpegPath.path); diff --git a/packages/ffmpeg/src/index.ts b/packages/ffmpeg/src/index.ts index 253745a..720c28a 100644 --- a/packages/ffmpeg/src/index.ts +++ b/packages/ffmpeg/src/index.ts @@ -1,2 +1,2 @@ -export * from './ffmpeg'; export * from './audio'; +export * from './ffmpeg'; diff --git a/packages/ffmpeg/test/Audio.test.ts b/packages/ffmpeg/test/Audio.test.ts index 45613d7..f17699f 100644 --- a/packages/ffmpeg/test/Audio.test.ts +++ b/packages/ffmpeg/test/Audio.test.ts @@ -1,7 +1,7 @@ -import { AssetPack } from '@play-co/assetpack-core'; -import { audio } from '@play-co/assetpack-plugin-ffmpeg'; import { existsSync } from 'fs-extra'; import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test'; +import { AssetPack } from '@play-co/assetpack-core'; +import { audio } from '@play-co/assetpack-plugin-ffmpeg'; const pkg = 'ffmpeg'; diff --git a/packages/image/rollup.config.mjs b/packages/image/rollup.config.mjs index d68789d..c213586 100644 --- a/packages/image/rollup.config.mjs +++ b/packages/image/rollup.config.mjs @@ -1,5 +1,4 @@ import { readFileSync } from 'fs'; - import { createConfig } from '../../shared/rollup.config.mjs'; export default createConfig({ diff --git a/packages/image/src/compress.ts b/packages/image/src/compress.ts index 04e8227..0d79806 100644 --- a/packages/image/src/compress.ts +++ b/packages/image/src/compress.ts @@ -1,9 +1,10 @@ -import type { PluginOptions, Asset, AssetPipe } from '@play-co/assetpack-core'; -import { checkExt, createNewAssetAt } from '@play-co/assetpack-core'; -import type { AvifOptions, JpegOptions, PngOptions, WebpOptions } from 'sharp'; import sharp from 'sharp'; -import { resolveOptions } from './utils/resolveOptions'; import { compressSharp } from './utils/compressSharp'; +import { resolveOptions } from './utils/resolveOptions'; +import { checkExt, createNewAssetAt } from '@play-co/assetpack-core'; + +import type { AvifOptions, JpegOptions, PngOptions, WebpOptions } from 'sharp'; +import type { Asset, AssetPipe, PluginOptions } from '@play-co/assetpack-core'; type CompressJpgOptions = Omit; type CompressWebpOptions = Omit; diff --git a/packages/image/src/mipmap.ts b/packages/image/src/mipmap.ts index e16a8d5..9911baf 100644 --- a/packages/image/src/mipmap.ts +++ b/packages/image/src/mipmap.ts @@ -1,9 +1,10 @@ -import type { Asset, AssetPipe, PluginOptions } from '@play-co/assetpack-core'; -import { checkExt, createNewAssetAt } from '@play-co/assetpack-core'; import sharp from 'sharp'; -import type { CompressImageData } from './compress'; import { mipmapSharp } from './utils/mipmapSharp'; import { resolveOptions } from './utils/resolveOptions'; +import { checkExt, createNewAssetAt } from '@play-co/assetpack-core'; + +import type { CompressImageData } from './compress'; +import type { Asset, AssetPipe, PluginOptions } from '@play-co/assetpack-core'; export interface MipmapOptions extends PluginOptions<'fix' | T> { @@ -46,7 +47,7 @@ export function mipmap(_options: MipmapOptions = {}): AssetPipe }, async transform(asset: Asset, options) { - const shouldMipmap = mipmap && !asset.metaData[options.tags.fix as any]; + const shouldMipmap = mipmap && !asset.metaData[options.tags.fix as any]; let processedImages: CompressImageData[]; diff --git a/packages/image/src/utils/compressSharp.ts b/packages/image/src/utils/compressSharp.ts index 512841c..17bf355 100644 --- a/packages/image/src/utils/compressSharp.ts +++ b/packages/image/src/utils/compressSharp.ts @@ -1,4 +1,4 @@ -import type { AvifOptions, WebpOptions, JpegOptions, PngOptions } from 'sharp'; +import type { AvifOptions, JpegOptions, PngOptions, WebpOptions } from 'sharp'; import type { CompressImageData, CompressOptions } from '../compress'; export async function compressSharp( diff --git a/packages/image/test/Compress.test.ts b/packages/image/test/Compress.test.ts index 4862f90..cc6a1c9 100644 --- a/packages/image/test/Compress.test.ts +++ b/packages/image/test/Compress.test.ts @@ -1,7 +1,7 @@ -import { AssetPack } from '@play-co/assetpack-core'; import { existsSync } from 'fs-extra'; import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test'; import { compress } from '../src/compress'; +import { AssetPack } from '@play-co/assetpack-core'; const pkg = 'image'; diff --git a/packages/image/test/Mipmap.test.ts b/packages/image/test/Mipmap.test.ts index 3546993..f38ef55 100644 --- a/packages/image/test/Mipmap.test.ts +++ b/packages/image/test/Mipmap.test.ts @@ -1,7 +1,7 @@ -import { AssetPack } from '@play-co/assetpack-core'; import { existsSync } from 'fs-extra'; import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test'; import { mipmap } from '../src/mipmap'; +import { AssetPack } from '@play-co/assetpack-core'; const pkg = 'image'; diff --git a/packages/json/rollup.config.mjs b/packages/json/rollup.config.mjs index d68789d..c213586 100644 --- a/packages/json/rollup.config.mjs +++ b/packages/json/rollup.config.mjs @@ -1,5 +1,4 @@ import { readFileSync } from 'fs'; - import { createConfig } from '../../shared/rollup.config.mjs'; export default createConfig({ diff --git a/packages/json/src/index.ts b/packages/json/src/index.ts index 79e30c5..e61150e 100644 --- a/packages/json/src/index.ts +++ b/packages/json/src/index.ts @@ -1,6 +1,7 @@ -import type { AssetPipe, Asset, PluginOptions } from '@play-co/assetpack-core'; import { checkExt, createNewAssetAt, Logger } from '@play-co/assetpack-core'; +import type { Asset, AssetPipe, PluginOptions } from '@play-co/assetpack-core'; + export type JsonOptions = PluginOptions<'nc'>; export function json(_options: JsonOptions = {}): AssetPipe diff --git a/packages/json/test/Json.test.ts b/packages/json/test/Json.test.ts index 085f136..4af6582 100644 --- a/packages/json/test/Json.test.ts +++ b/packages/json/test/Json.test.ts @@ -1,7 +1,7 @@ -import { AssetPack } from '@play-co/assetpack-core'; -import { json } from '../src'; import { existsSync, readFileSync } from 'fs-extra'; import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test'; +import { json } from '../src'; +import { AssetPack } from '@play-co/assetpack-core'; const pkg = 'json'; diff --git a/packages/manifest/rollup.config.mjs b/packages/manifest/rollup.config.mjs index d68789d..c213586 100644 --- a/packages/manifest/rollup.config.mjs +++ b/packages/manifest/rollup.config.mjs @@ -1,5 +1,4 @@ import { readFileSync } from 'fs'; - import { createConfig } from '../../shared/rollup.config.mjs'; export default createConfig({ diff --git a/packages/manifest/src/pixiManifest.ts b/packages/manifest/src/pixiManifest.ts index a6287ec..a3b0223 100644 --- a/packages/manifest/src/pixiManifest.ts +++ b/packages/manifest/src/pixiManifest.ts @@ -1,13 +1,12 @@ +import fs from 'fs-extra'; import { - stripTags, type Asset, type AssetPipe, type PipeSystem, - path + path, + stripTags } from '@play-co/assetpack-core'; -import fs from 'fs-extra'; - export interface PixiManifest { name: string; @@ -80,7 +79,7 @@ export function pixiManifest(_options: PixiManifestOptions = {}): AssetPipe await assetpack.run(); // load the manifest json - const manifest = sortObjectProperties((await readJSONSync(`${outputDir}/manifest.json`))) as any; + const manifest = sortObjectProperties((await readJSONSync(`${outputDir}/manifest.json`))) as any; expect(manifest.bundles[1]).toEqual({ name: 'bundle', @@ -348,7 +349,7 @@ describe('Manifest', () => await assetpack.run(); // load the manifest json - const manifest = sortObjectProperties(await readJSONSync(`${outputDir}/manifest.json`)); + const manifest = sortObjectProperties(await readJSONSync(`${outputDir}/manifest.json`)); expect(manifest.bundles[0]).toEqual({ name: 'default', @@ -495,7 +496,7 @@ describe('Manifest', () => await assetpack.run(); // load the manifest json - const manifest = sortObjectProperties((await readJSONSync(`${outputDir}/manifest.json`))) as any; + const manifest = sortObjectProperties((await readJSONSync(`${outputDir}/manifest.json`))) as any; expect(manifest.bundles[0]).toEqual({ @@ -619,7 +620,7 @@ describe('Manifest', () => await assetpack.run(); // load the manifest json - const manifest = sortObjectProperties((await readJSONSync(`${outputDir}/manifest.json`))) as any; + const manifest = sortObjectProperties((await readJSONSync(`${outputDir}/manifest.json`))) as any; expect(manifest.bundles[0]).toEqual({ name: 'default', @@ -765,7 +766,7 @@ describe('Manifest', () => await assetpack.run(); // load the manifest json - const manifest = sortObjectProperties((await readJSONSync(`${outputDir}/manifest.json`))) as any; + const manifest = sortObjectProperties((await readJSONSync(`${outputDir}/manifest.json`))) as any; expect(manifest.bundles[0]).toEqual({ name: 'default', diff --git a/packages/spine/rollup.config.mjs b/packages/spine/rollup.config.mjs index d68789d..c213586 100644 --- a/packages/spine/rollup.config.mjs +++ b/packages/spine/rollup.config.mjs @@ -1,5 +1,4 @@ import { readFileSync } from 'fs'; - import { createConfig } from '../../shared/rollup.config.mjs'; export default createConfig({ diff --git a/packages/spine/src/index.ts b/packages/spine/src/index.ts index 18cb77c..af52670 100644 --- a/packages/spine/src/index.ts +++ b/packages/spine/src/index.ts @@ -1,4 +1,4 @@ -export * from './spineAtlasMipmap'; -export * from './spineAtlasCompress'; export * from './spineAtlasCacheBuster'; +export * from './spineAtlasCompress'; export * from './spineAtlasManifestMod'; +export * from './spineAtlasMipmap'; diff --git a/packages/spine/src/spineAtlasCacheBuster.ts b/packages/spine/src/spineAtlasCacheBuster.ts index f8d9a86..90bdcc9 100644 --- a/packages/spine/src/spineAtlasCacheBuster.ts +++ b/packages/spine/src/spineAtlasCacheBuster.ts @@ -1,7 +1,8 @@ -import type { Asset } from '@play-co/assetpack-core'; -import { checkExt, type AssetPipe, findAssets } from '@play-co/assetpack-core'; -import { AtlasView } from './AtlasView'; import { removeSync, writeFileSync } from 'fs-extra'; +import { AtlasView } from './AtlasView'; +import { type AssetPipe, checkExt, findAssets } from '@play-co/assetpack-core'; + +import type { Asset } from '@play-co/assetpack-core'; /** * This should be used after the cache buster plugin in the pipes. @@ -62,7 +63,7 @@ export function spineAtlasCacheBuster(): AssetPipe asset.filename === texture, asset, true); // last transformed child is the renamed texture - const cacheBustedTexture = textureAssets[0].getFinalTransformedChildren()[0]; + const cacheBustedTexture = textureAssets[0].getFinalTransformedChildren()[0]; atlasView.replaceTexture(texture, cacheBustedTexture.filename); }); diff --git a/packages/spine/src/spineAtlasCompress.ts b/packages/spine/src/spineAtlasCompress.ts index e1f3fb7..1ea8dfd 100644 --- a/packages/spine/src/spineAtlasCompress.ts +++ b/packages/spine/src/spineAtlasCompress.ts @@ -1,7 +1,8 @@ +import { AtlasView } from './AtlasView'; +import { checkExt, createNewAssetAt, swapExt } from '@play-co/assetpack-core'; + import type { Asset, AssetPipe, PluginOptions } from '@play-co/assetpack-core'; -import { checkExt, createNewAssetAt, swapExt } from '@play-co/assetpack-core'; import type { CompressOptions } from '@play-co/assetpack-plugin-image'; -import { AtlasView } from './AtlasView'; export type SpineAtlasCompressOptions = PluginOptions<'nc'> & CompressOptions; diff --git a/packages/spine/src/spineAtlasManifestMod.ts b/packages/spine/src/spineAtlasManifestMod.ts index 3d7c477..896eebd 100644 --- a/packages/spine/src/spineAtlasManifestMod.ts +++ b/packages/spine/src/spineAtlasManifestMod.ts @@ -1,7 +1,8 @@ -import type { Asset } from '@play-co/assetpack-core'; -import { type AssetPipe, path, findAssets } from '@play-co/assetpack-core'; -import { AtlasView } from './AtlasView'; import { readJsonSync, writeJSONSync } from 'fs-extra'; +import { AtlasView } from './AtlasView'; +import { type AssetPipe, findAssets, path } from '@play-co/assetpack-core'; + +import type { Asset } from '@play-co/assetpack-core'; export interface SpineManifestOptions { diff --git a/packages/spine/src/spineAtlasMipmap.ts b/packages/spine/src/spineAtlasMipmap.ts index d86e0a4..7180d18 100644 --- a/packages/spine/src/spineAtlasMipmap.ts +++ b/packages/spine/src/spineAtlasMipmap.ts @@ -1,5 +1,6 @@ +import { type AssetPipe, checkExt, createNewAssetAt } from '@play-co/assetpack-core'; + import type { Asset, PluginOptions } from '@play-co/assetpack-core'; -import { checkExt, type AssetPipe, createNewAssetAt } from '@play-co/assetpack-core'; import type { MipmapOptions } from '@play-co/assetpack-plugin-image'; export type SpineOptions = PluginOptions<'fix'> & MipmapOptions; diff --git a/packages/spine/test/spineAtlasAll.test.ts b/packages/spine/test/spineAtlasAll.test.ts index 901b46a..0fe8030 100644 --- a/packages/spine/test/spineAtlasAll.test.ts +++ b/packages/spine/test/spineAtlasAll.test.ts @@ -1,11 +1,11 @@ -import { AssetPack } from '@play-co/assetpack-core'; -import { compress, mipmap } from '@play-co/assetpack-plugin-image'; import { existsSync, readFileSync } from 'fs-extra'; import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test'; +import { spineAtlasCacheBuster } from '../src/spineAtlasCacheBuster'; import { spineAtlasCompress } from '../src/spineAtlasCompress'; import { spineAtlasMipmap } from '../src/spineAtlasMipmap'; +import { AssetPack } from '@play-co/assetpack-core'; import { cacheBuster } from '@play-co/assetpack-plugin-cache-buster'; -import { spineAtlasCacheBuster } from '../src/spineAtlasCacheBuster'; +import { compress, mipmap } from '@play-co/assetpack-plugin-image'; const pkg = 'spine'; diff --git a/packages/spine/test/spineAtlasCacheBuster.test.ts b/packages/spine/test/spineAtlasCacheBuster.test.ts index f5d873e..f8f9aa7 100644 --- a/packages/spine/test/spineAtlasCacheBuster.test.ts +++ b/packages/spine/test/spineAtlasCacheBuster.test.ts @@ -1,8 +1,8 @@ -import { AssetPack } from '@play-co/assetpack-core'; -import { cacheBuster } from '@play-co/assetpack-plugin-cache-buster'; import { readFileSync } from 'fs-extra'; import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test'; import { spineAtlasCacheBuster } from '../src/spineAtlasCacheBuster'; +import { AssetPack } from '@play-co/assetpack-core'; +import { cacheBuster } from '@play-co/assetpack-plugin-cache-buster'; const pkg = 'spine'; diff --git a/packages/spine/test/spineAtlasCompress.test.ts b/packages/spine/test/spineAtlasCompress.test.ts index d37ecbe..74a64cb 100644 --- a/packages/spine/test/spineAtlasCompress.test.ts +++ b/packages/spine/test/spineAtlasCompress.test.ts @@ -1,8 +1,8 @@ -import { AssetPack } from '@play-co/assetpack-core'; -import { compress } from '@play-co/assetpack-plugin-image'; import { readFileSync } from 'fs-extra'; import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test'; import { spineAtlasCompress } from '../src/spineAtlasCompress'; +import { AssetPack } from '@play-co/assetpack-core'; +import { compress } from '@play-co/assetpack-plugin-image'; const pkg = 'spine'; diff --git a/packages/spine/test/spineAtlasManifest.test.ts b/packages/spine/test/spineAtlasManifest.test.ts index 90bebcd..8d3296b 100644 --- a/packages/spine/test/spineAtlasManifest.test.ts +++ b/packages/spine/test/spineAtlasManifest.test.ts @@ -1,8 +1,8 @@ -import { AssetPack } from '@play-co/assetpack-core'; -import { pixiManifest } from '@play-co/assetpack-plugin-manifest'; import { readFileSync } from 'fs-extra'; import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test'; import { spineAtlasManifestMod } from '../src/spineAtlasManifestMod'; +import { AssetPack } from '@play-co/assetpack-core'; +import { pixiManifest } from '@play-co/assetpack-plugin-manifest'; const pkg = 'spine'; diff --git a/packages/spine/test/spineAtlasMipmap.test.ts b/packages/spine/test/spineAtlasMipmap.test.ts index 2e5799d..3bfeabf 100644 --- a/packages/spine/test/spineAtlasMipmap.test.ts +++ b/packages/spine/test/spineAtlasMipmap.test.ts @@ -1,8 +1,8 @@ -import { AssetPack } from '@play-co/assetpack-core'; import { existsSync } from 'fs-extra'; import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test'; -import { mipmap } from '@play-co/assetpack-plugin-image'; import { spineAtlasMipmap } from '../src/spineAtlasMipmap'; +import { AssetPack } from '@play-co/assetpack-core'; +import { mipmap } from '@play-co/assetpack-plugin-image'; const pkg = 'spine'; diff --git a/packages/texture-packer/rollup.config.mjs b/packages/texture-packer/rollup.config.mjs index d68789d..c213586 100644 --- a/packages/texture-packer/rollup.config.mjs +++ b/packages/texture-packer/rollup.config.mjs @@ -1,5 +1,4 @@ import { readFileSync } from 'fs'; - import { createConfig } from '../../shared/rollup.config.mjs'; export default createConfig({ diff --git a/packages/texture-packer/src/index.ts b/packages/texture-packer/src/index.ts index 1c3c663..689b8dc 100644 --- a/packages/texture-packer/src/index.ts +++ b/packages/texture-packer/src/index.ts @@ -1,4 +1,4 @@ export * from './texturePacker'; -export * from './texturePackerCompress'; export * from './texturePackerCacheBuster'; +export * from './texturePackerCompress'; export * from './texturePackerManifestMod'; diff --git a/packages/texture-packer/src/packer/createJsons.ts b/packages/texture-packer/src/packer/createJsons.ts index 058a9e1..5655c3d 100644 --- a/packages/texture-packer/src/packer/createJsons.ts +++ b/packages/texture-packer/src/packer/createJsons.ts @@ -1,5 +1,6 @@ -import { path } from '@play-co/assetpack-core'; import { createName } from './createTextures'; +import { path } from '@play-co/assetpack-core'; + import type { PixiPacker } from './packTextures'; function convertName(pth: string, nameStyle: 'short' | 'relative') diff --git a/packages/texture-packer/src/packer/createTextureData.ts b/packages/texture-packer/src/packer/createTextureData.ts index aadcf60..f7e424b 100644 --- a/packages/texture-packer/src/packer/createTextureData.ts +++ b/packages/texture-packer/src/packer/createTextureData.ts @@ -1,8 +1,9 @@ -import sharp from 'sharp'; -import type { PackTexturesOptions, PixiRectData, TextureData } from './packTextures'; import { MaxRectsPacker } from 'maxrects-packer'; +import sharp from 'sharp'; import { Logger } from '@play-co/assetpack-core'; +import type { PackTexturesOptions, PixiRectData, TextureData } from './packTextures'; + export async function createTextureData(options: Required) { const packer = new MaxRectsPacker(options.width, options.height, options.padding, { @@ -14,7 +15,7 @@ export async function createTextureData(options: Required) const scale = options.scale; - const textureDatas = await Promise.all(options.texturesToPack.map(async (texture) => + const textureDatas = await Promise.all(options.texturesToPack.map(async (texture) => { let sharpImage = sharp(texture.contents); diff --git a/packages/texture-packer/src/packer/packTextures.ts b/packages/texture-packer/src/packer/packTextures.ts index fefe05d..9489369 100644 --- a/packages/texture-packer/src/packer/packTextures.ts +++ b/packages/texture-packer/src/packer/packTextures.ts @@ -1,9 +1,10 @@ -import type { MaxRectsPacker, Rectangle } from 'maxrects-packer'; import { createJsons } from './createJsons'; -import { createTextures } from './createTextures'; import { createTextureData } from './createTextureData'; +import { createTextures } from './createTextures'; import { fitTextureToPacker } from './fitTextureToPacker'; +import type { MaxRectsPacker, Rectangle } from 'maxrects-packer'; + export interface PixiRectData extends Rectangle { textureData: TextureData; diff --git a/packages/texture-packer/src/texturePacker.ts b/packages/texture-packer/src/texturePacker.ts index a435090..2bc4b03 100644 --- a/packages/texture-packer/src/texturePacker.ts +++ b/packages/texture-packer/src/texturePacker.ts @@ -1,9 +1,10 @@ -import type { PluginOptions, Asset, AssetPipe } from '@play-co/assetpack-core'; -import { createNewAssetAt, stripTags, path, Logger } from '@play-co/assetpack-core'; import fs from 'fs-extra'; import glob from 'glob-promise'; -import type { PackTexturesOptions, TexturePackerFormat } from './packer/packTextures'; import { packTextures } from './packer/packTextures'; +import { createNewAssetAt, Logger, path, stripTags } from '@play-co/assetpack-core'; + +import type { PackTexturesOptions, TexturePackerFormat } from './packer/packTextures'; +import type { Asset, AssetPipe, PluginOptions } from '@play-co/assetpack-core'; export interface TexturePackerOptions extends PluginOptions<'tps' | 'fix' | 'jpg' | 'nc' > { diff --git a/packages/texture-packer/src/texturePackerCacheBuster.ts b/packages/texture-packer/src/texturePackerCacheBuster.ts index 98a24ca..4d3725d 100644 --- a/packages/texture-packer/src/texturePackerCacheBuster.ts +++ b/packages/texture-packer/src/texturePackerCacheBuster.ts @@ -1,6 +1,7 @@ -import type { Asset } from '@play-co/assetpack-core'; -import { checkExt, type AssetPipe, findAssets } from '@play-co/assetpack-core'; import { removeSync, writeFileSync } from 'fs-extra'; +import { type AssetPipe, checkExt, findAssets } from '@play-co/assetpack-core'; + +import type { Asset } from '@play-co/assetpack-core'; /** * This should be used after the cache buster plugin in the pipes. @@ -61,7 +62,7 @@ export function texturePackerCacheBuster(): AssetPipe asset.filename === texture, asset, true); // last transformed child is the renamed texture - const cacheBustedTexture = textureAssets[0].getFinalTransformedChildren()[0]; + const cacheBustedTexture = textureAssets[0].getFinalTransformedChildren()[0]; json.meta.image = cacheBustedTexture.filename; diff --git a/packages/texture-packer/src/texturePackerCompress.ts b/packages/texture-packer/src/texturePackerCompress.ts index 9a5728f..cf24344 100644 --- a/packages/texture-packer/src/texturePackerCompress.ts +++ b/packages/texture-packer/src/texturePackerCompress.ts @@ -1,5 +1,6 @@ +import { checkExt, createNewAssetAt, swapExt } from '@play-co/assetpack-core'; + import type { Asset, AssetPipe, PluginOptions } from '@play-co/assetpack-core'; -import { checkExt, createNewAssetAt, swapExt } from '@play-co/assetpack-core'; import type { CompressOptions } from '@play-co/assetpack-plugin-image'; export type TexturePackerCompressOptions = PluginOptions<'tps' | 'nc'> & CompressOptions; diff --git a/packages/texture-packer/src/texturePackerManifestMod.ts b/packages/texture-packer/src/texturePackerManifestMod.ts index 8eb6633..5c83dc5 100644 --- a/packages/texture-packer/src/texturePackerManifestMod.ts +++ b/packages/texture-packer/src/texturePackerManifestMod.ts @@ -1,6 +1,7 @@ -import type { Asset } from '@play-co/assetpack-core'; -import { type AssetPipe, path, findAssets } from '@play-co/assetpack-core'; import { existsSync, readJsonSync, writeJSONSync } from 'fs-extra'; +import { type AssetPipe, findAssets, path } from '@play-co/assetpack-core'; + +import type { Asset } from '@play-co/assetpack-core'; export interface TexturePackerManifestOptions { diff --git a/packages/texture-packer/test/texturePacker.test.ts b/packages/texture-packer/test/texturePacker.test.ts index a8b14fc..8f5ef84 100644 --- a/packages/texture-packer/test/texturePacker.test.ts +++ b/packages/texture-packer/test/texturePacker.test.ts @@ -1,9 +1,10 @@ -import { AssetPack, Logger } from '@play-co/assetpack-core'; import { existsSync, readJSONSync } from 'fs-extra'; import sharp from 'sharp'; -import type { File } from '../../../shared/test/index'; import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test/index'; import { texturePacker } from '../src/texturePacker'; +import { AssetPack, Logger } from '@play-co/assetpack-core'; + +import type { File } from '../../../shared/test/index'; const pkg = 'texture-packer'; @@ -60,7 +61,7 @@ describe('Texture Packer', () => const sheet1 = readJSONSync(`${outputDir}/sprites.json`); - const expectedSize = { + const expectedSize = { w: 554, h: 476, }; @@ -252,7 +253,7 @@ describe('Texture Packer', () => const sheet1 = readJSONSync(`${outputDir}/sprites.json`); - const expectedSize = { + const expectedSize = { w: 554, h: 476, }; @@ -290,7 +291,7 @@ describe('Texture Packer', () => expect(sheet2).toBe(true); // check to see if the size of the 0.5 asset is half the size of the 1x asset - const expectedSize = { + const expectedSize = { w: 291, h: 249, }; diff --git a/packages/texture-packer/test/texturePackerAll.test.ts b/packages/texture-packer/test/texturePackerAll.test.ts index 18eda2f..a73c09a 100644 --- a/packages/texture-packer/test/texturePackerAll.test.ts +++ b/packages/texture-packer/test/texturePackerAll.test.ts @@ -1,13 +1,14 @@ -import { AssetPack } from '@play-co/assetpack-core'; -import { texturePackerCacheBuster } from '../src/texturePackerCacheBuster'; -import { texturePacker } from '../src/texturePacker'; -import { cacheBuster } from '@play-co/assetpack-plugin-cache-buster'; import { readJSONSync } from 'fs-extra'; -import type { File } from 'shared/test'; import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test/index'; +import { texturePacker } from '../src/texturePacker'; +import { texturePackerCacheBuster } from '../src/texturePackerCacheBuster'; import { texturePackerCompress } from '../src/texturePackerCompress'; +import { AssetPack } from '@play-co/assetpack-core'; +import { cacheBuster } from '@play-co/assetpack-plugin-cache-buster'; import { compress, mipmap } from '@play-co/assetpack-plugin-image'; +import type { File } from 'shared/test'; + const pkg = 'texture-packer'; function genFolder(testName: string) diff --git a/packages/texture-packer/test/texturePackerCacheBuster.test.ts b/packages/texture-packer/test/texturePackerCacheBuster.test.ts index 8d60ef7..8222032 100644 --- a/packages/texture-packer/test/texturePackerCacheBuster.test.ts +++ b/packages/texture-packer/test/texturePackerCacheBuster.test.ts @@ -1,10 +1,11 @@ -import { AssetPack } from '@play-co/assetpack-core'; -import { texturePackerCacheBuster } from '../src/texturePackerCacheBuster'; +import { readJSONSync } from 'fs-extra'; +import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test/index'; import { texturePacker } from '../src/texturePacker'; +import { texturePackerCacheBuster } from '../src/texturePackerCacheBuster'; +import { AssetPack } from '@play-co/assetpack-core'; import { cacheBuster } from '@play-co/assetpack-plugin-cache-buster'; -import { readJSONSync } from 'fs-extra'; + import type { File } from 'shared/test'; -import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test/index'; const pkg = 'texture-packer'; diff --git a/packages/texture-packer/test/texturePackerCompress.test.ts b/packages/texture-packer/test/texturePackerCompress.test.ts index 470cc71..b33fe4b 100644 --- a/packages/texture-packer/test/texturePackerCompress.test.ts +++ b/packages/texture-packer/test/texturePackerCompress.test.ts @@ -1,9 +1,10 @@ +import { readJSONSync } from 'fs-extra'; +import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test/index'; import { AssetPack } from '@play-co/assetpack-core'; import { compress } from '@play-co/assetpack-plugin-image'; import { texturePacker, texturePackerCompress } from '@play-co/assetpack-plugin-texture-packer'; -import { readJSONSync } from 'fs-extra'; + import type { File } from '../../../shared/test/index'; -import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test/index'; const pkg = 'texture-packer'; diff --git a/packages/texture-packer/test/texturePackerManifest.test.ts b/packages/texture-packer/test/texturePackerManifest.test.ts index dd29c0b..8d456a5 100644 --- a/packages/texture-packer/test/texturePackerManifest.test.ts +++ b/packages/texture-packer/test/texturePackerManifest.test.ts @@ -1,9 +1,10 @@ +import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test/index'; +import { texturePackerManifestMod } from '../src/texturePackerManifestMod'; import { AssetPack } from '@play-co/assetpack-core'; -import { texturePacker } from '@play-co/assetpack-plugin-texture-packer'; import { pixiManifest } from '@play-co/assetpack-plugin-manifest'; +import { texturePacker } from '@play-co/assetpack-plugin-texture-packer'; + import type { File } from '../../../shared/test/index'; -import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test/index'; -import { texturePackerManifestMod } from '../src/texturePackerManifestMod'; const pkg = 'texture-packer'; diff --git a/packages/webfont/rollup.config.mjs b/packages/webfont/rollup.config.mjs index d68789d..c213586 100644 --- a/packages/webfont/rollup.config.mjs +++ b/packages/webfont/rollup.config.mjs @@ -1,5 +1,4 @@ import { readFileSync } from 'fs'; - import { createConfig } from '../../shared/rollup.config.mjs'; export default createConfig({ diff --git a/packages/webfont/src/sdf.ts b/packages/webfont/src/sdf.ts index 10a271d..84fcf28 100644 --- a/packages/webfont/src/sdf.ts +++ b/packages/webfont/src/sdf.ts @@ -1,9 +1,10 @@ // ////ts-nocheck -import type { AssetPipe, Asset, PluginOptions } from '@play-co/assetpack-core'; +import fs from 'fs-extra'; +import generateBMFont from 'msdf-bmfont-xml'; import { checkExt, createNewAssetAt, stripTags } from '@play-co/assetpack-core'; + import type { BitmapFontOptions } from 'msdf-bmfont-xml'; -import generateBMFont from 'msdf-bmfont-xml'; -import fs from 'fs-extra'; +import type { Asset, AssetPipe, PluginOptions } from '@play-co/assetpack-core'; export interface SDFFontOptions extends PluginOptions<'sdf'> { diff --git a/packages/webfont/src/webfont.ts b/packages/webfont/src/webfont.ts index faa7b35..9687d94 100644 --- a/packages/webfont/src/webfont.ts +++ b/packages/webfont/src/webfont.ts @@ -1,6 +1,7 @@ -import type { AssetPipe, Asset } from '@play-co/assetpack-core'; -import { checkExt, createNewAssetAt, path } from '@play-co/assetpack-core'; import { fonts } from './fonts'; +import { checkExt, createNewAssetAt, path } from '@play-co/assetpack-core'; + +import type { Asset, AssetPipe } from '@play-co/assetpack-core'; export function webfont(): AssetPipe { diff --git a/packages/webfont/test/Webfont.test.ts b/packages/webfont/test/Webfont.test.ts index 31cbdc6..b62e102 100644 --- a/packages/webfont/test/Webfont.test.ts +++ b/packages/webfont/test/Webfont.test.ts @@ -1,7 +1,7 @@ -import { AssetPack } from '@play-co/assetpack-core'; import { existsSync, readJSONSync } from 'fs-extra'; import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test'; import { msdfFont, sdfFont, webfont } from '../src'; +import { AssetPack } from '@play-co/assetpack-core'; import { pixiManifest } from '@play-co/assetpack-plugin-manifest'; const pkg = 'webfont'; diff --git a/shared/rollup.config.mjs b/shared/rollup.config.mjs index a7aac61..c0db907 100644 --- a/shared/rollup.config.mjs +++ b/shared/rollup.config.mjs @@ -1,6 +1,6 @@ import { builtinModules } from 'module'; -import typescript from '@rollup/plugin-typescript'; import dts from 'rollup-plugin-dts'; +import typescript from '@rollup/plugin-typescript'; /** * Create a base rollup config diff --git a/shared/test/index.ts b/shared/test/index.ts index 004ef82..7fc2083 100644 --- a/shared/test/index.ts +++ b/shared/test/index.ts @@ -1,6 +1,7 @@ import fs from 'fs-extra'; import path from 'path'; import { getRoot } from './find'; + import type { AssetPipe } from '@play-co/assetpack-core'; export interface Folder