feat: migrated packages to ts
This commit is contained in:
@@ -1,3 +1,27 @@
|
||||
import baseConfig from '@aklive2d/eslint-config'
|
||||
import { tsConfig } from '@aklive2d/eslint-config'
|
||||
import tseslint from 'typescript-eslint'
|
||||
import globals from 'globals'
|
||||
|
||||
/** @type {import('eslint').Config} */
|
||||
export default [...baseConfig]
|
||||
export default tseslint.config(
|
||||
...tsConfig,
|
||||
{
|
||||
ignores: ['dist', 'data'],
|
||||
},
|
||||
{
|
||||
files: ['**/*.js', '**/*.ts'],
|
||||
languageOptions: {
|
||||
ecmaVersion: 2022,
|
||||
globals: {
|
||||
...globals.node,
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
{ argsIgnorePattern: '^_' },
|
||||
],
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -66,12 +66,18 @@ export const build = async () => {
|
||||
return err
|
||||
}
|
||||
|
||||
const composite = async (filenamePrefix, fileExt) => {
|
||||
const composite = async (filenamePrefix: string, fileExt: string) => {
|
||||
const image = sharp(
|
||||
path.join(EXTRACTED_DIR, `${filenamePrefix}_left${fileExt}`)
|
||||
)
|
||||
const metadata = await image.metadata()
|
||||
|
||||
if (!metadata.width || !metadata.height) {
|
||||
throw new Error(
|
||||
`Width and height metadata for ${filenamePrefix}_left${fileExt} is not found.`
|
||||
)
|
||||
}
|
||||
|
||||
image
|
||||
.resize(2 * metadata.width, metadata.height, {
|
||||
kernel: sharp.kernel.nearest,
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "@aklive2d/background",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"main": "index.js",
|
||||
"main": "index.ts",
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"sharp": "^0.33.5",
|
||||
@@ -12,9 +12,14 @@
|
||||
"@aklive2d/eslint-config": "workspace:*",
|
||||
"@aklive2d/prettier-config": "workspace:*"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"globals": ">=16.0.0",
|
||||
"typescript-eslint": ">=8.31.1",
|
||||
"typescript": ">=5.8.2"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "mode=build node runner.js",
|
||||
"lint": "eslint \"*.js\" \"**/*.js\" && prettier --check .",
|
||||
"build": "mode=build bun runner.js",
|
||||
"lint": "eslint && prettier --check .",
|
||||
"build:cleanup": "rm -rf ./dist ./data"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { build } from './index.js'
|
||||
import { build } from './index.ts'
|
||||
import { envParser, error } from '@aklive2d/libs'
|
||||
|
||||
async function main() {
|
||||
25
packages/background/tsconfig.json
Normal file
25
packages/background/tsconfig.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2024",
|
||||
"useDefineForClassFields": true,
|
||||
"module": "ESNext",
|
||||
"lib": ["ES2024", "DOM", "DOM.Iterable"],
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"isolatedModules": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["**/*"],
|
||||
"exclude": ["dist/**/*", "data/**/*"]
|
||||
}
|
||||
Reference in New Issue
Block a user