+11
-11
@@ -7,17 +7,6 @@ import { Transformer } from '@napi-rs/image'
|
||||
|
||||
const SOURCE_EXTENSIONS = ['.png', '.jpg', '.jpeg', '.webp']
|
||||
|
||||
async function main() {
|
||||
const files = process.argv.slice(2).map(f => path.resolve(process.cwd(), f))
|
||||
if (files.length === 0) {
|
||||
console.error('No files provided.')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
await Promise.all(files.map(f => stat(f)))
|
||||
await Promise.allSettled(files.map(file => transform(file)))
|
||||
}
|
||||
|
||||
async function transform(filePath: string): Promise<any> {
|
||||
if ((await stat(filePath)).isDirectory()) {
|
||||
return await Promise.allSettled(
|
||||
@@ -38,4 +27,15 @@ async function transform(filePath: string): Promise<any> {
|
||||
console.info(`√ ${filePath} -> ${dist}`)
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const files = process.argv.slice(2).map(f => path.resolve(process.cwd(), f))
|
||||
if (files.length === 0) {
|
||||
console.error('No files provided.')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
await Promise.all(files.map(f => stat(f)))
|
||||
await Promise.allSettled(files.map(file => transform(file)))
|
||||
}
|
||||
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user