diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b622ded0..91b7598a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -27,7 +27,10 @@ jobs: sudo apt-get install -y tree - name: Build source w/ jsii - run: npx jsii + run: | + lambda/build + npx jsii + make validate-package - name: Build packages w/ jsii-pacmak run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 820f8cff..bbe36386 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -92,7 +92,10 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - name: Build source w/ jsii - run: npx jsii + run: | + lambda/build + npx jsii + make validate-package - name: Build packages w/ jsii-pacmak run: | diff --git a/.npmignore b/.npmignore index 0bca0edb..f85d678a 100644 --- a/.npmignore +++ b/.npmignore @@ -26,6 +26,7 @@ tsconfig.tsbuildinfo .eslintrc .prettierrc tsconfig-lint.json +publish_output.txt lambda/* !lambda/code.zip diff --git a/Makefile b/Makefile index 5349418f..319503db 100644 --- a/Makefile +++ b/Makefile @@ -24,3 +24,21 @@ eslint: @echo -e "$(TARGET_COLOR)Running eslint $$(npx eslint --version)$(NO_COLOR)" @npx eslint .; \ echo "Passed" + +validate-package: + @echo -e "$(TARGET_COLOR)Checking package content$(NO_COLOR)" + @npm publish --dry-run 2>&1 | tee publish_output.txt + @\ + FILES_TO_CHECK="lambda/code.zip lib/index.d.ts lib/index.js lib/types.d.ts lib/types.js"; \ + MISSING_FILES=""; \ + for file in $$FILES_TO_CHECK; do \ + if ! grep -q $$file publish_output.txt; then \ + MISSING_FILES="$$MISSING_FILES $$file"; \ + fi; \ + done; \ + if [ -n "$$MISSING_FILES" ]; then \ + echo "❌ The following files are NOT included in the package:$$MISSING_FILES"; \ + rm publish_output.txt; \ + exit 1; \ + fi + @rm publish_output.txt