diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af3585b..2be2c58 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,9 @@ jobs: - name: Build package run: bun run prepack + - name: Test types + run: bun run test:types + - name: Trigger deploy if: github.ref == 'refs/heads/master' env: diff --git a/package.json b/package.json index af8ae74..7b97b34 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ } }, "scripts": { - "prepack": "bun test" + "prepack": "bun test", + "test:types": "bun tests/test-types.ts" }, "devDependencies": { "@carbon/icon-helpers": "latest", diff --git a/tests/svelte@3/Icons.svelte b/tests/svelte@3/Icons.svelte new file mode 100644 index 0000000..5d27764 --- /dev/null +++ b/tests/svelte@3/Icons.svelte @@ -0,0 +1,35 @@ + + + + + + + + + + + diff --git a/tests/svelte@3/bun.lockb b/tests/svelte@3/bun.lockb new file mode 100755 index 0000000..634fad6 Binary files /dev/null and b/tests/svelte@3/bun.lockb differ diff --git a/tests/svelte@3/package.json b/tests/svelte@3/package.json new file mode 100644 index 0000000..eb6e85a --- /dev/null +++ b/tests/svelte@3/package.json @@ -0,0 +1,15 @@ +{ + "private": true, + "type": "module", + "scripts": { + "test:types": "svelte-check" + }, + "dependencies": { + "carbon-icons-svelte": "link:carbon-icons-svelte" + }, + "devDependencies": { + "svelte": "^3.59.2", + "svelte-check": "^3.8.6", + "typescript": "^5.7.2" + } +} diff --git a/tests/svelte@3/tsconfig.json b/tests/svelte@3/tsconfig.json new file mode 100644 index 0000000..0d7e7a2 --- /dev/null +++ b/tests/svelte@3/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "verbatimModuleSyntax": true, + "isolatedModules": true, + "target": "ESNext", + "module": "ESNext", + "moduleResolution": "node", + "noUnusedLocals": true, + "noUnusedParameters": true, + "strict": true, + "skipLibCheck": true + } +} diff --git a/tests/svelte@4/Icons.svelte b/tests/svelte@4/Icons.svelte new file mode 100644 index 0000000..5d27764 --- /dev/null +++ b/tests/svelte@4/Icons.svelte @@ -0,0 +1,35 @@ + + + + + + + + + + + diff --git a/tests/svelte@4/bun.lockb b/tests/svelte@4/bun.lockb new file mode 100755 index 0000000..c2c0e0c Binary files /dev/null and b/tests/svelte@4/bun.lockb differ diff --git a/tests/svelte@4/package.json b/tests/svelte@4/package.json new file mode 100644 index 0000000..c867ffa --- /dev/null +++ b/tests/svelte@4/package.json @@ -0,0 +1,15 @@ +{ + "private": true, + "type": "module", + "scripts": { + "test:types": "svelte-check" + }, + "dependencies": { + "carbon-icons-svelte": "link:carbon-icons-svelte" + }, + "devDependencies": { + "svelte": "^4.2.19", + "svelte-check": "^4.1.1", + "typescript": "^5.7.2" + } +} diff --git a/tests/svelte@4/tsconfig.json b/tests/svelte@4/tsconfig.json new file mode 100644 index 0000000..0d7e7a2 --- /dev/null +++ b/tests/svelte@4/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "verbatimModuleSyntax": true, + "isolatedModules": true, + "target": "ESNext", + "module": "ESNext", + "moduleResolution": "node", + "noUnusedLocals": true, + "noUnusedParameters": true, + "strict": true, + "skipLibCheck": true + } +} diff --git a/tests/Icons.svelte b/tests/svelte@5/Icons.svelte similarity index 100% rename from tests/Icons.svelte rename to tests/svelte@5/Icons.svelte diff --git a/tests/svelte@5/bun.lockb b/tests/svelte@5/bun.lockb new file mode 100755 index 0000000..67ba47c Binary files /dev/null and b/tests/svelte@5/bun.lockb differ diff --git a/tests/svelte@5/package.json b/tests/svelte@5/package.json new file mode 100644 index 0000000..5865c4f --- /dev/null +++ b/tests/svelte@5/package.json @@ -0,0 +1,15 @@ +{ + "private": true, + "type": "module", + "scripts": { + "test:types": "svelte-check" + }, + "dependencies": { + "carbon-icons-svelte": "link:carbon-icons-svelte" + }, + "devDependencies": { + "svelte": "^5.16.0", + "svelte-check": "^4.1.1", + "typescript": "^5.7.2" + } +} diff --git a/tests/svelte@5/tsconfig.json b/tests/svelte@5/tsconfig.json new file mode 100644 index 0000000..0d7e7a2 --- /dev/null +++ b/tests/svelte@5/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "verbatimModuleSyntax": true, + "isolatedModules": true, + "target": "ESNext", + "module": "ESNext", + "moduleResolution": "node", + "noUnusedLocals": true, + "noUnusedParameters": true, + "strict": true, + "skipLibCheck": true + } +} diff --git a/tests/test-types.ts b/tests/test-types.ts new file mode 100644 index 0000000..afa2a4c --- /dev/null +++ b/tests/test-types.ts @@ -0,0 +1,8 @@ +import { $ } from "bun"; + +for await (const dir of $`find tests -maxdepth 1 -mindepth 1 -type d`.lines()) { + if (dir && /svelte/.test(dir)) { + await $`cd ${dir} && bun install`; + await $`cd ${dir} && bun run test:types`; + } +} diff --git a/tsconfig.json b/tsconfig.json index 5410b3d..9993478 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "esModuleInterop": true, "lib": ["esnext", "DOM"], + "target": "esnext", "module": "esnext", "moduleResolution": "node", "resolveJsonModule": true,