Skip to content

Commit

Permalink
Fix(webp): squoosh to sharp (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
juunini authored Feb 11, 2023
1 parent 4b9568e commit 861f3f8
Show file tree
Hide file tree
Showing 13 changed files with 978 additions and 642 deletions.
21 changes: 3 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
coverage
dist
node_modules
output
sample

.env
.env.development.local
.env.test.local
.env.production.local
.env.local
.vscode-test

*.js
*.d.ts
!jest.config.js
!.eslintrc.js
!gltf-pipeline.d.ts

src/draco3d
**/.DS_Store
**/.vscode
11 changes: 2 additions & 9 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,5 @@
!/LICENSE
!/README.md

!/bin
/bin/*.ts
!/bin/*.d.ts

!/src
/src/**/*.ts
!/src/**/*.d.ts
!/src/**/*.js
!/src/**/*.wasm
!/dist
!/draco3d
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
Only can compress `.glb` file now.
Will be support `.gltf` soon.

This library working in node v16.
see: https://github.com/GoogleChromeLabs/squoosh/issues/1260#issuecomment-1369809452
Will change squoosh to other library.

## Introduce

Optimize glTF.
Expand All @@ -62,7 +58,7 @@ pnpm add gltf-optimizer
bun add gltf-optimizer

# If you install and use browser side
cp node_modules/gltf-optimizer/src/draco3d/* ./<your_static_path>/
cp node_modules/gltf-optimizer/draco3d/* ./<your_static_path>/
```

## Usage
Expand Down
Binary file added darco3d/draco_decoder.wasm
Binary file not shown.
Binary file added darco3d/draco_encoder.wasm
Binary file not shown.
117 changes: 117 additions & 0 deletions darco3d/draco_wasm_wrapper.js

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"name": "gltf-optimizer",
"version": "0.3.8",
"version": "0.4.0",
"description": "Optimize glTF model",
"homepage": "https://github.com/juunini/gltf-optimizer",
"repository": "juunini/gltf-optimizer",
"license": "MIT",
"author": "juunini",
"main": "./src/index.js",
"module": "./src/index.js",
"types": "./src/index.d.ts",
"main": "./dist/src/index.js",
"module": "./dist/src/module.js",
"types": "./dist/src/index.d.ts",
"bin": {
"gltf-optimizer": "./bin/index.js"
"gltf-optimizer": "./dist/bin/index.js"
},
"scripts": {
"build": "tsc -p ./tsconfig.build.json && mkdir src/draco3d && cp node_modules/draco3d/*.wasm src/draco3d/",
"build": "tsc -p ./tsconfig.build.json",
"test": "pnpm clear && jest",
"test:cov": "pnpm clear && jest --coverage",
"clear": "rimraf bin/*.js && rimraf bin/*.d.ts && rimraf src/**/*.js && rimraf src/**/*.d.ts",
Expand All @@ -26,6 +26,7 @@
"@types/jest": "^29.2.4",
"@types/jest-plugin-context": "^2.9.5",
"@types/node": "^18.11.18",
"@types/sharp": "^0.31.1",
"@types/yargs": "^17.0.17",
"@typescript-eslint/eslint-plugin": "^5.47.1",
"eslint": "^8.30.0",
Expand All @@ -45,6 +46,7 @@
"@squoosh/lib": "^0.5.3",
"draco3d": "^1.5.6",
"meshoptimizer": "^0.18.1",
"sharp": "^0.31.3",
"webp-converter-browser": "^1.0.3",
"yargs": "^17.6.2"
}
Expand Down
Loading

0 comments on commit 861f3f8

Please sign in to comment.