From d9383b33079c34e2fbce5da268fb615fc662b0d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20=C3=85hfelt?= Date: Wed, 25 Sep 2024 19:54:02 +0200 Subject: [PATCH 1/2] chore: generate ts declarations with tsc --- Makefile | 6 +++++- package.json | 3 ++- yarn.lock | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3d58daf..c6d9ddc 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ TARGETS = $(HDR_TARGETS) \ $(JSON_TARGETS) $(WOFF_TARGETS) \ $(GLB_TARGETS) $(GLTF_TARGETS) -all: $(TARGETS) +all: $(TARGETS) ts-declarations $(DIST)/%.js: $(SRC)/%.b64 mkdir -p $(dir $@) @@ -79,3 +79,7 @@ $(DIST)/%.js: $(SRC)/%.b64 .PHONY: clean clean: rm -rf $(DIST) + +.PHONY: ts-declarations +ts-declarations: + cd $(DIST) && npx -p typescript tsc **/*.js --declaration --allowJs --emitDeclarationOnly --skipLibCheck diff --git a/package.json b/package.json index 15a6f60..fef590a 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "@gltf-transform/cli": "^3.4.0", "copyfiles": "^2.3.0", "json": "^11.0.0", - "semantic-release": "^20.1.1" + "semantic-release": "^20.1.1", + "typescript": "^5.6.2" }, "repository": { "type": "git", diff --git a/yarn.lock b/yarn.lock index 13792ef..a16c901 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4836,6 +4836,11 @@ type-fest@^3.0.0: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-3.11.1.tgz#d8e62c7f42e14537d5b8796de5450d541f3a33a7" integrity sha512-aCuRNRERRVh33lgQaJRlUxZqzfhzwTrsE98Mc3o3VXqmiaQdHacgUtJ0esp+7MvZ92qhtzKPeusaX6vIEcoreA== +typescript@^5.6.2: + version "5.6.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.2.tgz#d1de67b6bef77c41823f822df8f0b3bcff60a5a0" + integrity sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw== + uglify-js@^3.1.4: version "3.17.4" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.17.4.tgz#61678cf5fa3f5b7eb789bb345df29afb8257c22c" From 2e61f56bd4c4e56b06e3583025f3a20ae98a3a90 Mon Sep 17 00:00:00 2001 From: Antoine BERNIER Date: Wed, 25 Sep 2024 20:53:40 +0200 Subject: [PATCH 2/2] ts-declarations script --- Makefile | 6 +----- package.json | 6 ++++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index c6d9ddc..3d58daf 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ TARGETS = $(HDR_TARGETS) \ $(JSON_TARGETS) $(WOFF_TARGETS) \ $(GLB_TARGETS) $(GLTF_TARGETS) -all: $(TARGETS) ts-declarations +all: $(TARGETS) $(DIST)/%.js: $(SRC)/%.b64 mkdir -p $(dir $@) @@ -79,7 +79,3 @@ $(DIST)/%.js: $(SRC)/%.b64 .PHONY: clean clean: rm -rf $(DIST) - -.PHONY: ts-declarations -ts-declarations: - cd $(DIST) && npx -p typescript tsc **/*.js --declaration --allowJs --emitDeclarationOnly --skipLibCheck diff --git a/package.json b/package.json index fef590a..ea75603 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "type": "module", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "build": "rm -rf dist && make && npm run copy", + "build": "rm -rf dist && make && npm run ts-declarations && npm run copy", + "ts-declarations": "tsc dist/**/*.js --declaration --allowJs --emitDeclarationOnly --outDir dist --skipLibCheck", "copy": "copyfiles package.json README.md LICENSE dist && json -I -f dist/package.json -e \"this.private=false; this.devDependencies=undefined; this.optionalDependencies=undefined; this.scripts=undefined; this.husky=undefined; this.prettier=undefined; this.jest=undefined; this['lint-staged']=undefined;\"", "release": "semantic-release" }, @@ -31,5 +32,6 @@ "bugs": { "url": "https://github.com/pmndrs/assets/issues" }, - "homepage": "https://github.com/pmndrs/assets#readme" + "homepage": "https://github.com/pmndrs/assets#readme", + "packageManager": "yarn@1.22.22" }