diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 1cd2e578f..ec50abe08 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -29,6 +29,7 @@ jobs: run: | npm ci npm run build:clean + npm run validate-exports - name: Test if: success() || failure() shell: bash diff --git a/package.json b/package.json index 7dc63ea71..0b8df40d6 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "test": "vitest", "test-ui": "vitest --ui", "coverage": "vitest run --coverage", + "validate-exports": "npm run validate-exports --workspace=langium", "version:dependencies": "node ./scripts/update-version.js && npm install", "langium:generate": "npm run langium:generate --workspace=langium --workspace=examples/domainmodel --workspace=examples/arithmetics --workspace=examples/statemachine --workspace=examples/requirements", "dev-build": "npm run dev-clean && npm install && npm link ./packages/langium && npm link ./packages/langium-cli && npm link ./packages/generator-langium", diff --git a/packages/langium/package.json b/packages/langium/package.json index f3ae2bff5..8eaf6b6c6 100644 --- a/packages/langium/package.json +++ b/packages/langium/package.json @@ -52,6 +52,7 @@ "build": "tsc", "watch": "tsc --watch", "lint": "eslint src test --ext .ts", + "validate-exports": "tsc -p test/tsconfig.export-main.json", "langium:generate": "langium generate", "langium:generate:production": "langium generate --mode=production", "publish:next": "npm --no-git-tag-version version \"$(semver $npm_package_version -i minor)-next.$(git rev-parse --short HEAD)\" && npm publish --tag next", diff --git a/packages/langium/test/tsconfig.export-main.json b/packages/langium/test/tsconfig.export-main.json new file mode 100644 index 000000000..b453a2326 --- /dev/null +++ b/packages/langium/test/tsconfig.export-main.json @@ -0,0 +1,10 @@ +// Validate the main package export by excluding parts of the code that shouldn't be directly linked +{ + "extends": "../tsconfig.src.json", + "compilerOptions": { + "noEmit": true + }, + "exclude": [ + "../src/test/**/*" + ] +}